public String getUserEmail() { switch (getAuthMode()) { case XOAUTH: return getOauth2Username(); default: return getImapUsername(); } }
public Preferences(Context context, SharedPreferences preferences) { this.context = context; this.preferences = preferences; this.dataTypePreferences = new DataTypePreferences(preferences); }
private int[] jobConstraints(BackupType backupType) { switch (backupType) { case BROADCAST_INTENT: return new int[0]; default: return preferences.isWifiOnly() ? new int[] { ON_UNMETERED_NETWORK } : new int[] { ON_ANY_NETWORK }; } }
public boolean hasOAuth2Tokens() { return getOauth2Username() != null && getOauth2Token() != null; }
public void migrate() { new AuthPreferences(context).migrate(); }
@Override public void onStop() { super.onStop(); preferences.getDataTypePreferences().registerDataTypeListener(null); }
protected AuthPreferences getAuthPreferences(Context context) { return new AuthPreferences(context); } }
protected Preferences getPreferences(Context context) { return new Preferences(context); }
private int getStringAsInt(Keys key, int def) { return getStringAsInt(key.key, def); }
public AddressStyle getEmailAddressStyle() { return getDefaultType(preferences, Keys.EMAIL_ADDRESS_STYLE.key, AddressStyle.class, AddressStyle.NAME); }
@Override public boolean enabled() { return preferences.isAppLogDebug(); }
public boolean useXOAuth() { return getAuthMode() == AuthMode.XOAUTH; }
protected AuthPreferences getAuthPreferences() { return new AuthPreferences(this); }
public BackupJobs(Context context) { this(context, new Preferences(context)); }
public int getMaxItemsPerSync() { return getStringAsInt(MAX_ITEMS_PER_SYNC, Defaults.MAX_ITEMS_PER_SYNC); }
public CallLogTypes getCallLogType() { return getDefaultType(preferences, CALLLOG_TYPES, CallLogTypes.class, CallLogTypes.EVERYTHING); }
public int getIncomingTimeoutSecs() { return getStringAsInt(INCOMING_TIMEOUT_SECONDS, Defaults.INCOMING_TIMEOUT_SECONDS); }
private AuthMode getAuthMode() { return getDefaultType(preferences, SERVER_AUTHENTICATION, AuthMode.class, AuthMode.XOAUTH); }
public int getCallLogCalendarId() { return getStringAsInt(CALLLOG_SYNC_CALENDAR, -1); }
public MarkAsReadTypes getMarkAsReadType() { return getDefaultType(preferences, MARK_AS_READ_TYPES.key, MarkAsReadTypes.class, MarkAsReadTypes.READ); }