forked from organicmaps/organicmaps
[android] auth fix
This commit is contained in:
parent
40d3a51fa9
commit
c55ab01992
4 changed files with 16 additions and 4 deletions
|
@ -9,7 +9,6 @@ import android.support.v4.app.Fragment;
|
|||
import android.text.TextUtils;
|
||||
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.util.ConnectionState;
|
||||
|
||||
/**
|
||||
* An authorizer is responsible for an authorization for the Mapsme server,
|
||||
|
@ -55,7 +54,7 @@ public class Authorizer implements AuthorizationListener
|
|||
|
||||
public final void authorize()
|
||||
{
|
||||
if (isAuthorized() || !ConnectionState.isConnected())
|
||||
if (isAuthorized())
|
||||
{
|
||||
if (mCallback != null)
|
||||
mCallback.onAuthorizationFinish(true);
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
|
||||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.background.Notifier;
|
||||
import com.mapswithme.maps.base.BaseMwmDialogFragment;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
|
@ -56,11 +57,15 @@ public class PassportAuthDialogFragment extends BaseMwmDialogFragment
|
|||
mAuthorizer.detach();
|
||||
}
|
||||
|
||||
private static class AuthCallback implements Authorizer.Callback
|
||||
private class AuthCallback implements Authorizer.Callback
|
||||
{
|
||||
@Override
|
||||
public void onAuthorizationFinish(boolean success)
|
||||
{
|
||||
dismiss();
|
||||
|
||||
if (success)
|
||||
Notifier.cancelNotification(Notifier.ID_IS_NOT_AUTHENTICATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.view.View;
|
|||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.auth.Authorizer;
|
||||
import com.mapswithme.maps.background.Notifier;
|
||||
import com.mapswithme.maps.widget.BookmarkBackupView;
|
||||
import com.mapswithme.util.DateUtils;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
@ -127,6 +128,7 @@ public class BookmarkBackupController implements Authorizer.Callback
|
|||
{
|
||||
if (success)
|
||||
{
|
||||
Notifier.cancelNotification(Notifier.ID_IS_NOT_AUTHENTICATED);
|
||||
BookmarkManager.INSTANCE.setCloudEnabled(true);
|
||||
Statistics.INSTANCE.trackEvent(Statistics.EventName.BMK_SYNC_PROPOSAL_ENABLED);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,10 @@ import android.widget.EditText;
|
|||
import com.mapswithme.maps.Framework;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.auth.BaseMwmAuthorizationFragment;
|
||||
import com.mapswithme.maps.background.Notifier;
|
||||
import com.mapswithme.maps.bookmarks.data.FeatureId;
|
||||
import com.mapswithme.maps.widget.ToolbarController;
|
||||
import com.mapswithme.util.ConnectionState;
|
||||
import com.mapswithme.util.Language;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
@ -79,7 +81,8 @@ public class UGCEditorFragment extends BaseMwmAuthorizationFragment
|
|||
submitButton.setOnClickListener(v ->
|
||||
{
|
||||
onSubmitButtonClick();
|
||||
authorize();
|
||||
if (ConnectionState.isConnected())
|
||||
authorize();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -100,6 +103,9 @@ public class UGCEditorFragment extends BaseMwmAuthorizationFragment
|
|||
@Override
|
||||
public void onAuthorizationFinish(boolean success)
|
||||
{
|
||||
if (success)
|
||||
Notifier.cancelNotification(Notifier.ID_IS_NOT_AUTHENTICATED);
|
||||
|
||||
if (isAdded())
|
||||
getActivity().finish();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue