diff --git a/Linphone/Core/CoreContext.swift b/Linphone/Core/CoreContext.swift index a7a0abb4a..e71947f38 100644 --- a/Linphone/Core/CoreContext.swift +++ b/Linphone/Core/CoreContext.swift @@ -170,8 +170,10 @@ final class CoreContext: ObservableObject { forPasteboardType: UTType.plainText.identifier ) - ToastViewModel.shared.toastMessage = "Success_copied_into_clipboard" - ToastViewModel.shared.displayToast = true + DispatchQueue.main.async { + ToastViewModel.shared.toastMessage = "Success_send_logs" + ToastViewModel.shared.displayToast = true + } } }) diff --git a/Linphone/Localizable.xcstrings b/Linphone/Localizable.xcstrings index 8dc0dee51..ec823b015 100644 --- a/Linphone/Localizable.xcstrings +++ b/Linphone/Localizable.xcstrings @@ -371,7 +371,10 @@ "Log out" : { }, - "Logout" : { + "Logs cleared" : { + + }, + "Logs URL copied into clipboard" : { }, "Message" : { @@ -382,9 +385,6 @@ }, "Missed call" : { - }, - "My Profile" : { - }, "New call" : { diff --git a/Linphone/UI/Main/Fragments/SideMenu.swift b/Linphone/UI/Main/Fragments/SideMenu.swift index 029f90ff1..e9fdc8d70 100644 --- a/Linphone/UI/Main/Fragments/SideMenu.swift +++ b/Linphone/UI/Main/Fragments/SideMenu.swift @@ -43,19 +43,44 @@ struct SideMenu: View { HStack { List { - Text("My Profile").onTapGesture { - print("My Profile") - } - Text("Send logs").onTapGesture { - sendLogs() - } - Text("Clear logs").onTapGesture { - print("Clear logs") - Core.resetLogCollection() - } - Text("Logout").onTapGesture { - print("Logout") - } + /* + Text("My Profile") + .frame(height: 40) + .frame(maxWidth: .infinity, alignment: .leading) + .background(Color.white) + .onTapGesture { + print("My Profile") + self.menuClose() + } + */ + Text("Send logs") + .frame(height: 40) + .frame(maxWidth: .infinity, alignment: .leading) + .background(Color.white) + .onTapGesture { + print("Send logs") + sendLogs() + self.menuClose() + } + Text("Clear logs") + .frame(height: 40) + .frame(maxWidth: .infinity, alignment: .leading) + .background(Color.white) + .onTapGesture { + print("Clear logs") + clearLogs() + self.menuClose() + } + /* + Text("Logout") + .frame(height: 40) + .frame(maxWidth: .infinity, alignment: .leading) + .background(Color.white) + .onTapGesture { + print("Logout") + self.menuClose() + } + */ } .frame(width: self.width - safeAreaInsets.leading) .background(Color.white) @@ -75,4 +100,14 @@ struct SideMenu: View { core.uploadLogCollection() } } + + func clearLogs() { + coreContext.doOnCoreQueue { core in + Core.resetLogCollection() + DispatchQueue.main.async { + ToastViewModel.shared.toastMessage = "Success_clear_logs" + ToastViewModel.shared.displayToast = true + } + } + } } diff --git a/Linphone/UI/Main/Fragments/ToastView.swift b/Linphone/UI/Main/Fragments/ToastView.swift index 9f8dc277e..565128b7e 100644 --- a/Linphone/UI/Main/Fragments/ToastView.swift +++ b/Linphone/UI/Main/Fragments/ToastView.swift @@ -48,6 +48,20 @@ struct ToastView: View { .default_text_style(styleSize: 15) .padding(8) + case "Success_clear_logs": + Text("Logs cleared") + .multilineTextAlignment(.center) + .foregroundStyle(Color.greenSuccess500) + .default_text_style(styleSize: 15) + .padding(8) + + case "Success_send_logs": + Text("Logs URL copied into clipboard") + .multilineTextAlignment(.center) + .foregroundStyle(Color.greenSuccess500) + .default_text_style(styleSize: 15) + .padding(8) + case "Success_copied_into_clipboard": Text("SIP address copied into clipboard") .multilineTextAlignment(.center)