mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-04 16:16:33 +02:00
Replaced MSAL by OAuth
This commit is contained in:
@@ -166,22 +166,29 @@ public class FragmentSetup extends FragmentBase {
|
||||
public void onClick(View v) {
|
||||
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(getContext(), getViewLifecycleOwner(), btnQuick);
|
||||
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_gmail, 1, R.string.title_setup_gmail);
|
||||
int order = 1;
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_gmail, order++, R.string.title_setup_gmail);
|
||||
|
||||
// Android 5 Lollipop does not support app links
|
||||
if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_gmail_oauth, 2, R.string.title_setup_gmail_oauth);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
for (EmailProvider provider : EmailProvider.loadProfiles(getContext()))
|
||||
if (provider.oauth != null && (provider.oauth.enabled || BuildConfig.DEBUG))
|
||||
popupMenu.getMenu()
|
||||
.add(Menu.NONE, -1, order++, getString(R.string.title_setup_oauth, provider.name))
|
||||
.setIntent(new Intent(ActivitySetup.ACTION_QUICK_OAUTH).putExtra("name", provider.name));
|
||||
|
||||
if (BuildConfig.DEBUG)
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_outlook, 3, R.string.title_setup_outlook);
|
||||
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_activesync, 4, R.string.title_setup_activesync);
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_other, 5, R.string.title_setup_other);
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_activesync, order++, R.string.title_setup_activesync);
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_setup_other, order++, R.string.title_setup_other);
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
if (item.getIntent() != null) {
|
||||
lbm.sendBroadcast(item.getIntent());
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.string.title_setup_gmail:
|
||||
if (Helper.hasValidFingerprint(getContext()))
|
||||
@@ -189,12 +196,6 @@ public class FragmentSetup extends FragmentBase {
|
||||
else
|
||||
ToastEx.makeText(getContext(), R.string.title_setup_gmail_support, Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
case R.string.title_setup_gmail_oauth:
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_QUICK_OAUTH).putExtra("name", "Gmail"));
|
||||
return true;
|
||||
case R.string.title_setup_outlook:
|
||||
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_QUICK_OUTLOOK));
|
||||
return true;
|
||||
case R.string.title_setup_activesync:
|
||||
Helper.viewFAQ(getContext(), 133);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user