Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PushWooshEventLogger.java « analytics « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 15103a48d219454b44997c599e608dd3ed089bf2 (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
package com.mapswithme.maps.analytics;

import android.app.Application;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.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);
  }
}