Add proxy routing and sing-box support
This commit is contained in:
@@ -49,13 +49,20 @@ class ProfileBackupScreen extends HookConsumerWidget {
|
||||
final backupFuture = useState<Future<bool>?>(null);
|
||||
final backupState = useFuture(backupFuture.value);
|
||||
|
||||
// One-shot: success navigates away; rebuilds before the route swap
|
||||
// completes would otherwise re-fire navigation and the snackbar.
|
||||
final successHandled = useRef(false);
|
||||
|
||||
useEffect(() {
|
||||
if (backupState.hasError) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!context.mounted) return;
|
||||
showErrorMessage(context, backupState.error!.toString());
|
||||
});
|
||||
} else if (backupState.hasData) {
|
||||
} else if (backupState.hasData && !successHandled.value) {
|
||||
successHandled.value = true;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!context.mounted) return;
|
||||
showInfoMessage(context, 'Backup created successfully');
|
||||
ProfileListRoute().go(context);
|
||||
});
|
||||
|
||||
@@ -55,13 +55,20 @@ class ProfileRestoreScreen extends HookConsumerWidget {
|
||||
|
||||
final restoreTarget = useState(forcedTarget ?? RestoreTarget.createNew);
|
||||
|
||||
// One-shot: a successful restore navigates away, but rebuilds before the
|
||||
// route swap completes can otherwise re-fire the success branch.
|
||||
final successHandled = useRef(false);
|
||||
|
||||
useEffect(() {
|
||||
if (restoreState.hasError) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!context.mounted) return;
|
||||
showErrorMessage(context, restoreState.error!.toString());
|
||||
});
|
||||
} else if (restoreState.hasData) {
|
||||
} else if (restoreState.hasData && !successHandled.value) {
|
||||
successHandled.value = true;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!context.mounted) return;
|
||||
showInfoMessage(context, 'Backup restored successfully');
|
||||
if (onRestoreSuccess != null) {
|
||||
onRestoreSuccess!(context, restoreState.data);
|
||||
|
||||
Reference in New Issue
Block a user