Skip to content
Snippets Groups Projects
Commit da08ed89 authored by Bruno Muniz's avatar Bruno Muniz :apple:
Browse files

working on backup/restore account

parent 15589043
No related branches found
No related tags found
1 merge request!66Using new client wrapper
......@@ -448,7 +448,7 @@
CODE_SIGN_ENTITLEMENTS = "client-ios/Resources/client-ios.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283;
CURRENT_PROJECT_VERSION = 288;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_BITCODE = NO;
......@@ -487,7 +487,7 @@
CODE_SIGN_ENTITLEMENTS = "client-ios/Resources/client-ios.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283;
CURRENT_PROJECT_VERSION = 288;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_BITCODE = NO;
......@@ -522,7 +522,7 @@
CODE_SIGN_ENTITLEMENTS = NotificationExtension/NotificationExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283;
CURRENT_PROJECT_VERSION = 288;
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -553,7 +553,7 @@
CODE_SIGN_ENTITLEMENTS = NotificationExtension/NotificationExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 283;
CURRENT_PROJECT_VERSION = 288;
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
......
......@@ -105,6 +105,6 @@
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>isReportingOptional</key>
<true/>
<false/>
</dict>
</plist>
......@@ -15,7 +15,6 @@ import XXClient
import XXMessengerClient
import CloudFiles
import CloudFilesDrive
import CloudFilesDropbox
public class AppDelegate: UIResponder, UIApplicationDelegate {
......@@ -64,7 +63,6 @@ public class AppDelegate: UIResponder, UIApplicationDelegate {
PushRouter.live(navigationController: navController)
)
restoreIfPossible()
return true
}
......
......@@ -26,6 +26,8 @@ public final class BackupService {
@Dependency var messenger: Messenger
@Dependency var networkManager: NetworkMonitoring
@KeyObject(.email, defaultValue: nil) var email: String?
@KeyObject(.phone, defaultValue: nil) var phone: String?
@KeyObject(.username, defaultValue: nil) var username: String?
@KeyObject(.backupSettings, defaultValue: nil) var storedSettings: Data?
......@@ -76,7 +78,11 @@ extension BackupService {
public func initializeBackup(passphrase: String) {
try! messenger.startBackup(
password: passphrase,
params: .init(username: username!)
params: .init(
username: username!,
email: email,
phone: phone
)
)
}
......
......@@ -58,7 +58,7 @@ public extension Validator where T == String {
return .failure("")
}
let regex = try? NSRegularExpression(pattern: "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d!@#$%^&*]{8,}$")
let regex = try? NSRegularExpression(pattern: "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d\\W_]{8,}$")
guard let regex = regex, regex.firstMatch(in: passphrase, options: [], range: passphrase.fullRange()) != nil else {
return .failure("")
......
......@@ -96,6 +96,7 @@ final class RestoreListViewModel {
guard let manager = managers[provider] else {
return
}
hudSubject.send(.on)
do {
try manager.fetch { [weak self] in
guard let self else { return }
......@@ -108,6 +109,7 @@ final class RestoreListViewModel {
provider: provider,
metadata: metadata
))
self.hudSubject.send(.none)
case .failure(let error):
self.hudSubject.send(.error(.init(with: error)))
}
......
......@@ -127,6 +127,21 @@ final class RestoreViewModel {
onProgress: { print(">>> \($0)") }
)
try self.database.saveContact(.init(
id: self.messenger.e2e.get()!.getContact().getId(),
marshaled: self.messenger.e2e.get()!.getContact().data,
username: self.username!,
email: self.email,
phone: self.phone,
nickname: nil,
photo: nil,
authStatus: .friend,
isRecent: false,
isBlocked: false,
isBanned: false,
createdAt: Date()
))
print(">>> Calling multilookup")
let multilookup = try self.messenger.lookupContacts(ids: result.restoredContacts)
......@@ -147,8 +162,12 @@ final class RestoreViewModel {
isBanned: false,
createdAt: Date()
))
let _ = try! self.messenger.e2e.get()!.resetAuthenticatedChannel(partner: $0)
}
try self.messenger.start()
multilookup.errors.forEach {
print(">>> Error: \($0.localizedDescription)")
}
......
......@@ -99,15 +99,6 @@
"version" : "1.3.0"
}
},
{
"identity" : "fileprovider",
"kind" : "remoteSourceControl",
"location" : "https://github.com/amosavian/FileProvider.git",
"state" : {
"revision" : "abf68a62541a4193c8d106367ddb3648e8ab693f",
"version" : "0.26.0"
}
},
{
"identity" : "firebase-ios-sdk",
"kind" : "remoteSourceControl",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment