Change error prompts

This commit is contained in:
problematicconsumer
2023-08-26 17:01:51 +03:30
parent f393020a31
commit 2ecb781f60
15 changed files with 88 additions and 48 deletions

View File

@@ -33,7 +33,7 @@ class AboutPage extends HookConsumerWidget {
if (next case AsyncData(:final value)) {
switch (value.latestVersion) {
case AsyncError(:final error):
CustomToast.error(t.presentError(error)).show(context);
CustomToast.error(t.printError(error)).show(context);
default:
if (value.newVersionAvailable) {
await NewVersionDialog(

View File

@@ -31,7 +31,7 @@ class ProfileTile extends HookConsumerWidget {
final selectActiveMutation = useMutation(
initialOnFailure: (err) {
CustomToast.error(t.presentError(err)).show(context);
CustomToast.error(t.printError(err)).show(context);
},
);
@@ -146,7 +146,8 @@ class ProfileActionButton extends HookConsumerWidget {
final updateProfileMutation = useMutation(
initialOnFailure: (err) {
CustomToast.error(t.presentError(err)).show(context);
// CustomToast.error(t.printError(err)).show(context);
CustomAlertDialog.fromErr(t.presentError(err)).show(context);
},
initialOnSuccess: () =>
CustomToast.success(t.profile.update.successMsg).show(context),
@@ -204,14 +205,14 @@ class ProfileActionsMenu extends HookConsumerWidget {
final updateProfileMutation = useMutation(
initialOnFailure: (err) {
CustomToast.error(t.presentError(err)).show(context);
CustomAlertDialog.fromErr(t.presentError(err)).show(context);
},
initialOnSuccess: () =>
CustomToast.success(t.profile.update.successMsg).show(context),
);
final deleteProfileMutation = useMutation(
initialOnFailure: (err) {
CustomToast.error(t.presentError(err)).show(context);
CustomAlertDialog.fromErr(t.presentError(err)).show(context);
},
);

View File

@@ -67,7 +67,7 @@ class HomePage extends HookConsumerWidget {
_ => const EmptyProfilesHomeBody(),
},
AsyncError(:final error) =>
SliverErrorBodyPlaceholder(t.presentError(error)),
SliverErrorBodyPlaceholder(t.printError(error)),
_ => const SliverToBoxAdapter(),
},
],

View File

@@ -24,13 +24,12 @@ class ConnectionButton extends HookConsumerWidget {
connectivityControllerProvider,
(_, next) {
if (next case AsyncError(:final error)) {
CustomToast.error(t.presentError(error)).show(context);
CustomAlertDialog.fromErr(t.presentError(error)).show(context);
}
if (next
case AsyncData(value: Disconnected(:final connectionFailure?))) {
CustomAlertDialog(
message: connectionFailure.present(t),
).show(context);
CustomAlertDialog.fromErr(t.presentError(connectionFailure))
.show(context);
}
},
);

View File

@@ -138,7 +138,7 @@ class LogsPage extends HookConsumerWidget with PresLogger {
NestedTabAppBar(
title: Text(t.logs.pageTitle.titleCase),
),
SliverErrorBodyPlaceholder(t.presentError(error)),
SliverErrorBodyPlaceholder(t.printError(error)),
],
),
);

View File

@@ -38,7 +38,7 @@ class ProfileDetailPage extends HookConsumerWidget with PresLogger {
if (asyncSave case AsyncData(value: final save)) {
switch (save) {
case MutationFailure(:final failure):
CustomToast.error(t.presentError(failure)).show(context);
CustomToast.error(t.printError(failure)).show(context);
case MutationSuccess():
CustomToast.success(t.profile.save.successMsg.sentenceCase)
.show(context);
@@ -58,7 +58,7 @@ class ProfileDetailPage extends HookConsumerWidget with PresLogger {
if (asyncSave case AsyncData(value: final delete)) {
switch (delete) {
case MutationFailure(:final failure):
CustomToast.error(t.presentError(failure)).show(context);
CustomToast.error(t.printError(failure)).show(context);
case MutationSuccess():
CustomToast.success(t.profile.delete.successMsg.sentenceCase)
.show(context);

View File

@@ -30,7 +30,8 @@ class AddProfileModal extends HookConsumerWidget {
final addProfileMutation = useMutation(
initialOnFailure: (err) {
mutationTriggered.value = false;
CustomToast.error(t.presentError(err)).show(context);
// CustomToast.error(t.presentError(err)).show(context);
CustomAlertDialog.fromErr(t.presentError(err)).show(context);
},
initialOnSuccess: () {
CustomToast.success(t.profile.save.successMsg.sentenceCase)

View File

@@ -38,7 +38,7 @@ class ProfilesModal extends HookConsumerWidget {
itemCount: profiles.length,
),
AsyncError(:final error) => SliverErrorBodyPlaceholder(
t.presentError(error),
t.printError(error),
),
AsyncLoading() => const SliverLoadingBodyPlaceholder(),
_ => const SliverToBoxAdapter(),

View File

@@ -22,7 +22,7 @@ class ProxiesPage extends HookConsumerWidget with PresLogger {
final selectActiveProxyMutation = useMutation(
initialOnFailure: (error) =>
CustomToast.error(t.presentError(error)).show(context),
CustomToast.error(t.printError(error)).show(context),
);
switch (asyncProxies) {
@@ -148,7 +148,7 @@ class ProxiesPage extends HookConsumerWidget with PresLogger {
title: Text(t.proxies.pageTitle.titleCase),
),
SliverErrorBodyPlaceholder(
t.presentError(error),
t.printError(error),
icon: null,
),
],