diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2018-04-10 16:33:55 +0300 |
---|---|---|
committer | Aleksandr Zatsepin <alexzatsepin@users.noreply.github.com> | 2018-04-10 16:36:20 +0300 |
commit | 10a614f428a6e2ffe51e5661c1ee10ca07752800 (patch) | |
tree | a44c5b955bb8af98e013b8ca5c7a55cb37de824e /android/src | |
parent | 64a3ad3b16ba52c7bbfa503ff4b0fee62e6bf7ec (diff) |
Revert "[android] Integrated libnotify library"
This reverts commit 64a3ad3b16ba52c7bbfa503ff4b0fee62e6bf7ec.
Diffstat (limited to 'android/src')
7 files changed, 1 insertions, 182 deletions
diff --git a/android/src/com/mapswithme/maps/MwmApplication.java b/android/src/com/mapswithme/maps/MwmApplication.java index bb005118c5..b24dc0a22e 100644 --- a/android/src/com/mapswithme/maps/MwmApplication.java +++ b/android/src/com/mapswithme/maps/MwmApplication.java @@ -41,9 +41,6 @@ import com.my.tracker.MyTracker; import com.my.tracker.MyTrackerParams; import com.pushwoosh.PushManager; import io.fabric.sdk.android.Fabric; -import ru.mail.libnotify.api.NotificationFactory; -import ru.mail.notify.core.api.BackgroundAwakeMode; -import ru.mail.notify.core.api.NetworkSyncMode; import java.util.List; @@ -168,7 +165,6 @@ public class MwmApplication extends Application private void initCoreIndependentSdks() { initCrashlytics(); - initLibnotify(); initPushWoosh(); initAppsFlyer(); initTracker(); @@ -337,22 +333,6 @@ public class MwmApplication extends Application } } - private void initLibnotify() - { - 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(this); - } - private void initAppsFlyer() { // There is no necessary to use a conversion data listener for a while. diff --git a/android/src/com/mapswithme/maps/search/SearchFragment.java b/android/src/com/mapswithme/maps/search/SearchFragment.java index d8ce890d48..f52b8a3a4d 100644 --- a/android/src/com/mapswithme/maps/search/SearchFragment.java +++ b/android/src/com/mapswithme/maps/search/SearchFragment.java @@ -41,7 +41,6 @@ import com.mapswithme.util.UiUtils; import com.mapswithme.util.Utils; import com.mapswithme.util.concurrency.UiThread; import com.mapswithme.util.statistics.Statistics; -import ru.mail.libnotify.debug.NotifyDebugActivity; import java.util.ArrayList; import java.util.LinkedList; @@ -519,12 +518,6 @@ public class SearchFragment extends BaseMwmFragment return true; } - if (str.equals("?libnotifyId")) - { - startActivity(new Intent(getContext(), NotifyDebugActivity.class)); - return true; - } - return false; } 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 89782bf4b2..de130074f5 100644 --- a/android/src/com/mapswithme/util/log/LoggerFactory.java +++ b/android/src/com/mapswithme/util/log/LoggerFactory.java @@ -12,7 +12,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; @@ -25,7 +24,7 @@ public class LoggerFactory public enum Type { MISC, LOCATION, TRAFFIC, GPS_TRACKING, TRACK_RECORDER, ROUTING, NETWORK, STORAGE, DOWNLOADER, - CORE, THIRD_PARTY + CORE } public interface OnZipCompletedListener @@ -136,11 +135,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 deleted file mode 100644 index 4bd025a03e..0000000000 --- a/android/src/com/mapswithme/util/push/GCMListenerRouterService.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.mapswithme.util.push; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.text.TextUtils; - -import com.google.android.gms.gcm.GcmListenerService; -import com.google.android.gms.gcm.GcmReceiver; -import com.mapswithme.util.log.Logger; -import com.mapswithme.util.log.LoggerFactory; -import com.pushwoosh.GCMListenerService; -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. -public class GCMListenerRouterService extends GcmListenerService -{ - private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.THIRD_PARTY); - private static final String TAG = GCMListenerRouterService.class.getSimpleName(); - @Override - public void onMessageReceived(@Nullable String from, @Nullable Bundle data) { - LOGGER.i(TAG, "Gcm router service received message: " - + (data != null ? data.toString() : "<null>") + " from: " + from); - - if (data == null || TextUtils.isEmpty(from)) - return; - - // Base GCM listener service removes this extra before calling onMessageReceived. - // Need to set it again to pass intent to another service. - data.putString("from", from); - - String pwProjectId = getPWProjectId(getApplicationContext()); - if (!TextUtils.isEmpty(pwProjectId) && pwProjectId.contains(from)) { - dispatchMessage(GCMListenerService.class.getName(), data); - return; - } - - NotificationFactory.deliverGcmMessageIntent(this, from, data); - } - - @Nullable - private static String getPWProjectId(@NonNull Context context) - { - PackageManager pMngr = context.getPackageManager(); - try - { - ApplicationInfo ai = pMngr.getApplicationInfo(context.getPackageName(), PackageManager - .GET_META_DATA); - Bundle metaData = ai.metaData; - if (metaData == null) - return null; - return metaData.getString("PW_PROJECT_ID"); - } - catch (PackageManager.NameNotFoundException e) - { - LOGGER.e(TAG, "Failed to get push woosh projectId: ", e); - } - return null; - } - - private void dispatchMessage(@NonNull String component, @NonNull Bundle data) { - Intent intent = new Intent(); - intent.putExtras(data); - intent.setAction("com.google.android.c2dm.intent.RECEIVE"); - intent.setComponent(new ComponentName(getPackageName(), component)); - - GcmReceiver.startWakefulService(getApplicationContext(), intent); - } -} diff --git a/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java b/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java deleted file mode 100644 index 06658a2c5e..0000000000 --- a/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.mapswithme.util.push; - -import android.content.Intent; - -import com.google.android.gms.iid.InstanceIDListenerService; -import com.mapswithme.util.log.Logger; -import com.mapswithme.util.log.LoggerFactory; -import com.pushwoosh.GCMInstanceIDListenerService; -import ru.mail.libnotify.api.NotificationFactory; - -public class GcmInstanceIDRouterListenerService extends InstanceIDListenerService -{ - @Override - public void onTokenRefresh() - { - super.onTokenRefresh(); - Logger l = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.THIRD_PARTY); - l.i(GcmInstanceIDRouterListenerService.class.getSimpleName(), "onTokenRefresh()"); - Intent pwIntent = new Intent(this, GCMInstanceIDListenerService.class); - pwIntent.setAction("com.google.android.gms.iid.InstanceID"); - startService(pwIntent); - NotificationFactory.refreshGcmToken(this); - } -} diff --git a/android/src/com/mapswithme/util/statistics/PushwooshHelper.java b/android/src/com/mapswithme/util/statistics/PushwooshHelper.java index f59031d1a6..f72f033ee0 100644 --- a/android/src/com/mapswithme/util/statistics/PushwooshHelper.java +++ b/android/src/com/mapswithme/util/statistics/PushwooshHelper.java @@ -5,12 +5,10 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Looper; -import com.mapswithme.maps.MwmApplication; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; import com.pushwoosh.PushManager; import com.pushwoosh.SendPushTagsCallBack; -import ru.mail.libnotify.api.NotificationFactory; import java.lang.ref.WeakReference; import java.util.HashMap; @@ -55,8 +53,6 @@ public final class PushwooshHelper implements SendPushTagsCallBack private void sendTags(Map<String, Object> tags) { - //TODO: move notifylib code to another place when Pushwoosh is deleted. - NotificationFactory.get(MwmApplication.get()).collectEventBatch(tags); synchronized (mSyncObject) { if (!canSendTags()) |