mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
show snackbar message after unsubscibing
This commit is contained in:
parent
313b7c2ff0
commit
a854ba88bc
1 changed files with 6 additions and 3 deletions
|
|
@ -22,8 +22,8 @@ import Views
|
|||
isLoading = false
|
||||
}
|
||||
|
||||
func cancelSubscription(dataService: DataService) async {
|
||||
guard let subscriptionName = subscriptionNameToCancel else { return }
|
||||
func cancelSubscription(dataService: DataService) async -> Bool {
|
||||
guard let subscriptionName = subscriptionNameToCancel else { return false }
|
||||
|
||||
do {
|
||||
try await dataService.deleteSubscription(subscriptionName: subscriptionName)
|
||||
|
|
@ -31,8 +31,10 @@ import Views
|
|||
if let index = index {
|
||||
subscriptions.remove(at: index)
|
||||
}
|
||||
return true
|
||||
} catch {
|
||||
appLogger.debug("failed to remove subscription")
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -99,7 +101,8 @@ struct SubscriptionsView: View {
|
|||
.alert("Are you sure you want to cancel this subscription?", isPresented: $deleteConfirmationShown) {
|
||||
Button("Yes", role: .destructive) {
|
||||
Task {
|
||||
await viewModel.cancelSubscription(dataService: dataService)
|
||||
let unsubscribed = await viewModel.cancelSubscription(dataService: dataService)
|
||||
Snackbar.show(message: unsubscribed ? "Subscription cancelled." : "Could not unsubscribe.")
|
||||
}
|
||||
}
|
||||
Button("No", role: .cancel) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue