-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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
1 parent
8768315
commit 34a077a
Showing
59 changed files
with
1,853 additions
and
1,854 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 0 additions & 103 deletions
103
app/src/main/java/fr/smarquis/fcm/FcmPayloadActivity.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.