Remy Benza
04/15/2025, 9:52 AMisNew boolean inside SessionStatus class, is this a 100% guarantee the user is really new? meaning the supabase user database has no record for this user? Meaning if i sign in from a different platform (eg ios) and then sign in with same account on android the isNew will return false? Even when the session on that device is 'new' (no local storage)Remy Benza
04/15/2025, 9:54 AM/**
* Whether the session is new, i.e. [source] is [SessionSource.SignIn], [SessionSource.SignUp] or [SessionSource.External].
* Use this to determine whether this status is the result of a new sign in or sign up or just a session refresh.
*/
val isNew: Boolean = source is SessionSource.SignIn || source is SessionSource.SignUp || source is SessionSource.External
this is what the docs, i want to rely user purchase actions on this boolean, so its important its always correct 🙂Remy Benza
04/15/2025, 9:55 AMJan
04/15/2025, 9:56 AMRemy Benza
04/15/2025, 9:59 AMSessionStatus should provide me with info whether or not this user has signed in beforeJan
04/15/2025, 10:08 AMSessionStatus does not know if there is data in other tables for your user, you'd have to implement that logic yourself.
What isNew checks, is whether the user just logged in, so there was no previous session before on this device (e.g. this would not be the case if the session was refreshed, so its not new)Remy Benza
04/15/2025, 10:10 AMsupabaseClient.auth.sessionStatus stateflow to check if an authenticated user is 'new' in the definition I just gave?Remy Benza
04/15/2025, 10:11 AMappMetaData or userMetadata JsonObjectsRemy Benza
04/15/2025, 10:12 AMRemy Benza
04/15/2025, 10:13 AMJan
04/15/2025, 10:17 AMi could look in theEither store a boolean in there on sign up, or maybe checking iforappMetaDataJsonObjectsuserMetadata
supabaseClient.auth.currentUserOrNull()?.lastSignInAt is null (so there was no previous sign in?) but I'd check that with a new accountJan
04/15/2025, 10:23 AMRemy Benza
04/15/2025, 10:23 AMlastSignInAt seems a good fit, im gonna test it with new account, thnxRemy Benza
04/15/2025, 12:37 PMlastSignInAt is still not null, and its also not the same value as createdAt, both are an Instant and around 50ms apart. So basing logic on that but its not best option