diff --git a/ReactNativeClient/android/app/build.gradle b/ReactNativeClient/android/app/build.gradle
index d0e1bc9ccb..61416060c2 100644
--- a/ReactNativeClient/android/app/build.gradle
+++ b/ReactNativeClient/android/app/build.gradle
@@ -137,7 +137,7 @@ android {
}
dependencies {
- implementation project(':react-native-firebase')
+ compile project(':react-native-push-notification')
implementation (project(':react-native-camera')) {
// This is required because com.google.firebase requires v16.0.x of com.google.android.gms
// while react-native-camera requires v15.x, which results in broken dependencies with
@@ -167,8 +167,6 @@ dependencies {
implementation "com.facebook.react:react-native:+"
implementation "com.google.android.gms:play-services-base:16.0.1" // For Firebase
- implementation "com.google.firebase:firebase-core:16.0.4" // For Firebase
- implementation "com.google.firebase:firebase-messaging:17.3.4" // For Firebase
implementation 'me.leolin:ShortcutBadger:1.1.21@aar' // For Firebase - this line if you wish to use badge on Android
// To fix the error below, which happened after adding react-native-camera.
@@ -197,5 +195,4 @@ task copyDownloadableDepsToLibs(type: Copy) {
into 'libs'
}
-apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
-apply plugin: 'com.google.gms.google-services' // For Firebase
\ No newline at end of file
+apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
\ No newline at end of file
diff --git a/ReactNativeClient/android/app/google-services.json b/ReactNativeClient/android/app/google-services.json
deleted file mode 100644
index 73f25d388f..0000000000
--- a/ReactNativeClient/android/app/google-services.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "project_info": {
- "project_number": "790045682275",
- "firebase_url": "https://joplin-b5b20.firebaseio.com",
- "project_id": "joplin-b5b20",
- "storage_bucket": "joplin-b5b20.appspot.com"
- },
- "client": [
- {
- "client_info": {
- "mobilesdk_app_id": "1:790045682275:android:8b68903cf881e9f7",
- "android_client_info": {
- "package_name": "net.cozic.joplin"
- }
- },
- "oauth_client": [
- {
- "client_id": "790045682275-fkusmvsm7gv3nve7h0sg0uuor9njf4sm.apps.googleusercontent.com",
- "client_type": 3
- }
- ],
- "api_key": [
- {
- "current_key": "AIzaSyCbHjUWAKcbldLTuoN7JybJ8dfznwBG_gM"
- }
- ],
- "services": {
- "analytics_service": {
- "status": 1
- },
- "appinvite_service": {
- "status": 1,
- "other_platform_oauth_client": []
- },
- "ads_service": {
- "status": 2
- }
- }
- }
- ],
- "configuration_version": "1"
-}
\ No newline at end of file
diff --git a/ReactNativeClient/android/app/src/main/AndroidManifest.xml b/ReactNativeClient/android/app/src/main/AndroidManifest.xml
index 8b0032397b..f0011cc679 100644
--- a/ReactNativeClient/android/app/src/main/AndroidManifest.xml
+++ b/ReactNativeClient/android/app/src/main/AndroidManifest.xml
@@ -11,18 +11,18 @@
-
-
+
-
-
+
+
+
+
+
-
+
-
-
@@ -39,56 +39,41 @@
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ReactNativeClient/android/app/src/main/java/net/cozic/joplin/MainApplication.java b/ReactNativeClient/android/app/src/main/java/net/cozic/joplin/MainApplication.java
index c7128fd911..dd1dade195 100644
--- a/ReactNativeClient/android/app/src/main/java/net/cozic/joplin/MainApplication.java
+++ b/ReactNativeClient/android/app/src/main/java/net/cozic/joplin/MainApplication.java
@@ -3,9 +3,7 @@ package net.cozic.joplin;
import android.app.Application;
import com.facebook.react.ReactApplication;
-import io.invertase.firebase.RNFirebasePackage;
-import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
-import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
+import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
import org.reactnative.camera.RNCameraPackage;
import com.vinzscam.reactnativefileviewer.RNFileViewerPackage;
import net.rhogan.rnsecurerandom.RNSecureRandomPackage;
@@ -41,10 +39,8 @@ public class MainApplication extends Application implements ReactApplication {
protected List getPackages() {
return Arrays.asList(
new MainReactPackage(),
+ new ReactNativePushNotificationPackage(),
new ImageResizerPackage(),
- new RNFirebasePackage(),
- new RNFirebaseMessagingPackage(),
- new RNFirebaseNotificationsPackage(),
new RNCameraPackage(),
new RNFileViewerPackage(),
new RNSecureRandomPackage(),
diff --git a/ReactNativeClient/android/app/src/main/res/values/colors.xml b/ReactNativeClient/android/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000000..6699fd6d3f
--- /dev/null
+++ b/ReactNativeClient/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,3 @@
+
+ #FFF
+
\ No newline at end of file
diff --git a/ReactNativeClient/android/build.gradle b/ReactNativeClient/android/build.gradle
index 5065c72483..2d474feb85 100644
--- a/ReactNativeClient/android/build.gradle
+++ b/ReactNativeClient/android/build.gradle
@@ -14,7 +14,6 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0' // Upgraded from 3.1.4 to 3.2.0 for Firebase
- classpath 'com.google.gms:google-services:4.0.1' // For Firebase
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/ReactNativeClient/android/settings.gradle b/ReactNativeClient/android/settings.gradle
index a9dd90dd6a..384eae0305 100644
--- a/ReactNativeClient/android/settings.gradle
+++ b/ReactNativeClient/android/settings.gradle
@@ -1,6 +1,4 @@
rootProject.name = 'Joplin'
-include ':react-native-firebase'
-project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-camera'
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
include ':react-native-file-viewer'
@@ -33,3 +31,6 @@ include ':app', ':react-native-share-extension'
project(':react-native-share-extension').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share-extension/android')
include ':react-native-version-info'
project(':react-native-version-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-info/android')
+
+include ':react-native-push-notification'
+project(':react-native-push-notification').projectDir = file('../node_modules/react-native-push-notification/android')
\ No newline at end of file
diff --git a/ReactNativeClient/lib/services/AlarmServiceDriver.android.js b/ReactNativeClient/lib/services/AlarmServiceDriver.android.js
index 6976f1bc3b..6c0254472a 100644
--- a/ReactNativeClient/lib/services/AlarmServiceDriver.android.js
+++ b/ReactNativeClient/lib/services/AlarmServiceDriver.android.js
@@ -1,17 +1,23 @@
-// Note: currently, if Play Services aren't available, notifications will not work at all
-// There won't be any warning or error message.
-
-import firebase from 'react-native-firebase';
+const PushNotification = require('react-native-push-notification');
class AlarmServiceDriver {
- constructor() {
- this.playServiceAvailable_ = firebase.utils().playServicesAvailability.isAvailable;
- if (!this.playServiceAvailable_) return;
+ PushNotificationHandler_() {
+ if (!this.PushNotification_) {
+ PushNotification.configure({
+ // (required) Called when a remote or local notification is opened or received
+ onNotification: function(notification) {
+ console.info('Notification was opened: ', notification );
+ // process the notification
+ },
+ popInitialNotification: true,
+ requestPermissions: true,
+ });
- this.channel_ = new firebase.notifications.Android.Channel('net.cozic.joplin.notification', 'Joplin Alarm',firebase.notifications.Android.Importance.Max)
- .setDescription('Displays a notification for alarms associated with to-dos.');
- firebase.notifications().android.createChannel(this.channel_);
+ this.PushNotification_ = PushNotification;
+ }
+
+ return this.PushNotification_;
}
hasPersistentNotifications() {
@@ -22,29 +28,18 @@ class AlarmServiceDriver {
throw new Error('Available only for non-persistent alarms');
}
- firebaseNotificationId_(joplinNotificationId) {
- return 'net.cozic.joplin-' + joplinNotificationId;
- }
-
async clearNotification(id) {
- if (!this.playServiceAvailable_) return;
-
- return firebase.notifications().cancelNotification(this.firebaseNotificationId_(id))
+ return this.PushNotificationHandler_().cancelLocalNotifications({id: id+''});
}
async scheduleNotification(notification) {
- if (!this.playServiceAvailable_) return;
+ const config = {
+ id: notification.id + '',
+ message: notification.title,
+ date: notification.date,
+ };
- const firebaseNotification = new firebase.notifications.Notification()
- firebaseNotification.setNotificationId(this.firebaseNotificationId_(notification.id));
- firebaseNotification.setTitle(notification.title)
- if ('body' in notification) firebaseNotification.body = notification.body;
- firebaseNotification.android.setChannelId('net.cozic.joplin.notification');
- firebaseNotification.android.setSmallIcon('ic_stat_access_alarm');
-
- await firebase.notifications().scheduleNotification(firebaseNotification, {
- fireDate: notification.date.getTime(),
- });
+ this.PushNotificationHandler_().localNotificationSchedule(config);
}
}
diff --git a/ReactNativeClient/package-lock.json b/ReactNativeClient/package-lock.json
index e29ca890d0..201be08b4f 100644
--- a/ReactNativeClient/package-lock.json
+++ b/ReactNativeClient/package-lock.json
@@ -5981,11 +5981,6 @@
"mimic-fn": "^1.0.0"
}
},
- "opencollective-postinstall": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.1.tgz",
- "integrity": "sha512-saQQ9hjLwu/oS0492eyYotoh+bra1819cfAT5rjY/e4REWwuc8IgZ844Oo44SiftWcJuBiqp0SA0BFVbmLX0IQ=="
- },
"opn": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/opn/-/opn-3.0.3.tgz",
@@ -6819,26 +6814,6 @@
"resolved": "https://registry.npmjs.org/react-native-file-viewer/-/react-native-file-viewer-1.0.5.tgz",
"integrity": "sha512-/5lwmVPliEOIJMoRby9tb1s9VPxUH1ru7BfdCKxZAwZI5LoOY1qHZuUMtCHAlIKLH1DHu8fhjleJuXbRHaCuLQ=="
},
- "react-native-firebase": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/react-native-firebase/-/react-native-firebase-5.1.1.tgz",
- "integrity": "sha512-Iv+GKsk7pSX88BcDZUEyR02T4XjVqhQaGMmpzyDZ0cBc/Dpo7XxPfUc8M3z8hKFGPLJwvyFa6rMYTtz6RcJYEw==",
- "requires": {
- "opencollective-postinstall": "^2.0.0",
- "prop-types": "^15.6.2"
- },
- "dependencies": {
- "prop-types": {
- "version": "15.6.2",
- "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz",
- "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==",
- "requires": {
- "loose-envify": "^1.3.1",
- "object-assign": "^4.1.1"
- }
- }
- }
- },
"react-native-fs": {
"version": "2.11.17",
"resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.11.17.tgz",
@@ -6908,6 +6883,11 @@
"resolved": "https://registry.npmjs.org/react-native-popup-menu/-/react-native-popup-menu-0.10.0.tgz",
"integrity": "sha1-zhU2eo1WKIfVypB+IyMB1BLd5+c="
},
+ "react-native-push-notification": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/react-native-push-notification/-/react-native-push-notification-3.1.2.tgz",
+ "integrity": "sha512-MjjPNXb2Cw7g1D41DtVbTVuGFCAtADxb91pAEFSkQ0AZ2gIooqYkWFHBL6woc15QHhtaZS8VT2GQoyW5OWlxIg=="
+ },
"react-native-securerandom": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/react-native-securerandom/-/react-native-securerandom-0.1.1.tgz",
diff --git a/ReactNativeClient/package.json b/ReactNativeClient/package.json
index b9f3135e24..6472f6ba3f 100644
--- a/ReactNativeClient/package.json
+++ b/ReactNativeClient/package.json
@@ -32,13 +32,13 @@
"react-native-document-picker": "^2.1.0",
"react-native-dropdownalert": "^3.1.2",
"react-native-file-viewer": "^1.0.5",
- "react-native-firebase": "^5.1.1",
"react-native-fs": "^2.11.17",
"react-native-image-picker": "^0.26.7",
"react-native-image-resizer": "^1.0.0",
"react-native-material-dropdown": "^0.5.2",
"react-native-popup-dialog": "^0.9.35",
"react-native-popup-menu": "^0.10.0",
+ "react-native-push-notification": "^3.1.2",
"react-native-securerandom": "^0.1.1",
"react-native-share-extension": "^1.2.1",
"react-native-side-menu": "^1.1.3",