show info dialog when reconnecting

This commit is contained in:
hiddify-com
2024-07-14 10:17:46 +02:00
parent 9e60abac04
commit 57b87157bb
3 changed files with 13 additions and 15 deletions

View File

@@ -322,7 +322,7 @@
"experimentalNotice": "Experimental Features In Use", "experimentalNotice": "Experimental Features In Use",
"experimentalNoticeMsg": "You've enabled some experimental features which might affect connection quality and cause unexpected errors. You can always change or reset these options from Config options page.", "experimentalNoticeMsg": "You've enabled some experimental features which might affect connection quality and cause unexpected errors. You can always change or reset these options from Config options page.",
"disableExperimentalNotice": "Don't Show Again", "disableExperimentalNotice": "Don't Show Again",
"reconnectMsg": "Reconnect for Changes to Take Effect" "reconnectMsg": "Reconnecting for taking into account the changes..."
}, },
"config": { "config": {
"resetBtn": "Reset Options", "resetBtn": "Reset Options",

View File

@@ -322,7 +322,7 @@
"experimentalNotice": "ویژگی‌های آزمایشی در حال استفاده", "experimentalNotice": "ویژگی‌های آزمایشی در حال استفاده",
"experimentalNoticeMsg": "شما برخی از ویژگی‌های آزمایشی را فعال کرده‌اید که ممکن است بر کیفیت اتصال تأثیر گذاشته و باعث بروز خطاهای غیرمنتظره شود. شما همیشه می‌توانید این گزینه‌ها را از صفحه‌ی تنظیمات پیکربندی تغییر دهید یا بازنشانی کنید.", "experimentalNoticeMsg": "شما برخی از ویژگی‌های آزمایشی را فعال کرده‌اید که ممکن است بر کیفیت اتصال تأثیر گذاشته و باعث بروز خطاهای غیرمنتظره شود. شما همیشه می‌توانید این گزینه‌ها را از صفحه‌ی تنظیمات پیکربندی تغییر دهید یا بازنشانی کنید.",
"disableExperimentalNotice": "دیگر نشان نده", "disableExperimentalNotice": "دیگر نشان نده",
"reconnectMsg": وباره متصل شوید تا تغییرات اعمال شوند" "reconnectMsg": ر حال اتصال مجدد برای اعمال تغییرات..."
}, },
"config": { "config": {
"resetBtn": "بازنشانی تنظیمات", "resetBtn": "بازنشانی تنظیمات",

View File

@@ -13,12 +13,10 @@ class ConnectionWrapper extends StatefulHookConsumerWidget {
final Widget child; final Widget child;
@override @override
ConsumerState<ConsumerStatefulWidget> createState() => ConsumerState<ConsumerStatefulWidget> createState() => _ConnectionWrapperState();
_ConnectionWrapperState();
} }
class _ConnectionWrapperState extends ConsumerState<ConnectionWrapper> class _ConnectionWrapperState extends ConsumerState<ConnectionWrapper> with AppLogger {
with AppLogger {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ref.listen(connectionNotifierProvider, (_, __) {}); ref.listen(connectionNotifierProvider, (_, __) {});
@@ -26,16 +24,16 @@ class _ConnectionWrapperState extends ConsumerState<ConnectionWrapper>
ref.listen(configOptionNotifierProvider, (previous, next) async { ref.listen(configOptionNotifierProvider, (previous, next) async {
if (next case AsyncData(value: true)) { if (next case AsyncData(value: true)) {
final t = ref.read(translationsProvider); final t = ref.read(translationsProvider);
ref.watch(inAppNotificationControllerProvider).showInfoToast(
t.connection.reconnectMsg,
// actionText: t.connection.reconnect,
// callback: () async {
// await ref
// .read(connectionNotifierProvider.notifier)
// .reconnect(await ref.read(activeProfileProvider.future));
// },
);
await ref.read(connectionNotifierProvider.notifier).reconnect(await ref.read(activeProfileProvider.future)); await ref.read(connectionNotifierProvider.notifier).reconnect(await ref.read(activeProfileProvider.future));
// ref.watch(inAppNotificationControllerProvider).showActionToast(
// t.connection.reconnectMsg,
// actionText: t.connection.reconnect,
// callback: () async {
// await ref
// .read(connectionNotifierProvider.notifier)
// .reconnect(await ref.read(activeProfileProvider.future));
// },
// );
} }
}); });