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

Implement onboarding slide animation #15489

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

Parveshdhull
Copy link
Member

@Parveshdhull Parveshdhull commented Mar 27, 2023

fixes: #15012
fixes: #15270
fixes: #15274
fixes: #15493

Summary

PR Implements onboarding slide animation

  • Animation will be paused when any screen opened, and the same paused state will be the background of opened screen (Not clearly visible, due to blur)
  • Animation will be resumed on returning to the intro screen

Note: Changing the slide by swiping left, or right will be implemented in a separate PR

status: ready

@Parveshdhull Parveshdhull self-assigned this Mar 27, 2023
@status-im-auto
Copy link
Member

status-im-auto commented Mar 27, 2023

Jenkins Builds

Click to see older builds (36)
Commit #️⃣ Finished (UTC) Duration Platform Result
d8d6dd1 #1 2023-03-27 07:19:28 ~2 min tests 📄log
✔️ d8d6dd1 #1 2023-03-27 07:24:04 ~6 min ios 📱ipa 📲
✔️ d8d6dd1 #1 2023-03-27 07:26:01 ~8 min android-e2e 🤖apk 📲
✔️ d8d6dd1 #1 2023-03-27 07:26:24 ~9 min android 🤖apk 📲
fe127cd #2 2023-03-27 17:45:45 ~1 min tests 📄log
✔️ fe127cd #2 2023-03-27 17:51:13 ~7 min ios 📱ipa 📲
✔️ fe127cd #2 2023-03-27 17:52:19 ~8 min android-e2e 🤖apk 📲
✔️ fe127cd #2 2023-03-27 17:52:33 ~8 min android 🤖apk 📲
065ce2b #3 2023-03-27 19:20:16 ~1 min tests 📄log
✔️ 065ce2b #3 2023-03-27 19:25:33 ~7 min ios 📱ipa 📲
✔️ 065ce2b #3 2023-03-27 19:26:49 ~8 min android-e2e 🤖apk 📲
✔️ 065ce2b #3 2023-03-27 19:26:57 ~8 min android 🤖apk 📲
b7bd6b8 #4 2023-03-27 19:44:49 ~5 min tests 📄log
✔️ b7bd6b8 #4 2023-03-27 19:47:21 ~7 min ios 📱ipa 📲
✔️ b7bd6b8 #4 2023-03-27 19:47:44 ~8 min android-e2e 🤖apk 📲
✔️ b7bd6b8 #4 2023-03-27 19:50:29 ~10 min android 🤖apk 📲
a7c2261 #5 2023-03-27 20:13:11 ~1 min tests 📄log
✔️ a7c2261 #5 2023-03-27 20:18:35 ~7 min ios 📱ipa 📲
✔️ a7c2261 #5 2023-03-27 20:19:45 ~8 min android-e2e 🤖apk 📲
✔️ a7c2261 #5 2023-03-27 20:20:01 ~8 min android 🤖apk 📲
dad52ad #6 2023-03-27 20:38:08 ~2 min tests 📄log
✔️ dad52ad #6 2023-03-27 20:43:27 ~7 min ios 📱ipa 📲
✔️ dad52ad #6 2023-03-27 20:43:49 ~7 min android-e2e 🤖apk 📲
✔️ dad52ad #6 2023-03-27 20:44:32 ~8 min android 🤖apk 📲
✔️ e91e858 #8 2023-03-27 21:25:06 ~6 min tests 📄log
✔️ e91e858 #8 2023-03-27 21:26:28 ~7 min ios 📱ipa 📲
✔️ e91e858 #8 2023-03-27 21:26:45 ~7 min android 🤖apk 📲
✔️ e91e858 #8 2023-03-27 21:27:27 ~8 min android-e2e 🤖apk 📲
✔️ 90d33f2 #9 2023-03-28 11:12:31 ~7 min tests 📄log
✔️ 90d33f2 #9 2023-03-28 11:13:09 ~8 min ios 📱ipa 📲
✔️ 90d33f2 #9 2023-03-28 11:13:40 ~8 min android-e2e 🤖apk 📲
✔️ 90d33f2 #9 2023-03-28 11:13:59 ~8 min android 🤖apk 📲
✔️ 42d2626 #10 2023-03-28 11:45:09 ~6 min tests 📄log
✔️ 42d2626 #10 2023-03-28 11:45:58 ~7 min ios 📱ipa 📲
✔️ 42d2626 #10 2023-03-28 11:46:35 ~8 min android-e2e 🤖apk 📲
✔️ 42d2626 #10 2023-03-28 11:46:56 ~8 min android 🤖apk 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 078f22e #12 2023-03-28 12:10:54 ~6 min tests 📄log
✔️ 078f22e #12 2023-03-28 12:11:46 ~7 min ios 📱ipa 📲
✔️ 078f22e #12 2023-03-28 12:11:53 ~7 min android-e2e 🤖apk 📲
✔️ 078f22e #12 2023-03-28 12:12:40 ~8 min android 🤖apk 📲
✔️ 4805234 #13 2023-03-28 15:26:56 ~7 min tests 📄log
✔️ 4805234 #13 2023-03-28 15:28:21 ~8 min android 🤖apk 📲
✔️ 4805234 #13 2023-03-28 15:28:25 ~9 min android-e2e 🤖apk 📲
4805234 #13 2023-03-28 15:28:52 ~9 min ios 📄log

