Scope issue in urls
This commit is contained in:
parent
f59507dde3
commit
d5a8612ece
|
@ -71,8 +71,8 @@ public class MastodonHelper {
|
||||||
public static final String RESPONSE_TYPE = "response_type";
|
public static final String RESPONSE_TYPE = "response_type";
|
||||||
public static final String SCOPE = "scope";
|
public static final String SCOPE = "scope";
|
||||||
public static final String REDIRECT_CONTENT_WEB = "fedilab://backtofedilab";
|
public static final String REDIRECT_CONTENT_WEB = "fedilab://backtofedilab";
|
||||||
public static final String OAUTH_SCOPES = "read write follow push";
|
public static final String OAUTH_SCOPES = "read%20write%20follow%20push";
|
||||||
public static final String OAUTH_SCOPES_ADMIN = "read write follow push admin:read admin:write";
|
public static final String OAUTH_SCOPES_ADMIN = "read%20write%20follow%20push%20admin:read%20admin:write";
|
||||||
|
|
||||||
public static final int ACCOUNTS_PER_CALL = 40;
|
public static final int ACCOUNTS_PER_CALL = 40;
|
||||||
public static final int STATUSES_PER_CALL = 40;
|
public static final int STATUSES_PER_CALL = 40;
|
||||||
|
|
|
@ -258,28 +258,33 @@ public class FragmentLoginMain extends Fragment {
|
||||||
scopes,
|
scopes,
|
||||||
Helper.WEBSITE_VALUE
|
Helper.WEBSITE_VALUE
|
||||||
).observe(requireActivity(), app -> {
|
).observe(requireActivity(), app -> {
|
||||||
client_idLogin = app.client_id;
|
if (app != null) {
|
||||||
client_secretLogin = app.client_secret;
|
client_idLogin = app.client_id;
|
||||||
String redirectUrl = MastodonHelper.authorizeURL(currentInstanceLogin, client_idLogin, ((LoginActivity) requireActivity()).requestedAdmin());
|
client_secretLogin = app.client_secret;
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
String redirectUrl = MastodonHelper.authorizeURL(currentInstanceLogin, client_idLogin, ((LoginActivity) requireActivity()).requestedAdmin());
|
||||||
boolean embedded_browser = sharedpreferences.getBoolean(getString(R.string.SET_EMBEDDED_BROWSER), true);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||||
if (embedded_browser) {
|
boolean embedded_browser = sharedpreferences.getBoolean(getString(R.string.SET_EMBEDDED_BROWSER), true);
|
||||||
Intent i = new Intent(requireActivity(), WebviewConnectActivity.class);
|
if (embedded_browser) {
|
||||||
i.putExtra("login_url", redirectUrl);
|
Intent i = new Intent(requireActivity(), WebviewConnectActivity.class);
|
||||||
i.putExtra("requestedAdmin", ((LoginActivity) requireActivity()).requestedAdmin());
|
i.putExtra("login_url", redirectUrl);
|
||||||
startActivity(i);
|
i.putExtra("requestedAdmin", ((LoginActivity) requireActivity()).requestedAdmin());
|
||||||
requireActivity().finish();
|
startActivity(i);
|
||||||
} else {
|
requireActivity().finish();
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
} else {
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setData(Uri.parse(redirectUrl));
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
try {
|
intent.setData(Uri.parse(redirectUrl));
|
||||||
startActivity(intent);
|
try {
|
||||||
} catch (Exception e) {
|
startActivity(intent);
|
||||||
Toasty.error(requireActivity(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
} catch (Exception e) {
|
||||||
}
|
Toasty.error(requireActivity(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Toasty.error(requireActivity(), getString(R.string.client_error), Toasty.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue