Stop service before updates

pull/50/head
M66B 6 years ago
parent cd93c7fce9
commit bef67ee485

@ -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");
}
}
}

@ -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");
}
}
}

@ -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