diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle
index 42642fc2cb..13803c8a45 100644
--- a/OsmAnd/build.gradle
+++ b/OsmAnd/build.gradle
@@ -197,11 +197,9 @@ android {
buildTypes {
debug {
- buildConfigField "String", "OPR_BASE_URL", "\"https://test.openplacereviews.org/\""
signingConfig signingConfigs.development
}
release {
- buildConfigField "String", "OPR_BASE_URL", "\"https://test.openplacereviews.org/\""
signingConfig signingConfigs.publishing
}
}
diff --git a/OsmAnd/no_translate.xml b/OsmAnd/no_translate.xml
index 719b6ee8fe..20d7a424ca 100644
--- a/OsmAnd/no_translate.xml
+++ b/OsmAnd/no_translate.xml
@@ -41,4 +41,9 @@
items modified
OsmAnd Unlimited
Markers
+ https://test.openplacereviews.org/
+ v8G8r9NLJZGMV4he5lwbQlz620FNVARKjI9Bm5UJ
+ jDvM95Ne1Bq2BDTmIfB6b3ZMxvdK87WGfp6DC07J
+ Ti2qq3fo4i4Wmuox3SiWRIGq3obZisBHnxmcM05y
+ lxulb3HYoMmd2cC4xxNe1dyfRMAY8dS0eNihJ0DM
diff --git a/OsmAnd/src/net/osmand/plus/OsmAndConstants.java b/OsmAnd/src/net/osmand/plus/OsmAndConstants.java
index 16a5312405..aee7b58bfa 100644
--- a/OsmAnd/src/net/osmand/plus/OsmAndConstants.java
+++ b/OsmAnd/src/net/osmand/plus/OsmAndConstants.java
@@ -12,10 +12,5 @@ public interface OsmAndConstants {
public int UI_HANDLER_PROGRESS = 6000;
public int UI_HANDLER_SEARCH = 7000;
-
- String OSM_OAUTH_DEVELOPER_KEY = "v8G8r9NLJZGMV4he5lwbQlz620FNVARKjI9Bm5UJ";
- String OSM_OAUTH_DEVELOPER_SECRET = "jDvM95Ne1Bq2BDTmIfB6b3ZMxvdK87WGfp6DC07J";
- String OSM_OAUTH_CONSUMER_KEY = "Ti2qq3fo4i4Wmuox3SiWRIGq3obZisBHnxmcM05y";
- String OSM_OAUTH_CONSUMER_SECRET = "lxulb3HYoMmd2cC4xxNe1dyfRMAY8dS0eNihJ0DM";
-
+
}
diff --git a/OsmAnd/src/net/osmand/plus/openplacereviews/OPRWebviewActivity.java b/OsmAnd/src/net/osmand/plus/openplacereviews/OPRWebviewActivity.java
index ebcf32e4ec..7cd6f5bc38 100644
--- a/OsmAnd/src/net/osmand/plus/openplacereviews/OPRWebviewActivity.java
+++ b/OsmAnd/src/net/osmand/plus/openplacereviews/OPRWebviewActivity.java
@@ -1,6 +1,7 @@
package net.osmand.plus.openplacereviews;
+import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -8,24 +9,36 @@ import android.webkit.CookieManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
+
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
+
import net.osmand.AndroidUtils;
-import net.osmand.plus.BuildConfig;
import net.osmand.plus.R;
import net.osmand.plus.activities.OsmandActionBarActivity;
public class OPRWebviewActivity extends OsmandActionBarActivity {
public static final String KEY_LOGIN = "LOGIN_KEY";
- private static final String url = BuildConfig.OPR_BASE_URL;
- private static final String cookieUrl = BuildConfig.OPR_BASE_URL + "profile";
- private static final String loginUrl = BuildConfig.OPR_BASE_URL + "login";
- private static final String registerUrl = BuildConfig.OPR_BASE_URL + "signup";
- private static final String finishUrl = cookieUrl;
public static String KEY_TITLE = "TITLE_KEY";
private WebView webView;
private boolean isLogin = false;
+ public static String getCookieUrl(Context ctx) {
+ return ctx.getString(R.string.opr_base_url) + "profile";
+ }
+
+ public static String getLoginUrl(Context ctx) {
+ return ctx.getString(R.string.opr_base_url) + "login";
+ }
+
+ public static String getRegisterUrl(Context ctx) {
+ return ctx.getString(R.string.opr_base_url) + "signup";
+ }
+
+ public static String getFinishUrl(Context ctx) {
+ return getCookieUrl(ctx);
+ }
+
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_opr_webview);
@@ -46,9 +59,9 @@ public class OPRWebviewActivity extends OsmandActionBarActivity {
if (b != null) {
isLogin = b.getBoolean(KEY_LOGIN);
if (isLogin) {
- webView.loadUrl(loginUrl);
+ webView.loadUrl(getLoginUrl(this));
} else {
- webView.loadUrl(registerUrl);
+ webView.loadUrl(getRegisterUrl(this));
}
}
}
@@ -59,18 +72,18 @@ public class OPRWebviewActivity extends OsmandActionBarActivity {
return true;
}
- public static String getPrivateKeyFromCookie() {
- return returnCookieByKey("opr-token");
+ public static String getPrivateKeyFromCookie(Context ctx) {
+ return returnCookieByKey(ctx, "opr-token");
}
- public static String getUsernameFromCookie() {
- return returnCookieByKey("opr-nickname");
+ public static String getUsernameFromCookie(Context ctx) {
+ return returnCookieByKey(ctx, "opr-nickname");
}
- private static String returnCookieByKey(String key) {
+ private static String returnCookieByKey(Context ctx, String key) {
String CookieValue = null;
CookieManager cookieManager = CookieManager.getInstance();
- String cookies = cookieManager.getCookie(cookieUrl);
+ String cookies = cookieManager.getCookie(getCookieUrl(ctx));
if (cookies == null || cookies.isEmpty()) {
return "";
}
@@ -88,7 +101,7 @@ public class OPRWebviewActivity extends OsmandActionBarActivity {
public class CloseOnSuccessWebViewClient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
- if (url.contains(finishUrl) && isLogin) {
+ if (url.contains(getFinishUrl(OPRWebviewActivity.this)) && isLogin) {
finish();
}
super.onPageFinished(view, url);
diff --git a/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java b/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java
index 63ca96b968..5df7bfb765 100644
--- a/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/osmedit/oauth/OsmOAuthAuthorizationAdapter.java
@@ -19,6 +19,7 @@ import net.osmand.PlatformUtil;
import net.osmand.osm.oauth.OsmOAuthAuthorizationClient;
import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
import org.apache.commons.logging.Log;
import org.xmlpull.v1.XmlPullParser;
@@ -45,12 +46,12 @@ public class OsmOAuthAuthorizationAdapter {
String secret;
if (app.getSettings().USE_DEV_URL.get()) {
api10a = new OsmOAuthAuthorizationClient.OsmDevApi();
- key = OsmAndConstants.OSM_OAUTH_DEVELOPER_KEY;
- secret = OsmAndConstants.OSM_OAUTH_DEVELOPER_SECRET;
+ key = app.getString(R.string.osm_oauth_developer_key);
+ secret = app.getString(R.string.osm_oauth_developer_secret);
} else {
api10a = new OsmOAuthAuthorizationClient.OsmApi();
- key = OsmAndConstants.OSM_OAUTH_CONSUMER_KEY;
- secret = OsmAndConstants.OSM_OAUTH_CONSUMER_SECRET;
+ key = app.getString(R.string.osm_oauth_consumer_key);
+ secret = app.getString(R.string.osm_oauth_consumer_secret);
}
client = new OsmOAuthAuthorizationClient(key, secret, api10a);
restoreToken();