diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts
index cb16a249..72805b01 100644
--- a/composeApp/build.gradle.kts
+++ b/composeApp/build.gradle.kts
@@ -11,6 +11,14 @@ plugins {
alias(libs.plugins.ktlint)
}
+
+val flavor: String by project
+val appId = when (flavor) {
+ "dw" -> "org.dw.probe"
+ else -> "org.ooni.probe"
+}
+println("The current build flavor is set to '$flavor' with suffix set to '$appId'.")
+
kotlin {
androidTarget {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
@@ -54,8 +62,21 @@ kotlin {
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.kotlin.serialization)
- }
+ // add source directories and resources based on flavor
+ when (flavor) {
+ "ooni" -> {
+ getByName("commonMain") {
+ kotlin.srcDir("src/ooniMain/kotlin")
+ }
+ }
+ "dw" -> {
+ getByName("commonMain") {
+ kotlin.srcDir("src/dwMain/kotlin")
+ }
+ }
+ }
+ }
all {
languageSettings.optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
}
@@ -71,12 +92,28 @@ kotlin {
}
}
+compose.resources {
+ when (flavor) {
+ "ooni" -> {
+ customDirectory(
+ sourceSetName = "commonMain",
+ directoryProvider = provider { layout.projectDirectory.dir("src/ooniMain/resources") }
+ )
+ }
+ "dw" -> {
+ customDirectory(
+ sourceSetName = "commonMain",
+ directoryProvider = provider { layout.projectDirectory.dir("src/dwMain/resources") }
+ )
+ }
+ }
+}
android {
namespace = "org.ooni.probe"
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
- applicationId = "org.ooni.probe"
+ applicationId = appId
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
@@ -89,7 +126,7 @@ android {
}
buildTypes {
getByName("debug") {
- applicationIdSuffix = ".debug"
+ //applicationIdSuffix = ".debug"
}
getByName("release") {
isMinifyEnabled = false
@@ -117,3 +154,11 @@ ktlint {
}
additionalEditorconfig.put("ktlint_function_naming_ignore_when_annotated_with", "Composable")
}
+
+//tasks.register("runDebug", Exec::class) {
+// dependsOn("clean", "uninstallDebug", "installDebug")
+// commandLine(
+// "adb", "shell", "am", "start", "-n",
+// "$appId/org.ooni.probe.MainActivity"
+// )
+//}
diff --git a/composeApp/src/androidMain/res/values/strings.xml b/composeApp/src/androidMain/res/values/strings.xml
index 9301c107..96cb7ce4 100644
--- a/composeApp/src/androidMain/res/values/strings.xml
+++ b/composeApp/src/androidMain/res/values/strings.xml
@@ -1,3 +1,3 @@
OONI Probe
-
\ No newline at end of file
+
diff --git a/composeApp/src/commonMain/composeResources/values/strings.xml b/composeApp/src/commonMain/composeResources/values/strings.xml
new file mode 100644
index 00000000..85420055
--- /dev/null
+++ b/composeApp/src/commonMain/composeResources/values/strings.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/App.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/App.kt
index 86cd973c..0b8f352b 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/App.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/App.kt
@@ -1,22 +1,20 @@
package org.ooni.probe
import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import org.jetbrains.compose.ui.tooling.preview.Preview
import org.ooni.probe.di.Dependencies
-import org.ooni.probe.ui.Theme
+import org.ooni.probe.ui.AppTheme
import org.ooni.probe.ui.main.MainScreen
@Composable
@Preview
fun App(dependencies: Dependencies) {
- Theme {
+ AppTheme {
Surface(
modifier = Modifier.fillMaxSize(),
- color = MaterialTheme.colorScheme.background,
) {
MainScreen(
dependencies.mainViewModel,
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/Theme.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/Theme.kt
index ca9a42a8..2bad828a 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/Theme.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/Theme.kt
@@ -10,18 +10,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
-private val primaryColor = Color(0xff0588cb)
-private val primaryLightColor = primaryColor.copy(alpha = 0.75f)
-private val secondaryColor = Color(0xff5db8fe)
-private val secondaryLightColor = secondaryColor.copy(alpha = 0.75f)
-private val primaryTextColor = Color(0xffffffff)
-private val secondaryTextColor = Color(0xff000000)
-private val surfaceDark = Color(0xFF161616)
-private val surfaceLight = Color(0xFFFFFFFF)
-private val backgroundLightColor = Color(0xffF1F0F5)
-private val backgroundDarkColor = Color(0xff010100)
-private val errorColor = Color(0xFFFF8989)
-private val onErrorColor = Color(0xFF000000)
private val LightColors =
lightColorScheme(
@@ -64,7 +52,7 @@ private val DarkColors =
)
@Composable
-internal fun Theme(
+fun AppTheme(
useDarkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit,
) {
diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/main/MainScreen.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/main/MainScreen.kt
index 548804d7..fa051a7c 100644
--- a/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/main/MainScreen.kt
+++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/ui/main/MainScreen.kt
@@ -1,34 +1,63 @@
package org.ooni.probe.ui.main
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
-import androidx.compose.material.Button
-import androidx.compose.material.Text
+import androidx.compose.material3.Button
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Text
+import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
+import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import ooniprobe.composeapp.generated.resources.Res
+import ooniprobe.composeapp.generated.resources.app_name
+import ooniprobe.composeapp.generated.resources.logo
+import org.jetbrains.compose.resources.painterResource
+import org.jetbrains.compose.resources.stringResource
+@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MainScreen(viewModel: MainViewModel) {
val state by viewModel.state.collectAsState()
+ Scaffold(
+ topBar = {
+ TopAppBar(
+ title = {
+ Text(stringResource(Res.string.app_name))
+ },
+ )
+ },
+ ) { contentPadding ->
- Column {
- Button(
- onClick = { viewModel.onEvent(MainViewModel.Event.StartClick) },
- enabled = !state.isRunning,
+ Column(
+ modifier = Modifier.padding(contentPadding),
+ verticalArrangement = Arrangement.Center,
) {
- Text("Run Test")
- }
+ Button(
+ onClick = { viewModel.onEvent(MainViewModel.Event.StartClick) },
+ enabled = !state.isRunning,
+ ) {
+ Text("Run Test")
+ }
- Text(
- text = state.log,
- modifier =
- Modifier
- .fillMaxSize()
- .verticalScroll(rememberScrollState()),
- )
+ Image(
+ painterResource(Res.drawable.logo),
+ contentDescription = "OONI Probe Logo",
+ modifier = Modifier.align(Alignment.CenterHorizontally),
+ )
+ Text(
+ text = state.log,
+ modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()),
+ )
+ }
}
+
}
diff --git a/composeApp/src/dwMain/kotlin/Config.kt b/composeApp/src/dwMain/kotlin/Config.kt
new file mode 100644
index 00000000..b152bcef
--- /dev/null
+++ b/composeApp/src/dwMain/kotlin/Config.kt
@@ -0,0 +1,3 @@
+object Config {
+ const val ENVIRONMENT:String = "News Media Scan"
+}
diff --git a/composeApp/src/dwMain/kotlin/org/ooni/probe/ui/Colors.kt b/composeApp/src/dwMain/kotlin/org/ooni/probe/ui/Colors.kt
new file mode 100644
index 00000000..c2d1bf18
--- /dev/null
+++ b/composeApp/src/dwMain/kotlin/org/ooni/probe/ui/Colors.kt
@@ -0,0 +1,17 @@
+package org.ooni.probe.ui
+
+import androidx.compose.ui.graphics.Color
+
+val primaryColor = Color(0xffD32625)
+val primaryLightColor = primaryColor.copy(alpha = 0.75f)
+val secondaryColor = Color(0xff5db8fe)
+val secondaryLightColor = secondaryColor.copy(alpha = 0.75f)
+val primaryTextColor = Color(0xffffffff)
+val secondaryTextColor = Color(0xff000000)
+val surfaceDark = Color(0xFF161616)
+val surfaceLight = Color(0xFFFFFFFF)
+val backgroundLightColor = Color(0xffF1F0F5)
+val backgroundDarkColor = Color(0xff010100)
+val errorColor = Color(0xFFFF8989)
+val onErrorColor = Color(0xFF000000)
+
diff --git a/composeApp/src/dwMain/resources/drawable/logo.xml b/composeApp/src/dwMain/resources/drawable/logo.xml
new file mode 100644
index 00000000..dac2aa51
--- /dev/null
+++ b/composeApp/src/dwMain/resources/drawable/logo.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/composeApp/src/dwMain/resources/values/strings.xml b/composeApp/src/dwMain/resources/values/strings.xml
new file mode 100644
index 00000000..ce499141
--- /dev/null
+++ b/composeApp/src/dwMain/resources/values/strings.xml
@@ -0,0 +1,4 @@
+
+ News Media Scan
+ News x
+
diff --git a/composeApp/src/ooniMain/kotlin/Config.kt b/composeApp/src/ooniMain/kotlin/Config.kt
new file mode 100644
index 00000000..baa10d00
--- /dev/null
+++ b/composeApp/src/ooniMain/kotlin/Config.kt
@@ -0,0 +1,3 @@
+object Config {
+ const val ENVIRONMENT:String = "OONI Probe"
+}
diff --git a/composeApp/src/ooniMain/kotlin/org/ooni/probe/ui/Colors.kt b/composeApp/src/ooniMain/kotlin/org/ooni/probe/ui/Colors.kt
new file mode 100644
index 00000000..0b7d10cc
--- /dev/null
+++ b/composeApp/src/ooniMain/kotlin/org/ooni/probe/ui/Colors.kt
@@ -0,0 +1,17 @@
+package org.ooni.probe.ui
+
+import androidx.compose.ui.graphics.Color
+
+val primaryColor = Color(0xff0588cb)
+val primaryLightColor = primaryColor.copy(alpha = 0.75f)
+val secondaryColor = Color(0xff5db8fe)
+val secondaryLightColor = secondaryColor.copy(alpha = 0.75f)
+val primaryTextColor = Color(0xffffffff)
+val secondaryTextColor = Color(0xff000000)
+val surfaceDark = Color(0xFF161616)
+val surfaceLight = Color(0xFFFFFFFF)
+val backgroundLightColor = Color(0xffF1F0F5)
+val backgroundDarkColor = Color(0xff010100)
+val errorColor = Color(0xFFFF8989)
+val onErrorColor = Color(0xFF000000)
+
diff --git a/composeApp/src/ooniMain/resources/drawable/logo.xml b/composeApp/src/ooniMain/resources/drawable/logo.xml
new file mode 100644
index 00000000..ec00ac58
--- /dev/null
+++ b/composeApp/src/ooniMain/resources/drawable/logo.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/composeApp/src/ooniMain/resources/values/strings.xml b/composeApp/src/ooniMain/resources/values/strings.xml
new file mode 100644
index 00000000..96cb7ce4
--- /dev/null
+++ b/composeApp/src/ooniMain/resources/values/strings.xml
@@ -0,0 +1,3 @@
+
+ OONI Probe
+
diff --git a/config/dw/build.gradle.kts b/config/dw/build.gradle.kts
new file mode 100644
index 00000000..fb314769
--- /dev/null
+++ b/config/dw/build.gradle.kts
@@ -0,0 +1,52 @@
+import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
+
+plugins {
+ alias(libs.plugins.kotlinMultiplatform)
+ alias(libs.plugins.jetbrainsCompose)
+ alias(libs.plugins.jetbrainsComposeCompiler)
+ alias(libs.plugins.androidLibrary)
+}
+
+kotlin {
+ androidTarget {
+ @OptIn(ExperimentalKotlinGradlePluginApi::class)
+ compilerOptions {
+ jvmTarget.set(JvmTarget.JVM_17)
+ }
+ }
+
+ listOf(
+ iosX64(),
+ iosArm64(),
+ iosSimulatorArm64()
+ ).forEach {
+ it.binaries.framework {
+ baseName = "composeApp"
+ isStatic = true
+ }
+ }
+
+ sourceSets {
+ commonMain.dependencies {
+ implementation(compose.runtime)
+ implementation(compose.components.resources)
+ }
+ commonTest.dependencies {
+ //implementation(libs.kotlin.test)
+ }
+ }
+}
+
+android {
+ namespace = "org.ooni.probe"
+ compileSdk = libs.versions.android.compileSdk.get().toInt()
+ defaultConfig {
+ minSdk = libs.versions.android.minSdk.get().toInt()
+ targetSdk = libs.versions.android.targetSdk.get().toInt()
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+}
diff --git a/config/dw/src/androidMain/res/values/strings.xml b/config/dw/src/androidMain/res/values/strings.xml
new file mode 100644
index 00000000..d0caa671
--- /dev/null
+++ b/config/dw/src/androidMain/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+
+ News Media Scan
+
diff --git a/config/dw/src/commonMain/composeResources/drawable/compose-multiplatform.xml b/config/dw/src/commonMain/composeResources/drawable/compose-multiplatform.xml
new file mode 100644
index 00000000..c0bcfb28
--- /dev/null
+++ b/config/dw/src/commonMain/composeResources/drawable/compose-multiplatform.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/dw/src/commonMain/composeResources/values/strings.xml b/config/dw/src/commonMain/composeResources/values/strings.xml
new file mode 100644
index 00000000..3cbb405a
--- /dev/null
+++ b/config/dw/src/commonMain/composeResources/values/strings.xml
@@ -0,0 +1,3 @@
+
+ News Media Scan
+
diff --git a/config/dw/src/commonMain/kotlin/Config.kt b/config/dw/src/commonMain/kotlin/Config.kt
new file mode 100644
index 00000000..74413ba6
--- /dev/null
+++ b/config/dw/src/commonMain/kotlin/Config.kt
@@ -0,0 +1,3 @@
+object Config {
+ const val ENVIRONMENT:String = "DW"
+}
diff --git a/config/ooni/build.gradle.kts b/config/ooni/build.gradle.kts
new file mode 100644
index 00000000..fb314769
--- /dev/null
+++ b/config/ooni/build.gradle.kts
@@ -0,0 +1,52 @@
+import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
+
+plugins {
+ alias(libs.plugins.kotlinMultiplatform)
+ alias(libs.plugins.jetbrainsCompose)
+ alias(libs.plugins.jetbrainsComposeCompiler)
+ alias(libs.plugins.androidLibrary)
+}
+
+kotlin {
+ androidTarget {
+ @OptIn(ExperimentalKotlinGradlePluginApi::class)
+ compilerOptions {
+ jvmTarget.set(JvmTarget.JVM_17)
+ }
+ }
+
+ listOf(
+ iosX64(),
+ iosArm64(),
+ iosSimulatorArm64()
+ ).forEach {
+ it.binaries.framework {
+ baseName = "composeApp"
+ isStatic = true
+ }
+ }
+
+ sourceSets {
+ commonMain.dependencies {
+ implementation(compose.runtime)
+ implementation(compose.components.resources)
+ }
+ commonTest.dependencies {
+ //implementation(libs.kotlin.test)
+ }
+ }
+}
+
+android {
+ namespace = "org.ooni.probe"
+ compileSdk = libs.versions.android.compileSdk.get().toInt()
+ defaultConfig {
+ minSdk = libs.versions.android.minSdk.get().toInt()
+ targetSdk = libs.versions.android.targetSdk.get().toInt()
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+}
diff --git a/config/ooni/src/androidMain/res/values/strings.xml b/config/ooni/src/androidMain/res/values/strings.xml
new file mode 100644
index 00000000..7fb2b7bb
--- /dev/null
+++ b/config/ooni/src/androidMain/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+
+ OONI Probe
+
diff --git a/config/ooni/src/commonMain/composeResources/drawable/compose-multiplatform.xml b/config/ooni/src/commonMain/composeResources/drawable/compose-multiplatform.xml
new file mode 100644
index 00000000..c0bcfb28
--- /dev/null
+++ b/config/ooni/src/commonMain/composeResources/drawable/compose-multiplatform.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/ooni/src/commonMain/composeResources/values/strings.xml b/config/ooni/src/commonMain/composeResources/values/strings.xml
new file mode 100644
index 00000000..7fea4c01
--- /dev/null
+++ b/config/ooni/src/commonMain/composeResources/values/strings.xml
@@ -0,0 +1,4 @@
+
+ OONI Probe
+ OONI Name
+
diff --git a/config/ooni/src/commonMain/kotlin/Config.kt b/config/ooni/src/commonMain/kotlin/Config.kt
new file mode 100644
index 00000000..baa10d00
--- /dev/null
+++ b/config/ooni/src/commonMain/kotlin/Config.kt
@@ -0,0 +1,3 @@
+object Config {
+ const val ENVIRONMENT:String = "OONI Probe"
+}
diff --git a/gradle.properties b/gradle.properties
index 5db355f8..e3b9b834 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -9,4 +9,7 @@ android.useAndroidX=true
#MPP
kotlin.mpp.androidSourceSetLayoutVersion=2
-kotlin.mpp.enableCInteropCommonization=true
\ No newline at end of file
+kotlin.mpp.enableCInteropCommonization=true
+
+#Flavor
+flavor=ooni
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 34f548b2..edefb22a 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -7,7 +7,7 @@ android-targetSdk = "34"
androidx-activityCompose = "1.9.1"
compose = "1.6.8"
-compose-plugin = "1.6.11"
+compose-plugin = "1.7.0-alpha02"
kotlin = "2.0.0"
[libraries]
@@ -25,4 +25,4 @@ jetbrainsComposeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
-ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "12.1.1" }
\ No newline at end of file
+ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "12.1.1" }
diff --git a/iosApp/iosApp/Info-News-Media-Scan.plist b/iosApp/iosApp/Info-News-Media-Scan.plist
new file mode 100644
index 00000000..412e3781
--- /dev/null
+++ b/iosApp/iosApp/Info-News-Media-Scan.plist
@@ -0,0 +1,50 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ $(PRODUCT_BUNDLE_PACKAGE_TYPE)
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+ LSRequiresIPhoneOS
+
+ CADisableMinimumFrameDurationOnPhone
+
+ UIApplicationSceneManifest
+
+ UIApplicationSupportsMultipleScenes
+
+
+ UILaunchScreen
+
+ UIRequiredDeviceCapabilities
+
+ armv7
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+
+
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 6f0e8113..182a3e2a 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -28,4 +28,4 @@ dependencyResolutionManagement {
}
}
-include(":composeApp")
\ No newline at end of file
+include(":composeApp")