Don't pass OAuth2TokenProvider to RemoteStore and Transport

This commit is contained in:
cketti 2016-12-12 02:26:20 +01:00
parent 74017c926e
commit f9ed304770
5 changed files with 9 additions and 9 deletions

View file

@ -20,12 +20,12 @@ public abstract class Transport {
// RFC 1047
protected static final int SOCKET_READ_TIMEOUT = 300000;
public synchronized static Transport getInstance(Context context, StoreConfig storeConfig,
OAuth2TokenProvider oauth2TokenProvider) throws MessagingException {
public static synchronized Transport getInstance(Context context, StoreConfig storeConfig)
throws MessagingException {
String uri = storeConfig.getTransportUri();
if (uri.startsWith("smtp")) {
return new SmtpTransport(storeConfig, new DefaultTrustedSocketFactory(context),
oauth2TokenProvider);
OAuth2TokenProvider oauth2TokenProvider = null;
return new SmtpTransport(storeConfig, new DefaultTrustedSocketFactory(context), oauth2TokenProvider);
} else if (uri.startsWith("webdav")) {
return new WebDavTransport(storeConfig);
} else {

View file

@ -41,8 +41,7 @@ public abstract class RemoteStore extends Store {
/**
* Get an instance of a remote mail store.
*/
public synchronized static Store getInstance(Context context, StoreConfig storeConfig,
OAuth2TokenProvider oAuth2TokenProvider) throws MessagingException {
public static synchronized Store getInstance(Context context, StoreConfig storeConfig) throws MessagingException {
String uri = storeConfig.getStoreUri();
if (uri.startsWith("local")) {
@ -52,6 +51,7 @@ public abstract class RemoteStore extends Store {
Store store = sStores.get(uri);
if (store == null) {
if (uri.startsWith("imap")) {
OAuth2TokenProvider oAuth2TokenProvider = null;
store = new ImapStore(
storeConfig,
new DefaultTrustedSocketFactory(context),

View file

@ -1287,7 +1287,7 @@ public class Account implements BaseAccount, StoreConfig {
}
public Store getRemoteStore() throws MessagingException {
return RemoteStore.getInstance(K9.app, this, null);
return RemoteStore.getInstance(K9.app, this);
}
// It'd be great if this actually went into the store implementation

View file

@ -475,7 +475,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
if (!(account.getRemoteStore() instanceof WebDavStore)) {
publishProgress(R.string.account_setup_check_settings_check_outgoing_msg);
}
Transport transport = Transport.getInstance(K9.app, account, null);
Transport transport = Transport.getInstance(K9.app, account);
transport.close();
try {
transport.open();

View file

@ -2973,7 +2973,7 @@ public class MessagingController {
if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Scanning folder '" + account.getOutboxFolderName() + "' (" + localFolder.getId() + ") for messages to send");
Transport transport = Transport.getInstance(K9.app, account, null);
Transport transport = Transport.getInstance(K9.app, account);
for (LocalMessage message : localMessages) {
if (message.isSet(Flag.DELETED)) {
message.destroy();