mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Some bug fixes + login issue
This commit is contained in:
parent
0ee936f52d
commit
4792c4971c
4 changed files with 123 additions and 90 deletions
|
@ -487,7 +487,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
if (itemId == R.id.action_logout_account) {
|
if (itemId == R.id.action_logout_account) {
|
||||||
AlertDialog.Builder alt_bld = new AlertDialog.Builder(BaseMainActivity.this, Helper.dialogStyle());
|
AlertDialog.Builder alt_bld = new AlertDialog.Builder(BaseMainActivity.this, Helper.dialogStyle());
|
||||||
alt_bld.setTitle(R.string.action_logout);
|
alt_bld.setTitle(R.string.action_logout);
|
||||||
alt_bld.setMessage(getString(R.string.logout_account_confirmation, account.mastodon_account.username, account.instance));
|
if (account.mastodon_account != null && account.mastodon_account.username != null && account.instance != null) {
|
||||||
|
alt_bld.setMessage(getString(R.string.logout_account_confirmation, account.mastodon_account.username, account.instance));
|
||||||
|
} else if (account.mastodon_account != null && account.mastodon_account.acct != null) {
|
||||||
|
alt_bld.setMessage(getString(R.string.logout_account_confirmation, account.mastodon_account.acct, ""));
|
||||||
|
} else {
|
||||||
|
alt_bld.setMessage(getString(R.string.logout_account_confirmation, "", ""));
|
||||||
|
}
|
||||||
alt_bld.setPositiveButton(R.string.action_logout, (dialog, id) -> {
|
alt_bld.setPositiveButton(R.string.action_logout, (dialog, id) -> {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -392,9 +392,11 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
Status fetchedStatus = statusList.get(0);
|
Status fetchedStatus = statusList.get(0);
|
||||||
statusesVM.bookmark(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id)
|
statusesVM.bookmark(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.bookmarked = _status.bookmarked;
|
if (_status != null) {
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.bookmarked = _status.bookmarked;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
||||||
|
@ -404,17 +406,21 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
if (statusToDeal.bookmarked) {
|
if (statusToDeal.bookmarked) {
|
||||||
statusesVM.unBookmark(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
statusesVM.unBookmark(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.bookmarked = _status.bookmarked;
|
if (_status != null) {
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.bookmarked = _status.bookmarked;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
((SparkButton) v).playAnimation();
|
((SparkButton) v).playAnimation();
|
||||||
statusesVM.bookmark(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
statusesVM.bookmark(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.bookmarked = _status.bookmarked;
|
if (_status != null) {
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.bookmarked = _status.bookmarked;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,10 +511,12 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
Status fetchedStatus = results.statuses.get(0);
|
Status fetchedStatus = results.statuses.get(0);
|
||||||
statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id, null)
|
statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id, null)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.reblogged = _status.reblogged;
|
if (_status != null) {
|
||||||
statusToDeal.reblogs_count = _status.reblogs_count;
|
statusToDeal.reblogged = _status.reblogged;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.reblogs_count = _status.reblogs_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
||||||
|
@ -518,19 +526,23 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
if (statusToDeal.reblogged) {
|
if (statusToDeal.reblogged) {
|
||||||
statusesVM.unReblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
statusesVM.unReblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.reblogged = _status.reblogged;
|
if (_status != null) {
|
||||||
statusToDeal.reblogs_count = _status.reblogs_count;
|
statusToDeal.reblogged = _status.reblogged;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.reblogs_count = _status.reblogs_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
((SparkButton) v).playAnimation();
|
((SparkButton) v).playAnimation();
|
||||||
statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id, null)
|
statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id, null)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.reblogged = _status.reblogged;
|
if (_status != null) {
|
||||||
statusToDeal.reblogs_count = _status.reblogs_count;
|
statusToDeal.reblogged = _status.reblogged;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.reblogs_count = _status.reblogs_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -548,10 +560,12 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
Status fetchedStatus = results.statuses.get(0);
|
Status fetchedStatus = results.statuses.get(0);
|
||||||
statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id, null)
|
statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id, null)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.reblogged = _status.reblogged;
|
if (_status != null) {
|
||||||
statusToDeal.reblogs_count = _status.reblogs_count;
|
statusToDeal.reblogged = _status.reblogged;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.reblogs_count = _status.reblogs_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
||||||
|
@ -561,19 +575,23 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
if (statusToDeal.reblogged) {
|
if (statusToDeal.reblogged) {
|
||||||
statusesVM.unReblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
statusesVM.unReblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.reblogged = _status.reblogged;
|
if (_status != null) {
|
||||||
statusToDeal.reblogs_count = _status.reblogs_count;
|
statusToDeal.reblogged = _status.reblogged;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.reblogs_count = _status.reblogs_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
((SparkButton) v).playAnimation();
|
((SparkButton) v).playAnimation();
|
||||||
statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id, null)
|
statusesVM.reblog(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id, null)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.reblogged = _status.reblogged;
|
if (_status != null) {
|
||||||
statusToDeal.reblogs_count = _status.reblogs_count;
|
statusToDeal.reblogged = _status.reblogged;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.reblogs_count = _status.reblogs_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -605,10 +623,12 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
Status fetchedStatus = results.statuses.get(0);
|
Status fetchedStatus = results.statuses.get(0);
|
||||||
statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id)
|
statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.favourited = _status.favourited;
|
if (_status != null) {
|
||||||
statusToDeal.favourites_count = _status.favourites_count;
|
statusToDeal.favourited = _status.favourited;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.favourites_count = _status.favourites_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
||||||
|
@ -618,18 +638,22 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
if (status.favourited) {
|
if (status.favourited) {
|
||||||
statusesVM.unFavourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
statusesVM.unFavourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.favourited = _status.favourited;
|
if (_status != null) {
|
||||||
statusToDeal.favourites_count = _status.favourites_count;
|
statusToDeal.favourited = _status.favourited;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
statusToDeal.favourites_count = _status.favourites_count;
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
((SparkButton) v).playAnimation();
|
((SparkButton) v).playAnimation();
|
||||||
statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.favourited = _status.favourited;
|
if (_status != null) {
|
||||||
statusToDeal.favourites_count = _status.favourites_count;
|
statusToDeal.favourited = _status.favourited;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.favourites_count = _status.favourites_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -647,10 +671,12 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
Status fetchedStatus = results.statuses.get(0);
|
Status fetchedStatus = results.statuses.get(0);
|
||||||
statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id)
|
statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, fetchedStatus.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.favourited = _status.favourited;
|
if (_status != null) {
|
||||||
statusToDeal.favourites_count = _status.favourites_count;
|
statusToDeal.favourited = _status.favourited;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.favourites_count = _status.favourites_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
Toasty.info(context, context.getString(R.string.toast_error_search), Toasty.LENGTH_SHORT).show();
|
||||||
|
@ -660,18 +686,22 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
if (statusToDeal.favourited) {
|
if (statusToDeal.favourited) {
|
||||||
statusesVM.unFavourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
statusesVM.unFavourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.favourited = _status.favourited;
|
if (_status != null) {
|
||||||
statusToDeal.favourites_count = _status.favourites_count;
|
statusToDeal.favourited = _status.favourited;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
statusToDeal.favourites_count = _status.favourites_count;
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
((SparkButton) v).playAnimation();
|
((SparkButton) v).playAnimation();
|
||||||
statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
statusesVM.favourite(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.id)
|
||||||
.observe((LifecycleOwner) context, _status -> {
|
.observe((LifecycleOwner) context, _status -> {
|
||||||
statusToDeal.favourited = _status.favourited;
|
if (_status != null) {
|
||||||
statusToDeal.favourites_count = _status.favourites_count;
|
statusToDeal.favourited = _status.favourited;
|
||||||
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
statusToDeal.favourites_count = _status.favourites_count;
|
||||||
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
sendAction(context, Helper.ARG_STATUS_ACTION, statusToDeal, null);
|
||||||
|
adapter.notifyItemChanged(getPositionAsync(notificationList, statusList, statusToDeal));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,37 +250,35 @@ public class FragmentLoginMain extends Fragment {
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
Toasty.error(requireActivity(), getString(R.string.client_error), Toast.LENGTH_LONG).show();
|
Toasty.error(requireActivity(), getString(R.string.client_error), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
if (api == Account.API.MASTODON) {
|
String scopes = ((LoginActivity) requireActivity()).requestedAdmin() ? Helper.OAUTH_SCOPES_ADMIN : Helper.OAUTH_SCOPES;
|
||||||
String scopes = ((LoginActivity) requireActivity()).requestedAdmin() ? Helper.OAUTH_SCOPES_ADMIN : Helper.OAUTH_SCOPES;
|
AppsVM appsVM = new ViewModelProvider(requireActivity()).get(AppsVM.class);
|
||||||
AppsVM appsVM = new ViewModelProvider(requireActivity()).get(AppsVM.class);
|
appsVM.createApp(currentInstance, getString(R.string.app_name),
|
||||||
appsVM.createApp(currentInstance, getString(R.string.app_name),
|
Helper.REDIRECT_CONTENT_WEB,
|
||||||
Helper.REDIRECT_CONTENT_WEB,
|
scopes,
|
||||||
scopes,
|
Helper.WEBSITE_VALUE
|
||||||
Helper.WEBSITE_VALUE
|
).observe(requireActivity(), app -> {
|
||||||
).observe(requireActivity(), app -> {
|
client_id = app.client_id;
|
||||||
client_id = app.client_id;
|
client_secret = app.client_secret;
|
||||||
client_secret = app.client_secret;
|
String redirectUrl = MastodonHelper.authorizeURL(currentInstance, client_id, ((LoginActivity) requireActivity()).requestedAdmin());
|
||||||
String redirectUrl = MastodonHelper.authorizeURL(currentInstance, client_id, ((LoginActivity) requireActivity()).requestedAdmin());
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
boolean embedded_browser = sharedpreferences.getBoolean(getString(R.string.SET_EMBEDDED_BROWSER), true);
|
||||||
boolean embedded_browser = sharedpreferences.getBoolean(getString(R.string.SET_EMBEDDED_BROWSER), true);
|
if (embedded_browser) {
|
||||||
if (embedded_browser) {
|
Intent i = new Intent(requireActivity(), WebviewConnectActivity.class);
|
||||||
Intent i = new Intent(requireActivity(), WebviewConnectActivity.class);
|
i.putExtra("login_url", redirectUrl);
|
||||||
i.putExtra("login_url", redirectUrl);
|
i.putExtra("requestedAdmin", ((LoginActivity) requireActivity()).requestedAdmin());
|
||||||
i.putExtra("requestedAdmin", ((LoginActivity) requireActivity()).requestedAdmin());
|
startActivity(i);
|
||||||
startActivity(i);
|
requireActivity().finish();
|
||||||
requireActivity().finish();
|
} else {
|
||||||
} else {
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.setData(Uri.parse(redirectUrl));
|
||||||
intent.setData(Uri.parse(redirectUrl));
|
try {
|
||||||
try {
|
startActivity(intent);
|
||||||
startActivity(intent);
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
Toasty.error(requireActivity(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||||
Toasty.error(requireActivity(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -57,13 +57,12 @@
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
<fragment
|
<androidx.fragment.app.FragmentContainerView
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
android:id="@+id/nav_host_fragment_content_main"
|
android:id="@+id/nav_host_fragment_content_main"
|
||||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:defaultNavHost="true"
|
app:defaultNavHost="true" />
|
||||||
/>
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
</androidx.drawerlayout.widget.DrawerLayout>
|
</androidx.drawerlayout.widget.DrawerLayout>
|
Loading…
Reference in a new issue