BearND has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311721

Change subject: Add beta cluster to RB Uri formats
......................................................................

Add beta cluster to RB Uri formats

So we can eventually test beta cluster RB deployments in the app
before deploying to production. The beta cluster feed endpoints
still have issues at this time.

Breaking change for developers:
Since the beta cluster URI format differs from the other ones significantly
we only use the Wikipedia subdomain. So, the second string
parameter passed in is only "en" instead of "en.wikipedia.org".

Examples of actual URIs to illustrate this:
Prod: https://en.wikipedia.org/api/rest_v1
Beta cluster: https://en.wikipedia.beta.wmflabs.org/api/rest_v1

Another minor issue with this patch is that now the hint text is so
long that on smaller devices you may have to scroll down to see the
input field.

Change-Id: I2aceab513b6761f7a18130db0f31722c0efe65f3
---
M app/src/main/java/org/wikipedia/Site.java
M 
app/src/main/java/org/wikipedia/feed/aggregated/AggregatedFeedContentClient.java
M app/src/main/java/org/wikipedia/server/restbase/RbPageEndpointsCache.java
M app/src/main/java/org/wikipedia/settings/Prefs.java
M app/src/main/res/xml/developer_preferences.xml
5 files changed, 22 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/21/311721/1

diff --git a/app/src/main/java/org/wikipedia/Site.java 
b/app/src/main/java/org/wikipedia/Site.java
index a21ccd0..90ba9f1 100644
--- a/app/src/main/java/org/wikipedia/Site.java
+++ b/app/src/main/java/org/wikipedia/Site.java
@@ -123,6 +123,11 @@
     }
 
     @NonNull
+    public String subdomain() {
+        return languageCodeToSubdomain(languageCode);
+    }
+
+    @NonNull
     public String host() {
         return uri.getHost();
     }
diff --git 
a/app/src/main/java/org/wikipedia/feed/aggregated/AggregatedFeedContentClient.java
 
b/app/src/main/java/org/wikipedia/feed/aggregated/AggregatedFeedContentClient.java
index db0a504..48f214c 100644
--- 
a/app/src/main/java/org/wikipedia/feed/aggregated/AggregatedFeedContentClient.java
+++ 
b/app/src/main/java/org/wikipedia/feed/aggregated/AggregatedFeedContentClient.java
@@ -38,7 +38,7 @@
         cancel();
         UtcDate date = DateUtil.getUtcRequestDateFor(age);
         String endpoint = String.format(Locale.ROOT, 
Prefs.getRestbaseUriFormat(), site.scheme(),
-                site.authority());
+                site.subdomain());
         Retrofit retrofit = RetrofitFactory.newInstance(site, endpoint);
         AggregatedFeedContentClient.Service service = 
retrofit.create(Service.class);
         call = service.get(date.year(), date.month(), date.date());
diff --git 
a/app/src/main/java/org/wikipedia/server/restbase/RbPageEndpointsCache.java 
b/app/src/main/java/org/wikipedia/server/restbase/RbPageEndpointsCache.java
index bff2202..9e35e50 100644
--- a/app/src/main/java/org/wikipedia/server/restbase/RbPageEndpointsCache.java
+++ b/app/src/main/java/org/wikipedia/server/restbase/RbPageEndpointsCache.java
@@ -23,7 +23,7 @@
 
     public static Retrofit retrofit(@NonNull Site site) {
         String endpoint = String.format(Locale.ROOT, 
Prefs.getRestbaseUriFormat(), site.scheme(),
-                site.authority());
+                site.subdomain());
         return RetrofitFactory.newInstance(site, endpoint);
     }
 
diff --git a/app/src/main/java/org/wikipedia/settings/Prefs.java 
b/app/src/main/java/org/wikipedia/settings/Prefs.java
index fdbbb52..054d86c 100644
--- a/app/src/main/java/org/wikipedia/settings/Prefs.java
+++ b/app/src/main/java/org/wikipedia/settings/Prefs.java
@@ -1,9 +1,5 @@
 package org.wikipedia.settings;
 
-import android.net.Uri;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-
 import org.wikipedia.Constants;
 import org.wikipedia.R;
 import org.wikipedia.SharedPreferenceCookieManager;
@@ -18,12 +14,16 @@
 import org.wikipedia.theme.Theme;
 import org.wikipedia.util.StringUtil;
 
+import okhttp3.logging.HttpLoggingInterceptor.Level;
+
+import android.net.Uri;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
-
-import okhttp3.logging.HttpLoggingInterceptor.Level;
 
 import static org.wikipedia.settings.PrefsIoUtil.contains;
 import static org.wikipedia.settings.PrefsIoUtil.getBoolean;
@@ -271,7 +271,9 @@
 
     public static int getSessionTimeout() {
         // return the timeout, but don't let it be less than the minimum
-        return Math.max(getInt(R.string.preference_key_session_timeout, 
SessionFunnel.DEFAULT_SESSION_TIMEOUT), SessionFunnel.MIN_SESSION_TIMEOUT);
+        return Math.max(
+                getInt(R.string.preference_key_session_timeout, 
SessionFunnel.DEFAULT_SESSION_TIMEOUT),
+                SessionFunnel.MIN_SESSION_TIMEOUT);
     }
 
     public static int getTextSizeMultiplier() {
@@ -335,7 +337,7 @@
     @NonNull
     public static String getRestbaseUriFormat() {
         return 
StringUtil.defaultIfBlank(getString(R.string.preference_key_restbase_uri_format,
 null),
-                "%1$s://%2$s/api/rest_v1/");
+                "%1$s://%2$s.wikipedia.org/api/rest_v1/");
     }
 
     @NonNull
diff --git a/app/src/main/res/xml/developer_preferences.xml 
b/app/src/main/res/xml/developer_preferences.xml
index 4672489..482c61c 100644
--- a/app/src/main/res/xml/developer_preferences.xml
+++ b/app/src/main/res/xml/developer_preferences.xml
@@ -30,11 +30,11 @@
             style="@style/DataStringPreference"
             android:key="@string/preference_key_restbase_uri_format"
             android:title="@string/preference_key_restbase_uri_format"
-            android:dialogMessage="Prod: %1$s://%2$s/api/rest_v1/
-            \nLabs: http://appservice.wmflabs.org/%2$s/v1/
-            \nDev: http://host:6927/%2$s/v1/
-            \n%1$s ➛ protocol (https if omitted)
-            \n%2$s ➛ WP host" />
+            android:dialogMessage="Prod: %1$s://%2$s.wikipedia.org/api/rest_v1/
+            \nBeta: https://%2$s.wikipedia.beta.wmflabs.org/api/rest_v1/
+            \nLabs: http://appservice.wmflabs.org/%2$s.wikipedia.org/v1/
+            \nDev: http://host:6927/%2$s.wikipedia.org/v1/
+            \n%1$s ➛ http or https; %2$s ➛ WP sub domain; scroll 
down for input field" />
 
         <org.wikipedia.settings.EditTextAutoSummarizePreference
             style="@style/DataStringPreference"

-- 
To view, visit https://gerrit.wikimedia.org/r/311721
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2aceab513b6761f7a18130db0f31722c0efe65f3
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND <bsitzm...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to