Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ class StoreInstallationViewModel @Inject constructor(
init {
if (!savedStateHandle.contains(STORE_DATA_KEY)) {
storeData = newStore.data
if (storeData.siteId == null) {
storeData = storeData.copy(siteId = appPrefsWrapper.createdStoreSiteId)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case the values from memory were whipped due to process death, we retrieve the required siteId for the new site from sharedPreferences.

}
check(storeData.siteId != null) { "Store data must contain site id during store creation" }
}

analyticsTrackerWrapper.track(
Expand All @@ -102,7 +106,7 @@ class StoreInstallationViewModel @Inject constructor(

val properties = mapOf(
AnalyticsTracker.KEY_SOURCE to appPrefsWrapper.getStoreCreationSource(),
AnalyticsTracker.KEY_URL to storeData.domain!!,
AnalyticsTracker.KEY_URL to storeData.domain,
Comment on lines -105 to +109
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The domain value is only for tracking purposes. So in the case of process death, it will be null and the !! will be causing the app to crash. Removed it. For the very few corner cases where storeData is null, we'll be tracking a null value, but is not a problem.

AnalyticsTracker.KEY_FLOW to AnalyticsTracker.VALUE_NATIVE,
AnalyticsTracker.KEY_IS_FREE_TRIAL to true
)
Expand Down