diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb
index 1f59cc5b..15d3a937 100644
--- a/assets/l10n/intl_en.arb
+++ b/assets/l10n/intl_en.arb
@@ -1573,6 +1573,7 @@
"type": "text",
"placeholders": {}
},
+ "link": "Link",
"serverRequiresEmail": "This server needs to validate your email address for registration.",
"optionalGroupName": "(Optional) Group name",
"@optionalGroupName": {
diff --git a/docs/en/fdroid.md b/docs/en/fdroid.md
index 1b504c66..df0a0444 100644
--- a/docs/en/fdroid.md
+++ b/docs/en/fdroid.md
@@ -1,62 +1,37 @@
---
layout: default
-title: F-Droid Repository
+title: Push
lang: en
---
-# F-Droid Repository
+# Enable Push Notifications without Google Services
-## Add Repository to F-Droid
+You have two options to receive push notifications on FluffyChat without Google Services.
-Easiest way to add the Repository is to either scan the QR-Code or if you are on your phone directly click it.
+1. Unified Push
+2. MicroG
-{::nomarkdown}
-
-
-
-{:/}
+## 1. Unified Push
+UnifiedPush is specifications and tools that let the user choose how push notifications are delivered. All in a free and open source way.
-### If the QR-Code doesn't work:
+### Use hosted (easy)
-First check if you have f-droid installed. If not you can get it from: [https://f-droid.org/](https://f-droid.org/).
-After you made sure you installed it and you didn't have it installed before you can try again the QR-Code.
-If this still isn't working follow the next steps:
+1. Go to: https://gotify1.unifiedpush.org/
+2. Register an account with a username+password
+3. Download UP-Gotify from F-Droid: https://f-droid.org/de/packages/com.github.gotify.up/
+4. Login on https://gotify1.unifiedpush.org/ with your username+password
+5. Restart FluffyChat
-1. Open the f-droid App
-2. Go to the `Settings` Tab in the Bottom bar
-3. Click the `Repositories` Action
-4. Click on the plus sign at the top.
-5. Fill in `https://fdroid.fluffychat.im` into the top field and `8E2637AEF6697CC6DD486AF044A6EE45B1A742AE3EF56566E748CDE8BC65C1FB` in the bottom field.
+From now on all push notifications will go through unified push.
-## What is the fingerprint?
+### Self-host (hard)
-The fingerprint of the Repository is: `8E2637AEF6697CC6DD486AF044A6EE45B1A742AE3EF56566E748CDE8BC65C1FB`
+For more privacy and protection of your meta data you can self host Gotify for unified push.
-# Nightly Repository
+Learn more about it here: https://unifiedpush.org/users/distributors/gotify/
-## Add Repository to F-Droid
+## 2. MicroG
-Easiest way to add the Repository is to either scan the QR-Code or if you are on your phone directly click it.
+You can use Firebase Cloud Messaging without Google Services using MicroG.
-{::nomarkdown}
-
-
-
-{:/}
-
-
-### If the QR-Code doesn't work:
-
-First check if you have f-droid installed. If not you can get it from: [https://f-droid.org/](https://f-droid.org/).
-After you made sure you installed it and you didn't have it installed before you can try again the QR-Code.
-If this still isn't working follow the next steps:
-
-1. Open the f-droid App
-2. Go to the `Settings` Tab in the Bottom bar
-3. Click the `Repositories` Action
-4. Click on the plus sign at the top.
-5. Fill in `https://nightly.fdroid.fluffychat.im` into the top field and `21A469657300576478B623DF99D8EB889A80BCD939ACA60A4074741BEAEC397D` in the bottom field.
-
-## What is the fingerprint?
-
-The fingerprint of the Repository is: `21A469657300576478B623DF99D8EB889A80BCD939ACA60A4074741BEAEC397D`
+Learn more about it here: https://microg.org/
\ No newline at end of file
diff --git a/docs/en/push.md b/docs/en/push.md
new file mode 100644
index 00000000..1b504c66
--- /dev/null
+++ b/docs/en/push.md
@@ -0,0 +1,62 @@
+---
+layout: default
+title: F-Droid Repository
+lang: en
+---
+# F-Droid Repository
+
+## Add Repository to F-Droid
+
+Easiest way to add the Repository is to either scan the QR-Code or if you are on your phone directly click it.
+
+{::nomarkdown}
+
+
+
+{:/}
+
+
+### If the QR-Code doesn't work:
+
+First check if you have f-droid installed. If not you can get it from: [https://f-droid.org/](https://f-droid.org/).
+After you made sure you installed it and you didn't have it installed before you can try again the QR-Code.
+If this still isn't working follow the next steps:
+
+1. Open the f-droid App
+2. Go to the `Settings` Tab in the Bottom bar
+3. Click the `Repositories` Action
+4. Click on the plus sign at the top.
+5. Fill in `https://fdroid.fluffychat.im` into the top field and `8E2637AEF6697CC6DD486AF044A6EE45B1A742AE3EF56566E748CDE8BC65C1FB` in the bottom field.
+
+## What is the fingerprint?
+
+The fingerprint of the Repository is: `8E2637AEF6697CC6DD486AF044A6EE45B1A742AE3EF56566E748CDE8BC65C1FB`
+
+# Nightly Repository
+
+## Add Repository to F-Droid
+
+Easiest way to add the Repository is to either scan the QR-Code or if you are on your phone directly click it.
+
+{::nomarkdown}
+
+
+
+{:/}
+
+
+### If the QR-Code doesn't work:
+
+First check if you have f-droid installed. If not you can get it from: [https://f-droid.org/](https://f-droid.org/).
+After you made sure you installed it and you didn't have it installed before you can try again the QR-Code.
+If this still isn't working follow the next steps:
+
+1. Open the f-droid App
+2. Go to the `Settings` Tab in the Bottom bar
+3. Click the `Repositories` Action
+4. Click on the plus sign at the top.
+5. Fill in `https://nightly.fdroid.fluffychat.im` into the top field and `21A469657300576478B623DF99D8EB889A80BCD939ACA60A4074741BEAEC397D` in the bottom field.
+
+## What is the fingerprint?
+
+The fingerprint of the Repository is: `21A469657300576478B623DF99D8EB889A80BCD939ACA60A4074741BEAEC397D`
diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart
index 31f722dd..43520725 100644
--- a/lib/config/app_config.dart
+++ b/lib/config/app_config.dart
@@ -16,6 +16,7 @@ abstract class AppConfig {
static const Color secondaryColor = Color(0xFF41a2bc);
static String _privacyUrl = 'https://fluffychat.im/en/privacy.html';
static String get privacyUrl => _privacyUrl;
+ static const String enablePushTutorial = 'https://fluffychat.im/en/push.html';
static const String appId = 'im.fluffychat.FluffyChat';
static const String appOpenUrlScheme = 'im.fluffychat';
static String _webBaseUrl = 'https://fluffychat.im/web';
diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart
index ef3ec698..f0bb4d4d 100644
--- a/lib/utils/background_push.dart
+++ b/lib/utils/background_push.dart
@@ -51,8 +51,7 @@ class BackgroundPush {
BuildContext context;
GlobalKey router;
String _fcmToken;
- LoginState _loginState;
- void Function(String errorMsg) onFcmError;
+ void Function(String errorMsg, {Uri link}) onFcmError;
L10n l10n;
Store _store;
Store get store => _store ??= Store();
@@ -95,7 +94,7 @@ class BackgroundPush {
factory BackgroundPush(
Client _client, BuildContext _context, GlobalKey router,
- {final void Function(String errorMsg) onFcmError}) {
+ {final void Function(String errorMsg, {Uri link}) onFcmError}) {
final instance = BackgroundPush.clientOnly(_client);
instance.context = _context;
instance.router = router;
@@ -109,7 +108,6 @@ class BackgroundPush {
}
void handleLoginStateChanged(LoginState state) {
- _loginState = state;
setupPush();
}
@@ -217,7 +215,7 @@ class BackgroundPush {
Future setupPush() async {
await setupLocalNotificationsPlugin();
- if (_loginState != LoginState.loggedIn ||
+ if (client.loginState != LoginState.loggedIn ||
!PlatformInfos.isMobile ||
context == null) {
return;
@@ -250,9 +248,15 @@ class BackgroundPush {
}
if (await store.getItemBool(SettingKeys.showNoGoogle, true)) {
await loadLocale();
- onFcmError?.call(PlatformInfos.isAndroid
- ? l10n.noGoogleServicesWarning
- : l10n.oopsPushError);
+ if (PlatformInfos.isAndroid) {
+ onFcmError?.call(
+ l10n.noGoogleServicesWarning,
+ link: Uri.parse(
+ AppConfig.enablePushTutorial,
+ ),
+ );
+ }
+ onFcmError?.call(l10n.oopsPushError);
if (null == await store.getItem(SettingKeys.showNoGoogle)) {
await store.setItemBool(SettingKeys.showNoGoogle, false);
diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart
index bd580211..0275c561 100644
--- a/lib/widgets/matrix.dart
+++ b/lib/widgets/matrix.dart
@@ -519,8 +519,22 @@ class MatrixState extends State with WidgetsBindingObserver {
client,
context,
widget.router,
- onFcmError: (errorMsg) => ScaffoldMessenger.of(context)
- .showSnackBar(SnackBar(content: Text(errorMsg))),
+ onFcmError: (errorMsg, {Uri link}) => Timer(
+ Duration(seconds: 1),
+ () {
+ final banner = SnackBar(
+ content: Text(errorMsg),
+ duration: Duration(seconds: 30),
+ action: link == null
+ ? null
+ : SnackBarAction(
+ label: L10n.of(context).link,
+ onPressed: () => launch(link.toString()),
+ ),
+ );
+ ScaffoldMessenger.of(navigatorContext).showSnackBar(banner);
+ },
+ ),
);
}
}