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

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsentiy Milchakov <milcars@mapswithme.com>2018-04-12 18:46:07 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2018-04-12 18:51:33 +0300
commit4a13f0624fac8f0f60365aed1156782e228aad12 (patch)
tree021dfbcb35f3d707050e5080c824abde95145bf3 /android/src
parentcd8c347fd58ddd4724c26054ab3c38a545811332 (diff)
[android] Phone auth review fixes + server integration fixes
Diffstat (limited to 'android/src')
-rw-r--r--android/src/com/mapswithme/maps/auth/PhoneAuthActivity.java2
-rw-r--r--android/src/com/mapswithme/maps/auth/PhoneAuthFragment.java10
-rw-r--r--android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java8
3 files changed, 10 insertions, 10 deletions
diff --git a/android/src/com/mapswithme/maps/auth/PhoneAuthActivity.java b/android/src/com/mapswithme/maps/auth/PhoneAuthActivity.java
index 0aa7491cae..3477318fd1 100644
--- a/android/src/com/mapswithme/maps/auth/PhoneAuthActivity.java
+++ b/android/src/com/mapswithme/maps/auth/PhoneAuthActivity.java
@@ -11,7 +11,7 @@ import com.mapswithme.maps.base.OnBackPressListener;
public class PhoneAuthActivity extends BaseMwmExtraTitleActivity
{
- public static void start(@NonNull Fragment fragment)
+ public static void startForResult(@NonNull Fragment fragment)
{
final Intent i = new Intent(fragment.getContext(), PhoneAuthActivity.class);
i.putExtra(EXTRA_TITLE, fragment.getString(R.string.authorization_button_sign_in));
diff --git a/android/src/com/mapswithme/maps/auth/PhoneAuthFragment.java b/android/src/com/mapswithme/maps/auth/PhoneAuthFragment.java
index a31eeacb2f..64fe510149 100644
--- a/android/src/com/mapswithme/maps/auth/PhoneAuthFragment.java
+++ b/android/src/com/mapswithme/maps/auth/PhoneAuthFragment.java
@@ -6,6 +6,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -20,7 +21,7 @@ import com.mapswithme.util.UiUtils;
public class PhoneAuthFragment extends BaseMwmFragment implements OnBackPressListener
{
- private static final String REDIRECT_URL = "https://localhost/";
+ private static final String REDIRECT_URL = "http://localhost";
@SuppressWarnings("NullableProblems")
@NonNull
@@ -43,9 +44,6 @@ public class PhoneAuthFragment extends BaseMwmFragment implements OnBackPressLis
{
super.onViewCreated(view, savedInstanceState);
- if (savedInstanceState != null)
- return;
-
mWebView = view.findViewById(R.id.webview);
mProgress = view.findViewById(R.id.progress);
mWebView.setWebViewClient(new WebViewClient()
@@ -60,11 +58,11 @@ public class PhoneAuthFragment extends BaseMwmFragment implements OnBackPressLis
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
- if (url.contains(REDIRECT_URL + "?code="))
+ if (!TextUtils.isEmpty(url) && url.contains(REDIRECT_URL + "/?code="))
{
Intent returnIntent = new Intent();
returnIntent.putExtra(Constants.EXTRA_PHONE_AUTH_TOKEN,
- url.substring((REDIRECT_URL + "?code=").length()));
+ url.substring((REDIRECT_URL + "/?code=").length()));
getActivity().setResult(Activity.RESULT_OK, returnIntent);
getActivity().finish();
diff --git a/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java b/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java
index 97c0aaeb1a..409ad458a5 100644
--- a/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java
+++ b/android/src/com/mapswithme/maps/auth/SocialAuthDialogFragment.java
@@ -43,7 +43,7 @@ public class SocialAuthDialogFragment extends BaseMwmDialogFragment
@NonNull
private final View.OnClickListener mPhoneClickListener = (View v) ->
{
- PhoneAuthActivity.start(this);
+ PhoneAuthActivity.startForResult(this);
};
@NonNull
@@ -126,9 +126,11 @@ public class SocialAuthDialogFragment extends BaseMwmDialogFragment
String token = mPhoneAuthToken;
@Framework.AuthTokenType
- int tokenType = token != null ? Framework.SOCIAL_TOKEN_PHONE : Framework.SOCIAL_TOKEN_FACEBOOK;
+ int tokenType = !TextUtils.isEmpty(token) ?
+ Framework.SOCIAL_TOKEN_PHONE :
+ Framework.SOCIAL_TOKEN_FACEBOOK;
- if (token == null)
+ if (TextUtils.isEmpty(token))
{
AccessToken facebookToken = AccessToken.getCurrentAccessToken();
token = facebookToken != null ? facebookToken.getToken() : null;