Skip to content

Commit

Permalink
DROID-1282 Settings | Analytics | File storage events (#3172)
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantiniiv authored and uburoiubu committed May 30, 2023
1 parent b9dda54 commit f7b9d45
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ object EventsDictionary {
const val accountDataSettingsShow = "ScreenSettingsAccountData"
const val aboutScreenShow = "ScreenSettingsAbout"
const val appearanceScreenShow = "ScreenSettingsAppearance"
const val screenSettingsStorage = "ScreenSettingsStorage"
const val screenSettingsStorageManage = "ScreenSettingsStorageManage"
const val screenSettingsStorageOffload = "SettingsStorageOffload"

// Object events
const val objectListDelete = "RemoveCompletely"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1457,4 +1457,22 @@ suspend fun Analytics.sendScreenHomeEvent() {
}
)
)
}

suspend fun Analytics.sendSettingsStorageEvent() {
sendEvent(
eventName = EventsDictionary.screenSettingsStorage
)
}

suspend fun Analytics.sendSettingsStorageManageEvent() {
sendEvent(
eventName = EventsDictionary.screenSettingsStorageManage
)
}

suspend fun Analytics.sendSettingsOffloadEvent() {
sendEvent(
eventName = EventsDictionary.screenSettingsStorageOffload
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import com.anytypeio.anytype.domain.device.ClearFileCache
import com.anytypeio.anytype.domain.library.StoreSearchByIdsParams
import com.anytypeio.anytype.domain.library.StorelessSubscriptionContainer
import com.anytypeio.anytype.domain.misc.UrlBuilder
import com.anytypeio.anytype.presentation.extension.sendSettingsOffloadEvent
import com.anytypeio.anytype.presentation.extension.sendSettingsStorageEvent
import com.anytypeio.anytype.presentation.extension.sendSettingsStorageManageEvent
import com.anytypeio.anytype.presentation.spaces.SpaceGradientProvider
import com.anytypeio.anytype.presentation.spaces.SpaceIconView
import com.anytypeio.anytype.presentation.spaces.spaceIcon
Expand Down Expand Up @@ -61,6 +64,7 @@ class FilesStorageViewModel(
.onEach { event -> dispatchCommand(event) }
.launchIn(viewModelScope)
subscribeToSpace()
viewModelScope.launch { analytics.sendSettingsStorageEvent() }
}

fun onClearFileCacheAccepted() {
Expand Down Expand Up @@ -97,9 +101,11 @@ class FilesStorageViewModel(
when (event) {
Event.OnManageFilesClicked -> {
commands.emit(Command.OpenRemoteStorageScreen(subscription = Subscription.Files.id))
analytics.sendSettingsStorageManageEvent()
}
Event.OnOffloadFilesClicked -> {
commands.emit(Command.OpenOffloadFilesScreen)
analytics.sendSettingsOffloadEvent()
}
}
}
Expand Down

0 comments on commit f7b9d45

Please sign in to comment.