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 SCOPE = "scope";
|
||||
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_ADMIN = "read write follow push admin:read admin:write";
|
||||
public static final String OAUTH_SCOPES = "read%20write%20follow%20push";
|
||||
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 STATUSES_PER_CALL = 40;
|
||||
|
|
|
@ -258,28 +258,33 @@ public class FragmentLoginMain extends Fragment {
|
|||
scopes,
|
||||
Helper.WEBSITE_VALUE
|
||||
).observe(requireActivity(), app -> {
|
||||
client_idLogin = app.client_id;
|
||||
client_secretLogin = app.client_secret;
|
||||
String redirectUrl = MastodonHelper.authorizeURL(currentInstanceLogin, client_idLogin, ((LoginActivity) requireActivity()).requestedAdmin());
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||
boolean embedded_browser = sharedpreferences.getBoolean(getString(R.string.SET_EMBEDDED_BROWSER), true);
|
||||
if (embedded_browser) {
|
||||
Intent i = new Intent(requireActivity(), WebviewConnectActivity.class);
|
||||
i.putExtra("login_url", redirectUrl);
|
||||
i.putExtra("requestedAdmin", ((LoginActivity) requireActivity()).requestedAdmin());
|
||||
startActivity(i);
|
||||
requireActivity().finish();
|
||||
} else {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setData(Uri.parse(redirectUrl));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Toasty.error(requireActivity(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
if (app != null) {
|
||||
client_idLogin = app.client_id;
|
||||
client_secretLogin = app.client_secret;
|
||||
String redirectUrl = MastodonHelper.authorizeURL(currentInstanceLogin, client_idLogin, ((LoginActivity) requireActivity()).requestedAdmin());
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||
boolean embedded_browser = sharedpreferences.getBoolean(getString(R.string.SET_EMBEDDED_BROWSER), true);
|
||||
if (embedded_browser) {
|
||||
Intent i = new Intent(requireActivity(), WebviewConnectActivity.class);
|
||||
i.putExtra("login_url", redirectUrl);
|
||||
i.putExtra("requestedAdmin", ((LoginActivity) requireActivity()).requestedAdmin());
|
||||
startActivity(i);
|
||||
requireActivity().finish();
|
||||
} else {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setData(Uri.parse(redirectUrl));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} 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