mirror of https://codeberg.org/gitnex/GitNex.git
Refactor: remove instanceUrlWithProtocol (#698)
Refactor: remove instanceUrlWithProtocol Co-authored-by: M M Arif <mmarif@swatian.com> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/698
This commit is contained in:
parent
23fb1ce71f
commit
02672aef3d
|
@ -114,10 +114,7 @@ public class AddNewAccountActivity extends BaseActivity {
|
||||||
|
|
||||||
URI rawInstanceUrl = UrlBuilder.fromString(UrlHelper.fixScheme(instanceUrlET, "http")).toUri();
|
URI rawInstanceUrl = UrlBuilder.fromString(UrlHelper.fixScheme(instanceUrlET, "http")).toUri();
|
||||||
|
|
||||||
URI instanceUrlWithProtocol = UrlBuilder.fromUri(rawInstanceUrl).withPath(PathsHelper.join(rawInstanceUrl.getPath()))
|
URI instanceUrl = UrlBuilder.fromUri(rawInstanceUrl).withScheme(protocol.toLowerCase()).withPath(PathsHelper.join(rawInstanceUrl.getPath(), "/api/v1/"))
|
||||||
.withScheme(protocol.toLowerCase()).toUri();
|
|
||||||
|
|
||||||
URI instanceUrl = UrlBuilder.fromUri(instanceUrlWithProtocol).withPath(PathsHelper.join(instanceUrlWithProtocol.getPath(), "/api/v1/"))
|
|
||||||
.toUri();
|
.toUri();
|
||||||
|
|
||||||
versionCheck(instanceUrl.toString(), loginToken);
|
versionCheck(instanceUrl.toString(), loginToken);
|
||||||
|
|
|
@ -136,11 +136,6 @@ public abstract class BaseActivity extends AppCompatActivity {
|
||||||
tinyDb.putString("draftsCommentsDeletionEnabledInit", "yes");
|
tinyDb.putString("draftsCommentsDeletionEnabledInit", "yes");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!tinyDb.getString("instanceUrlWithProtocol").endsWith("/")) {
|
|
||||||
|
|
||||||
tinyDb.putString("instanceUrlWithProtocol", tinyDb.getString("instanceUrlWithProtocol") + "/");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tinyDb.getBoolean("crashReportingEnabled")) {
|
if (tinyDb.getBoolean("crashReportingEnabled")) {
|
||||||
|
|
||||||
CoreConfigurationBuilder ACRABuilder = new CoreConfigurationBuilder(this);
|
CoreConfigurationBuilder ACRABuilder = new CoreConfigurationBuilder(this);
|
||||||
|
|
|
@ -167,16 +167,12 @@ public class LoginActivity extends BaseActivity {
|
||||||
|
|
||||||
URI rawInstanceUrl = UrlBuilder.fromString(UrlHelper.fixScheme(instanceUrlET.getText().toString(), "http")).toUri();
|
URI rawInstanceUrl = UrlBuilder.fromString(UrlHelper.fixScheme(instanceUrlET.getText().toString(), "http")).toUri();
|
||||||
|
|
||||||
URI instanceUrlWithProtocol = UrlBuilder.fromUri(rawInstanceUrl).withPath(PathsHelper.join(rawInstanceUrl.getPath()))
|
URI instanceUrl = UrlBuilder.fromUri(rawInstanceUrl).withScheme(protocol.name().toLowerCase()).withPath(PathsHelper.join(rawInstanceUrl.getPath(), "/api/v1/"))
|
||||||
.withScheme(protocol.name().toLowerCase()).toUri();
|
|
||||||
|
|
||||||
URI instanceUrl = UrlBuilder.fromUri(instanceUrlWithProtocol).withPath(PathsHelper.join(instanceUrlWithProtocol.getPath(), "/api/v1/"))
|
|
||||||
.toUri();
|
.toUri();
|
||||||
|
|
||||||
tinyDB.putString("loginType", loginType.name().toLowerCase());
|
tinyDB.putString("loginType", loginType.name().toLowerCase());
|
||||||
tinyDB.putString("instanceUrlRaw", instanceUrlET.getText().toString());
|
tinyDB.putString("instanceUrlRaw", instanceUrlET.getText().toString());
|
||||||
tinyDB.putString("instanceUrl", instanceUrl.toString());
|
tinyDB.putString("instanceUrl", instanceUrl.toString());
|
||||||
tinyDB.putString("instanceUrlWithProtocol", instanceUrlWithProtocol.toString());
|
|
||||||
|
|
||||||
if(instanceUrlET.getText().toString().equals("")) {
|
if(instanceUrlET.getText().toString().equals("")) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue