[android] Removed pushwoosh dependency and logic #118

Signed-off-by: Altynaika <altynaika.toktomuratovaa@gmail.com>
This commit is contained in:
Altynaika 2021-02-10 18:20:34 +06:00 committed by Roman Tsisyk
parent ef5f48a9ee
commit ee8f8844af
11 changed files with 5 additions and 70 deletions

View file

@ -476,13 +476,7 @@
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<service
android:name="com.pushwoosh.GCMRegistrationService"
android:exported="false"/>
<service
android:name="com.pushwoosh.location.GeoLocationService"/>
<service android:name="com.mapswithme.util.push.GcmInstanceIDListenerService"/>
<service android:name="com.mapswithme.util.push.GcmMessageHandlerService"/>
<service
android:name="com.mapswithme.maps.geofence.GeofenceTransitionsIntentService"
android:permission="android.permission.BIND_JOB_SERVICE"

View file

@ -58,7 +58,6 @@ dependencies {
// 3-party
implementation 'com.google.code.gson:gson:2.6.1'
implementation 'com.pushwoosh:pushwoosh:5.19.7'
implementation ('com.my.target:mytarget-sdk:5.2.2') {
exclude group: 'com.google.android.exoplayer', module:'exoplayer-core'
exclude group: 'com.google.android.exoplayer', module:'exoplayer-dash'

View file

@ -36,7 +36,6 @@ import com.mapswithme.util.UiUtils;
import com.mapswithme.util.concurrency.UiThread;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import com.mapswithme.util.statistics.PushwooshHelper;
public class SplashActivity extends AppCompatActivity
implements BaseNewsFragment.NewsDialogListener, BaseActivity,
@ -503,7 +502,6 @@ public class SplashActivity extends AppCompatActivity
if (!success || !app.isFirstLaunch())
return;
PushwooshHelper.nativeProcessFirstLaunch();
LocationHelper.INSTANCE.onEnteredIntoFirstRun();
if (!LocationHelper.INSTANCE.isActive())
LocationHelper.INSTANCE.start();

View file

@ -17,7 +17,6 @@ class EventLoggerAggregator extends ContextDependentEventLogger
{
super(application);
mLoggers = new HashMap<>();
mLoggers.put(PushWooshEventLogger.class, new PushWooshEventLogger(application));
mLoggers.put(FlurryEventLogger.class, new FlurryEventLogger(application));
}

View file

@ -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)

View file

@ -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

View file

@ -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());
}
}
}

View file

@ -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

View file

@ -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

View file

@ -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<Void, PushwooshException> result)
{
if (result.isSuccess())
onSuccess(result);
else
onError(result);
}
private void onError(@NonNull Result<Void, PushwooshException> result)
{
PushwooshException exception = result.getException();
String msg = exception == null ? null : exception.getLocalizedMessage();
LOGGER.e("Pushwoosh", msg != null ? msg : "onSentTagsError");
}
private void onSuccess(@NonNull Result<Void, PushwooshException> result)
{
/* Do nothing by default */
}
public static native void nativeProcessFirstLaunch();
public static native void nativeSendEditorAddObjectTag();

View file

@ -1083,10 +1083,6 @@ public enum Statistics implements Initializable<Context>
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)