Last active
November 10, 2017 16:43
-
-
Save RBonaventure/9ef0867bb5ee89a5bb2f6d14f3551206 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Les deux traces et les URLs associées : | |
* A : ReactJS | |
* B : Plain HTML | |
*/ | |
private enum RenderingType { | |
REACT_JS(Traces.REACT_JS_TIME, "https://pot-pourri-android.firebaseapp.com/reactjs"), | |
PLAIN_HTML(Traces.PLAIN_HTML_TIME, "https://pot-pourri-android.firebaseapp.com/html"); | |
private String mTraceName; | |
private String mBackendUrl; | |
RenderingType(String traceName, String backendUrl) { | |
mTraceName = traceName; | |
mBackendUrl = backendUrl; | |
} | |
String getTraceName() { | |
return mTraceName; | |
} | |
String getBackendUrl() { | |
return mBackendUrl; | |
} | |
} | |
// Récupération de la variante assignée au device par l'algorithme d'A/B Testing | |
mRenderingType = mFirebaseRemoteConfig.getBoolean( | |
RemoteConfig.REACTJS_ENABLED_KEY) ? RenderingType.REACT_JS : RenderingType.PLAIN_HTML; | |
// Utilisation la Trace adéquate | |
mRenderingTrace = FirebasePerformance.getInstance().newTrace(mRenderingType.getTraceName()); | |
// Affichage du contenu A ou B | |
mWebView.loadUrl(mRenderingType.getBackendUrl()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment