mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-01-11 18:22:49 +01:00
fix: Push error message
This commit is contained in:
parent
ee2d30bebe
commit
f3a002d1a3
@ -2950,5 +2950,6 @@
|
||||
"number": {}
|
||||
}
|
||||
},
|
||||
"hideUnimportantStateEvents": "Hide unimportant state events"
|
||||
"hideUnimportantStateEvents": "Hide unimportant state events",
|
||||
"doNotShowAgain": "Do not show again"
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ abstract class AppConfig {
|
||||
'https://gitlab.com/famedly/fluffychat/-/blob/main/PRIVACY.md';
|
||||
static String get privacyUrl => _privacyUrl;
|
||||
static const String enablePushTutorial =
|
||||
'https://www.reddit.com/r/fluffychat/comments/qn6liu/enable_push_notifications_without_google_services/';
|
||||
'https://gitlab.com/famedly/fluffychat/-/wikis/Push-Notifications-without-Google-Services';
|
||||
static const String appId = 'im.fluffychat.FluffyChat';
|
||||
static const String appOpenUrlScheme = 'im.fluffychat';
|
||||
static String _webBaseUrl = 'https://fluffychat.im/web';
|
||||
|
@ -258,8 +258,11 @@ class BackgroundPush {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
if (await store.getItemBool(SettingKeys.showNoGoogle, true)) {
|
||||
if (await store.getItemBool(SettingKeys.showNoGoogle, true) != true) {
|
||||
return;
|
||||
}
|
||||
await loadLocale();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (PlatformInfos.isAndroid) {
|
||||
onFcmError?.call(
|
||||
l10n!.noGoogleServicesWarning,
|
||||
@ -267,13 +270,10 @@ class BackgroundPush {
|
||||
AppConfig.enablePushTutorial,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
onFcmError?.call(l10n!.oopsPushError);
|
||||
|
||||
if (null == await store.getItem(SettingKeys.showNoGoogle)) {
|
||||
await store.setItemBool(SettingKeys.showNoGoogle, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> setupFirebase() async {
|
||||
|
@ -5,6 +5,7 @@ import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:adaptive_theme/adaptive_theme.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:desktop_notifications/desktop_notifications.dart';
|
||||
@ -400,22 +401,23 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||
client,
|
||||
context,
|
||||
widget.router,
|
||||
onFcmError: (errorMsg, {Uri? link}) => Timer(
|
||||
const Duration(seconds: 1),
|
||||
() {
|
||||
final banner = SnackBar(
|
||||
content: Text(errorMsg),
|
||||
duration: const Duration(seconds: 30),
|
||||
action: link == null
|
||||
? null
|
||||
: SnackBarAction(
|
||||
label: L10n.of(navigatorContext)!.link,
|
||||
onPressed: () => launch(link.toString()),
|
||||
),
|
||||
onFcmError: (errorMsg, {Uri? link}) async {
|
||||
final result = await showOkCancelAlertDialog(
|
||||
barrierDismissible: true,
|
||||
context: context,
|
||||
title: L10n.of(context)!.oopsSomethingWentWrong,
|
||||
message: errorMsg,
|
||||
okLabel:
|
||||
link == null ? L10n.of(context)!.ok : L10n.of(context)!.help,
|
||||
cancelLabel: L10n.of(context)!.doNotShowAgain,
|
||||
);
|
||||
ScaffoldMessenger.of(navigatorContext).showSnackBar(banner);
|
||||
if (result == OkCancelResult.ok && link != null) {
|
||||
launch(link.toString());
|
||||
}
|
||||
if (result == OkCancelResult.cancel) {
|
||||
await store.setItemBool(SettingKeys.showNoGoogle, true);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user