From ee8f8844af13c3c4ce36be11aad716af6c97a719 Mon Sep 17 00:00:00 2001 From: Altynaika Date: Wed, 10 Feb 2021 18:20:34 +0600 Subject: [PATCH] [android] Removed pushwoosh dependency and logic #118 Signed-off-by: Altynaika --- android/AndroidManifest.xml | 8 +---- android/build.gradle | 1 - .../com/mapswithme/maps/SplashActivity.java | 2 -- .../maps/analytics/EventLoggerAggregator.java | 1 - .../maps/analytics/PushWooshEventLogger.java | 6 +--- .../SystemDownloadCompletedService.java | 15 +--------- .../maps/search/SearchFragment.java | 2 -- .../util/push/GCMListenerRouterService.java | 4 +-- .../GcmInstanceIDRouterListenerService.java | 2 -- .../util/statistics/PushwooshHelper.java | 30 +------------------ .../util/statistics/Statistics.java | 4 --- 11 files changed, 5 insertions(+), 70 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 30f3b7b308..8ec1b6b135 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -476,13 +476,7 @@ - - - - + (); - mLoggers.put(PushWooshEventLogger.class, new PushWooshEventLogger(application)); mLoggers.put(FlurryEventLogger.class, new FlurryEventLogger(application)); } diff --git a/android/src/com/mapswithme/maps/analytics/PushWooshEventLogger.java b/android/src/com/mapswithme/maps/analytics/PushWooshEventLogger.java index 150dd07336..def07dba82 100644 --- a/android/src/com/mapswithme/maps/analytics/PushWooshEventLogger.java +++ b/android/src/com/mapswithme/maps/analytics/PushWooshEventLogger.java @@ -11,8 +11,7 @@ import com.mapswithme.util.UiUtils; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; import com.mapswithme.util.statistics.PushwooshHelper; -import com.pushwoosh.Pushwoosh; -import com.pushwoosh.notification.PushwooshNotificationSettings; + class PushWooshEventLogger extends DefaultEventLogger { @@ -37,9 +36,6 @@ class PushWooshEventLogger extends DefaultEventLogger @ColorInt int color = UiUtils.getNotificationColor(getApplication()); - PushwooshNotificationSettings.setNotificationIconBackgroundColor(color); - Pushwoosh pushManager = Pushwoosh.getInstance(); - pushManager.registerForPushNotifications(); mPushwooshHelper = new PushwooshHelper(); } catch(Exception e) diff --git a/android/src/com/mapswithme/maps/bookmarks/SystemDownloadCompletedService.java b/android/src/com/mapswithme/maps/bookmarks/SystemDownloadCompletedService.java index e52af7231b..14f9ae4f33 100644 --- a/android/src/com/mapswithme/maps/bookmarks/SystemDownloadCompletedService.java +++ b/android/src/com/mapswithme/maps/bookmarks/SystemDownloadCompletedService.java @@ -21,7 +21,6 @@ import com.mapswithme.util.Utils; import com.mapswithme.util.concurrency.UiThread; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; -import com.mapswithme.util.statistics.PushwooshHelper; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -159,19 +158,7 @@ public class SystemDownloadCompletedService extends JobIntentService String name = p.getParameterByName(decodedUrl, BookmarkPaymentDataParser.NAME); MwmApplication app = (MwmApplication) application; - if (TextUtils.isEmpty(productId)) - { - app.sendPushWooshTags("Bookmarks_Guides_free_title", new String[] {name}); - app.sendPushWooshTags("Bookmarks_Guides_free_date", - new String[] {PushwooshHelper.nativeGetFormattedTimestamp()}); - } - else - { - app.sendPushWooshTags("Bookmarks_Guides_paid_tier", new String[] {productId}); - app.sendPushWooshTags("Bookmarks_Guides_paid_title", new String[] {name}); - app.sendPushWooshTags("Bookmarks_Guides_paid_date", - new String[] {PushwooshHelper.nativeGetFormattedTimestamp()}); - } + } private static class SendStatusTask implements Runnable diff --git a/android/src/com/mapswithme/maps/search/SearchFragment.java b/android/src/com/mapswithme/maps/search/SearchFragment.java index e2cc4f5197..7ba843bb16 100644 --- a/android/src/com/mapswithme/maps/search/SearchFragment.java +++ b/android/src/com/mapswithme/maps/search/SearchFragment.java @@ -42,7 +42,6 @@ import com.mapswithme.util.Utils; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; import com.mapswithme.util.statistics.Statistics; -import com.pushwoosh.Pushwoosh; import java.util.ArrayList; import java.util.Arrays; @@ -829,7 +828,6 @@ public class SearchFragment extends BaseMwmFragment { Logger logger = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.THIRD_PARTY); String tag = PushTokenCommand.class.getSimpleName(); - logger.i(tag, "Push token: " + Pushwoosh.getInstance().getPushToken()); } } } diff --git a/android/src/com/mapswithme/util/push/GCMListenerRouterService.java b/android/src/com/mapswithme/util/push/GCMListenerRouterService.java index 05915b456e..b835360dd2 100644 --- a/android/src/com/mapswithme/util/push/GCMListenerRouterService.java +++ b/android/src/com/mapswithme/util/push/GCMListenerRouterService.java @@ -12,7 +12,6 @@ import com.google.android.gms.gcm.GcmListenerService; import com.mapswithme.maps.BuildConfig; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; -import com.pushwoosh.internal.utils.NotificationRegistrarHelper; // 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. @@ -35,8 +34,7 @@ public class GCMListenerRouterService extends GcmListenerService data.putString("from", from); String pwProjectId = getPWProjectId(getApplicationContext()); - if (!TextUtils.isEmpty(pwProjectId) && pwProjectId.contains(from)) - NotificationRegistrarHelper.handleMessage(data); + } @Nullable diff --git a/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java b/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java index 16166086fd..55101880b8 100644 --- a/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java +++ b/android/src/com/mapswithme/util/push/GcmInstanceIDRouterListenerService.java @@ -7,7 +7,6 @@ import com.google.android.gms.iid.InstanceID; import com.google.android.gms.iid.InstanceIDListenerService; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; -import com.pushwoosh.PushwooshFcmHelper; import java.io.IOException; @@ -34,7 +33,6 @@ public class GcmInstanceIDRouterListenerService extends InstanceIDListenerServic private void onTokenRefreshInternal() throws IOException { String token = getRefreshedToken(); - PushwooshFcmHelper.onTokenRefresh(this, token); } @Nullable diff --git a/android/src/com/mapswithme/util/statistics/PushwooshHelper.java b/android/src/com/mapswithme/util/statistics/PushwooshHelper.java index 303a779546..a57be9be75 100644 --- a/android/src/com/mapswithme/util/statistics/PushwooshHelper.java +++ b/android/src/com/mapswithme/util/statistics/PushwooshHelper.java @@ -5,12 +5,7 @@ import androidx.annotation.Nullable; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; -import com.pushwoosh.Pushwoosh; -import com.pushwoosh.exception.PushwooshException; -import com.pushwoosh.function.Result; -import com.pushwoosh.tags.TagsBundle; -import java.util.Arrays; public final class PushwooshHelper { @@ -22,32 +17,9 @@ public final class PushwooshHelper if (params == null) return; - TagsBundle.Builder builder = new TagsBundle.Builder(); - boolean isSingleParam = params.length == 1; - TagsBundle tagsBundle = isSingleParam ? builder.putString(tag, params[0]).build() - : builder.putList(tag, Arrays.asList(params)).build(); - Pushwoosh.getInstance().sendTags(tagsBundle, this::onPostExecute); + } - private void onPostExecute(@NonNull Result result) - { - if (result.isSuccess()) - onSuccess(result); - else - onError(result); - } - - private void onError(@NonNull Result result) - { - PushwooshException exception = result.getException(); - String msg = exception == null ? null : exception.getLocalizedMessage(); - LOGGER.e("Pushwoosh", msg != null ? msg : "onSentTagsError"); - } - - private void onSuccess(@NonNull Result result) - { - /* Do nothing by default */ - } public static native void nativeProcessFirstLaunch(); public static native void nativeSendEditorAddObjectTag(); diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java index d4f3062546..eeaac1778e 100644 --- a/android/src/com/mapswithme/util/statistics/Statistics.java +++ b/android/src/com/mapswithme/util/statistics/Statistics.java @@ -1083,10 +1083,6 @@ public enum Statistics implements Initializable editorMwmParams().add(EventParam.IS_AUTHENTICATED, valueOfIsAuthorized) .add(EventParam.IS_ONLINE, String.valueOf(ConnectionState.INSTANCE.isConnected()))); - if (newObject) - PushwooshHelper.nativeSendEditorAddObjectTag(); - else - PushwooshHelper.nativeSendEditorEditObjectTag(); } public void trackMapLayerClick(@NonNull Mode mode, @NonNull String from, boolean turnOn)