1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-22 20:31:16 +00:00

Update Syncthing URL on restart if it was changed (fixes #442).

This commit is contained in:
Felix Ableitner 2016-04-10 17:29:05 +02:00
parent 6a686cdb95
commit f4c15a98e6
2 changed files with 8 additions and 2 deletions

View file

@ -150,7 +150,7 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
private String mVersion; private String mVersion;
private final String mUrl; private String mUrl;
private final String mApiKey; private final String mApiKey;
@ -200,6 +200,10 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
mOnConfigChangedListener = configListener; mOnConfigChangedListener = configListener;
} }
public void setWebGuiUrl(String newUrl) {
mUrl = newUrl;
}
/** /**
* Number of previous calls to {@link #tryIsAvailable()}. * Number of previous calls to {@link #tryIsAvailable()}.
*/ */

View file

@ -227,8 +227,10 @@ public class SyncthingService extends Service implements
if (mConfig != null) { if (mConfig != null) {
mCurrentState = State.STARTING; mCurrentState = State.STARTING;
if (mApi != null) if (mApi != null) {
registerOnWebGuiAvailableListener(mApi); registerOnWebGuiAvailableListener(mApi);
mApi.setWebGuiUrl(mConfig.getWebGuiUrl());
}
if (mEventProcessor != null) if (mEventProcessor != null)
registerOnWebGuiAvailableListener(mEventProcessor); registerOnWebGuiAvailableListener(mEventProcessor);
new PollWebGuiAvailableTaskImpl(getFilesDir() + "/" + HTTPS_CERT_FILE) new PollWebGuiAvailableTaskImpl(getFilesDir() + "/" + HTTPS_CERT_FILE)