mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
去掉 iCloud 同步
This commit is contained in:
parent
a49b998537
commit
8ed3dcddd7
@ -704,6 +704,7 @@
|
|||||||
06CF783C21C7A50300A052D7 /* Sources */,
|
06CF783C21C7A50300A052D7 /* Sources */,
|
||||||
06CF783D21C7A50300A052D7 /* Frameworks */,
|
06CF783D21C7A50300A052D7 /* Frameworks */,
|
||||||
06CF783E21C7A50300A052D7 /* Resources */,
|
06CF783E21C7A50300A052D7 /* Resources */,
|
||||||
|
73BB82AB466F692F871A6876 /* [CP] Copy Pods Resources */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@ -896,6 +897,8 @@
|
|||||||
"${PODS_CONFIGURATION_BUILD_DIR}/Material/com.cosmicmind.material.icons.bundle",
|
"${PODS_CONFIGURATION_BUILD_DIR}/Material/com.cosmicmind.material.icons.bundle",
|
||||||
"${PODS_CONFIGURATION_BUILD_DIR}/Material/com.cosmicmind.material.fonts.bundle",
|
"${PODS_CONFIGURATION_BUILD_DIR}/Material/com.cosmicmind.material.fonts.bundle",
|
||||||
"${PODS_CONFIGURATION_BUILD_DIR}/MercariQRScanner/QRScannerAssets.bundle",
|
"${PODS_CONFIGURATION_BUILD_DIR}/MercariQRScanner/QRScannerAssets.bundle",
|
||||||
|
"${PODS_CONFIGURATION_BUILD_DIR}/Realm/realm_objc_privacy.bundle",
|
||||||
|
"${PODS_CONFIGURATION_BUILD_DIR}/RealmSwift/realm_swift_privacy.bundle",
|
||||||
"${PODS_ROOT}/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle",
|
"${PODS_ROOT}/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle",
|
||||||
);
|
);
|
||||||
name = "[CP] Copy Pods Resources";
|
name = "[CP] Copy Pods Resources";
|
||||||
@ -905,6 +908,8 @@
|
|||||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/com.cosmicmind.material.icons.bundle",
|
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/com.cosmicmind.material.icons.bundle",
|
||||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/com.cosmicmind.material.fonts.bundle",
|
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/com.cosmicmind.material.fonts.bundle",
|
||||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QRScannerAssets.bundle",
|
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/QRScannerAssets.bundle",
|
||||||
|
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/realm_objc_privacy.bundle",
|
||||||
|
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/realm_swift_privacy.bundle",
|
||||||
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SVProgressHUD.bundle",
|
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SVProgressHUD.bundle",
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -912,6 +917,26 @@
|
|||||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Bark/Pods-Bark-resources.sh\"\n";
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Bark/Pods-Bark-resources.sh\"\n";
|
||||||
showEnvVarsInLog = 0;
|
showEnvVarsInLog = 0;
|
||||||
};
|
};
|
||||||
|
73BB82AB466F692F871A6876 /* [CP] Copy Pods Resources */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-NotificationServiceExtension/Pods-NotificationServiceExtension-resources.sh",
|
||||||
|
"${PODS_CONFIGURATION_BUILD_DIR}/Realm/realm_objc_privacy.bundle",
|
||||||
|
"${PODS_CONFIGURATION_BUILD_DIR}/RealmSwift/realm_swift_privacy.bundle",
|
||||||
|
);
|
||||||
|
name = "[CP] Copy Pods Resources";
|
||||||
|
outputPaths = (
|
||||||
|
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/realm_objc_privacy.bundle",
|
||||||
|
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/realm_swift_privacy.bundle",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NotificationServiceExtension/Pods-NotificationServiceExtension-resources.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
96E966B1F9EF139B935A8BB1 /* [CP] Check Pods Manifest.lock */ = {
|
96E966B1F9EF139B935A8BB1 /* [CP] Check Pods Manifest.lock */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import CloudKit
|
import CloudKit
|
||||||
import CrashReporter
|
import CrashReporter
|
||||||
import IceCream
|
//import IceCream
|
||||||
import IQKeyboardManagerSwift
|
import IQKeyboardManagerSwift
|
||||||
import Material
|
import Material
|
||||||
import UIKit
|
import UIKit
|
||||||
@ -17,15 +17,15 @@ import UserNotifications
|
|||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
|
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
var syncEngine: SyncEngine?
|
// var syncEngine: SyncEngine?
|
||||||
func setupRealm() {
|
func setupRealm() {
|
||||||
// Tell Realm to use this new configuration object for the default Realm
|
// Tell Realm to use this new configuration object for the default Realm
|
||||||
Realm.Configuration.defaultConfiguration = kRealmDefaultConfiguration
|
Realm.Configuration.defaultConfiguration = kRealmDefaultConfiguration
|
||||||
|
|
||||||
// iCloud 同步
|
// // iCloud 同步
|
||||||
syncEngine = SyncEngine(objects: [
|
// syncEngine = SyncEngine(objects: [
|
||||||
SyncObject(type: Message.self)
|
// SyncObject(type: Message.self)
|
||||||
], databaseScope: .private)
|
// ], databaseScope: .private)
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
let realm = try? Realm()
|
let realm = try? Realm()
|
||||||
@ -148,15 +148,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||||||
notificatonHandler(userInfo: response.notification.request.content.userInfo)
|
notificatonHandler(userInfo: response.notification.request.content.userInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
// func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
||||||
if let dict = userInfo as? [String: NSObject],
|
// if let dict = userInfo as? [String: NSObject],
|
||||||
let notification = CKNotification(fromRemoteNotificationDictionary: dict),
|
// let notification = CKNotification(fromRemoteNotificationDictionary: dict),
|
||||||
let subscriptionID = notification.subscriptionID, IceCreamSubscription.allIDs.contains(subscriptionID)
|
// let subscriptionID = notification.subscriptionID, IceCreamSubscription.allIDs.contains(subscriptionID)
|
||||||
{
|
// {
|
||||||
NotificationCenter.default.post(name: Notifications.cloudKitDataDidChangeRemotely.name, object: nil, userInfo: userInfo)
|
// NotificationCenter.default.post(name: Notifications.cloudKitDataDidChangeRemotely.name, object: nil, userInfo: userInfo)
|
||||||
completionHandler(.newData)
|
// completionHandler(.newData)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private func notificatonHandler(userInfo: [AnyHashable: Any]) {
|
private func notificatonHandler(userInfo: [AnyHashable: Any]) {
|
||||||
let navigationController = Client.shared.currentNavigationController
|
let navigationController = Client.shared.currentNavigationController
|
||||||
|
|||||||
@ -198,10 +198,17 @@ class MessageListViewModel: ViewModel, ViewModelType {
|
|||||||
guard let messages = strongSelf.getResults(filterGroups: filterGroups.value, searchText: nil)?.filter("createDate >= %@", date) else {
|
guard let messages = strongSelf.getResults(filterGroups: filterGroups.value, searchText: nil)?.filter("createDate >= %@", date) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 不再使用icecream 了
|
||||||
|
// 所以需要手动删除
|
||||||
|
// try? realm.write {
|
||||||
|
// for msg in messages {
|
||||||
|
// msg.isDeleted = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
try? realm.write {
|
try? realm.write {
|
||||||
for msg in messages {
|
realm.delete(messages)
|
||||||
msg.isDeleted = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,9 +71,10 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
|||||||
|
|
||||||
let settings: [MessageSettingItem] = {
|
let settings: [MessageSettingItem] = {
|
||||||
var settings = [MessageSettingItem]()
|
var settings = [MessageSettingItem]()
|
||||||
settings.append(.label(text: "iCloud"))
|
// settings.append(.label(text: "iCloud"))
|
||||||
settings.append(.iCloudStatus)
|
// settings.append(.iCloudStatus)
|
||||||
settings.append(.label(text: NSLocalizedString("iCloudSync")))
|
// settings.append(.label(text: NSLocalizedString("iCloudSync")))
|
||||||
|
settings.append(.label(text: NSLocalizedString("historyMessage")))
|
||||||
settings.append(.backup(viewModel: MutableTextCellViewModel(
|
settings.append(.backup(viewModel: MutableTextCellViewModel(
|
||||||
title: "\(NSLocalizedString("export"))/\(NSLocalizedString("import"))",
|
title: "\(NSLocalizedString("export"))/\(NSLocalizedString("import"))",
|
||||||
text: Observable.merge([restoreSuccess, input.viewDidAppear])
|
text: Observable.merge([restoreSuccess, input.viewDidAppear])
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
// Copyright © 2020 Fin. All rights reserved.
|
// Copyright © 2020 Fin. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import IceCream
|
//import IceCream
|
||||||
import RealmSwift
|
import RealmSwift
|
||||||
import UIKit
|
import UIKit
|
||||||
class Message: Object {
|
class Message: Object {
|
||||||
@ -29,5 +29,5 @@ class Message: Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Message: CKRecordConvertible {}
|
//extension Message: CKRecordConvertible {}
|
||||||
extension Message: CKRecordRecoverable {}
|
//extension Message: CKRecordRecoverable {}
|
||||||
|
|||||||
@ -11,30 +11,23 @@ import RealmSwift
|
|||||||
|
|
||||||
extension Object {
|
extension Object {
|
||||||
func toDictionary() -> [String: AnyObject] {
|
func toDictionary() -> [String: AnyObject] {
|
||||||
let properties = self.objectSchema.properties.map { $0.name }
|
|
||||||
var dicProps = [String: AnyObject]()
|
var dicProps = [String: AnyObject]()
|
||||||
for (key, value) in self.dictionaryWithValues(forKeys: properties) {
|
self.objectSchema.properties.forEach { property in
|
||||||
if let value = value as? ListBase {
|
if property.isArray {
|
||||||
dicProps[key] = value.toArray1() as AnyObject
|
var arr: [[String: AnyObject]] = []
|
||||||
} else if let value = value as? Object {
|
for obj in self.dynamicList(property.name) {
|
||||||
dicProps[key] = value.toDictionary() as AnyObject
|
arr.append(obj.toDictionary())
|
||||||
} else if let value = value as? Date {
|
}
|
||||||
dicProps[key] = Int64(value.timeIntervalSince1970) as AnyObject
|
dicProps[property.name] = arr as AnyObject
|
||||||
|
} else if let value = self[property.name] as? Object {
|
||||||
|
dicProps[property.name] = value.toDictionary() as AnyObject
|
||||||
|
} else if let value = self[property.name] as? Date {
|
||||||
|
dicProps[property.name] = Int64(value.timeIntervalSince1970) as AnyObject
|
||||||
} else {
|
} else {
|
||||||
dicProps[key] = value as AnyObject
|
let value = self[property.name]
|
||||||
|
dicProps[property.name] = value as AnyObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dicProps
|
return dicProps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ListBase {
|
|
||||||
func toArray1() -> [AnyObject] {
|
|
||||||
var _toArray = [AnyObject]()
|
|
||||||
for i in 0 ..< self._rlmArray.count {
|
|
||||||
let obj = unsafeBitCast(self._rlmArray[i], to: Object.self)
|
|
||||||
_toArray.append(obj.toDictionary() as AnyObject)
|
|
||||||
}
|
|
||||||
return _toArray
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
6
Podfile
6
Podfile
@ -14,7 +14,8 @@ def pods
|
|||||||
pod 'SwiftyJSON'
|
pod 'SwiftyJSON'
|
||||||
pod 'DeviceKit'
|
pod 'DeviceKit'
|
||||||
pod 'DefaultsKit', :git => 'https://github.com/nmdias/DefaultsKit'
|
pod 'DefaultsKit', :git => 'https://github.com/nmdias/DefaultsKit'
|
||||||
pod 'IceCream'
|
# pod 'IceCream'
|
||||||
|
pod 'RealmSwift'
|
||||||
pod 'CryptoSwift'
|
pod 'CryptoSwift'
|
||||||
pod 'IQKeyboardManagerSwift'
|
pod 'IQKeyboardManagerSwift'
|
||||||
|
|
||||||
@ -43,7 +44,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
target 'NotificationServiceExtension' do
|
target 'NotificationServiceExtension' do
|
||||||
pod 'IceCream'
|
# pod 'IceCream'
|
||||||
|
pod 'RealmSwift'
|
||||||
pod 'Kingfisher'
|
pod 'Kingfisher'
|
||||||
pod 'CryptoSwift'
|
pod 'CryptoSwift'
|
||||||
pod 'SwiftyJSON'
|
pod 'SwiftyJSON'
|
||||||
|
|||||||
22
Podfile.lock
22
Podfile.lock
@ -6,8 +6,6 @@ PODS:
|
|||||||
- Differentiator (5.0.0)
|
- Differentiator (5.0.0)
|
||||||
- DropDown (2.3.13)
|
- DropDown (2.3.13)
|
||||||
- FDFullscreenPopGesture (1.1)
|
- FDFullscreenPopGesture (1.1)
|
||||||
- IceCream (2.0.4):
|
|
||||||
- RealmSwift (< 10.8.0)
|
|
||||||
- IQKeyboardManagerSwift (6.5.10)
|
- IQKeyboardManagerSwift (6.5.10)
|
||||||
- Kingfisher (6.3.1)
|
- Kingfisher (6.3.1)
|
||||||
- KVOController (1.2.0)
|
- KVOController (1.2.0)
|
||||||
@ -29,11 +27,11 @@ PODS:
|
|||||||
- RxSwift (~> 6.2)
|
- RxSwift (~> 6.2)
|
||||||
- ObjectMapper (4.2.0)
|
- ObjectMapper (4.2.0)
|
||||||
- PLCrashReporter (1.11.1)
|
- PLCrashReporter (1.11.1)
|
||||||
- Realm (10.7.7):
|
- Realm (10.50.1):
|
||||||
- Realm/Headers (= 10.7.7)
|
- Realm/Headers (= 10.50.1)
|
||||||
- Realm/Headers (10.7.7)
|
- Realm/Headers (10.50.1)
|
||||||
- RealmSwift (10.7.7):
|
- RealmSwift (10.50.1):
|
||||||
- Realm (= 10.7.7)
|
- Realm (= 10.50.1)
|
||||||
- RxCocoa (6.2.0):
|
- RxCocoa (6.2.0):
|
||||||
- RxRelay (= 6.2.0)
|
- RxRelay (= 6.2.0)
|
||||||
- RxSwift (= 6.2.0)
|
- RxSwift (= 6.2.0)
|
||||||
@ -57,7 +55,6 @@ DEPENDENCIES:
|
|||||||
- DeviceKit
|
- DeviceKit
|
||||||
- DropDown
|
- DropDown
|
||||||
- FDFullscreenPopGesture
|
- FDFullscreenPopGesture
|
||||||
- IceCream
|
|
||||||
- IQKeyboardManagerSwift
|
- IQKeyboardManagerSwift
|
||||||
- Kingfisher
|
- Kingfisher
|
||||||
- KVOController
|
- KVOController
|
||||||
@ -68,6 +65,7 @@ DEPENDENCIES:
|
|||||||
- "NSObject+Rx"
|
- "NSObject+Rx"
|
||||||
- ObjectMapper
|
- ObjectMapper
|
||||||
- PLCrashReporter
|
- PLCrashReporter
|
||||||
|
- RealmSwift
|
||||||
- RxCocoa
|
- RxCocoa
|
||||||
- RxDataSources
|
- RxDataSources
|
||||||
- RxGesture
|
- RxGesture
|
||||||
@ -84,7 +82,6 @@ SPEC REPOS:
|
|||||||
- Differentiator
|
- Differentiator
|
||||||
- DropDown
|
- DropDown
|
||||||
- FDFullscreenPopGesture
|
- FDFullscreenPopGesture
|
||||||
- IceCream
|
|
||||||
- IQKeyboardManagerSwift
|
- IQKeyboardManagerSwift
|
||||||
- Kingfisher
|
- Kingfisher
|
||||||
- KVOController
|
- KVOController
|
||||||
@ -128,7 +125,6 @@ SPEC CHECKSUMS:
|
|||||||
Differentiator: e8497ceab83c1b10ca233716d547b9af21b9344d
|
Differentiator: e8497ceab83c1b10ca233716d547b9af21b9344d
|
||||||
DropDown: 8a2116376c1981888557f72ec2ffc9a5e0e456ec
|
DropDown: 8a2116376c1981888557f72ec2ffc9a5e0e456ec
|
||||||
FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
|
FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
|
||||||
IceCream: 717d516a1c634eba8eaa8ce7d3d7bc5f7e40c2fa
|
|
||||||
IQKeyboardManagerSwift: 52962c76ab33532f15ad9f3ff4e5715eda5335bb
|
IQKeyboardManagerSwift: 52962c76ab33532f15ad9f3ff4e5715eda5335bb
|
||||||
Kingfisher: 016c8b653a35add51dd34a3aba36b580041acc74
|
Kingfisher: 016c8b653a35add51dd34a3aba36b580041acc74
|
||||||
KVOController: d72ace34afea42468329623b3379ab3cd1d286b6
|
KVOController: d72ace34afea42468329623b3379ab3cd1d286b6
|
||||||
@ -140,8 +136,8 @@ SPEC CHECKSUMS:
|
|||||||
"NSObject+Rx": 61cf1f7306a73dcef8b36649198af0813ec18dfd
|
"NSObject+Rx": 61cf1f7306a73dcef8b36649198af0813ec18dfd
|
||||||
ObjectMapper: 1eb41f610210777375fa806bf161dc39fb832b81
|
ObjectMapper: 1eb41f610210777375fa806bf161dc39fb832b81
|
||||||
PLCrashReporter: 5d2d3967afe0efad61b3048d617e2199a5d1b787
|
PLCrashReporter: 5d2d3967afe0efad61b3048d617e2199a5d1b787
|
||||||
Realm: 8010af8b7a576ba501729bcbc54a3cd1f1f7dca3
|
Realm: 36bc9fe2681d7cf234aa487e7990821c772206a2
|
||||||
RealmSwift: dc17e6d649c12a8996f9e962c3fe6cef356885c4
|
RealmSwift: 84a370d3d4f191d327a9f8ade1f064a274f79847
|
||||||
RxCocoa: 4baf94bb35f2c0ab31bc0cb9f1900155f646ba42
|
RxCocoa: 4baf94bb35f2c0ab31bc0cb9f1900155f646ba42
|
||||||
RxDataSources: aa47cc1ed6c500fa0dfecac5c979b723542d79cf
|
RxDataSources: aa47cc1ed6c500fa0dfecac5c979b723542d79cf
|
||||||
RxGesture: f059f2aeef966fb17dad56ee440e76410f10e55f
|
RxGesture: f059f2aeef966fb17dad56ee440e76410f10e55f
|
||||||
@ -151,6 +147,6 @@ SPEC CHECKSUMS:
|
|||||||
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
|
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
|
||||||
SwiftyJSON: 2f33a42c6fbc52764d96f13368585094bfd8aa5e
|
SwiftyJSON: 2f33a42c6fbc52764d96f13368585094bfd8aa5e
|
||||||
|
|
||||||
PODFILE CHECKSUM: 73cfda85b7a345d896330d72bc61822356f98586
|
PODFILE CHECKSUM: c9560d9c6653dd0da638d1f49876c91a02632de6
|
||||||
|
|
||||||
COCOAPODS: 1.15.2
|
COCOAPODS: 1.15.2
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user