diff --git a/apps/ios/Shared/Model/SimpleXAPI.swift b/apps/ios/Shared/Model/SimpleXAPI.swift index dd13fa3d71..97b073cb48 100644 --- a/apps/ios/Shared/Model/SimpleXAPI.swift +++ b/apps/ios/Shared/Model/SimpleXAPI.swift @@ -125,8 +125,8 @@ func apiGetActiveUser() throws -> User? { } } -func apiCreateActiveUser(_ p: Profile?) throws -> User { - let r = chatSendCmdSync(.createActiveUser(profile: p)) +func apiCreateActiveUser(_ p: Profile?, sameServers: Bool = false, pastTimestamp: Bool = false) throws -> User { + let r = chatSendCmdSync(.createActiveUser(profile: p, sameServers: sameServers, pastTimestamp: pastTimestamp)) if case let .activeUser(user) = r { return user } throw r } diff --git a/apps/ios/Shared/Views/LocalAuth/LocalAuthView.swift b/apps/ios/Shared/Views/LocalAuth/LocalAuthView.swift index 8200a2c0f5..59b13e45b3 100644 --- a/apps/ios/Shared/Views/LocalAuth/LocalAuthView.swift +++ b/apps/ios/Shared/Views/LocalAuth/LocalAuthView.swift @@ -58,7 +58,7 @@ struct LocalAuthView: View { if let displayName = displayName, displayName != "" { profile = Profile(displayName: displayName, fullName: "") } - m.currentUser = try apiCreateActiveUser(profile) + m.currentUser = try apiCreateActiveUser(profile, pastTimestamp: true) onboardingStageDefault.set(.onboardingComplete) m.onboardingStage = .onboardingComplete try startChat() diff --git a/apps/ios/Shared/Views/UserSettings/PrivacySettings.swift b/apps/ios/Shared/Views/UserSettings/PrivacySettings.swift index a6f12cb275..92bf35867f 100644 --- a/apps/ios/Shared/Views/UserSettings/PrivacySettings.swift +++ b/apps/ios/Shared/Views/UserSettings/PrivacySettings.swift @@ -338,6 +338,7 @@ struct SimplexLockView: View { switch laResult { case .success: _ = kcAppPassword.remove() + resetSelfDestruct() laAlert = .laTurnedOnAlert case .failed, .unavailable: currentLAMode = .passcode diff --git a/apps/ios/SimpleXChat/APITypes.swift b/apps/ios/SimpleXChat/APITypes.swift index e29b309a3a..eb21b347d8 100644 --- a/apps/ios/SimpleXChat/APITypes.swift +++ b/apps/ios/SimpleXChat/APITypes.swift @@ -14,7 +14,7 @@ let jsonEncoder = getJSONEncoder() public enum ChatCommand { case showActiveUser - case createActiveUser(profile: Profile?) + case createActiveUser(profile: Profile?, sameServers: Bool, pastTimestamp: Bool) case listUsers case apiSetActiveUser(userId: Int64, viewPwd: String?) case apiHideUser(userId: Int64, viewPwd: String) @@ -111,11 +111,9 @@ public enum ChatCommand { get { switch self { case .showActiveUser: return "/u" - case let .createActiveUser(profile): - if let profile = profile { - return "/create user \(profile.displayName) \(profile.fullName)" - } - return "/create user" + case let .createActiveUser(profile, sameServers, pastTimestamp): + let user = NewUser(profile: profile, sameServers: sameServers, pastTimestamp: pastTimestamp) + return "/_create user \(encodeJSON(user))" case .listUsers: return "/users" case let .apiSetActiveUser(userId, viewPwd): return "/_user \(userId)\(maybePwd(viewPwd))" case let .apiHideUser(userId, viewPwd): return "/_hide user \(userId) \(encodeJSON(viewPwd))" @@ -735,6 +733,12 @@ public enum ChatResponse: Decodable, Error { } } +struct NewUser: Encodable { + var profile: Profile? + var sameServers: Bool + var pastTimestamp: Bool +} + public enum ChatPagination { case last(count: Int) case after(chatItemId: Int64, count: Int)