Browse Source

Stop service before updates

main
M66B 6 years ago
parent
commit
bef67ee485
3 changed files with 12 additions and 4 deletions
  1. +4
    -2
      app/src/main/java/eu/faircode/email/FragmentAccount.java
  2. +4
    -2
      app/src/main/java/eu/faircode/email/FragmentFolder.java
  3. +4
    -0
      app/src/main/java/eu/faircode/email/FragmentIdentity.java

+ 4
- 2
app/src/main/java/eu/faircode/email/FragmentAccount.java View File

@ -510,6 +510,8 @@ public class FragmentAccount extends FragmentEx {
@Override
public Throwable loadInBackground() {
try {
ServiceSynchronize.stop(getContext(), "folder");
String name = args.getString("name");
String host = args.getString("host");
String port = args.getString("port");
@ -629,12 +631,12 @@ public class FragmentAccount extends FragmentEx {
db.endTransaction();
}
ServiceSynchronize.restart(getContext(), "account");
return null;
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
return ex;
} finally {
ServiceSynchronize.restart(getContext(), "account");
}
}
}


+ 4
- 2
app/src/main/java/eu/faircode/email/FragmentFolder.java View File

@ -129,6 +129,8 @@ public class FragmentFolder extends FragmentEx {
@Override
public Throwable loadInBackground() {
try {
ServiceSynchronize.stop(getContext(), "folder");
long id = args.getLong("id");
boolean synchronize = args.getBoolean("synchronize");
String after = args.getString("after");
@ -144,12 +146,12 @@ public class FragmentFolder extends FragmentEx {
if (!folder.synchronize)
db.message().deleteMessages(folder.id);
ServiceSynchronize.restart(getContext(), "folder");
return null;
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
return ex;
} finally {
ServiceSynchronize.restart(getContext(), "folder");
}
}
}


+ 4
- 0
app/src/main/java/eu/faircode/email/FragmentIdentity.java View File

@ -318,6 +318,8 @@ public class FragmentIdentity extends FragmentEx {
@Override
public Throwable loadInBackground() {
try {
ServiceSynchronize.stop(getContext(), "account");
long id = args.getLong("id");
String name = args.getString("name");
String email = args.getString("email");
@ -396,6 +398,8 @@ public class FragmentIdentity extends FragmentEx {
} catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
return ex;
} finally {
ServiceSynchronize.restart(getContext(), "account");
}
}
}


Loading…
Cancel
Save