Fix side menu buttons

This commit is contained in:
Benoit Martins 2024-01-12 14:58:39 +01:00 committed by QuentinArguillere
parent 04dbce540c
commit 5aaf01250b
4 changed files with 70 additions and 19 deletions

View file

@ -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
}
}
})

View file

@ -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" : {

View file

@ -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
}
}
}
}

View file

@ -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)