mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-01-25 19:44:17 +01:00
fix: Push error message
This commit is contained in:
parent
ee2d30bebe
commit
f3a002d1a3
@ -2950,5 +2950,6 @@
|
|||||||
"number": {}
|
"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';
|
'https://gitlab.com/famedly/fluffychat/-/blob/main/PRIVACY.md';
|
||||||
static String get privacyUrl => _privacyUrl;
|
static String get privacyUrl => _privacyUrl;
|
||||||
static const String enablePushTutorial =
|
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 appId = 'im.fluffychat.FluffyChat';
|
||||||
static const String appOpenUrlScheme = 'im.fluffychat';
|
static const String appOpenUrlScheme = 'im.fluffychat';
|
||||||
static String _webBaseUrl = 'https://fluffychat.im/web';
|
static String _webBaseUrl = 'https://fluffychat.im/web';
|
||||||
|
@ -258,8 +258,11 @@ class BackgroundPush {
|
|||||||
if (context == null) {
|
if (context == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (await store.getItemBool(SettingKeys.showNoGoogle, true)) {
|
if (await store.getItemBool(SettingKeys.showNoGoogle, true) != true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
await loadLocale();
|
await loadLocale();
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (PlatformInfos.isAndroid) {
|
if (PlatformInfos.isAndroid) {
|
||||||
onFcmError?.call(
|
onFcmError?.call(
|
||||||
l10n!.noGoogleServicesWarning,
|
l10n!.noGoogleServicesWarning,
|
||||||
@ -267,13 +270,10 @@ class BackgroundPush {
|
|||||||
AppConfig.enablePushTutorial,
|
AppConfig.enablePushTutorial,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
onFcmError?.call(l10n!.oopsPushError);
|
onFcmError?.call(l10n!.oopsPushError);
|
||||||
|
});
|
||||||
if (null == await store.getItem(SettingKeys.showNoGoogle)) {
|
|
||||||
await store.setItemBool(SettingKeys.showNoGoogle, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setupFirebase() async {
|
Future<void> setupFirebase() async {
|
||||||
|
@ -5,6 +5,7 @@ import 'dart:io';
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||||
import 'package:adaptive_theme/adaptive_theme.dart';
|
import 'package:adaptive_theme/adaptive_theme.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:desktop_notifications/desktop_notifications.dart';
|
import 'package:desktop_notifications/desktop_notifications.dart';
|
||||||
@ -400,22 +401,23 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||||||
client,
|
client,
|
||||||
context,
|
context,
|
||||||
widget.router,
|
widget.router,
|
||||||
onFcmError: (errorMsg, {Uri? link}) => Timer(
|
onFcmError: (errorMsg, {Uri? link}) async {
|
||||||
const Duration(seconds: 1),
|
final result = await showOkCancelAlertDialog(
|
||||||
() {
|
barrierDismissible: true,
|
||||||
final banner = SnackBar(
|
context: context,
|
||||||
content: Text(errorMsg),
|
title: L10n.of(context)!.oopsSomethingWentWrong,
|
||||||
duration: const Duration(seconds: 30),
|
message: errorMsg,
|
||||||
action: link == null
|
okLabel:
|
||||||
? null
|
link == null ? L10n.of(context)!.ok : L10n.of(context)!.help,
|
||||||
: SnackBarAction(
|
cancelLabel: L10n.of(context)!.doNotShowAgain,
|
||||||
label: L10n.of(navigatorContext)!.link,
|
|
||||||
onPressed: () => launch(link.toString()),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
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