Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement activity dot indicator experiment #11319

Merged
merged 9 commits into from
Jan 2, 2025

Conversation

anandaroop
Copy link
Member

@anandaroop anandaroop commented Dec 19, 2024

This PR resolves ONYX-1465

Description

Sets up the activity dot experiment

Control Variant B Variant C
control varb varc

TODO:

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

  • Add experiment for activity indicator dots

iOS user-facing changes

Android user-facing changes

Dev changes

Need help with something? Have a look at our docs, or get in touch with us.

@anandaroop anandaroop self-assigned this Dec 19, 2024
@anandaroop anandaroop force-pushed the anandaroop/ONYX-1465-dot-experiment branch from 7e0134c to 7ce2bb9 Compare December 30, 2024 20:00
And define a payload that allows us to force the dots to display (for QA)
Strangely, I don't see how the profile icon's dot ever gets requested
so I've added the ability to force it here
@anandaroop anandaroop force-pushed the anandaroop/ONYX-1465-dot-experiment branch 2 times, most recently from 3b6fcb9 to 3114cb9 Compare December 30, 2024 22:39
@anandaroop anandaroop force-pushed the anandaroop/ONYX-1465-dot-experiment branch from 3114cb9 to ad75562 Compare December 30, 2024 22:45
@anandaroop anandaroop marked this pull request as ready for review December 30, 2024 23:55
@ArtsyOpenSource
Copy link
Contributor

ArtsyOpenSource commented Dec 30, 2024

This PR contains the following changes:

  • Cross-platform user-facing changes (Add experiment for activity indicator dots - anandaroop)

Generated by 🚫 dangerJS against 9b0dd0b

src/app/Scenes/HomeView/Components/ActivityIndicator.tsx Outdated Show resolved Hide resolved
src/app/Scenes/HomeView/Components/ActivityIndicator.tsx Outdated Show resolved Hide resolved
src/app/Scenes/HomeView/HomeView.tsx Show resolved Hide resolved
fallbackEnabled: true,
fallbackVariant: "control",
variantSuggestions: ["control", "variant-b", "variant-c"],
payloadSuggestions: ['{"forceDots": "true"}', '{"forceDots": "false"}'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm is is okay to have 3 variant and 2 payload suggestions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I believe the payload is just "additional" information that can be used in the rendering logic. That's what I'm utilizing to force the display of the activity dots for QA purposes.

// Dev Menu helper to force visible dots for testing during QA
const forceDots = Boolean(payload && JSON.parse(payload)?.forceDots === "true")

const color: Color = enabled ? (variant === "variant-b" ? "red50" : "blue100") : "blue100"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for this experiment it is fine as it doesn't touch a lot of functionality, but if it was a bigger experiment we could also use a feature flag just to make sure if something goes wrong with the implementation of the experiment we can always fall back.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Enabled toggle in Unleash effectively gives us that ability, no? That's why this logic on L14 accounts for enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if the implementation of the experiment is correct. For small experiments it should be fine not to use a ff.
I just wanted to spread the knowledge @olerichter00 shared with me while working on the Artwork card redesign - for that experiment it was recommended to use the feature flag because the experiment's logic was more complex and used in a lot of components. So if there was a mistake that affects the experiment's results we would disable the experiment and the feature flag, fix the issue and enable the ff and the experiment again
I hope it makes sense 😅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An additional Echo feature flag can be useful when implementing a feature that takes a long time across multiple app releases. In this case, enabling the flag in Unleash would also activate the feature for app versions that only have a work-in-progress state.

If the feature is ready within a single release cycle, the extra flag is unnecessary.

Copy link
Member Author

@anandaroop anandaroop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops I wrote, but forgot to submit, these comments before requesting review 🙈

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hook encapsulates the color calculation and other experiment-related features to simplify the invocation of the experiment at the various call sites.

Comment on lines +36 to +37
variantSuggestions: ["control", "variant-b", "variant-c"],
payloadSuggestions: ['{"forceDots": "true"}', '{"forceDots": "false"}'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The payload suggestions here will allow testers to force the activity dots to display, as a convenience during QA (otherwise every tester would have to tediously ensure the existence of various kinds of unseen notifications and messages.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines +74 to +78
const { trackExperiment: trackActvityDotExperiment } = useActivityDotExperiment()

useEffect(() => {
trackActvityDotExperiment()
}, [])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We fire the experiment_viewed event once per session this way.

Comment on lines +89 to 97
case "profile": {
if (forceDots) {
tabsBadges[tab] = {
tabBarBadge: unreadConversationsCount,
tabBarBadge: "",
tabBarBadgeStyle: {
backgroundColor: color("red100"),
...visualClueStyles,
},
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The profile branch of this switch statement was missing, and thus the blue profile dot is currently unable to be displayed.

After discussing with @gkartalis I think that may have been a deliberate decision, in which case we can drop this case "profile" branch as well. But in the meantime this allows us to force the dot to display during QA.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MounirDhahri this^ was our finding, in case you have any further insight on this — is the bottom nav profile icon expected to display a dot after all?

- Use new var instead of mutating destructured var from props
- Avoid 'px' in positioning props
Copy link
Contributor

@dariakoko dariakoko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments, looks good!

Copy link
Member

@MounirDhahri MounirDhahri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! thanks!

Comment on lines +36 to +37
variantSuggestions: ["control", "variant-b", "variant-c"],
payloadSuggestions: ['{"forceDots": "true"}', '{"forceDots": "false"}'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@anandaroop anandaroop merged commit a04dab7 into main Jan 2, 2025
7 checks passed
@anandaroop anandaroop deleted the anandaroop/ONYX-1465-dot-experiment branch January 2, 2025 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants