Add utm ref
Conflicts: OsmAnd/src/net/osmand/plus/mapillary/MapillaryInstallDialogFragment.java
This commit is contained in:
parent
42823b7baf
commit
ff8448753d
12 changed files with 21 additions and 17 deletions
|
@ -178,7 +178,7 @@ public abstract class OsmandPlugin {
|
|||
allPlugins.add(srtm);
|
||||
} else {
|
||||
if (marketEnabled) {
|
||||
srtm.setInstallURL(Version.marketPrefix(app) + id);
|
||||
srtm.setInstallURL(Version.getUrlWithUtmRef(app, id));
|
||||
allPlugins.add(srtm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class Version {
|
|||
private final static String FREE_VERSION_NAME = "net.osmand";
|
||||
private final static String FREE_DEV_VERSION_NAME = "net.osmand.dev";
|
||||
private final static String SHERPAFY_VERSION_NAME = "net.osmand.sherpafy";
|
||||
|
||||
private final static String UTM_REF = "&referrer=utm_source%3Dosmand";
|
||||
|
||||
public static boolean isGpsStatusEnabled(OsmandApplication ctx) {
|
||||
return isGooglePlayEnabled(ctx) && !isBlackberry(ctx);
|
||||
|
@ -36,6 +36,10 @@ public class Version {
|
|||
return "https://osmand.net/apps?id=";
|
||||
}
|
||||
|
||||
public static String getUrlWithUtmRef(OsmandApplication ctx, String appName) {
|
||||
return marketPrefix(ctx) + appName + UTM_REF;
|
||||
}
|
||||
|
||||
private static boolean isAmazonEnabled(OsmandApplication ctx) {
|
||||
return ctx.getString(R.string.versionFeatures).contains("+amazon");
|
||||
}
|
||||
|
|
|
@ -198,8 +198,7 @@ public class ShareDialog {
|
|||
builder.setPositiveButton(activity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.marketPrefix((OsmandApplication) activity.getApplication())
|
||||
+ ZXING_BARCODE_SCANNER_COMPONENT));
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef((OsmandApplication) activity.getApplication(), ZXING_BARCODE_SCANNER_COMPONENT)));
|
||||
try {
|
||||
activity.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -26,7 +26,6 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
||||
public class StartGPSStatus extends OsmAndAction {
|
||||
|
||||
|
@ -178,7 +177,7 @@ public class StartGPSStatus extends OsmAndAction {
|
|||
builder.setPositiveButton(mapActivity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.marketPrefix(getMyApplication()) + g.appName));
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef(getMyApplication(), g.appName)));
|
||||
try {
|
||||
mapActivity.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -86,7 +86,7 @@ public class DashRateUsFragment extends DashBaseFragment {
|
|||
return;
|
||||
case USER_LIKES_APP:
|
||||
settings.RATE_US_STATE.set(RateUsBottomSheetDialog.RateUsState.LIKED);
|
||||
Uri uri = Uri.parse(Version.marketPrefix(getMyApplication()) + getActivity().getPackageName());
|
||||
Uri uri = Uri.parse(Version.getUrlWithUtmRef(getMyApplication(), getActivity().getPackageName()));
|
||||
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
|
||||
startActivity(goToMarket);
|
||||
break;
|
||||
|
|
|
@ -115,7 +115,7 @@ public class RateUsBottomSheetDialog extends BottomSheetDialogFragment {
|
|||
return;
|
||||
case USER_LIKES_APP:
|
||||
settings.RATE_US_STATE.set(RateUsBottomSheetDialog.RateUsState.LIKED);
|
||||
Uri uri = Uri.parse(Version.marketPrefix(getMyApplication()) + getActivity().getPackageName());
|
||||
Uri uri = Uri.parse(Version.getUrlWithUtmRef(getMyApplication(), getActivity().getPackageName()));
|
||||
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
|
||||
startActivity(goToMarket);
|
||||
break;
|
||||
|
|
|
@ -248,7 +248,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
|||
} else {
|
||||
app.logEvent(this, "paid_version_redirect");
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse(Version.marketPrefix(app) + "net.osmand.plus"));
|
||||
Uri.parse(Version.getUrlWithUtmRef(app, "net.osmand.plus")));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -381,7 +381,7 @@ public class DownloadIndexesThread {
|
|||
builder.setPositiveButton(R.string.button_upgrade_osmandplus, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=net.osmand.plus"));
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef(app, "net.osmand.plus")));
|
||||
try {
|
||||
ctx.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -224,8 +224,7 @@ public class DownloadValidationManager {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse(Version.marketPrefix(getMyApplication())
|
||||
+ "net.osmand.plus"));
|
||||
Uri.parse(Version.getUrlWithUtmRef(getMyApplication(), "net.osmand.plus")));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
|
|
|
@ -147,7 +147,7 @@ public class DiscountHelper {
|
|||
int i = url.indexOf("osmand-market-app:");
|
||||
if (i != -1) {
|
||||
String appName = url.substring(i + 18);
|
||||
return Version.marketPrefix(app) + appName;
|
||||
return Version.getUrlWithUtmRef(app, appName);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
|
|
|
@ -35,8 +35,7 @@ public class MapillaryInstallDialogFragment extends DialogFragment {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
mapActivity.getMyApplication().logEvent(mapActivity, "click_install_mapillary");
|
||||
MapillaryPlugin.installMapillary(mapActivity.getMyApplication());
|
||||
MapillaryPlugin.installMapillary(mapActivity, mapActivity.getMyApplication());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.mapillary;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -23,6 +24,7 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityLayers;
|
||||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||
|
@ -34,6 +36,7 @@ import net.osmand.plus.views.mapwidgets.MapWidgetRegistry.MapWidgetRegInfo;
|
|||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -235,8 +238,9 @@ public class MapillaryPlugin extends OsmandPlugin {
|
|||
return success;
|
||||
}
|
||||
|
||||
public static boolean installMapillary(OsmandApplication app) {
|
||||
boolean success = execInstall(app, "market://details?id=" + MAPILLARY_PACKAGE_ID);
|
||||
public static boolean installMapillary(Activity activity, OsmandApplication app) {
|
||||
app.logEvent(activity, "install_mapillary");
|
||||
boolean success = execInstall(app, Version.getUrlWithUtmRef(app, MAPILLARY_PACKAGE_ID));
|
||||
if (!success) {
|
||||
success = execInstall(app, "https://play.google.com/store/apps/details?id=" + MAPILLARY_PACKAGE_ID);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue