Add various informative alert-boxes

This commit is contained in:
2025-11-09 21:31:03 +01:00
parent c108859899
commit fd5e714074
23 changed files with 426 additions and 130 deletions

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:simplecloudnotifier/api/api_client.dart';
import 'package:simplecloudnotifier/api/api_exception.dart';
import 'package:simplecloudnotifier/components/error_display/error_display.dart';
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
import 'package:simplecloudnotifier/models/channel.dart';
@@ -407,6 +408,9 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
await _initStateAsync(false);
Toaster.success("Success", 'Subscription succesfully confirmed');
} on APIException catch (exc, trace) {
if (!exc.toastShown) Toaster.error("Error", 'Failed to confirm subscription');
ApplicationLog.error('Failed to confirm subscription: ' + exc.toString(), trace: trace);
} catch (exc, trace) {
Toaster.error("Error", 'Failed to confirm subscription');
ApplicationLog.error('Failed to confirm subscription: ' + exc.toString(), trace: trace);
@@ -429,6 +433,9 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
Toaster.success("Success", 'Unsubscribed from channel');
Navi.pop(context);
} on APIException catch (exc, trace) {
if (!exc.toastShown) Toaster.error("Error", 'Failed to unsubscribe from channel');
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
} catch (exc, trace) {
Toaster.error("Error", 'Failed to unsubscribe from channel');
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
@@ -447,6 +454,9 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
await _initStateAsync(false);
Toaster.success("Success", 'Unsubscribed from channel');
} on APIException catch (exc, trace) {
if (!exc.toastShown) Toaster.error("Error", 'Failed to unsubscribe from channel');
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
} catch (exc, trace) {
Toaster.error("Error", 'Failed to unsubscribe from channel');
ApplicationLog.error('Failed to unsubscribe from channel: ' + exc.toString(), trace: trace);
@@ -465,6 +475,9 @@ class _SubscriptionViewPageState extends State<SubscriptionViewPage> {
await _initStateAsync(false);
Toaster.success("Success", 'Subscribed to channel');
} on APIException catch (exc, trace) {
if (!exc.toastShown) Toaster.error("Error", 'Failed to subscribe to channel');
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);
} catch (exc, trace) {
Toaster.error("Error", 'Failed to subscribe to channel');
ApplicationLog.error('Failed to subscribe to channel: ' + exc.toString(), trace: trace);