Track successful country downloads differently for different flavors.

This commit is contained in:
Dmitry Yunitsky 2015-02-09 18:56:08 +03:00 committed by Alex Zolotarev
parent da07881291
commit 46f5390e00
3 changed files with 14 additions and 5 deletions

View file

@ -20,8 +20,6 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.mapswithme.maps.BuildConfig;
import com.mapswithme.maps.MWMApplication;
import com.mapswithme.maps.MapStorage;
import com.mapswithme.maps.R;
import com.mapswithme.maps.downloader.DownloadHelper;
@ -153,7 +151,6 @@ abstract class BaseDownloadAdapter extends BaseAdapter
public void onDownload()
{
startItemDownloading(holder, position, newOptions);
Statistics.INSTANCE.trackCountryDownload(MWMApplication.get().nativeGetBoolean(MWMApplication.IS_PREINSTALLED, false), BuildConfig.FLAVOR);
}
});
}

View file

@ -6,6 +6,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Log;
@ -35,6 +36,7 @@ public class MWMApplication extends android.app.Application implements ActiveCou
private static final String LAST_SESSION_TIMESTAMP_SETTING = "LastSessionTimestamp"; // timestamp of last session
public static final String IS_PREINSTALLED = "IsPreinstalled";
private static final String FIRST_INSTALL_VERSION = "FirstInstallVersion";
private static final String FIRST_INSTALL_FLAVOR = "FirstInstallFlavor";
private static MWMApplication mSelf;
@ -67,6 +69,8 @@ public class MWMApplication extends android.app.Application implements ActiveCou
CountryItem item = ActiveCountryTree.getCountryItem(group, position);
Notifier.placeDownloadFailed(ActiveCountryTree.getCoreIndex(group, position), item.getName());
}
else if (newStatus == MapStorage.ON_DISK)
Statistics.INSTANCE.trackCountryDownload(MWMApplication.get().nativeGetBoolean(MWMApplication.IS_PREINSTALLED, false), getFirstInstallFlavor());
}
@Override
@ -266,6 +270,10 @@ public class MWMApplication extends android.app.Application implements ActiveCou
{
trackAppActivation();
nativeSetInt(FIRST_INSTALL_VERSION, BuildConfig.VERSION_CODE);
final String installedFlavor = getFirstInstallFlavor();
if (TextUtils.isEmpty(installedFlavor))
nativeSetString(FIRST_INSTALL_FLAVOR, BuildConfig.FLAVOR);
}
nativeSetInt(LAUNCH_NUMBER_SETTING, currentLaunches + 1);
@ -310,4 +318,9 @@ public class MWMApplication extends android.app.Application implements ActiveCou
{
return nativeGetInt(FIRST_INSTALL_VERSION, 0);
}
public String getFirstInstallFlavor()
{
return nativeGetString(FIRST_INSTALL_FLAVOR, "");
}
}

View file

@ -127,9 +127,8 @@ public enum Statistics
public void trackCountryDownload(boolean isPreinstalled, String flavor)
{
trackIfEnabled(mEventBuilder.
setName(EventName.COUNTRY_DOWNLOAD).
setName(EventName.COUNTRY_DOWNLOAD + flavor).
addParam(EventParam.IS_PREINSTALLED, String.valueOf(isPreinstalled)).
addParam(EventParam.APP_FLAVOR, flavor).
addParam(EventParam.COUNT, String.valueOf(ActiveCountryTree.getTotalCount())).
buildEvent());
}