forked from mirrors/linphone-iphone
Error management for meeting scheduling: unreachable network, missing subject/participant, fail to send some or all ICS invitations
This commit is contained in:
parent
df8f515601
commit
66500e42b5
3 changed files with 46 additions and 11 deletions
|
|
@ -37,7 +37,7 @@ class AccountLoginViewModel: ObservableObject {
|
|||
guard self.coreContext.networkStatusIsConnected else {
|
||||
DispatchQueue.main.async {
|
||||
self.coreContext.loggingInProgress = false
|
||||
ToastViewModel.shared.toastMessage = "Registration_failed_no_network"
|
||||
ToastViewModel.shared.toastMessage = "Unavailable_network"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
return
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ struct ToastView: View {
|
|||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Registration_failed_no_network":
|
||||
case "Unavailable_network":
|
||||
Text("Could not reach network")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
|
|
@ -253,6 +253,20 @@ struct ToastView: View {
|
|||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Failed_meeting_invitations_not_sent":
|
||||
Text("Could not send ICS invitations to meeting to any participant")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
case "Failed_no_subject_or_participant":
|
||||
Text("A subject and at least one participant is required to create a meeting")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundStyle(Color.redDanger500)
|
||||
.default_text_style(styleSize: 15)
|
||||
.padding(8)
|
||||
|
||||
default:
|
||||
Text("Error")
|
||||
.multilineTextAlignment(.center)
|
||||
|
|
|
|||
|
|
@ -216,13 +216,23 @@ class MeetingViewModel: ObservableObject {
|
|||
Log.info("\(MeetingViewModel.TAG) All invitations have been sent")
|
||||
} else if cbVal.failedInvitations.count == self.participants.count {
|
||||
Log.error("\(MeetingViewModel.TAG) No invitation sent!")
|
||||
// TODO: show error toast
|
||||
} else {
|
||||
Log.warn("\(MeetingViewModel.TAG) \(cbVal.failedInvitations.count) invitations couldn't have been sent for:")
|
||||
for failInv in cbVal.failedInvitations {
|
||||
Log.warn(failInv.asStringUriOnly())
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Failed_meeting_invitations_not_sent"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
} else {
|
||||
var failInvList = ""
|
||||
for failInv in cbVal.failedInvitations {
|
||||
if !failInvList.isEmpty {
|
||||
failInvList += ", "
|
||||
}
|
||||
failInvList.append(failInv.asStringUriOnly())
|
||||
}
|
||||
Log.warn("\(MeetingViewModel.TAG) \(cbVal.failedInvitations.count) invitations couldn't have been sent to: \(failInvList)")
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Error: \(cbVal.failedInvitations.count) invitations couldn't be sent to \(failInvList)"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
// TODO: show error toast
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
|
|
@ -233,13 +243,24 @@ class MeetingViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func schedule() {
|
||||
if subject.isEmpty || participants.isEmpty {
|
||||
guard !subject.isEmpty && participants.isEmpty else {
|
||||
Log.error("\(MeetingViewModel.TAG) Either no subject was set or no participant was selected, can't schedule meeting.")
|
||||
// TODO: show red toast
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Failed_no_subject_or_participant"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
return
|
||||
}
|
||||
operationInProgress = true
|
||||
|
||||
guard CoreContext.shared.networkStatusIsConnected else {
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.toastMessage = "Unavailable_network"
|
||||
ToastViewModel.shared.displayToast = true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
operationInProgress = true
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.info("\(MeetingViewModel.TAG) Scheduling \(self.isBroadcastSelected ? "broadcast" : "meeting")")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue