mirror of https://github.com/M66B/FairEmail.git
Use separate store connection for foreground actions
This commit is contained in:
parent
984ef5f4c6
commit
feb70159b0
|
@ -239,13 +239,16 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
boolean debug = (prefs.getBoolean("debug", false) || BuildConfig.BETA_RELEASE);
|
||||
//System.setProperty("mail.socket.debug", Boolean.toString(debug));
|
||||
|
||||
// Create session
|
||||
// Get properties
|
||||
Properties props = MessageHelper.getSessionProperties(account.auth_type, account.realm, account.insecure);
|
||||
|
||||
// Create session
|
||||
final Session isession = Session.getInstance(props, null);
|
||||
isession.setDebug(debug);
|
||||
// adb -t 1 logcat | grep "fairemail\|System.out"
|
||||
|
||||
final Store istore = isession.getStore(account.getProtocol());
|
||||
|
||||
final Map<EntityFolder, Folder> folders = new HashMap<>();
|
||||
List<Thread> idlers = new ArrayList<>();
|
||||
List<Handler> handlers = new ArrayList<>();
|
||||
|
|
|
@ -289,8 +289,13 @@ public class ServiceUI extends IntentService {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean debug = (prefs.getBoolean("debug", false) || BuildConfig.BETA_RELEASE);
|
||||
|
||||
// Create session
|
||||
String protocol = account.getProtocol();
|
||||
|
||||
// Get properties
|
||||
Properties props = MessageHelper.getSessionProperties(account.auth_type, account.realm, account.insecure);
|
||||
props.put("mail." + protocol + ".separatestoreconnection", true);
|
||||
|
||||
// Create session
|
||||
final Session isession = Session.getInstance(props, null);
|
||||
isession.setDebug(debug);
|
||||
|
||||
|
@ -299,7 +304,7 @@ public class ServiceUI extends IntentService {
|
|||
// Connect account
|
||||
Log.i(account.name + " connecting");
|
||||
db.account().setAccountState(account.id, "connecting");
|
||||
istore = isession.getStore(account.getProtocol());
|
||||
istore = isession.getStore(protocol);
|
||||
Helper.connect(this, istore, account);
|
||||
db.account().setAccountState(account.id, "connected");
|
||||
db.account().setAccountConnected(account.id, new Date().getTime());
|
||||
|
@ -354,15 +359,20 @@ public class ServiceUI extends IntentService {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean debug = (prefs.getBoolean("debug", false) || BuildConfig.BETA_RELEASE);
|
||||
|
||||
// Create session
|
||||
String protocol = account.getProtocol();
|
||||
|
||||
// Get properties
|
||||
Properties props = MessageHelper.getSessionProperties(account.auth_type, account.realm, account.insecure);
|
||||
props.put("mail." + protocol + ".separatestoreconnection", true);
|
||||
|
||||
// Create session
|
||||
final Session isession = Session.getInstance(props, null);
|
||||
isession.setDebug(debug);
|
||||
|
||||
// Connect account
|
||||
Log.i(account.name + " connecting");
|
||||
db.account().setAccountState(account.id, "connecting");
|
||||
istore = isession.getStore(account.getProtocol());
|
||||
istore = isession.getStore(protocol);
|
||||
Helper.connect(this, istore, account);
|
||||
db.account().setAccountState(account.id, "connected");
|
||||
db.account().setAccountConnected(account.id, new Date().getTime());
|
||||
|
|
|
@ -163,12 +163,18 @@ public class ViewModelBrowse extends ViewModel {
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(state.context);
|
||||
boolean debug = (prefs.getBoolean("debug", false) || BuildConfig.BETA_RELEASE);
|
||||
|
||||
String protocol = account.getProtocol();
|
||||
|
||||
// Get properties
|
||||
Properties props = MessageHelper.getSessionProperties(account.auth_type, account.realm, account.insecure);
|
||||
props.put("mail." + protocol + ".separatestoreconnection", true);
|
||||
|
||||
// Create session
|
||||
Session isession = Session.getInstance(props, null);
|
||||
isession.setDebug(debug);
|
||||
|
||||
Log.i("Boundary connecting account=" + account.name);
|
||||
state.istore = (IMAPStore) isession.getStore(account.getProtocol());
|
||||
state.istore = (IMAPStore) isession.getStore(protocol);
|
||||
Helper.connect(state.context, state.istore, account);
|
||||
|
||||
Log.i("Boundary opening folder=" + folder.name);
|
||||
|
|
Loading…
Reference in New Issue