Compare commits
1 commit
54fb000cc8
...
9febeae894
Author | SHA1 | Date | |
---|---|---|---|
9febeae894 |
7 changed files with 57 additions and 16 deletions
|
@ -16,18 +16,7 @@ object PiHelperModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun providesAnalyticsHelper(): AnalyticsHelper = object : AnalyticsHelper {
|
fun providesAnalyticsHelper(): AnalyticsHelper = PlausibleAnalyticsHelper
|
||||||
override fun pageView(route: Route) {
|
|
||||||
// Not implemented
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun event(
|
|
||||||
event: AnalyticsEvent,
|
|
||||||
route: Route
|
|
||||||
) {
|
|
||||||
// Not implemented
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
|
|
|
@ -7,4 +7,6 @@
|
||||||
<string name="action_disable_30_seconds_short">Disable for 30 seconds</string>
|
<string name="action_disable_30_seconds_short">Disable for 30 seconds</string>
|
||||||
<string name="action_disable_5_minutes">Disable for 5 minutes</string>
|
<string name="action_disable_5_minutes">Disable for 5 minutes</string>
|
||||||
<string name="action_disable_5_minutes_short">Disable for 5 minutes</string>
|
<string name="action_disable_5_minutes_short">Disable for 5 minutes</string>
|
||||||
|
<string name="plausible_domain">pihelper.android.wbrawner.com</string>
|
||||||
|
<string name="plausible_host">https://plausible.wbrawner.com</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,15 +1,38 @@
|
||||||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlin.jvm)
|
kotlin("jvm")
|
||||||
alias(libs.plugins.compose)
|
id("org.jetbrains.compose")
|
||||||
alias(libs.plugins.jetbrainsCompose)
|
|
||||||
java
|
java
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.wbrawner.pihelper"
|
group = "com.wbrawner.pihelper"
|
||||||
version = "1.0-SNAPSHOT"
|
version = "1.0-SNAPSHOT"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
||||||
|
google()
|
||||||
|
}
|
||||||
|
|
||||||
|
val osName = System.getProperty("os.name")
|
||||||
|
val targetOs = when {
|
||||||
|
osName == "Mac OS X" -> "macos"
|
||||||
|
osName.startsWith("Win") -> "windows"
|
||||||
|
osName.startsWith("Linux") -> "linux"
|
||||||
|
else -> error("Unsupported OS: $osName")
|
||||||
|
}
|
||||||
|
|
||||||
|
val targetArch = when (val osArch = System.getProperty("os.arch")) {
|
||||||
|
"x86_64", "amd64" -> "x64"
|
||||||
|
"aarch64" -> "arm64"
|
||||||
|
else -> error("Unsupported arch: $osArch")
|
||||||
|
}
|
||||||
|
|
||||||
|
val skikoVersion = "0.7.77" // or any more recent version
|
||||||
|
val target = "${targetOs}-${targetArch}"
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Note, if you develop a library, you should use compose.desktop.common.
|
// Note, if you develop a library, you should use compose.desktop.common.
|
||||||
// compose.desktop.currentOs should be used in launcher-sourceSet
|
// compose.desktop.currentOs should be used in launcher-sourceSet
|
||||||
|
@ -17,8 +40,9 @@ dependencies {
|
||||||
// With compose.desktop.common you will also lose @Preview functionality
|
// With compose.desktop.common you will also lose @Preview functionality
|
||||||
implementation(project(":shared"))
|
implementation(project(":shared"))
|
||||||
implementation(compose.desktop.currentOs)
|
implementation(compose.desktop.currentOs)
|
||||||
|
// implementation("org.jetbrains.skiko:skiko-awt-runtime-$target:$skikoVersion")
|
||||||
implementation(libs.kotlinx.coroutines.jvm)
|
implementation(libs.kotlinx.coroutines.jvm)
|
||||||
implementation(libs.logback.classic)
|
implementation("ch.qos.logback:logback-classic:1.4.5")
|
||||||
}
|
}
|
||||||
|
|
||||||
compose.desktop {
|
compose.desktop {
|
||||||
|
|
|
@ -23,6 +23,7 @@ material = "1.12.0"
|
||||||
maxSdk = "35"
|
maxSdk = "35"
|
||||||
minSdk = "23"
|
minSdk = "23"
|
||||||
okhttp = "4.10.0"
|
okhttp = "4.10.0"
|
||||||
|
plausible = "0.1.0-SNAPSHOT"
|
||||||
settings = "0.8.1"
|
settings = "0.8.1"
|
||||||
versionCode = "5"
|
versionCode = "5"
|
||||||
versionName = "1.1.1"
|
versionName = "1.1.1"
|
||||||
|
@ -62,6 +63,7 @@ material = { module = "com.google.android.material:material", version.ref = "mat
|
||||||
mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" }
|
mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" }
|
||||||
multiplatform-settings = { module = "com.russhwolf:multiplatform-settings-no-arg", version.ref = "settings" }
|
multiplatform-settings = { module = "com.russhwolf:multiplatform-settings-no-arg", version.ref = "settings" }
|
||||||
navigation-compose = { module = "androidx.navigation:navigation-compose", version = "navigation" }
|
navigation-compose = { module = "androidx.navigation:navigation-compose", version = "navigation" }
|
||||||
|
plausible = { module = "com.wbrawner.plausible:plausible-android", version.ref = "plausible" }
|
||||||
preference = { module = "androidx.preference:preference-ktx", version = "1.2.0" }
|
preference = { module = "androidx.preference:preference-ktx", version = "1.2.0" }
|
||||||
test-ext = { module = "androidx.test.ext:junit", version = "1.1.5" }
|
test-ext = { module = "androidx.test.ext:junit", version = "1.1.5" }
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ kotlin {
|
||||||
|
|
||||||
val androidMain by getting {
|
val androidMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation(libs.plausible)
|
||||||
api(compose.runtime)
|
api(compose.runtime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.wbrawner.pihelper.shared
|
||||||
|
|
||||||
|
import com.wbrawner.plausible.android.Plausible
|
||||||
|
|
||||||
|
object PlausibleAnalyticsHelper : AnalyticsHelper {
|
||||||
|
override fun pageView(route: Route) {
|
||||||
|
Plausible.pageView(route.path)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun event(event: AnalyticsEvent, route: Route) {
|
||||||
|
val props = when (event) {
|
||||||
|
is AnalyticsEvent.DisableButtonClicked -> mapOf("duration" to event.duration)
|
||||||
|
is AnalyticsEvent.LinkClicked -> mapOf("link" to event.link)
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
Plausible.event(event.name, route.path, props = props)
|
||||||
|
}
|
||||||
|
}
|
|
@ -104,6 +104,11 @@ fun InfoScreen(onBackClicked: () -> Unit, onForgetPiholeClicked: () -> Unit) {
|
||||||
) {
|
) {
|
||||||
message.getStringAnnotations(it, it).firstOrNull()?.let { annotation ->
|
message.getStringAnnotations(it, it).firstOrNull()?.let { annotation ->
|
||||||
uriHandler.openUri(annotation.item)
|
uriHandler.openUri(annotation.item)
|
||||||
|
// TODO: Move this to the store?
|
||||||
|
// PlausibleAnalyticsHelper.event(
|
||||||
|
// AnalyticsEvent.LinkClicked(annotation.item),
|
||||||
|
// Route.ABOUT
|
||||||
|
// )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TextButton(onClick = onForgetPiholeClicked) {
|
TextButton(onClick = onForgetPiholeClicked) {
|
||||||
|
|
Loading…
Reference in a new issue