-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Added sync indicator #2810
Added sync indicator #2810
Conversation
<Icon | ||
src={Sync} | ||
fill={themeColors.textReversed} | ||
width="100%" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawnborton But indicator size is 12x12 including 2px transparent border around. So Green circle is 8x8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want the indicator to become larger when we are showing that content is syncing. So the green online indicator should grow in size and then show the spinning icon inside of it. Let me know if that makes sense - happy to make a prototype as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK after growing, it should be 16px. makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawnborton It looks a little big. Don't you think so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or if this is looking fine, let me know I will update the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawnborton any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it looks big. I think ideally the size of the indicator wouldn't need to change – we just show the spinning icon in the normal-size indicator if it's loading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Amal Nazeem <amalnazeem@gmail.com>
Co-authored-by: Amal Nazeem <amalnazeem@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - I'm might get someone to double check me. But I'd also wait for Shawn to get back to you on the icon size.
Added myself as a review to help buddy-check @TomatoToaster. @parasharrajat Will review tomorrow 👍 |
Hey @parasharrajat can you please include screenshots for the other platforms? Also, I edited the tests + qa steps to clarify them and add platform-specific instructions. Also, do you have any recommendations for testing this on an iOS simulator/Android emulator? |
Let me add screenshots for all devices. Thanks for updating the steps.
Currently not. |
Apologies @parasharrajat as I was out of office yesterday. I'll review this soon! |
const indicatorStyles = [ | ||
styles.alignItemsCenter, | ||
styles.justifyContentCenter, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've tried to take a pretty hard stance against inline styles. In this scenario, we would usually make a function in styles.js
called getAvatarIndicatorStyles
or something and dynamically generate these styles in there. You can see how I handed transforms in a dynamic style function in src/styles/getTooltipSyles.js
. We haven't really decided whether dynamic style generators should be in their own module or directly in styles.js
, so it's up to you! Since it's probably just one function, I would probably put it directly in styles.js
<Icon | ||
src={Sync} | ||
fill={themeColors.textReversed} | ||
width="100%" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it looks big. I think ideally the size of the indicator wouldn't need to change – we just show the spinning icon in the normal-size indicator if it's loading.
@parasharrajat During my testing on iOS I was able to successfully test this the first time the app loads. However, repeating the same steps I am unable to get it to work again. Could this be related to needing FWIW I see three ways to test this locally on iOS:
|
Looking at my ngrok logs it seems like the problem is like this:
|
@roryabraham Sorry. I just found something is off but yet to find where exactly. Animation does not seem to Loop well. Please hold your testing until I push a fix to that. I see successful state change without shouldComponentUpdate as In absence of this by default shallow matching will be done for props and thus it will work without adding custom |
@shawnborton Does this look right? indicator-w.mp4 |
This looks great Rajat! Could you just slightly speed up the speed of the icon rotating? Otherwise I think it's good to go. |
Ready for review. |
<Icon | ||
src={Sync} | ||
fill={themeColors.textReversed} | ||
width={6} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure I am following, when the indicator is in syncing mode, the small white icon that spins is shown at 6x6?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not setting the width & height for the indicator. Instead, I use scaling which is Smooth. So when we scale the green dot, all its children including the icon will scale. 8px icon was looking big when scaling so I have adjusted it and found 6px is looking fine.
Scaling using fixed px is not smooth as the indicator is absolutely placed thus when we increase width & height, It changes location and does not look good. Oppose to what scaling keeps the center and scale uniformly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense to me and sounds good!
@parasharrajat When testing this on iOS I was able to get it in a state where it is "stuck" syncing. All I did was turn off wifi and then turn it back on using the Network Link Conditioner tool. |
Ok. Let me check it with Network Link Conditioner. |
@roryabraham Not sure how to turn off the WIfi with NLC. I would definitely need that tip but I tried 100% loss profile and On bringing the app on foreground from background, I also saw that syncing never stops~~(takes like 5 mins). I checked the logs it seems that Updatefor some cases, |
Yeah, this is what I meant by "turn off Wifi". Sorry it that wasn't clear.
I think that since this PR introduces a visual indication of the state of that key, we should not merge it until the key is being successfully updated when we expect it to. |
Agree, let me see what happens with the |
@roryabraham |
@parasharrajat Sorry, I still can't seem to get this working on iOS. 😕 It seems to spin forever, regardless of the state of the network connection. Can you provide a screencast of it working on iOS? The code seems fine, so it could be something weird with ngrok, or my VM or something. I don't want to block you on this forever, but I also can't approve this without seeing it work on all platforms. If you can provide a screencast of this working on iOS I might be willing to just merge this and see if it works on staging. |
Sure @roryabraham. I will share the Screencast. |
@TomatoToaster Did this work for you? |
@roryabraham Here is a recording. Its little Blurry due to resolution but functionality can be seen well. indicator-ios.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, looks good to me. Thanks for providing screen recordings on all platforms.
@shawnborton Code looks good to me. I'll let you to a final design review, then if everything looks good feel free to merge once all the checks pass. |
Looks good to me design-wise! |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Please review.
Details
Added sync indicator which is shown when
ONYXKEYS.IS_LOADING_AFTER_RECONNECT
istrue
Fixed Issues
Fixes #2606
Tests
Web/Desktop
QA Steps
Web/Desktop
iOS/Android/mWeb
Tested On
Screenshots
Web
indicator-w.mp4
Mobile Web
1621372645191.mp4
Desktop
indicator-d.mp4
iOS
indicator-ios.mp4
Android
1621371423054.mp4