-
Notifications
You must be signed in to change notification settings - Fork 106
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
chore(IT Wallet): [SIW-1878] Loader before SPID Login Webview #6493
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6493 +/- ##
==========================================
- Coverage 48.42% 48.41% -0.02%
==========================================
Files 1488 1577 +89
Lines 31617 32184 +567
Branches 7669 7331 -338
==========================================
+ Hits 15311 15582 +271
- Misses 16238 16549 +311
+ Partials 68 53 -15
... and 1714 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
return ( | ||
<LoadingSpinnerOverlay isLoading={isLoading}> | ||
<View style={styles.webViewWrapper}>{content}</View> | ||
</LoadingSpinnerOverlay> | ||
); |
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.
isMachineLoading
is redundant, but we can use it in the isLoading
prop of the LoadingSpinnerOverlay
component. What do you think?
return ( | |
<LoadingSpinnerOverlay isLoading={isLoading}> | |
<View style={styles.webViewWrapper}>{content}</View> | |
</LoadingSpinnerOverlay> | |
); | |
return ( | |
<LoadingSpinnerOverlay isLoading={isLoading || isMachineLoading}> | |
<View style={styles.webViewWrapper}>{content}</View> | |
</LoadingSpinnerOverlay> | |
); |
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.
Hi @mastro993, I have conducted some tests, including the suggestion to use isMachineLoading
directly in the isLoading
property of the LoadingSpinnerOverlay
component. However, I found that if isMachineLoading
is set to true
for testing, the loader remains visible and the WebView appears underneath it.
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.
Did you try to set loadingOpacity
to 1.0
? This will make the LoadingSpinnerOverlay
completely cover the webview until it is ready.
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.
No, now I'll try. Thanks for the suggestion
!isMachineLoading && O.isSome(spidAuthUrl) ? ( | ||
<WebView | ||
cacheEnabled={false} | ||
androidCameraAccessDisabled | ||
androidMicrophoneAccessDisabled | ||
javaScriptEnabled | ||
textZoom={100} | ||
originWhitelist={originSchemasWhiteList} | ||
source={{ uri: spidAuthUrl.value }} | ||
onError={onError} | ||
onHttpError={onError} | ||
onNavigationStateChange={handleNavigationStateChange} | ||
onShouldStartLoadWithRequest={handleShouldStartLoading} | ||
allowsInlineMediaPlayback | ||
mediaPlaybackRequiresUserAction | ||
userAgent={defaultUserAgent} | ||
onLoadEnd={onLoadEnd} | ||
/> | ||
) : ( | ||
<></> | ||
), |
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.
If spidAuthUrl
is not ready or present, it likely indicates that the machine is still loading. This makes isMachineLoading
redundant in this context. I suggest we keep the original code and add a fallback to null
to prevent rendering multiple spinners. What do you think?
!isMachineLoading && O.isSome(spidAuthUrl) ? ( | |
<WebView | |
cacheEnabled={false} | |
androidCameraAccessDisabled | |
androidMicrophoneAccessDisabled | |
javaScriptEnabled | |
textZoom={100} | |
originWhitelist={originSchemasWhiteList} | |
source={{ uri: spidAuthUrl.value }} | |
onError={onError} | |
onHttpError={onError} | |
onNavigationStateChange={handleNavigationStateChange} | |
onShouldStartLoadWithRequest={handleShouldStartLoading} | |
allowsInlineMediaPlayback | |
mediaPlaybackRequiresUserAction | |
userAgent={defaultUserAgent} | |
onLoadEnd={onLoadEnd} | |
/> | |
) : ( | |
<></> | |
), | |
O.fold( | |
() => null, | |
(url: string) => ( | |
<WebView | |
key={"spid_webview"} | |
cacheEnabled={false} | |
androidCameraAccessDisabled | |
androidMicrophoneAccessDisabled | |
javaScriptEnabled | |
textZoom={100} | |
originWhitelist={originSchemasWhiteList} | |
source={{ uri: url }} | |
onError={onError} | |
onHttpError={onError} | |
onNavigationStateChange={handleNavigationStateChange} | |
onShouldStartLoadWithRequest={handleShouldStartLoading} | |
allowsInlineMediaPlayback | |
mediaPlaybackRequiresUserAction | |
userAgent={defaultUserAgent} | |
onLoadEnd={onLoadEnd} | |
/> | |
) | |
)(spidAuthUrl), |
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 that having isMachineLoading
set to true and having the auth URL at the same time is unlikely, as one depends on the other. The machine is loading first, and then it receives the auth URL. Therefore, isMachineLoading
is redundant in this context.
I'm agree with you
@@ -41,6 +37,11 @@ const ItwSpidIdpLoginScreen = () => { | |||
const spidAuthUrl = | |||
ItwEidIssuanceMachineContext.useSelector(selectAuthUrlOption); | |||
const machineRef = ItwEidIssuanceMachineContext.useActorRef(); | |||
const [isLoading, setIsLoading] = useState(true); |
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.
Adds more context. What do you think?
const [isLoading, setIsLoading] = useState(true); | |
const [isWebViewLoading, setWebViewLoading] = useState(true); |
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.
Yes, it's okay.
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
Short description
This PR fix the loader until the WebView has finished loading in
ItwSpidIdpLoginScreen
. Previously, there was a brief moment where the component appeared empty before the WebView was ready.List of changes proposed in this pull request
onLoadEnd
property to theWebView
to handle the end of the loading processHow to test
Activate "Documenti su IO" using SPID as authentication method
Warning
Tested only on Android
Screen.Recording.2024-12-04.at.14.48.44.mov