File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed
google-secure-signals-integration/with_sdk_v3/views Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 2929 $ ( '#login_required' ) . text (
3030 sdk . isLoginRequired ( ) || sdk . isLoginRequired ( ) === undefined ? 'yes' : 'no'
3131 ) ;
32- $ ( `#has_opted_out` ) . text (
33- sdk . hasOptedOut ( ) ? 'yes' : 'no'
34- ) ;
32+ $ ( `#has_opted_out` ) . text ( sdk . hasOptedOut ( ) ? 'yes' : 'no' ) ;
3533 $ ( '#update_counter' ) . text ( callbackCounter ) ;
3634 $ ( '#identity_state' ) . text ( String ( JSON . stringify ( state , null , 2 ) ) ) ;
3735
Original file line number Diff line number Diff line change 1- <!doctype html>
1+ <!DOCTYPE html>
22< html >
33 < head >
44 < meta charset ="UTF-8 " />
Original file line number Diff line number Diff line change @@ -181,16 +181,20 @@ export abstract class SdkBase {
181181 return this . _initComplete ;
182182 }
183183
184- /**
185- * Deprecated
186- */
187184 public isLoginRequired ( ) {
188- return this . hasIdentity ( ) ;
185+ return ! this . isIdentityAvailable ( ) ;
189186 }
190187
188+ /**
189+ * @deprecated in version 3.10.0. Will remove in June 2025. Use isIdentityAvailable() instead.
190+ **/
191191 public hasIdentity ( ) {
192192 if ( ! this . _initComplete ) return undefined ;
193- return ! ( this . isLoggedIn ( ) || this . _apiClient ?. hasActiveRequests ( ) ) ;
193+ return ! ( this . isIdentityValid ( ) || this . _apiClient ?. hasActiveRequests ( ) ) ;
194+ }
195+
196+ public isIdentityAvailable ( ) {
197+ return this . isIdentityValid ( ) || this . _apiClient ?. hasActiveRequests ( ) ;
194198 }
195199
196200 public hasOptedOut ( ) {
@@ -295,8 +299,9 @@ export abstract class SdkBase {
295299 if ( this . hasOptedOut ( ) ) this . _callbackManager . runCallbacks ( EventType . OptoutReceived , { } ) ;
296300 }
297301
298- private isLoggedIn ( ) {
299- return this . _identity && ! hasExpired ( this . _identity . refresh_expires ) ;
302+ private isIdentityValid ( ) {
303+ const identity = this . _identity ?? this . getIdentityNoInit ( ) ;
304+ return identity && ! hasExpired ( identity . refresh_expires ) ;
300305 }
301306
302307 private temporarilyUnavailable ( identity : Identity | OptoutIdentity | null | undefined ) {
You can’t perform that action at this time.
0 commit comments