@Test public void returnBlankWhenAccountNameIsNotSaved() { stubSavedAccount("some_other_email"); stubAccount(EXPECTED_ACCOUNT); assertEquals("", googleAccountsManager.getLastSelectedAccountIfValid()); assertNull(currentAccount); }
@NonNull public String getLastSelectedAccountIfValid() { Account[] googleAccounts = credential.getAllAccounts(); String account = (String) preferences.get(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); if (googleAccounts != null && googleAccounts.length > 0) { for (Account googleAccount : googleAccounts) { if (googleAccount.name.equals(account)) { return account; } } preferences.reset(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); } return ""; }
GoogleAccountsManager { @NonNull public String getLastSelectedAccountIfValid() { Account[] googleAccounts = credential.getAllAccounts(); String account = (String) preferences.get(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); if (googleAccounts != null && googleAccounts.length > 0) { for (Account googleAccount : googleAccounts) { if (googleAccount.name.equals(account)) { return account; } } preferences.reset(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); } return ""; } }
GoogleAccountsManager { @NonNull public String getLastSelectedAccountIfValid() { Account[] googleAccounts = credential.getAllAccounts(); String account = (String) preferences.get(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); if (googleAccounts != null && googleAccounts.length > 0) { for (Account googleAccount : googleAccounts) { if (googleAccount.name.equals(account)) { return account; } } preferences.reset(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); } return ""; } @Inject  GoogleAccountsManager(@NonNull Context context);  GoogleAccountsManager(@NonNull GoogleAccountCredential credential,
                                 @NonNull GeneralSharedPreferences preferences,
                                 @NonNull Intent intentChooseAccount,
                                 @NonNull ThemeUtils themeUtils
    ); }
GoogleAccountsManager { @NonNull public String getLastSelectedAccountIfValid() { Account[] googleAccounts = credential.getAllAccounts(); String account = (String) preferences.get(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); if (googleAccounts != null && googleAccounts.length > 0) { for (Account googleAccount : googleAccounts) { if (googleAccount.name.equals(account)) { return account; } } preferences.reset(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); } return ""; } @Inject  GoogleAccountsManager(@NonNull Context context);  GoogleAccountsManager(@NonNull GoogleAccountCredential credential,
                                 @NonNull GeneralSharedPreferences preferences,
                                 @NonNull Intent intentChooseAccount,
                                 @NonNull ThemeUtils themeUtils
    ); static void showSettingsDialog(Activity activity); boolean isAccountSelected(); @NonNull String getLastSelectedAccountIfValid(); void selectAccount(String accountName); DriveHelper getDriveHelper(); SheetsHelper getSheetsHelper(); String getToken(); Intent getAccountChooserIntent(); }
GoogleAccountsManager { @NonNull public String getLastSelectedAccountIfValid() { Account[] googleAccounts = credential.getAllAccounts(); String account = (String) preferences.get(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); if (googleAccounts != null && googleAccounts.length > 0) { for (Account googleAccount : googleAccounts) { if (googleAccount.name.equals(account)) { return account; } } preferences.reset(GeneralKeys.KEY_SELECTED_GOOGLE_ACCOUNT); } return ""; } @Inject  GoogleAccountsManager(@NonNull Context context);  GoogleAccountsManager(@NonNull GoogleAccountCredential credential,
                                 @NonNull GeneralSharedPreferences preferences,
                                 @NonNull Intent intentChooseAccount,
                                 @NonNull ThemeUtils themeUtils
    ); static void showSettingsDialog(Activity activity); boolean isAccountSelected(); @NonNull String getLastSelectedAccountIfValid(); void selectAccount(String accountName); DriveHelper getDriveHelper(); SheetsHelper getSheetsHelper(); String getToken(); Intent getAccountChooserIntent();  }