Skip to content

Commit 61a8fee

Browse files
author
Amanda Riu
committed
Move logic to method so rest of code works with changes from develop
1 parent 14d168c commit 61a8fee

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,11 +2300,7 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() {
23002300
boolean isFreeWPCom = mSite.isWPCom() && SiteUtils.onFreePlan(mSite);
23012301
boolean isWPComSite = mSite.isWPCom() || mSite.isWPComAtomic();
23022302

2303-
int hashedUserId = convertUserIdToHash(getUserId(), "can_view_editor_onboarding");
2304-
boolean canViewEditorOnboarding = !AppPrefs.hasLaunchedGutenbergEditor() && (
2305-
hashedUserId % 100 >= (100 - EDITOR_ONBOARDING_PHASE_PERCENTAGE)
2306-
|| BuildConfig.DEBUG
2307-
);
2303+
boolean enableEditorOnboarding = !AppPrefs.hasLaunchedGutenbergEditor() && canViewEditorOnboarding();
23082304

23092305
return new GutenbergPropsBuilder(
23102306
mContactInfoBlockFeatureConfig.isEnabled() && SiteUtils.supportsContactInfoFeature(mSite),
@@ -2328,21 +2324,19 @@ private GutenbergPropsBuilder getGutenbergPropsBuilder() {
23282324
* Temporary method for the Editor Onboarding project to control the percentage
23292325
* of users able to use this new editor onboarding tooltip feature. This will eventually
23302326
* be removed when the functionality is opened to all users.
2331-
*
2332-
* If the currently logged in user is a WPcom user, then return the userId associated with
2333-
* that account. If logged in via self-hosted admin creds then this value will be '0'. In this
2334-
* case we use the anonymous ID generated by Tracks saved in SharedPrefs.
2335-
*
2336-
* @return A unique ID for the logged in user
23372327
*/
2338-
private String getUserId() {
2328+
private boolean canViewEditorOnboarding() {
2329+
// Get the userId for the logged in user. If not WPcom, use the anonymous userId
2330+
// generated by tracks.
23392331
long userAccountId = mAccountStore.getAccount().getUserId();
23402332
String userId = String.valueOf(userAccountId);
23412333
if (userAccountId == 0) {
23422334
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
23432335
userId = preferences.getString("nosara_tracks_anon_id", null);
23442336
}
2345-
return userId;
2337+
2338+
int hashedUserId = convertUserIdToHash(userId, "can_view_editor_onboarding");
2339+
return hashedUserId % 100 >= (100 - EDITOR_ONBOARDING_PHASE_PERCENTAGE) || BuildConfig.DEBUG;
23462340
}
23472341

23482342
/**

0 commit comments

Comments
 (0)