use of com.zegoggles.smssync.preferences.AuthPreferences in project sms-backup-plus by jberkel.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportFragmentManager().addOnBackStackChangedListener(this);
authPreferences = new AuthPreferences(this);
oauth2Client = new OAuth2Client(authPreferences.getOAuth2ClientId());
fallbackAuthIntent = new Intent(this, OAuth2WebAuthActivity.class).setData(oauth2Client.requestUrl());
changeDefaultPackageIntent = new Intent(ACTION_CHANGE_DEFAULT).putExtra(EXTRA_PACKAGE_NAME, getPackageName());
preferences = new Preferences(this);
if (bundle == null) {
showFragment(new MainSettings(), null);
}
if (preferences.shouldShowAboutDialog()) {
showDialog(ABOUT);
}
checkDefaultSmsApp();
requestPermissionsIfNeeded();
}
use of com.zegoggles.smssync.preferences.AuthPreferences in project sms-backup-plus by jberkel.
the class SmsRestoreService method handleIntent.
@Override
protected void handleIntent(final Intent intent) {
if (isWorking())
return;
try {
final boolean restoreCallLog = getPreferences().getDataTypePreferences().isRestoreEnabled(CALLLOG);
final boolean restoreSms = getPreferences().getDataTypePreferences().isRestoreEnabled(SMS);
if (restoreSms && !canWriteToSmsProvider()) {
postError(new SmsProviderNotWritableException());
return;
}
MessageConverter converter = new MessageConverter(service, getPreferences(), getAuthPreferences().getUserEmail(), new PersonLookup(getContentResolver()), new ContactAccessor());
RestoreConfig config = new RestoreConfig(getBackupImapStore(), 0, restoreSms, restoreCallLog, getPreferences().isRestoreStarredOnly(), getPreferences().getMaxItemsPerRestore(), 0);
final AuthPreferences authPreferences = new AuthPreferences(this);
new RestoreTask(this, converter, getContentResolver(), new TokenRefresher(service, new OAuth2Client(authPreferences.getOAuth2ClientId()), authPreferences)).execute(config);
} catch (MessagingException e) {
postError(e);
}
}
use of com.zegoggles.smssync.preferences.AuthPreferences in project sms-backup-plus by jberkel.
the class MainSettings method onCreatePreferences.
@Override
public void onCreatePreferences(Bundle bundle, String rootKey) {
super.onCreatePreferences(bundle, rootKey);
authPreferences = new AuthPreferences(getContext());
}
Aggregations