Browse Source

Support for adding dedicated Xirvik servers by QR code

pull/596/head
Eric Kok 4 years ago
parent
commit
df868dfa77
  1. 23
      app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java
  2. 3
      app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java
  3. 2
      app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettings.java

23
app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java

@ -294,35 +294,36 @@ public class MainSettingsActivity extends PreferenceCompatActivity { @@ -294,35 +294,36 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
protected void onServerBarcodeScanHandled(String[] qrResult) {
final String server = qrResult[0];
final String token = qrResult[2];
new XirvikSharedSettingsActivity.RetrieveXirvikAutoConfTask(server, "", "", token) {
@Override
protected void onPostExecute(String result) {
if (result == null) {
log.d(MainSettingsActivity.this, "Could not retrieve the Xirvik shared seedbox RPC mount point setting");
}
switch (qrResult[1]) {
case "P":
XirvikDediSettings xirvikDediSettings = new XirvikDediSettings();
xirvikDediSettings.saveServerSetting(this, server, token);
xirvikDediSettings.saveServerSetting(getApplicationContext(), server, token);
onResume();
break;
case "N":
XirvikSemiSettings xirvikSemiSettings = new XirvikSemiSettings();
xirvikSemiSettings.saveServerSetting(this, server, token);
xirvikSemiSettings.saveServerSetting(getApplicationContext(), server, token);
onResume();
break;
case "RG":
new XirvikSharedSettingsActivity.RetrieveXirvikAutoConfTask(server, "", "", token) {
@Override
protected void onPostExecute(String result) {
if (result == null) {
log.d(MainSettingsActivity.this, "Could not retrieve the Xirvik shared seedbox RPC mount point setting");
}
XirvikSharedSettings xirvikSharedSettings = new XirvikSharedSettings();
xirvikSharedSettings.saveServerSetting(getApplicationContext(), server, token, result);
onResume();
}
}.execute();
break;
default:
SnackbarManager.show(Snackbar.with(this).text(R.string.pref_seedbox_xirvikscanerror).colorResource(R.color.red).type(SnackbarType.MULTI_LINE));
SnackbarManager.show(Snackbar.with(MainSettingsActivity.this).text(R.string.pref_seedbox_xirvikscanerror).colorResource(R.color.red).type(SnackbarType.MULTI_LINE));
break;
}
}
}.execute();
}
}

3
app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java

@ -43,6 +43,9 @@ public class PreferenceCompatActivity extends AppCompatActivity implements AppCo @@ -43,6 +43,9 @@ public class PreferenceCompatActivity extends AppCompatActivity implements AppCo
private int preferencesResId;
public RootPreferencesFragment() {
}
public RootPreferencesFragment(int preferencesResId) {
this.preferencesResId = preferencesResId;
}

2
app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettings.java

@ -62,7 +62,7 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe @@ -62,7 +62,7 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe
type != Daemon.uTorrent,
false,
null,
type == Daemon.Deluge ? "/deluge" : null,
type == Daemon.Deluge ? "/deluge" : "/RPC2-aAoWTED8ngLqZyKnZ7FFEAgfz5lejcof",
true,
user,
pass,

Loading…
Cancel
Save