-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #957 from StepicOrg/feature/APPS_3612_fix_parcelab…
…le_crash APPS-3612: Fix parcelable crash
- Loading branch information
Showing
24 changed files
with
144 additions
and
106 deletions.
There are no files selected for viewing
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
36 changes: 36 additions & 0 deletions
36
app/src/main/java/org/stepik/android/domain/base/analytic/AnalyticEventExtensions.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,36 @@ | ||
package org.stepik.android.domain.base.analytic | ||
|
||
import android.os.Bundle | ||
import androidx.core.os.bundleOf | ||
|
||
const val BUNDLEABLE_ANALYTIC_EVENT = "bundleable_analytic_event" | ||
|
||
private const val BUNDLEABLE_EVENT_NAME = "bundleable_event_name" | ||
private const val BUNDLEABLE_EVENT_PARAMS = "bundleable_event_params" | ||
|
||
fun AnalyticEvent.toBundle(): Bundle = | ||
bundleOf( | ||
BUNDLEABLE_EVENT_NAME to name, | ||
BUNDLEABLE_EVENT_PARAMS to bundleOf(*params.map { (a, b) -> a to b }.toTypedArray()) | ||
) | ||
|
||
fun Bundle.toAnalyticEvent(): AnalyticEvent? { | ||
val eventName = getString(BUNDLEABLE_EVENT_NAME) | ||
val eventParams = getBundle(BUNDLEABLE_EVENT_PARAMS) | ||
return if (eventName == null) { | ||
null | ||
} else { | ||
object : AnalyticEvent { | ||
override val name: String = | ||
eventName | ||
|
||
override val params: Map<String, Any> = | ||
eventParams?.let { bundle -> | ||
bundle | ||
.keySet() | ||
.mapNotNull { key -> bundle[key]?.let { value -> key to value } } | ||
.toMap() | ||
} ?: emptyMap() | ||
} | ||
} | ||
} |
5 changes: 0 additions & 5 deletions
5
app/src/main/java/org/stepik/android/domain/base/analytic/ParcelableAnalyticEvent.kt
This file was deleted.
Oops, something went wrong.
12 changes: 5 additions & 7 deletions
12
...ava/org/stepik/android/domain/personal_deadlines/analytic/DeadlinesNotificationClicked.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
12 changes: 5 additions & 7 deletions
12
...a/org/stepik/android/domain/personal_deadlines/analytic/DeadlinesNotificationDismissed.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
6 changes: 2 additions & 4 deletions
6
...a/org/stepik/android/domain/purchase_notification/analytic/PurchaseNotificationClicked.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
6 changes: 2 additions & 4 deletions
6
...org/stepik/android/domain/purchase_notification/analytic/PurchaseNotificationDismissed.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
6 changes: 2 additions & 4 deletions
6
app/src/main/java/org/stepik/android/domain/remind/analytic/RemindAppNotificationClicked.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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
package org.stepik.android.domain.remind.analytic | ||
|
||
import kotlinx.android.parcel.Parcelize | ||
import org.stepik.android.domain.base.analytic.ParcelableAnalyticEvent | ||
import org.stepik.android.domain.base.analytic.AnalyticEvent | ||
|
||
@Parcelize | ||
object RemindAppNotificationClicked : ParcelableAnalyticEvent { | ||
object RemindAppNotificationClicked : AnalyticEvent { | ||
override val name: String = | ||
"Remind app notification clicked" | ||
} |
6 changes: 2 additions & 4 deletions
6
...src/main/java/org/stepik/android/domain/remind/analytic/RemindAppNotificationDismissed.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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
package org.stepik.android.domain.remind.analytic | ||
|
||
import kotlinx.android.parcel.Parcelize | ||
import org.stepik.android.domain.base.analytic.ParcelableAnalyticEvent | ||
import org.stepik.android.domain.base.analytic.AnalyticEvent | ||
|
||
@Parcelize | ||
object RemindAppNotificationDismissed : ParcelableAnalyticEvent { | ||
object RemindAppNotificationDismissed : AnalyticEvent { | ||
override val name: String = | ||
"Remind app notification dismissed" | ||
} |
6 changes: 2 additions & 4 deletions
6
...n/java/org/stepik/android/domain/remind/analytic/RemindRegistrationNotificationClicked.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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
package org.stepik.android.domain.remind.analytic | ||
|
||
import kotlinx.android.parcel.Parcelize | ||
import org.stepik.android.domain.base.analytic.ParcelableAnalyticEvent | ||
import org.stepik.android.domain.base.analytic.AnalyticEvent | ||
|
||
@Parcelize | ||
object RemindRegistrationNotificationClicked : ParcelableAnalyticEvent { | ||
object RemindRegistrationNotificationClicked : AnalyticEvent { | ||
override val name: String = | ||
"Remind registration notification clicked" | ||
} |
6 changes: 2 additions & 4 deletions
6
...java/org/stepik/android/domain/remind/analytic/RemindRegistrationNotificationDismissed.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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
package org.stepik.android.domain.remind.analytic | ||
|
||
import kotlinx.android.parcel.Parcelize | ||
import org.stepik.android.domain.base.analytic.ParcelableAnalyticEvent | ||
import org.stepik.android.domain.base.analytic.AnalyticEvent | ||
|
||
@Parcelize | ||
object RemindRegistrationNotificationDismissed : ParcelableAnalyticEvent { | ||
object RemindRegistrationNotificationDismissed : AnalyticEvent { | ||
override val name: String = | ||
"Remind registration notification dismissed" | ||
} |
12 changes: 5 additions & 7 deletions
12
...rc/main/java/org/stepik/android/domain/retention/analytic/RetentionNotificationClicked.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
12 changes: 5 additions & 7 deletions
12
.../main/java/org/stepik/android/domain/retention/analytic/RetentionNotificationDismissed.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
10 changes: 4 additions & 6 deletions
10
app/src/main/java/org/stepik/android/domain/streak/analytic/StreakNotificationClicked.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
10 changes: 4 additions & 6 deletions
10
app/src/main/java/org/stepik/android/domain/streak/analytic/StreakNotificationDismissed.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
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.