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