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(art advisor): enable Milestone 1 #10724

Merged
merged 6 commits into from
Sep 9, 2024

Conversation

anandaroop
Copy link
Member

@anandaroop anandaroop commented Sep 6, 2024

This PR resolves ONYX-1267

Description

Implements the following logic to determine when to serve the new home view:

  • A regular user on an app store build sees the legacy home screen by default
  • A user on a simulator/beta/TestFlight build sees the new home screen by default
  • A user can toggle a feature flag (ARPreferLegacyHomeScreen) to revert to the legacy home screen for dev/testing/QA

Or, in truth table form:

isBetaOrDev=false isBetaOrDev =true
ARPreferLegacyHomeScreen=false Old screen New screen
ARPreferLegacyHomeScreen=true Old screen Old screen

In addition the new info button presents some helpful links for reporting issues related to the new home screen, or reverting back to the old one.

m1.out.mov

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

iOS user-facing changes

Android user-facing changes

Dev changes

  • Prefer the new home screen by default in dev/test environment, but allow override - Roop

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

@anandaroop anandaroop self-assigned this Sep 6, 2024
Comment on lines +16 to +22
describe("conditional rendering of old vs new home screen", () => {
beforeEach(() => {
jest.clearAllMocks()
})

describe("when running in beta or simulator", () => {
beforeEach(() => (ArtsyNativeModule.ArtsyNativeModule.isBetaOrDev = true))
Copy link
Member Author

@anandaroop anandaroop Sep 6, 2024

Choose a reason for hiding this comment

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

This test run produces:

  conditional rendering of old vs new home screen

    when running in beta or simulator
      when ARPreferLegacyHomeScreen is false
        ✅ renders the NEW screen

      when ARPreferLegacyHomeScreen is true
        ✅ renders the old screen


    when NOT running in beta or simulator
      when ARPreferLegacyHomeScreen is false
        ✅ renders the old screen

      when ARPreferLegacyHomeScreen is true
        ✅ renders the old screen

This matches the table above: the new screen is shown only when you are running in beta/simulator and the "Prefer legacy home screen" has not been toggled on.

For dev/testing purposes you would just toggle that flag on (cc @brainbicycle)

Comment on lines +46 to +52
<LinkText
onPress={() =>
Linking.openURL("https://www.notion.so/artsy/e9958451ea9d44c6b357aba6505c0abc")
}
>
See more on how to switch back
</LinkText>
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to flesh this page out with the some non-technical instructions.

Comment on lines +30 to +37
<LinkText
fontWeight="bold"
onPress={() =>
Linking.openURL("https://www.notion.so/artsy/abc1123548504ae58051405627fb6c9f")
}
>
Notion feedback board
</LinkText>
Copy link
Member Author

Choose a reason for hiding this comment

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

And feedback board is set up now.

Comment on lines -267 to +268
ARUseNewHomeView: {
description: "Use new home view",
ARPreferLegacyHomeScreen: {
description: "Prefer legacy home screen",
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that we've replaced the old flag with this new one, with reversed semantics. Now you opt out of the new screen (when running in beta or sim).

@anandaroop anandaroop requested review from a team and brainbicycle September 6, 2024 19:18
@anandaroop anandaroop marked this pull request as ready for review September 6, 2024 19:18
@ArtsyOpenSource
Copy link
Contributor

ArtsyOpenSource commented Sep 6, 2024

This PR contains the following changes:

  • Dev changes (Prefer the new home screen by default in dev/test environment, but allow override - Roop)

Generated by 🚫 dangerJS against be597a9

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.

By default, ARPreferLegacyHomeScreen will be falsy, this means that we will be already rendering the new home view for all users which I don't think makes sense now since we have not QA'd the home properly yet and some tracking events are still missing.

Comment on lines +16 to +18
const preferLegacyHomeScreen = useFeatureFlag("ARPreferLegacyHomeScreen")

const shouldDisplayNewHomeView = ArtsyNativeModule.isBetaOrDev && !preferLegacyHomeScreen
Copy link
Member Author

@anandaroop anandaroop Sep 7, 2024

Choose a reason for hiding this comment

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

@MounirDhahri regarding your comment, I think this shouldDisplayNewHomeView condition can only be true in a beta build or simulator, no?

I am assuming that the low-level computation of isBetaOrDev means strictly that you are either in the simulator or beta, but we should be absolutely certain of that (for iOS as well as Android):

+ (BOOL)isDev;
{
#if TARGET_IPHONE_SIMULATOR
return YES;
#elif DEBUG
return YES;
#else
return NO;
#endif
}
+ (BOOL)isBeta;
{
static BOOL isBeta = NO;
static dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^{
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSString *receiptURLString = [receiptURL path];
isBeta = [receiptURLString rangeOfString:@"sandboxReceipt"].location != NSNotFound;
});
return isBeta;
}
+ (BOOL)isBetaOrDev;
{
return [self isDev] || [self isBeta];
}

Copy link
Contributor

Choose a reason for hiding this comment

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

We rely on this to default to staging in betas and prod in app and play store, so if it is not working we are in trouble 😅. It works

nickskalkin
nickskalkin previously approved these changes Sep 9, 2024
Copy link
Contributor

@nickskalkin nickskalkin left a comment

Choose a reason for hiding this comment

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

👏

brainbicycle
brainbicycle previously approved these changes Sep 9, 2024
Copy link
Contributor

@brainbicycle brainbicycle left a comment

Choose a reason for hiding this comment

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

🙌

dblandin
dblandin previously approved these changes Sep 9, 2024
Copy link
Member

@dblandin dblandin left a comment

Choose a reason for hiding this comment

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

Awesome 💯

MounirDhahri
MounirDhahri previously approved these changes Sep 9, 2024
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.

LGTM - thanks! I got it now 😄

@anandaroop
Copy link
Member Author

anandaroop commented Sep 9, 2024

Cool, thanks for all the 👀

As discussed in Onyx planning today — the last change I'll smuggle into this PR is to change the initial fetch from 5 sections to 10, to make that spinner a little less obtrusive. (b25a41c)

(UPDATE: rebasing to see if that fixes some unrelated test failures to pick up the fix for those spurious failures)

@anandaroop anandaroop force-pushed the anandaroop/ONYX-1267-milestone-1 branch from b25a41c to f719b2e Compare September 9, 2024 16:38
@anandaroop anandaroop force-pushed the anandaroop/ONYX-1267-milestone-1 branch from f719b2e to be597a9 Compare September 9, 2024 17:38
@anandaroop anandaroop merged commit 863e0f1 into main Sep 9, 2024
7 checks passed
@anandaroop anandaroop deleted the anandaroop/ONYX-1267-milestone-1 branch September 9, 2024 20:56
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.

6 participants