use of com.nutomic.syncthingandroid.model.Config in project syncthing-android by syncthing.
the class RestApi method onWebGuiAvailable.
/**
* Gets local device ID, syncthing version and config, then calls all OnApiAvailableListeners.
*/
@Override
public void onWebGuiAvailable() {
mAvailableCount.set(0);
new GetRequest(mContext, mUrl, GetRequest.URI_VERSION, mApiKey, null, result -> {
JsonObject json = new JsonParser().parse(result).getAsJsonObject();
mVersion = json.get("version").getAsString();
Log.i(TAG, "Syncthing version is " + mVersion);
tryIsAvailable();
});
new GetRequest(mContext, mUrl, GetRequest.URI_CONFIG, mApiKey, null, result -> {
mConfig = new Gson().fromJson(result, Config.class);
if (mConfig == null) {
throw new RuntimeException("config is null: " + result);
}
tryIsAvailable();
});
getSystemInfo(info -> {
mLocalDeviceId = info.myID;
tryIsAvailable();
});
}
use of com.nutomic.syncthingandroid.model.Config in project syncthing-android by syncthing.
the class RestApi method onReloadConfigComplete.
private void onReloadConfigComplete(String result) {
Boolean configParseSuccess;
synchronized (mConfigLock) {
mConfig = new Gson().fromJson(result, Config.class);
configParseSuccess = mConfig != null;
}
if (!configParseSuccess) {
throw new RuntimeException("config is null: " + result);
}
Log.v(TAG, "onReloadConfigComplete: Successfully parsed configuration.");
if (BuildConfig.DEBUG) {
Log.v(TAG, "mConfig.remoteIgnoredDevices = " + new Gson().toJson(mConfig.remoteIgnoredDevices));
}
// Update cached device and folder information stored in the mCompletion model.
mCompletion.updateFromConfig(getDevices(true), getFolders());
}
Aggregations