Fix with popup

This commit is contained in:
tom79 2019-06-19 17:55:48 +02:00
parent e3180c1956
commit fb107e6274
3 changed files with 22 additions and 6 deletions

View File

@ -114,7 +114,7 @@ public class LoginActivity extends BaseActivity {
private TextView instance_chosen;
private ImageView info_instance;
private final int PICK_IMPORT = 5557;
private boolean admin;
public static boolean admin;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -886,8 +886,14 @@ public class LoginActivity extends BaseActivity {
String queryString = Helper.CLIENT_ID + "="+ clientId;
queryString += "&" + Helper.REDIRECT_URI + "="+ Uri.encode(Helper.REDIRECT_CONTENT_WEB);
queryString += "&" + Helper.RESPONSE_TYPE +"=code";
if( socialNetwork != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED )
queryString += "&" + Helper.SCOPE +"=" + Helper.OAUTH_SCOPES;
if( socialNetwork != UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED ) {
if( admin ) {
queryString += "&" + Helper.SCOPE + "=" + Helper.OAUTH_SCOPES_ADMIN;
}else{
queryString += "&" + Helper.SCOPE + "=" + Helper.OAUTH_SCOPES;
}
}
return Helper.instanceWithProtocol(context, instance) + Helper.EP_AUTHORIZE + "?" + queryString;
}

View File

@ -191,14 +191,13 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
mainLoader.setVisibility(View.GONE);
nextElementLoader.setVisibility(View.GONE);
if( apiResponse.getError() != null){
Toasty.error(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
swipeRefreshLayout.setRefreshing(false);
swiped = false;
flag_loading = false;
//Admin right not granted through the API?
if( apiResponse.getError().getStatusCode() == 403){
AlertDialog.Builder builderInner;
builderInner = new AlertDialog.Builder(context, R.style.AppAdminTheme);
builderInner = new AlertDialog.Builder(context, R.style.AdminDialog);
builderInner.setTitle(R.string.reconnect_account);
builderInner.setMessage(R.string.reconnect_account_message);
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@ -216,6 +215,8 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
}
});
builderInner.show();
}else{
Toasty.error(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show();
}
return;
}

View File

@ -396,7 +396,7 @@
<!-- Light theme -->
<style name="AppAdminTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textColor">@color/light_black</item>
<item name="android:textColor">@color/dark_text</item>
<item name="colorPrimary">@color/mastodonC1</item>
<item name="colorPrimaryDark">@color/mastodonC1</item>
<item name="colorAccent">@color/mastodonC4</item>
@ -427,4 +427,13 @@
<item name="android:contentDescription">@string/abc_action_menu_overflow_description</item>
</style>
<style name="AdminAlertDialogDark" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:windowBackground">@color/mastodonC1__</item>
</style>
<style name="AdminDialog" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:windowBackground">@color/mastodonC1__</item>
<item name="colorAccent">@color/mastodonC4</item>
<item name="android:headerBackground">@color/mastodonC2</item>
<item name="colorControlNormal">@color/mastodonC2</item>
</style>
</resources>