diff --git a/ConversationsClassic/AppData/Services/PersistUserSettings.swift b/ConversationsClassic/AppData/Services/PersistUserSettings.swift index 69c38f1..f41af84 100644 --- a/ConversationsClassic/AppData/Services/PersistUserSettings.swift +++ b/ConversationsClassic/AppData/Services/PersistUserSettings.swift @@ -33,7 +33,7 @@ enum UserSettings { @Storage(key: kOmemoDevicesIds, defaultValue: [:]) private static var omemoDevicesIds: [String: UInt32] - @Storage(key: kSecureChatsByDefault, defaultValue: false) + @Storage(key: kSecureChatsByDefault, defaultValue: true) private static var vSecureChatsByDefault: Bool } @@ -41,7 +41,7 @@ enum UserSettings { extension UserSettings { static func reset() { omemoDevicesIds = [:] - vSecureChatsByDefault = false + vSecureChatsByDefault = true } static func set(omemoDeviceId: UInt32, for account: String) { diff --git a/ConversationsClassic/AppData/Store/ClientsStore.swift b/ConversationsClassic/AppData/Store/ClientsStore.swift index 9e845ac..972d6d2 100644 --- a/ConversationsClassic/AppData/Store/ClientsStore.swift +++ b/ConversationsClassic/AppData/Store/ClientsStore.swift @@ -76,14 +76,13 @@ extension ClientsStore { if let client = clients.first(where: { $0.credentials.bareJid == jidStr }) { // check if credentials already exist and enable it // this change will invoke reconnect automatically - try? await client.credentials.setActive(flag: true) + await client.updActivity(true) } else { // new client login with fake timeout async let sleep: Void? = try? await Task.sleep(nanoseconds: 1 * NSEC_PER_SEC) async let request = try await Client.tryLogin(with: .init(bareJid: jidStr, pass: pass, isActive: true)) let client = try await(request, sleep).0 - clients.append(client) try? await client.credentials.save() } } diff --git a/ConversationsClassic/View/Entering/LoginScreen.swift b/ConversationsClassic/View/Entering/LoginScreen.swift index 976975b..2cf71e7 100644 --- a/ConversationsClassic/View/Entering/LoginScreen.swift +++ b/ConversationsClassic/View/Entering/LoginScreen.swift @@ -13,17 +13,8 @@ struct LoginScreen: View { @FocusState private var focus: Field? - #if DEBUG - @State private var jidStr: String = "grouptest1@test.anal.company" - @State private var pass: String = "12345" - // @State private var jidStr: String = "nartest1@conversations.im" - // @State private var pass: String = "nartest12345" - // @State private var jidStr: String = "test1@test.anal.company" - // @State private var pass: String = "12345" - #else - @State private var jidStr: String = "" - @State private var pass: String = "" - #endif + @State private var jidStr: String = "" + @State private var pass: String = "" public var body: some View { ZStack { @@ -107,19 +98,18 @@ struct LoginScreen: View { } private func tryLogin() async { - defer { - router.dismissScreen() - } - do { try await clientsStore.tryLogin(jidStr, pass) + router.dismissScreen() } catch { router.showAlert( .alert, title: L10n.Global.Error.title, subtitle: L10n.Login.error ) { - Button(L10n.Global.ok, role: .cancel) {} + Button(L10n.Global.ok, role: .cancel) { + router.dismissModal() + } } } }