@Parveshdhull Parveshdhull marked this pull request as ready for review March 27, 2023 21:22
@Parveshdhull Parveshdhull changed the title [WIP] Implement onboarding slide animation Implement onboarding slide animation Mar 27, 2023
@J-Son89
Copy link
Contributor

J-Son89 commented Mar 27, 2023

@Parveshdhull, I see you deleted the single versions of these images. I think we still need these as they are the backround for the pages that follow on the onboarding process.
We will need to add them to state and save which image is the background when the user navigates over.
e.g the carousel is on the second item and presses "I'm new to Status" then the background for the rest of the onboarding flow will be image 2

(when dark-overlay?
[:f>
(fn []
(carousel.animation/initialize-animation)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is the carousel here? 🤔
nearly all of the onboarding pages are using this background component except for the intro page and the intro page is using the carousel component.

Should we not create a separate background component for this use case?

Copy link
Member Author

Choose a reason for hiding this comment

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

nearly all of the onboarding pages are using this background component except for the intro page and the intro page is using the carousel component.

Hi, I don't understand what you mean, intro page is also using background component

image

Copy link
Contributor

Choose a reason for hiding this comment

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

ah you are right , it was not before. I understand now the other pages are using this for where the background image has stopped and the section being shown. Nicely done :D

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you

Copy link
Member

Choose a reason for hiding this comment

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

I'd use useEffect hook with empty array to do initialization stuff, any reason to not do it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @briansztamfater,
According to the react docs - Effects let you specify side effects that are caused by rendering itself
So, if I use effect here then the animation will be initialized after rendering.
But I need to initialize it before rendering, otherwise, shared-values will be nil and will throw an error.

Copy link
Contributor

Choose a reason for hiding this comment

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

what about useLayoutEffect? 🤔 https://react.dev/reference/react/useLayoutEffect

Copy link
Member Author

Choose a reason for hiding this comment

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

Just curious, how this will be different then calling function before view?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not 100% if this applies here, but useLayoutEffect works similar to useEffect except it fires before the screen is painted. It's probably safer to initialise this way in React if possible. But it's not a must have, just worth exploring :)

@Parveshdhull
Copy link
Member Author

@Parveshdhull, I see you deleted the single versions of these images. I think we still need these as they are the backround for the pages that follow on the onboarding process. We will need to add them to state and save which image is the background when the user navigates over. e.g the carousel is on the second item and presses "I'm new to Status" then the background for the rest of the onboarding flow will be image 2

Hi @J-Son89, Thank you very much for reviewing PR.
We don't need single versions because as I mentioned in PR description Animation will be paused when any screen opened, and the same paused state will be the background of opened screen

Comment on lines 30 to 56
case (progressValue < 25):
return 0;
break;
case (progressValue == 25):
return withTiming(-windowWidth, easeOut);
break;
case (progressValue < 50):
return -windowWidth;
break;
case (progressValue == 50):
return withTiming(-2 * windowWidth, easeOut);
break;
case (progressValue < 75):
return -2 * windowWidth;
break;
case (progressValue == 75):
return withTiming(-3 * windowWidth, easeOut);
break;
case (progressValue < 100):
return -3 * windowWidth;
break;
case (progressValue == 100):
return withTiming(-4 * windowWidth, easeOut);
break;
default:
return 0;
break;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe improve indentation

switch(expression) {
  case x:
    // code block
    break;
  case y:
    // code block
    break;
  default:
    // code block
}

Copy link
Member

Choose a reason for hiding this comment

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

Also break statements are not necessary as you are returning right before breaks

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe improve indentation

Can we do code formatting also for js files? cc @yqrashawn

[react-native.reanimated :as reanimated]
[utils.worklets.onboarding-carousel :as worklets.onboarding-carousel]))

(def progress (atom nil))
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder is it possible to avoid these global atoms and instead have them scoped to the onboarding stack? 🤔

Copy link
Member Author

@Parveshdhull Parveshdhull Mar 28, 2023

Choose a reason for hiding this comment

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

Maybe, we can initialize them on top of root and pass as params to other stacks.
Although we have two roots, we have to do this initialization in profiles & intro.
But just curious why we want to do that?

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 can initialize them on top of root and pass as params to other stacks

It sounds complicated to pass shared values as params to navigated screens

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I believe we want to avoid global atoms as much as possible

I understand there are exceptions and perhaps it's needed/ not so much of an issue in this case

cc: @ilmotta @ulisesmac

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for cc'ing me @J-Son89. Let's be real, global state is often not a big issue since most of our global atoms or ratoms are used only in the scope of a single namespace, at least that's how I feel. Practically speaking, it's passable 🤷‍♂️

