Search in sources :

Example 1 with MessageConverter

use of com.zegoggles.smssync.mail.MessageConverter 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);
    }
}
Also used : AuthPreferences(com.zegoggles.smssync.preferences.AuthPreferences) SmsProviderNotWritableException(com.zegoggles.smssync.service.exception.SmsProviderNotWritableException) TokenRefresher(com.zegoggles.smssync.auth.TokenRefresher) MessagingException(com.fsck.k9.mail.MessagingException) OAuth2Client(com.zegoggles.smssync.auth.OAuth2Client) ContactAccessor(com.zegoggles.smssync.contacts.ContactAccessor) MessageConverter(com.zegoggles.smssync.mail.MessageConverter) PersonLookup(com.zegoggles.smssync.mail.PersonLookup)

Aggregations

MessagingException (com.fsck.k9.mail.MessagingException)1 OAuth2Client (com.zegoggles.smssync.auth.OAuth2Client)1 TokenRefresher (com.zegoggles.smssync.auth.TokenRefresher)1 ContactAccessor (com.zegoggles.smssync.contacts.ContactAccessor)1 MessageConverter (com.zegoggles.smssync.mail.MessageConverter)1 PersonLookup (com.zegoggles.smssync.mail.PersonLookup)1 AuthPreferences (com.zegoggles.smssync.preferences.AuthPreferences)1 SmsProviderNotWritableException (com.zegoggles.smssync.service.exception.SmsProviderNotWritableException)1