From 7e48adf3ef6782aa3e8a7202d0961abb6d7e3cbe Mon Sep 17 00:00:00 2001 From: Abdulrahman Abdulkarim Date: Thu, 14 May 2020 15:45:20 +0100 Subject: [PATCH 1/6] Update index.js to fix issues --- cloud-functions/functions/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloud-functions/functions/index.js b/cloud-functions/functions/index.js index 192da4e..eeeb6c1 100644 --- a/cloud-functions/functions/index.js +++ b/cloud-functions/functions/index.js @@ -16,12 +16,12 @@ admin.initializeApp(functions.config().firebase); // }); // }); -exports.pushNotification = functions.database.ref('/messages/{pushId}').onWrite( event => { +exports.pushNotification = functions.database.ref('/messages/{pushId}').onWrite( (change, event) => { console.log('Push notification event triggered'); // Grab the current value of what was written to the Realtime Database. - var valueObject = event.data.val(); + var valueObject = change.after.val(); const payload = { notification: { From 42c03f329f3333eedaf5677623863cd7b643fa99 Mon Sep 17 00:00:00 2001 From: Abdulrahman Abdulkarim Date: Fri, 15 May 2020 10:40:47 +0100 Subject: [PATCH 2/6] minor code changes to .gitignore and build.gradle files --- .gitignore | 1 + build.gradle | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 39fb081..fc83475 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /local.properties /.idea/workspace.xml /.idea/libraries +/.idea .DS_Store /build /captures diff --git a/build.gradle b/build.gradle index a746e06..2f47b95 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,10 @@ buildscript { repositories { jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + } } dependencies { classpath 'com.android.tools.build:gradle:2.2.0' @@ -16,6 +20,10 @@ buildscript { allprojects { repositories { jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + } } } From f73e2c97d52a9c1f00c6e26d4d9f38680efa8d28 Mon Sep 17 00:00:00 2001 From: Abdulrahman Abdulkarim Date: Fri, 15 May 2020 16:50:17 +0100 Subject: [PATCH 3/6] Update AndroidManifest file --- app/src/main/AndroidManifest.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 936da6a..91e4176 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,8 +9,7 @@ android:supportsRtl="true" android:theme="@style/AppTheme"> + android:name=".MainActivity"> @@ -18,7 +17,8 @@ - + From f0a154806a71b348a38aa4a538958bfa985a2472 Mon Sep 17 00:00:00 2001 From: Abdulrahman Abdulkarim Date: Fri, 15 May 2020 16:56:05 +0100 Subject: [PATCH 4/6] Update activity_main.xml file --- .gitignore | 2 +- app/.gitignore | 1 + app/src/main/res/layout/activity_main.xml | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fc83475..a222420 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ *.iml .gradle /local.properties +.idea /.idea/workspace.xml /.idea/libraries -/.idea .DS_Store /build /captures diff --git a/app/.gitignore b/app/.gitignore index c7ee965..0ff4472 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1,6 +1,7 @@ *.iml .gradle /local.properties +.idea /.idea/workspace.xml /.idea/libraries .DS_Store diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a0d4433..77f0536 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -43,6 +43,8 @@ android:id="@+id/title" android:layout_width="match_parent" android:layout_height="wrap_content" + android:inputType="text" + android:imeOptions="actionNext" android:hint="Title" /> @@ -56,6 +58,8 @@ android:id="@+id/message" android:layout_width="match_parent" android:layout_height="wrap_content" + android:imeOptions="actionDone" + android:inputType="textMultiLine" android:hint="Message" /> From 0f03ba03dd84831f8b199381138b06aef5a6e870 Mon Sep 17 00:00:00 2001 From: Abdulrahman Abdulkarim Date: Fri, 15 May 2020 17:09:59 +0100 Subject: [PATCH 5/6] Update dependencies and build tool version, upgrade gradle version --- app/build.gradle | 18 +++++++++--------- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 099c46d..dcdc437 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 25 - buildToolsVersion "25.0.1" + compileSdkVersion 28 + buildToolsVersion "28.0.3" defaultConfig { applicationId "com.github.chizoba.firebasecloudfunctions" - minSdkVersion 16 - targetSdkVersion 25 + minSdkVersion 17 + targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -24,12 +24,12 @@ dependencies { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - compile 'com.android.support:appcompat-v7:25.1.1' + compile 'com.android.support:appcompat-v7:28.0.0' testCompile 'junit:junit:4.12' - compile 'com.android.support:cardview-v7:25.1.1' - compile 'com.android.support:design:25.1.1' - compile 'com.google.firebase:firebase-messaging:9.6.1' - compile 'com.google.firebase:firebase-database:9.6.1' + compile 'com.android.support:cardview-v7:28.0.0' + compile 'com.android.support:design:28.0.0' + compile 'com.google.firebase:firebase-messaging:10.2.1' + compile 'com.google.firebase:firebase-database:10.2.1' } apply plugin: 'com.google.gms.google-services' diff --git a/build.gradle b/build.gradle index 2f47b95..84472ba 100644 --- a/build.gradle +++ b/build.gradle @@ -9,11 +9,11 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:2.2.0' + classpath 'com.android.tools.build:gradle:3.6.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files - classpath 'com.google.gms:google-services:3.0.0' + classpath 'com.google.gms:google-services:4.3.3' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 04e285f..3be7fd8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 28 10:00:20 PST 2015 +#Fri May 15 17:04:28 WAT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip From 41f01aff36c92df9d6d87e9e826e979ecd3f0e5e Mon Sep 17 00:00:00 2001 From: Abdulrahman Abdulkarim Date: Fri, 15 May 2020 17:27:04 +0100 Subject: [PATCH 6/6] Major code changes Migrate to AndroidX Update notification implementation for Android 8 and above Update dependencies Update example instrumented test code base --- .idea/codeStyles/Project.xml | 116 ++++++++++++++++++ .idea/gradle.xml | 2 + .idea/misc.xml | 34 ++--- .idea/modules.xml | 2 + .idea/vcs.xml | 6 + app/build.gradle | 17 ++- .../ExampleInstrumentedTest.java | 6 +- .../firebasecloudfunctions/FCMService.java | 29 ++++- .../firebasecloudfunctions/MainActivity.java | 8 +- app/src/main/res/layout/activity_main.xml | 12 +- gradle.properties | 2 + 11 files changed, 191 insertions(+), 43 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 7ac24c7..5cd135a 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,8 +1,10 @@ +