blob: 150dd073366a11ef12a36d1d0b99d6eec344c48e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
package com.mapswithme.maps.analytics;
import android.app.Application;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mapswithme.maps.BuildConfig;
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
{
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
private static final String PW_EMPTY_APP_ID = "XXXXX";
@Nullable
private PushwooshHelper mPushwooshHelper;
PushWooshEventLogger(@NonNull Application application)
{
super(application);
}
@Override
public void initialize()
{
try
{
if (BuildConfig.PW_APPID.equals(PW_EMPTY_APP_ID))
return;
@ColorInt
int color = UiUtils.getNotificationColor(getApplication());
PushwooshNotificationSettings.setNotificationIconBackgroundColor(color);
Pushwoosh pushManager = Pushwoosh.getInstance();
pushManager.registerForPushNotifications();
mPushwooshHelper = new PushwooshHelper();
}
catch(Exception e)
{
LOGGER.e("Pushwoosh", "Failed to init Pushwoosh", e);
}
}
@Override
public void sendTags(@NonNull String tag, @Nullable String[] params)
{
super.sendTags(tag, params);
if (mPushwooshHelper != null)
mPushwooshHelper.sendTags(tag, params);
}
}
|