Skip to content

Commit

Permalink
Release 1.6.0
Browse files Browse the repository at this point in the history
- AndroidX migration
- GSON to Moshi migration
- Tap to toggle message display: raw vs content
- Undo delete actions
- Menu button to refresh InstanceId token
- More reliable presence status
- Add Travis CI
  • Loading branch information
SimonMarquis committed Mar 9, 2019
1 parent 8768315 commit 34a077a
Show file tree
Hide file tree
Showing 59 changed files with 1,853 additions and 1,854 deletions.
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: android
jdk: oraclejdk8
before_cache:
- 'rm -f $HOME/.gradle/caches/modules-2/modules-2.lock'
- 'rm -fr $HOME/.gradle/caches/*/plugin-resolution/'
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
android:
licenses:
- android-sdk-preview-license-.+
- android-sdk-license-.+
- google-gdk-license-.+
components:
- tools
- platform-tools
- build-tools-28.0.3
- android-28
- extra
before_install:
- 'chmod +x gradlew'
script:
- './gradlew clean check --stacktrace'
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# FCM toolbox

This public toolbox allows you to easily **test** and **debug** the [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/) service.
- Send and receive FCM payloads
- Send and receive FCM messages
- Manage registered devices
- Self-hosting capabilities

Expand All @@ -14,8 +14,8 @@ This public toolbox allows you to easily **test** and **debug** the [Firebase Cl
Download the latest public version on the [Play Store](https://play.google.com/store/apps/details?id=fr.smarquis.fcm) or choose your [release version](https://github.com/SimonMarquis/FCM-toolbox/releases).

- Notify its presence and send its FCM token to a remote server
- Issue a notification for each payload
- Retain all received payload
- Issue a notification for each message
- Retain all received messages

![android_empty](art/android_empty.png) ![android_lis](art/android_list.png) ![android_notifications](art/android_notifications.png)

Expand Down
36 changes: 22 additions & 14 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def versionMajor = 1
def versionMinor = 7
def versionMinor = 6
def versionPatch = 0
def versionBuild = 0

Expand All @@ -13,35 +13,43 @@ android {
targetSdkVersion 28
versionCode versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version") {
exclude group: 'org.jetbrains', module: 'annotations'
}
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha02'
implementation 'androidx.media:media:1.1.0-alpha01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha3'
implementation 'com.squareup.moshi:moshi:1.8.0'
implementation 'com.squareup.moshi:moshi-adapters:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
}

apply plugin: 'com.google.gms.google-services'
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package fr.smarquis.fcm;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -34,7 +34,7 @@
public class ExampleInstrumentedTest {

@Test
public void useAppContext() throws Exception {
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

Expand Down
18 changes: 4 additions & 14 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
xmlns:tools="http://schemas.android.com/tools"
package="fr.smarquis.fcm">

<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />

<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
Expand All @@ -40,25 +43,12 @@
</activity>

<service
android:name=".MyFirebaseMessagingService"
android:name=".FcmService"
tools:ignore="ExportedService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService"
tools:ignore="ExportedService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>

<activity
android:name=".FcmPayloadActivity"
android:excludeFromRecents="true"
android:noHistory="true"
android:theme="@style/Theme.AppCompat.Light.Dialog" />
<activity
android:name=".CopyToClipboardActivity"
android:theme="@android:style/Theme.NoDisplay" />
Expand Down
103 changes: 0 additions & 103 deletions app/src/main/java/fr/smarquis/fcm/FcmPayloadActivity.java

This file was deleted.

69 changes: 69 additions & 0 deletions app/src/main/java/fr/smarquis/fcm/FcmService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright 2017 Simon Marquis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package fr.smarquis.fcm;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;

import androidx.annotation.UiThread;
import androidx.annotation.WorkerThread;
import fr.smarquis.fcm.payloads.Link;
import fr.smarquis.fcm.payloads.Payload;
import fr.smarquis.fcm.payloads.Text;


public class FcmService extends FirebaseMessagingService {

@Override
public void onNewToken(String token) {
Token.broadcast(this, token);
}

@Override
@WorkerThread
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Message<Payload> message = Message.from(remoteMessage);
boolean silent = Boolean.valueOf(remoteMessage.getData().get("silent"));
new Handler(Looper.getMainLooper()).post(() -> notifyAndExecute(message, silent, this));
}

@UiThread
private void notifyAndExecute(Message<Payload> message, boolean silent, Context context) {
if (!silent) {
Notifications.show(context, message);
}
Messages.instance(context).add(message);
Payload payload = message.payload();
if (payload instanceof Link) {
Link link = (Link) payload;
if (link.open()) {
startActivity(link.intent());
}
} else if (payload instanceof Text) {
Text text = (Text) payload;
if (text.clipboard()) {
text.copyToClipboard(this);
}
}
}

}
Loading

0 comments on commit 34a077a

Please sign in to comment.