But having said that, I still think it's weird... In one hand Clojure(Script) promotes pure code as much as possible and controlled, local state. On the other hand, ClojureScript and Reagent allow us to define state used for views outside view components, something that's a no-no in React itself. That is to say, even raw React code feels more functional than our own ClojureScript code with global vars.

It's a discussion without a clear answer to me. As usual, almost all global state is created in the name of convenience, so this is not enough to justify, at least to me.

Given this discussion come and go every now and then, maybe it's about time we write something in the guidelines if we can all agree on something. Perhaps the discussion should be made outside this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I think it would be nice to discuss this. As far as I see it one big drawback is this code becomes a lot less reusable. In this case we have other carousels in the new designs and so ideally we could use this component/code (or at least a good chunk of it) to create these carousels. Anyway if that is the case we can also let the developer who will work on these aim to refactor when they go to use this code. Ideally we can do as much as possible to enable that from the initial point code is added to the code base.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great point, reusability is one big reason to favor local state, because there's no state to synchronize between components in the first place.

@Parveshdhull Parveshdhull force-pushed the feat/improve-onboarding-screen branch from 82163cb to 078f22e Compare March 28, 2023 12:04
@VolodLytvynenko VolodLytvynenko self-assigned this Mar 28, 2023
@status-im-auto
Copy link
Member

97% of end-end tests have passed

Total executed tests: 29
Failed tests: 1
Passed tests: 28
IDs of failed tests: 702838 

Failed tests (1)

Click to expand
  • Rerun failed tests

  • Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_send_check_timestamps_sender_username, id: 702838

    Device 2: Verifying that 'hello' is under today
    Device 2: Looking for a message by text: hello

    critical/test_public_chat_browsing.py:418: in test_community_message_send_check_timestamps_sender_username
        channel.verify_message_is_under_today_text(message, self.errors)
    ../views/chat_view.py:923: in verify_message_is_under_today_text
        message_element.wait_for_visibility_of_element()
    ../views/base_element.py:135: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: ChatElementByText by xpath:`//*[starts-with(@text,'hello')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']` is not found on the screen after wait_for_visibility_of_element 
    

    [[blocked by 14797]]

    Device sessions

    Passed tests (28)

    Click to expand

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    2. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947
    Device sessions

    2. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    3. test_navigation_jump_to, id: 702936
    Device sessions

    4. test_activity_center_mentions, id: 702957
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    2. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    3. test_community_mentions_push_notification, id: 702786
    Device sessions

    4. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    5. test_community_leave, id: 702845
    Device sessions

    6. test_community_unread_messages_badge, id: 702841
    Device sessions

    7. test_community_message_delete, id: 702839
    Device sessions

    8. test_community_message_edit, id: 702843
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732
    Device sessions

    2. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    3. test_group_chat_offline_pn, id: 702808
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    2. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    2. test_1_1_chat_edit_message, id: 702855
    Device sessions

    3. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    4. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    5. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    6. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    7. test_1_1_chat_pin_messages, id: 702731
    Device sessions

    8. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    9. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    @VolodLytvynenko
    Copy link
    Contributor

    VolodLytvynenko commented Mar 28, 2023

    Hi, @Parveshdhull thank you for PR. One low-priority issue is found:

    ISSUE 1: [Androids only] The animation is paused if the Status app is closed by device's "back" button

    Steps to reproduce:

    1. Open onboarding page
    2. tap 'back' button on device
    3. Reopen the app

    Actual result:

    The animation is paused

    stops.mp4

    Expected result:

    The animation still sliding after app reopening

    ENV:

    • Real device: Huawei P20 light, version 9
    • Android Emulator: Pixel 3 XL, version 11

    @Parveshdhull
    Copy link
    Member Author

    hi @VladimrLitvinenko,
    Thank you very much for testing the PR.
    Will it be ok, if we fix this issue separately in a follow up PR?

    @VolodLytvynenko
    Copy link
    Contributor

    hi @VladimrLitvinenko, Thank you very much for testing the PR. Will it be ok, if we fix this issue separately in a follow up PR?

    @Parveshdhull Sure. No other issues from my side. PR is ready to be merged. Created this issue as a separate follow up #15522
    Thank you!

    @Parveshdhull Parveshdhull force-pushed the feat/improve-onboarding-screen branch from 078f22e to 4805234 Compare March 28, 2023 15:19
    @Parveshdhull Parveshdhull merged commit f0ca637 into develop Mar 28, 2023
    @Parveshdhull Parveshdhull deleted the feat/improve-onboarding-screen branch March 28, 2023 15:27
    Copy link
    Contributor

    @ulisesmac ulisesmac left a comment

    Choose a reason for hiding this comment

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

    I know it's merged, but I've just added a comment about the :f> use

    :end {:x 0 :y 1}
    :style (style/background-gradient-overlay dark-overlay?)}]
    (when dark-overlay?
    [:f>
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    I'd recommend to put that functional component in a different function:

    (defn my-f-component [props]
      ;;component code
      )
      
    (defn component-exposed-to-the-world [props]
      [:f> my-f-component props])

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    No open projects
    Archived in project
    8 participants