-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/killswitch' of github.com:mirego/kmp-boilerplat…
…e into feature/killswitch
- Loading branch information
Showing
38 changed files
with
450 additions
and
77 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
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
30 changes: 30 additions & 0 deletions
30
...p/src/main/java/com/mirego/kmp/boilerplate/app/analytics/AndroidSharedAnalyticsService.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,30 @@ | ||
package com.mirego.kmp.boilerplate.app.analytics | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import com.google.firebase.analytics.FirebaseAnalytics | ||
import com.mirego.kmp.boilerplate.analytics.SharedAnalyticsService | ||
import com.mirego.trikot.analytics.AnalyticsEvent | ||
import com.mirego.trikot.analytics.AnalyticsPropertiesType | ||
|
||
class AndroidSharedAnalyticsService( | ||
context: Context, | ||
private var analyticsEnabled: Boolean = true | ||
) : SharedAnalyticsService { | ||
private var firebaseAnalytics = FirebaseAnalytics.getInstance(context) | ||
|
||
override var isEnabled: Boolean | ||
get() = analyticsEnabled | ||
set(value) { | ||
analyticsEnabled = value | ||
firebaseAnalytics.setAnalyticsCollectionEnabled(value) | ||
} | ||
|
||
override fun trackEvent(event: AnalyticsEvent, properties: AnalyticsPropertiesType) { | ||
val bundle = Bundle() | ||
properties.forEach { | ||
bundle.putString(it.key, it.value.toString()) | ||
} | ||
firebaseAnalytics.logEvent(event.name, bundle) | ||
} | ||
} |
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
13 changes: 12 additions & 1 deletion
13
androidApp/src/main/java/com/mirego/kmp/boilerplate/app/resources/AndroidImageProvider.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,9 +1,20 @@ | ||
package com.mirego.kmp.boilerplate.app.resources | ||
|
||
import android.content.Context | ||
import com.mirego.kmp.boilerplate.R | ||
import com.mirego.kmp.boilerplate.viewmodel.common.SharedImageResource | ||
import com.mirego.trikot.viewmodels.declarative.configuration.VMDImageProvider | ||
import com.mirego.trikot.viewmodels.declarative.properties.VMDImageResource | ||
|
||
class AndroidImageProvider : VMDImageProvider { | ||
override fun resourceIdForResource(resource: VMDImageResource, context: Context) = null | ||
override fun resourceIdForResource(resource: VMDImageResource, context: Context) = when (resource) { | ||
is SharedImageResource -> when (resource) { | ||
SharedImageResource.emptyPageIcon -> R.drawable.baseline_question_mark_24 | ||
SharedImageResource.errorPageIcon -> R.drawable.baseline_warning_24 | ||
SharedImageResource.imagePlaceholder -> R.drawable.baseline_image_24 | ||
SharedImageResource.closeIcon -> TODO() | ||
} | ||
|
||
else -> null | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
androidApp/src/main/java/com/mirego/kmp/boilerplate/app/ui/common/Utils.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,17 @@ | ||
package com.mirego.kmp.boilerplate.app.ui.common | ||
|
||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import com.google.accompanist.placeholder.PlaceholderHighlight | ||
import com.google.accompanist.placeholder.placeholder | ||
import com.google.accompanist.placeholder.shimmer | ||
import com.mirego.kmp.boilerplate.app.ui.theme.ShimmerBackground | ||
import com.mirego.kmp.boilerplate.app.ui.theme.ShimmerHighlight | ||
|
||
fun Modifier.loading(isLoading: Boolean) = this.then( | ||
placeholder( | ||
visible = isLoading, | ||
highlight = PlaceholderHighlight.shimmer(highlightColor = Color.ShimmerHighlight), | ||
color = Color.ShimmerBackground | ||
) | ||
) |
Oops, something went wrong.