WIP - Start a new session on a new app install#1896
Closed
nan-li wants to merge 1 commit intouser-model/mainfrom
Closed
WIP - Start a new session on a new app install#1896nan-li wants to merge 1 commit intouser-model/mainfrom
nan-li wants to merge 1 commit intouser-model/mainfrom
Conversation
e9a6927 to
b6e54be
Compare
Background: Each session has an `isValid` property that is read at the start of a potential new session. If this value read is `false`, then a new session will start and its property is set to `true`. If this value read is `true`, that means we continue on this same previous session. At the end of the session, this property will be set to `false`. Problem: On a brand new app install, we were defaulting this value to `true`, which means the logic to trigger a new session will not happen, since the SDK will believe it should continue from a previous session. However, this is the first time the app is opened after a new install. Solution: By defaulting instead to `false`, we ensure that this first app open will start a new session. In addition, this will trigger a `TRACK_SESSION_START` operation and ask the server to `refresh_device_metadata`, updating country and IP for this user.
b6e54be to
4157b33
Compare
Contributor
Author
|
See instead #1932 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP - whether or not to do this
Description
One Line Summary
REQUIRED - Very short description that summaries the changes in this PR.
Details
Background:
Each session has an
isValidproperty that is read at the start of a potential new session. If this value read isfalse, then a new session will start and its property is set totrue. If this value read istrue, that means we continue on this same previous session.At the end of the session, this property will be set to
false.Problem:
On a brand new app install, we were defaulting this value to
true, which means the logic to trigger a new session will not happen, since the SDK will believe it should continue from a previous session. However, this is the first time the app is opened after a new install.Solution:
By defaulting instead to
false, we ensure that this first app open will start a new session. In addition, this will trigger aTRACK_SESSION_STARToperation and ask the server torefresh_device_metadata, updating country and IP for this user.Sending this request body:
{ "refresh_device_metadata":true, "deltas":{"session_count":1} }This is in line with what the iOS SDK does on a new app install as well.
Motivation
The primary motivation is to send a request to update country and IP after creating a user on a new app install. Secondary motivation is starting off the very first session correctly.
Scope
Affects the very first session on a new app install.
Testing
Unit testing
None
Manual testing
Tested on Android emulator API 33
{"refresh_device_metadata":true, "deltas":{"session_count":1}}Affected code checklist
Checklist
Overview
Testing
Final pass
This change is