Basic FCM vs fdroid mode

This commit is contained in:
Valere
2019-06-20 15:22:40 +02:00
committed by Benoit Marty
parent 0e46fc4c0a
commit 2e417a9143
30 changed files with 663 additions and 1245 deletions

View File

@ -2,14 +2,24 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="im.vector.riotredesign">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application>
<receiver android:name=".receiver.OnApplicationUpgradeReceiver">
<receiver android:name=".receiver.OnApplicationUpgradeOrRebootReceiver">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver
android:name=".core.services.AlarmSyncBroadcastReceiver"
android:enabled="true"
android:exported="false">
</receiver>
</application>
</manifest>

View File

@ -14,24 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.riotredesign.push.fcm;
package im.vector.riotredesign.push.fcm
import android.app.Activity;
import android.content.Context;
import android.app.Activity
import android.content.Context
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import im.vector.riotredesign.core.pushers.PushersManager
public class FcmHelper {
object FcmHelper {
fun isPushSupported(): Boolean = false
/**
* Retrieves the FCM registration token.
*
* @return the FCM token or null if not received from FCM
*/
@Nullable
public static String getFcmToken(Context context) {
return null;
fun getFcmToken(context: Context): String? {
return null
}
/**
@ -40,8 +40,7 @@ public class FcmHelper {
* @param context android context
* @param token the token to store
*/
public static void storeFcmToken(@NonNull Context context,
@Nullable String token) {
fun storeFcmToken(context: Context, token: String?) {
// No op
}
@ -50,7 +49,7 @@ public class FcmHelper {
*
* @param activity the first launch Activity
*/
public static void ensureFcmTokenIsRetrieved(final Activity activity, PushersManager pushersManager) {
fun ensureFcmTokenIsRetrieved(activity: Activity, pushersManager: PushersManager) {
// No op
}
}

View File

@ -1,5 +1,6 @@
/*
* Copyright 2018 New Vector Ltd
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,21 +15,18 @@
* limitations under the License.
*/
package im.vector.riotredesign.receiver;
package im.vector.riotredesign.receiver
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import im.vector.riotredesign.core.services.AlarmSyncBroadcastReceiver
import timber.log.Timber
import timber.log.Timber;
class OnApplicationUpgradeOrRebootReceiver : BroadcastReceiver() {
public class OnApplicationUpgradeReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Timber.v("## onReceive() : Application has been upgraded, restart event stream service.");
// Start Event stream
// TODO EventStreamServiceX.Companion.onApplicationUpgrade(context);
override fun onReceive(context: Context, intent: Intent) {
Timber.v("## onReceive() ${intent.action}")
AlarmSyncBroadcastReceiver.scheduleAlarm(context, 10)
}
}