-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Anonymous Analytics User Profile EPIC - (WPB-8978) (#2887)
* feat: add analytics user profile - Part 1 (WPB-8978) (#2868) * feat: add method to set/insert tracking identifier into user metadata table * feat: add MessageContent for DataTransfer with TrackingIdentifier * feat: add DataTransferEventHandler to handle new data transfer events and set tracking identifier to user config metadata * chore: remove needless blank line * feat: add analytics user profile - Part 2 (WPB-8978) (#2877) * feat: add method to set/insert tracking identifier into user metadata table * feat: add MessageContent for DataTransfer with TrackingIdentifier * feat: add DataTransferEventHandler to handle new data transfer events and set tracking identifier to user config metadata * chore: remove needless blank line * feat: add get for current tracking identifier and get and set for previous tracking identifier * feat: add usage and logic handling for current and previous tracking identifiers * feat: add tests * feat: add better handling of receiving already existing tracking id and tests * feat: add new analytics logger to kalium logger * feat: add usecase to observe analytics tracking identifier * feat: add tests for observeAnalyticsTrackingIdentifierStatus * feat: add none AnalyticsIdentifierResult to be used in AR and remove abstract attribute * feat: add proper mapping to observer result and verification on Either Left is tracking identifier already exists * feat: add tests for observer with new logic * chore: add user scope logger * chore: add `as` instantiation of right value for usecase result * feat: move AnalyticsIdentifierResult to new data module and update its usages * feat: add usecase to delete previous tracking identifier * chore: add missing imports * test: add test for DeletePreviousTrackingIdentifierUseCase * chore: remove delete previous tracking identifier use case * feat: add extra sealed interface for better handling of analytics identifier result * feat: add AnalyticsIdentifierManager to handle migration complete and propagating tracking identifier * chore: add missing extension from new sealed interface * test: add tests for AnalyticsIdentifierManager * chore: adjust detekt * chore: remove unused import * chore: rename user config current tracking identifier * chore: add docs
- Loading branch information
1 parent
afefda7
commit f534d36
Showing
20 changed files
with
966 additions
and
6 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
data/src/commonMain/kotlin/com/wire/kalium/logic/data/analytics/AnalyticsIdentifierResult.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2024 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
|
||
package com.wire.kalium.logic.data.analytics | ||
|
||
sealed interface AnalyticsIdentifierResult { | ||
|
||
/** | ||
* To be used when there is no user logged in or analytics settings is disabled. | ||
*/ | ||
data object Disabled : AnalyticsIdentifierResult | ||
|
||
/** | ||
* Wrapper: To be used when there is a user logged in and analytics settings is enabled. | ||
*/ | ||
sealed interface Enabled : AnalyticsIdentifierResult { | ||
val identifier: String | ||
} | ||
|
||
/** | ||
* To be used when user first login to device, generating a new identifier and sending over to other clients. | ||
*/ | ||
data class NonExistingIdentifier( | ||
override val identifier: String | ||
) : Enabled | ||
|
||
/** | ||
* To be used when user already has a tracking identifier, meaning no migration will be done. | ||
*/ | ||
data class ExistingIdentifier( | ||
override val identifier: String | ||
) : Enabled | ||
|
||
/** | ||
* To be used when user is already logged in and receive a new tracking identifier from another client, | ||
* it needs to set received tracking identifier as current identifier with migration. | ||
* (migrate old identifier events to new identifier) | ||
*/ | ||
data class MigrationIdentifier( | ||
override val identifier: String | ||
) : Enabled | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.