From 0f5df8806c2e9691c4e0c6f4c93cf1a183bd1947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B0=D1=86=D0=B5=D0=BF=D0=B8=D0=BD?= Date: Tue, 1 Oct 2019 18:50:49 +0300 Subject: [PATCH] [android] Removed Libnotify from project --- android/AndroidManifest.xml | 8 --- android/build.gradle | 19 ------- android/res/values/libnotify.xml | 18 ------ .../maps/analytics/EventLoggerAggregator.java | 1 - .../maps/analytics/LibnotifyEventLogger.java | 57 ------------------- .../maps/search/SearchFragment.java | 21 ------- .../util/log/LibnotifyLogReceiver.java | 45 --------------- .../mapswithme/util/log/LoggerFactory.java | 6 -- .../util/push/GCMListenerRouterService.java | 12 ++-- .../GcmInstanceIDRouterListenerService.java | 3 - 10 files changed, 4 insertions(+), 186 deletions(-) delete mode 100644 android/res/values/libnotify.xml delete mode 100644 android/src/com/mapswithme/maps/analytics/LibnotifyEventLogger.java delete mode 100644 android/src/com/mapswithme/util/log/LibnotifyLogReceiver.java diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index c1a10f197e..9ee89a73e1 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -87,14 +87,6 @@ android:name="${PW_PROJECT_ID_KEY}" android:value="@string/pw_project_id"/> - - - - diff --git a/android/build.gradle b/android/build.gradle index 1b2bcc0f96..c93c9cd5a4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,9 +26,6 @@ repositories { maven { url 'https://maven.fabric.io/public' } - maven { - url 'https://dl.bintray.com/libverify/android' - } maven { url 'https://s3.amazonaws.com/moat-sdk-builds' } @@ -94,14 +91,6 @@ dependencies { implementation 'net.jcip:jcip-annotations:1.0' implementation 'com.appsflyer:af-android-sdk:4.9.0' implementation 'com.android.installreferrer:installreferrer:1.0' - implementation ("ru.mail:libnotify:0.1.177-notify-support-v107-sdk-26@aar") { - transitive = true - changing = true - } - implementation ("ru.mail:libnotify-debug:0.1.177-notify-support-v107-sdk-26@aar") { - transitive = true - changing = true - } implementation 'com.android.support.constraint:constraint-layout:1.1.0' implementation 'com.android.billingclient:billing:1.1' @@ -189,12 +178,6 @@ android { resValue 'string', 'pw_project_id', pwProps['pwProjectId'] buildConfigField "String", 'PW_PROJECT_ID', "\"" + pwProjectIdKey + "\"" - // Libnotify keys - Properties lnProps = new Properties() - lnProps.load(new FileInputStream("${projectDir}/libnotify.properties")); - manifestPlaceholders += ['LIBNOTIFY_APP_ID': lnProps['appId']] - manifestPlaceholders += ['LIBNOTIFY_PROJECT_ID': lnProps['projectId']] - multiDexEnabled true multiDexKeepFile file('multidex-config.txt') @@ -443,7 +426,6 @@ android { zipAlignEnabled true signingConfig signingConfigs.mapswithmeDebug android.sourceSets.debug.setRoot('flavors/debug') - manifestPlaceholders += ['LIBNOTIFY_APP_ID': 'MapsMeDebug'] resValue 'string', 'app_id', android.defaultConfig.applicationId + applicationIdSuffix } @@ -461,7 +443,6 @@ android { signingConfig signingConfigs.mapswithme android.sourceSets.beta.setRoot('flavors/beta') matchingFallbacks = ['debug', 'release'] - manifestPlaceholders += ['LIBNOTIFY_APP_ID': 'MapsMeBeta'] resValue 'string', 'app_id', android.defaultConfig.applicationId + applicationIdSuffix } } diff --git a/android/res/values/libnotify.xml b/android/res/values/libnotify.xml deleted file mode 100644 index 1fc3739c78..0000000000 --- a/android/res/values/libnotify.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - drawable/ic_notification - - color/base_accent - - color/button_accent_text - diff --git a/android/src/com/mapswithme/maps/analytics/EventLoggerAggregator.java b/android/src/com/mapswithme/maps/analytics/EventLoggerAggregator.java index d93523f901..eed8800784 100644 --- a/android/src/com/mapswithme/maps/analytics/EventLoggerAggregator.java +++ b/android/src/com/mapswithme/maps/analytics/EventLoggerAggregator.java @@ -17,7 +17,6 @@ class EventLoggerAggregator extends ContextDependentEventLogger { super(application); mLoggers = new HashMap<>(); - mLoggers.put(LibnotifyEventLogger.class, new LibnotifyEventLogger(application)); mLoggers.put(PushWooshEventLogger.class, new PushWooshEventLogger(application)); mLoggers.put(MyTrackerEventLogger.class, new MyTrackerEventLogger(application)); mLoggers.put(FlurryEventLogger.class, new FlurryEventLogger(application)); diff --git a/android/src/com/mapswithme/maps/analytics/LibnotifyEventLogger.java b/android/src/com/mapswithme/maps/analytics/LibnotifyEventLogger.java deleted file mode 100644 index 54e2c126bf..0000000000 --- a/android/src/com/mapswithme/maps/analytics/LibnotifyEventLogger.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.mapswithme.maps.analytics; - -import android.app.Application; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; - -import com.mapswithme.maps.BuildConfig; -import com.mapswithme.util.log.Logger; -import com.mapswithme.util.log.LoggerFactory; -import ru.mail.libnotify.api.NotificationApi; -import ru.mail.libnotify.api.NotificationFactory; -import ru.mail.notify.core.api.BackgroundAwakeMode; -import ru.mail.notify.core.api.NetworkSyncMode; - -import java.util.Collections; -import java.util.Map; - -class LibnotifyEventLogger extends DefaultEventLogger -{ - LibnotifyEventLogger(@NonNull Application application) - { - super(application); - } - - @Override - public void initialize() - { - if (BuildConfig.DEBUG || BuildConfig.BUILD_TYPE.equals("beta")) - { - NotificationFactory.enableDebugMode(); - NotificationFactory.setLogReceiver(LoggerFactory.INSTANCE.createLibnotifyLogger()); - NotificationFactory.setUncaughtExceptionListener((thread, throwable) -> { - Logger l = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.THIRD_PARTY); - l.e("LIBNOTIFY", "Thread: " + thread, throwable); - }); - } - NotificationFactory.setNetworkSyncMode(NetworkSyncMode.WIFI_ONLY); - NotificationFactory.setBackgroundAwakeMode(BackgroundAwakeMode.DISABLED); - NotificationFactory.initialize(getApplication()); - NotificationApi api = NotificationFactory.get(getApplication()); - api.allowDeviceIdTracking(false, false); - } - - @Override - public void sendTags(@NonNull String tag, @Nullable String[] params) - { - super.sendTags(tag, params); - if (params == null) - return; - - boolean isSingleParam = params.length == 1; - Object value = isSingleParam ? params[0] : params; - Map map = Collections.singletonMap(tag, value); - NotificationApi api = NotificationFactory.get(getApplication()); - api.collectEventBatch(map); - } -} diff --git a/android/src/com/mapswithme/maps/search/SearchFragment.java b/android/src/com/mapswithme/maps/search/SearchFragment.java index 4c5e899b50..0788fb60e9 100644 --- a/android/src/com/mapswithme/maps/search/SearchFragment.java +++ b/android/src/com/mapswithme/maps/search/SearchFragment.java @@ -1,7 +1,6 @@ package com.mapswithme.maps.search; import android.app.Activity; -import android.content.Context; import android.content.Intent; import android.location.Location; import android.os.Bundle; @@ -39,7 +38,6 @@ import com.mapswithme.util.SharedPropertiesUtils; import com.mapswithme.util.UiUtils; import com.mapswithme.util.Utils; import com.mapswithme.util.statistics.Statistics; -import ru.mail.libnotify.debug.NotifyDebugActivity; import java.util.ArrayList; import java.util.Arrays; @@ -472,7 +470,6 @@ public class SearchFragment extends BaseMwmFragment if (mHiddenCommands.isEmpty()) { mHiddenCommands.addAll(Arrays.asList(new BadStorageCommand("?emulateBadStorage"), - new LibnotifyIdCommand(getActivity(), "?libnotifyId"), new JavaCrashCommand("?emulateJavaCrash"), new NativeCrashCommand("?emulateNativeCrash"))); } @@ -751,24 +748,6 @@ public class SearchFragment extends BaseMwmFragment } } - private static class LibnotifyIdCommand extends HiddenCommand.BaseHiddenCommand - { - @NonNull - private final Context mContext; - - protected LibnotifyIdCommand(@NonNull Context context, @NonNull String command) - { - super(command); - mContext = context; - } - - @Override - void executeInternal() - { - mContext.startActivity(new Intent(mContext, NotifyDebugActivity.class)); - } - } - private static class JavaCrashCommand extends HiddenCommand.BaseHiddenCommand { protected JavaCrashCommand(@NonNull String command) diff --git a/android/src/com/mapswithme/util/log/LibnotifyLogReceiver.java b/android/src/com/mapswithme/util/log/LibnotifyLogReceiver.java deleted file mode 100644 index a5c3ad2a63..0000000000 --- a/android/src/com/mapswithme/util/log/LibnotifyLogReceiver.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.mapswithme.util.log; - -import ru.mail.notify.core.utils.LogReceiver; - -class LibnotifyLogReceiver implements LogReceiver -{ - private static final Logger LOGGER - = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.THIRD_PARTY); - private static final String TAG = "LIBNOTIFY_"; - @Override - public void v(String tag, String msg) - { - LOGGER.v(TAG + tag, msg); - } - - @Override - public void v(String tag, String msg, Throwable throwable) - { - LOGGER.v(TAG + tag, msg, throwable); - } - - @Override - public void e(String tag, String msg) - { - LOGGER.e(TAG + tag, msg); - } - - @Override - public void e(String tag, String msg, Throwable throwable) - { - LOGGER.e(tag, msg, throwable); - } - - @Override - public void d(String tag, String msg) - { - LOGGER.d(TAG + tag, msg); - } - - @Override - public void d(String tag, String msg, Throwable throwable) - { - LOGGER.d(TAG + tag, msg, throwable); - } -} diff --git a/android/src/com/mapswithme/util/log/LoggerFactory.java b/android/src/com/mapswithme/util/log/LoggerFactory.java index 6c04786f1b..286a55d70d 100644 --- a/android/src/com/mapswithme/util/log/LoggerFactory.java +++ b/android/src/com/mapswithme/util/log/LoggerFactory.java @@ -13,7 +13,6 @@ import com.mapswithme.maps.R; import com.mapswithme.util.StorageUtils; import net.jcip.annotations.GuardedBy; import net.jcip.annotations.ThreadSafe; -import ru.mail.notify.core.utils.LogReceiver; import java.io.File; import java.util.EnumMap; @@ -158,11 +157,6 @@ public class LoggerFactory return mFileLoggerExecutor; } - @NonNull - public LogReceiver createLibnotifyLogger() - { - return new LibnotifyLogReceiver(); - } // Called from JNI. @SuppressWarnings("unused") private static void logCoreMessage(int level, String msg) diff --git a/android/src/com/mapswithme/util/push/GCMListenerRouterService.java b/android/src/com/mapswithme/util/push/GCMListenerRouterService.java index 4ee0d84bde..a6f8e08177 100644 --- a/android/src/com/mapswithme/util/push/GCMListenerRouterService.java +++ b/android/src/com/mapswithme/util/push/GCMListenerRouterService.java @@ -13,7 +13,6 @@ import com.mapswithme.maps.BuildConfig; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; import com.pushwoosh.internal.utils.NotificationRegistrarHelper; -import ru.mail.libnotify.api.NotificationFactory; // It's temporary class, it may be deleted along with Pushwoosh sdk. // The base of this code is taken from https://www.pushwoosh.com/docs/gcm-integration-legacy. @@ -23,9 +22,10 @@ public class GCMListenerRouterService extends GcmListenerService private static final String TAG = GCMListenerRouterService.class.getSimpleName(); @Override - public void onMessageReceived(@Nullable String from, @Nullable Bundle data) { + public void onMessageReceived(@Nullable String from, @Nullable Bundle data) + { LOGGER.i(TAG, "Gcm router service received message: " - + (data != null ? data.toString() : "") + " from: " + from); + + (data != null ? data.toString() : "") + " from: " + from); if (data == null || TextUtils.isEmpty(from)) return; @@ -35,12 +35,8 @@ public class GCMListenerRouterService extends GcmListenerService data.putString("from", from); String pwProjectId = getPWProjectId(getApplicationContext()); - if (!TextUtils.isEmpty(pwProjectId) && pwProjectId.contains(from)) { + if (!TextUtils.isEmpty(pwProjectId) && pwProjectId.contains(from)) NotificationRegistrarHelper.handleMessage(data); - return; - } - - NotificationFactory.deliverGcmMessageIntent(this, from, data); } @Nullable diff --git a/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java b/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java index c2e75fb3c1..c4ab03b4bc 100644 --- a/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java +++ b/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java @@ -11,8 +11,6 @@ import com.pushwoosh.PushwooshFcmHelper; import java.io.IOException; -import ru.mail.libnotify.api.NotificationFactory; - public class GcmInstanceIDRouterListenerService extends InstanceIDListenerService { private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.THIRD_PARTY); @@ -37,7 +35,6 @@ public class GcmInstanceIDRouterListenerService extends InstanceIDListenerServic { String token = getRefreshedToken(); PushwooshFcmHelper.onTokenRefresh(this, token); - NotificationFactory.refreshGcmToken(this); } @Nullable