Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config: Add new values for SyncthingNative v1.2.0 (fixes #421) #424

Merged
merged 3 commits into from
Jun 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/src/main/java/com/nutomic/syncthingandroid/model/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ public class Options {
// Since v1.0.0, see https://github.com/syncthing/syncthing/pull/4888
public int maxConcurrentScans = 1;

// Since v1.2.0
public String crashReportingURL = "https://crash.syncthing.net/newcrash";
public boolean crashReportingEnabled = true;
public int stunKeepaliveStartS = 180;
public int stunKeepaliveMinS = 20;
public String stunServer = "default";

// Items that may be temporarily missing because they are empty.
/**
* Possible notification IDs:
* crAutoEnabled (crash reporting after upgrade to v1.2.0)
*/
public String unackedNotificationID = "";

public static class MinHomeDiskFree {
public float value = 1;
public String unit = "%";
Expand Down
18 changes: 13 additions & 5 deletions app/src/main/java/com/nutomic/syncthingandroid/util/ConfigXml.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,13 @@ private void updateIfNeeded() {
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node.getNodeName().equals("unackedNotificationID")) {
if (node.equals("fsWatcherNotification")) {
Log.i(TAG, "Remove found unackedNotificationID 'fsWatcherNotification'.");
options.removeChild(node);
changed = true;
break;
switch (getContentOrDefault(node, "")) {
case "crAutoEnabled":
case "fsWatcherNotification":
Log.i(TAG, "Remove found unackedNotificationID '" + node + "'.");
options.removeChild(node);
changed = true;
break;
}
}
}
Expand Down Expand Up @@ -908,6 +910,12 @@ public Options getOptions() {
options.setLowPriority = getContentOrDefault(elementOptions.getElementsByTagName("setLowPriority").item(0), options.setLowPriority);
// minHomeDiskFree
options.maxConcurrentScans = getContentOrDefault(elementOptions.getElementsByTagName("maxConcurrentScans").item(0), options.maxConcurrentScans);
options.unackedNotificationID = getContentOrDefault(elementOptions.getElementsByTagName("unackedNotificationID").item(0), options.unackedNotificationID);
options.crashReportingURL = getContentOrDefault(elementOptions.getElementsByTagName("crashReportingURL").item(0), options.crashReportingURL);
options.crashReportingEnabled =getContentOrDefault(elementOptions.getElementsByTagName("crashReportingEnabled").item(0), options.crashReportingEnabled);
options.stunKeepaliveStartS = getContentOrDefault(elementOptions.getElementsByTagName("stunKeepaliveStartS").item(0), options.stunKeepaliveStartS);
options.stunKeepaliveMinS = getContentOrDefault(elementOptions.getElementsByTagName("stunKeepaliveMinS").item(0), options.stunKeepaliveMinS);
options.stunServer = getContentOrDefault(elementOptions.getElementsByTagName("stunServer").item(0), options.stunServer);
return options;
}

Expand Down