ios get address on start

This commit is contained in:
JRoberts
2022-04-15 23:01:12 +04:00
parent b9627d4082
commit 6f0ecbb540
3 changed files with 3 additions and 14 deletions
+1
View File
@@ -19,6 +19,7 @@ struct ContentView: View {
do {
try apiStartChat()
try apiSetFilesFolder(filesFolder: getAppFilesDirectory().path)
chatModel.userAddress = try apiGetUserAddress()
chatModel.userSMPServers = try getUserSMPServers()
chatModel.chats = try apiGetChats()
} catch {
+2 -2
View File
@@ -520,8 +520,8 @@ func apiDeleteUserAddress() async throws {
throw r
}
func apiGetUserAddress() async throws -> String? {
let r = await chatSendCmd(.showMyAddress)
func apiGetUserAddress() throws -> String? {
let r = chatSendCmdSync(.showMyAddress)
switch r {
case let .userContactLink(connReq):
return connReq
@@ -18,18 +18,6 @@ struct SettingsButton: View {
}
.sheet(isPresented: $showSettings, content: {
SettingsView(showSettings: $showSettings)
.onAppear {
Task {
do {
let userAddress = try await apiGetUserAddress()
DispatchQueue.main.async {
chatModel.userAddress = userAddress
}
} catch {
logger.error("SettingsButton apiGetUserAddress error: \(error.localizedDescription)")
}
}
}
})
}
}