diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/SCNSettings.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/SCNSettings.java index c729bd6..aeceb4d 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/SCNSettings.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/SCNSettings.java @@ -163,10 +163,12 @@ public class SCNSettings return user_id>=0 && user_key != null && !user_key.isEmpty(); } - public String createOnlineURL() + public String createOnlineURL(boolean longurl) { - if (!isConnected()) return ServerCommunication.BASE_URL + "index.php"; - return ServerCommunication.BASE_URL + "index.php?preset_user_id="+user_id+"&preset_user_key="+user_key; + String base = longurl ? ServerCommunication.PAGE_URL_LONG : ServerCommunication.PAGE_URL_SHORT; + + if (!isConnected()) return base; + return base + "index.php?preset_user_id="+user_id+"&preset_user_key="+user_key; } public void setServerToken(String token, View loader) diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java index 68087f9..6779fdb 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java @@ -27,7 +27,9 @@ import okhttp3.ResponseBody; public class ServerCommunication { - public static final String BASE_URL = /*SCNApp.LOCAL_DEBUG ? "http://localhost:1010/" : */"https://scn.blackforestbytes.com/api/"; + public static final String PAGE_URL_LONG = "https://simplecloudnotifier.blackforestbytes.com/"; + public static final String PAGE_URL_SHORT = "https://scn.blackforestbytes.com/"; + public static final String BASE_URL = "https://scn.blackforestbytes.com/api/"; private static final OkHttpClient client = new OkHttpClient(); diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/AccountFragment.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/AccountFragment.java index e8aed56..d57b5b1 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/AccountFragment.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/view/AccountFragment.java @@ -105,7 +105,7 @@ public class AccountFragment extends Fragment v.findViewById(R.id.btnQR).setOnClickListener(cv -> { - Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(SCNSettings.inst().createOnlineURL())); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(SCNSettings.inst().createOnlineURL(true))); startActivity(browserIntent); }); @@ -141,7 +141,7 @@ public class AccountFragment extends Fragment tvUserID.setText(String.valueOf(s.user_id)); tvUserKey.setText(s.user_key); tvQuota.setText(String.format("%d / %d", s.quota_curr, s.quota_max)); - btnQR.setImageBitmap(QRCode.from(s.createOnlineURL()).to(ImageType.PNG).withSize(512, 512).bitmap()); + btnQR.setImageBitmap(QRCode.from(s.createOnlineURL(false)).to(ImageType.PNG).withSize(512, 512).bitmap()); ivQuota.setColorFilter(s.quota_curr>=s.quota_max ? Color.rgb(200, 0, 0) : Color.rgb(128, 128, 128)); } else