From 94a0c01ed18fe72818c95875c32654971f68db17 Mon Sep 17 00:00:00 2001 From: David Carr Date: Wed, 19 Jun 2024 11:34:42 +0100 Subject: [PATCH 1/3] GOVUKAPP-499: Add onboarding module --- .gitignore | 2 + app/build.gradle.kts | 1 + feature/onboarding/.gitignore | 1 + feature/onboarding/build.gradle.kts | 45 +++++++++++++++++++ .../app/settings/ExampleInstrumentedTest.kt | 24 ++++++++++ .../onboarding/src/main/AndroidManifest.xml | 4 ++ .../govuk/app/settings/ui/OnboardingScreen.kt | 15 +++++++ .../uk/govuk/app/settings/ExampleUnitTest.kt | 17 +++++++ settings.gradle.kts | 2 +- 9 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 feature/onboarding/.gitignore create mode 100644 feature/onboarding/build.gradle.kts create mode 100644 feature/onboarding/src/androidTest/java/uk/govuk/app/settings/ExampleInstrumentedTest.kt create mode 100644 feature/onboarding/src/main/AndroidManifest.xml create mode 100644 feature/onboarding/src/main/java/uk/govuk/app/settings/ui/OnboardingScreen.kt create mode 100644 feature/onboarding/src/test/java/uk/govuk/app/settings/ExampleUnitTest.kt diff --git a/.gitignore b/.gitignore index 347e252e..5cf90e82 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ google-services.json # Android Profiling *.hprof + +*.DS_Store \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7869df7a..e3cdd33e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -79,6 +79,7 @@ android { dependencies { implementation(projects.feature.home) implementation(projects.feature.settings) + implementation(projects.feature.onboarding) implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) diff --git a/feature/onboarding/.gitignore b/feature/onboarding/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/feature/onboarding/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/onboarding/build.gradle.kts b/feature/onboarding/build.gradle.kts new file mode 100644 index 00000000..58031b06 --- /dev/null +++ b/feature/onboarding/build.gradle.kts @@ -0,0 +1,45 @@ +// Todo - extract to common file reusable across all feature modules + +plugins { + alias(libs.plugins.androidLibrary) + alias(libs.plugins.jetbrainsKotlinAndroid) +} + +android { + namespace = "uk.govuk.app.onboarding" + compileSdk = 34 + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = "1.8" + } + + buildFeatures { + compose = true + } + + composeOptions { + kotlinCompilerExtensionVersion = "1.5.1" + } +} + +dependencies { + + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.material) + + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.navigation.compose) + implementation(platform(libs.androidx.compose.bom)) + implementation(libs.androidx.material3) + + testImplementation(libs.junit) + + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) +} \ No newline at end of file diff --git a/feature/onboarding/src/androidTest/java/uk/govuk/app/settings/ExampleInstrumentedTest.kt b/feature/onboarding/src/androidTest/java/uk/govuk/app/settings/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..038c7c2d --- /dev/null +++ b/feature/onboarding/src/androidTest/java/uk/govuk/app/settings/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package uk.govuk.app.settings + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("uk.govuk.app.settings.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/onboarding/src/main/AndroidManifest.xml b/feature/onboarding/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a5918e68 --- /dev/null +++ b/feature/onboarding/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/feature/onboarding/src/main/java/uk/govuk/app/settings/ui/OnboardingScreen.kt b/feature/onboarding/src/main/java/uk/govuk/app/settings/ui/OnboardingScreen.kt new file mode 100644 index 00000000..e12bd13e --- /dev/null +++ b/feature/onboarding/src/main/java/uk/govuk/app/settings/ui/OnboardingScreen.kt @@ -0,0 +1,15 @@ +package uk.govuk.app.settings.ui + +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable + +@Composable +fun OnboardingRoute() { + // Collect UI state from view model here and pass to screen (if necessary) + OnboardingScreen() +} + +@Composable +private fun OnboardingScreen() { + Text("Onboarding Screen") +} \ No newline at end of file diff --git a/feature/onboarding/src/test/java/uk/govuk/app/settings/ExampleUnitTest.kt b/feature/onboarding/src/test/java/uk/govuk/app/settings/ExampleUnitTest.kt new file mode 100644 index 00000000..b8e87a2f --- /dev/null +++ b/feature/onboarding/src/test/java/uk/govuk/app/settings/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package uk.govuk.app.settings + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 770ce224..8a0bd1d0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -23,6 +23,6 @@ rootProject.name = "govuk-mobile-android-app" enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") include(":app") -include(":feature") include(":feature:home") include(":feature:settings") +include(":feature:onboarding") From 7c20ad94fa0187e161805c39e1d6b93527c0c223 Mon Sep 17 00:00:00 2001 From: David Carr Date: Wed, 19 Jun 2024 11:40:46 +0100 Subject: [PATCH 2/3] GOVUKAPP-499: Correct package name --- .../{settings => onboarding}/ExampleInstrumentedTest.kt | 8 +++----- .../app/{settings => onboarding}/ui/OnboardingScreen.kt | 2 +- .../govuk/app/{settings => onboarding}/ExampleUnitTest.kt | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) rename feature/onboarding/src/androidTest/java/uk/govuk/app/{settings => onboarding}/ExampleInstrumentedTest.kt (89%) rename feature/onboarding/src/main/java/uk/govuk/app/{settings => onboarding}/ui/OnboardingScreen.kt (89%) rename feature/onboarding/src/test/java/uk/govuk/app/{settings => onboarding}/ExampleUnitTest.kt (80%) diff --git a/feature/onboarding/src/androidTest/java/uk/govuk/app/settings/ExampleInstrumentedTest.kt b/feature/onboarding/src/androidTest/java/uk/govuk/app/onboarding/ExampleInstrumentedTest.kt similarity index 89% rename from feature/onboarding/src/androidTest/java/uk/govuk/app/settings/ExampleInstrumentedTest.kt rename to feature/onboarding/src/androidTest/java/uk/govuk/app/onboarding/ExampleInstrumentedTest.kt index 038c7c2d..c4a78bbb 100644 --- a/feature/onboarding/src/androidTest/java/uk/govuk/app/settings/ExampleInstrumentedTest.kt +++ b/feature/onboarding/src/androidTest/java/uk/govuk/app/onboarding/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ -package uk.govuk.app.settings +package uk.govuk.app.onboarding -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * diff --git a/feature/onboarding/src/main/java/uk/govuk/app/settings/ui/OnboardingScreen.kt b/feature/onboarding/src/main/java/uk/govuk/app/onboarding/ui/OnboardingScreen.kt similarity index 89% rename from feature/onboarding/src/main/java/uk/govuk/app/settings/ui/OnboardingScreen.kt rename to feature/onboarding/src/main/java/uk/govuk/app/onboarding/ui/OnboardingScreen.kt index e12bd13e..29a16b69 100644 --- a/feature/onboarding/src/main/java/uk/govuk/app/settings/ui/OnboardingScreen.kt +++ b/feature/onboarding/src/main/java/uk/govuk/app/onboarding/ui/OnboardingScreen.kt @@ -1,4 +1,4 @@ -package uk.govuk.app.settings.ui +package uk.govuk.app.onboarding.ui import androidx.compose.material3.Text import androidx.compose.runtime.Composable diff --git a/feature/onboarding/src/test/java/uk/govuk/app/settings/ExampleUnitTest.kt b/feature/onboarding/src/test/java/uk/govuk/app/onboarding/ExampleUnitTest.kt similarity index 80% rename from feature/onboarding/src/test/java/uk/govuk/app/settings/ExampleUnitTest.kt rename to feature/onboarding/src/test/java/uk/govuk/app/onboarding/ExampleUnitTest.kt index b8e87a2f..7db89a8e 100644 --- a/feature/onboarding/src/test/java/uk/govuk/app/settings/ExampleUnitTest.kt +++ b/feature/onboarding/src/test/java/uk/govuk/app/onboarding/ExampleUnitTest.kt @@ -1,9 +1,8 @@ -package uk.govuk.app.settings +package uk.govuk.app.onboarding +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * From b01d45435ef300660dcbea373e141f9af49bf6b6 Mon Sep 17 00:00:00 2001 From: David Carr Date: Wed, 19 Jun 2024 11:45:28 +0100 Subject: [PATCH 3/3] GOVUKAPP-499: Change java package to kotlin --- .../{java => kotlin}/uk/govuk/app/ExampleInstrumentedTest.kt | 0 app/src/main/{java => kotlin}/uk/govuk/app/MainActivity.kt | 0 app/src/main/{java => kotlin}/uk/govuk/app/ui/GovUkApp.kt | 0 .../uk/govuk/app/ui/navigation/TopLevelDestination.kt | 0 app/src/main/{java => kotlin}/uk/govuk/app/ui/theme/Color.kt | 0 app/src/main/{java => kotlin}/uk/govuk/app/ui/theme/Theme.kt | 0 app/src/main/{java => kotlin}/uk/govuk/app/ui/theme/Type.kt | 0 app/src/test/{java => kotlin}/uk/govuk/app/ExampleUnitTest.kt | 0 .../{java => kotlin}/uk/govuk/app/home/ExampleInstrumentedTest.kt | 0 .../src/main/{java => kotlin}/uk/govuk/app/home/ui/HomeScreen.kt | 0 .../uk/govuk/app/home/ui/navigation/HomeNavigation.kt | 0 .../test/{java => kotlin}/uk/govuk/app/home/ExampleUnitTest.kt | 0 .../uk/govuk/app/onboarding/ExampleInstrumentedTest.kt | 0 .../uk/govuk/app/onboarding/ui/OnboardingScreen.kt | 0 .../{java => kotlin}/uk/govuk/app/onboarding/ExampleUnitTest.kt | 0 .../uk/govuk/app/settings/ExampleInstrumentedTest.kt | 0 .../{java => kotlin}/uk/govuk/app/settings/ui/SettingsScreen.kt | 0 .../uk/govuk/app/settings/ui/SettingsSubScreen.kt | 0 .../uk/govuk/app/settings/ui/navigation/SettingsNavigation.kt | 0 .../{java => kotlin}/uk/govuk/app/settings/ExampleUnitTest.kt | 0 20 files changed, 0 insertions(+), 0 deletions(-) rename app/src/androidTest/{java => kotlin}/uk/govuk/app/ExampleInstrumentedTest.kt (100%) rename app/src/main/{java => kotlin}/uk/govuk/app/MainActivity.kt (100%) rename app/src/main/{java => kotlin}/uk/govuk/app/ui/GovUkApp.kt (100%) rename app/src/main/{java => kotlin}/uk/govuk/app/ui/navigation/TopLevelDestination.kt (100%) rename app/src/main/{java => kotlin}/uk/govuk/app/ui/theme/Color.kt (100%) rename app/src/main/{java => kotlin}/uk/govuk/app/ui/theme/Theme.kt (100%) rename app/src/main/{java => kotlin}/uk/govuk/app/ui/theme/Type.kt (100%) rename app/src/test/{java => kotlin}/uk/govuk/app/ExampleUnitTest.kt (100%) rename feature/home/src/androidTest/{java => kotlin}/uk/govuk/app/home/ExampleInstrumentedTest.kt (100%) rename feature/home/src/main/{java => kotlin}/uk/govuk/app/home/ui/HomeScreen.kt (100%) rename feature/home/src/main/{java => kotlin}/uk/govuk/app/home/ui/navigation/HomeNavigation.kt (100%) rename feature/home/src/test/{java => kotlin}/uk/govuk/app/home/ExampleUnitTest.kt (100%) rename feature/onboarding/src/androidTest/{java => kotlin}/uk/govuk/app/onboarding/ExampleInstrumentedTest.kt (100%) rename feature/onboarding/src/main/{java => kotlin}/uk/govuk/app/onboarding/ui/OnboardingScreen.kt (100%) rename feature/onboarding/src/test/{java => kotlin}/uk/govuk/app/onboarding/ExampleUnitTest.kt (100%) rename feature/settings/src/androidTest/{java => kotlin}/uk/govuk/app/settings/ExampleInstrumentedTest.kt (100%) rename feature/settings/src/main/{java => kotlin}/uk/govuk/app/settings/ui/SettingsScreen.kt (100%) rename feature/settings/src/main/{java => kotlin}/uk/govuk/app/settings/ui/SettingsSubScreen.kt (100%) rename feature/settings/src/main/{java => kotlin}/uk/govuk/app/settings/ui/navigation/SettingsNavigation.kt (100%) rename feature/settings/src/test/{java => kotlin}/uk/govuk/app/settings/ExampleUnitTest.kt (100%) diff --git a/app/src/androidTest/java/uk/govuk/app/ExampleInstrumentedTest.kt b/app/src/androidTest/kotlin/uk/govuk/app/ExampleInstrumentedTest.kt similarity index 100% rename from app/src/androidTest/java/uk/govuk/app/ExampleInstrumentedTest.kt rename to app/src/androidTest/kotlin/uk/govuk/app/ExampleInstrumentedTest.kt diff --git a/app/src/main/java/uk/govuk/app/MainActivity.kt b/app/src/main/kotlin/uk/govuk/app/MainActivity.kt similarity index 100% rename from app/src/main/java/uk/govuk/app/MainActivity.kt rename to app/src/main/kotlin/uk/govuk/app/MainActivity.kt diff --git a/app/src/main/java/uk/govuk/app/ui/GovUkApp.kt b/app/src/main/kotlin/uk/govuk/app/ui/GovUkApp.kt similarity index 100% rename from app/src/main/java/uk/govuk/app/ui/GovUkApp.kt rename to app/src/main/kotlin/uk/govuk/app/ui/GovUkApp.kt diff --git a/app/src/main/java/uk/govuk/app/ui/navigation/TopLevelDestination.kt b/app/src/main/kotlin/uk/govuk/app/ui/navigation/TopLevelDestination.kt similarity index 100% rename from app/src/main/java/uk/govuk/app/ui/navigation/TopLevelDestination.kt rename to app/src/main/kotlin/uk/govuk/app/ui/navigation/TopLevelDestination.kt diff --git a/app/src/main/java/uk/govuk/app/ui/theme/Color.kt b/app/src/main/kotlin/uk/govuk/app/ui/theme/Color.kt similarity index 100% rename from app/src/main/java/uk/govuk/app/ui/theme/Color.kt rename to app/src/main/kotlin/uk/govuk/app/ui/theme/Color.kt diff --git a/app/src/main/java/uk/govuk/app/ui/theme/Theme.kt b/app/src/main/kotlin/uk/govuk/app/ui/theme/Theme.kt similarity index 100% rename from app/src/main/java/uk/govuk/app/ui/theme/Theme.kt rename to app/src/main/kotlin/uk/govuk/app/ui/theme/Theme.kt diff --git a/app/src/main/java/uk/govuk/app/ui/theme/Type.kt b/app/src/main/kotlin/uk/govuk/app/ui/theme/Type.kt similarity index 100% rename from app/src/main/java/uk/govuk/app/ui/theme/Type.kt rename to app/src/main/kotlin/uk/govuk/app/ui/theme/Type.kt diff --git a/app/src/test/java/uk/govuk/app/ExampleUnitTest.kt b/app/src/test/kotlin/uk/govuk/app/ExampleUnitTest.kt similarity index 100% rename from app/src/test/java/uk/govuk/app/ExampleUnitTest.kt rename to app/src/test/kotlin/uk/govuk/app/ExampleUnitTest.kt diff --git a/feature/home/src/androidTest/java/uk/govuk/app/home/ExampleInstrumentedTest.kt b/feature/home/src/androidTest/kotlin/uk/govuk/app/home/ExampleInstrumentedTest.kt similarity index 100% rename from feature/home/src/androidTest/java/uk/govuk/app/home/ExampleInstrumentedTest.kt rename to feature/home/src/androidTest/kotlin/uk/govuk/app/home/ExampleInstrumentedTest.kt diff --git a/feature/home/src/main/java/uk/govuk/app/home/ui/HomeScreen.kt b/feature/home/src/main/kotlin/uk/govuk/app/home/ui/HomeScreen.kt similarity index 100% rename from feature/home/src/main/java/uk/govuk/app/home/ui/HomeScreen.kt rename to feature/home/src/main/kotlin/uk/govuk/app/home/ui/HomeScreen.kt diff --git a/feature/home/src/main/java/uk/govuk/app/home/ui/navigation/HomeNavigation.kt b/feature/home/src/main/kotlin/uk/govuk/app/home/ui/navigation/HomeNavigation.kt similarity index 100% rename from feature/home/src/main/java/uk/govuk/app/home/ui/navigation/HomeNavigation.kt rename to feature/home/src/main/kotlin/uk/govuk/app/home/ui/navigation/HomeNavigation.kt diff --git a/feature/home/src/test/java/uk/govuk/app/home/ExampleUnitTest.kt b/feature/home/src/test/kotlin/uk/govuk/app/home/ExampleUnitTest.kt similarity index 100% rename from feature/home/src/test/java/uk/govuk/app/home/ExampleUnitTest.kt rename to feature/home/src/test/kotlin/uk/govuk/app/home/ExampleUnitTest.kt diff --git a/feature/onboarding/src/androidTest/java/uk/govuk/app/onboarding/ExampleInstrumentedTest.kt b/feature/onboarding/src/androidTest/kotlin/uk/govuk/app/onboarding/ExampleInstrumentedTest.kt similarity index 100% rename from feature/onboarding/src/androidTest/java/uk/govuk/app/onboarding/ExampleInstrumentedTest.kt rename to feature/onboarding/src/androidTest/kotlin/uk/govuk/app/onboarding/ExampleInstrumentedTest.kt diff --git a/feature/onboarding/src/main/java/uk/govuk/app/onboarding/ui/OnboardingScreen.kt b/feature/onboarding/src/main/kotlin/uk/govuk/app/onboarding/ui/OnboardingScreen.kt similarity index 100% rename from feature/onboarding/src/main/java/uk/govuk/app/onboarding/ui/OnboardingScreen.kt rename to feature/onboarding/src/main/kotlin/uk/govuk/app/onboarding/ui/OnboardingScreen.kt diff --git a/feature/onboarding/src/test/java/uk/govuk/app/onboarding/ExampleUnitTest.kt b/feature/onboarding/src/test/kotlin/uk/govuk/app/onboarding/ExampleUnitTest.kt similarity index 100% rename from feature/onboarding/src/test/java/uk/govuk/app/onboarding/ExampleUnitTest.kt rename to feature/onboarding/src/test/kotlin/uk/govuk/app/onboarding/ExampleUnitTest.kt diff --git a/feature/settings/src/androidTest/java/uk/govuk/app/settings/ExampleInstrumentedTest.kt b/feature/settings/src/androidTest/kotlin/uk/govuk/app/settings/ExampleInstrumentedTest.kt similarity index 100% rename from feature/settings/src/androidTest/java/uk/govuk/app/settings/ExampleInstrumentedTest.kt rename to feature/settings/src/androidTest/kotlin/uk/govuk/app/settings/ExampleInstrumentedTest.kt diff --git a/feature/settings/src/main/java/uk/govuk/app/settings/ui/SettingsScreen.kt b/feature/settings/src/main/kotlin/uk/govuk/app/settings/ui/SettingsScreen.kt similarity index 100% rename from feature/settings/src/main/java/uk/govuk/app/settings/ui/SettingsScreen.kt rename to feature/settings/src/main/kotlin/uk/govuk/app/settings/ui/SettingsScreen.kt diff --git a/feature/settings/src/main/java/uk/govuk/app/settings/ui/SettingsSubScreen.kt b/feature/settings/src/main/kotlin/uk/govuk/app/settings/ui/SettingsSubScreen.kt similarity index 100% rename from feature/settings/src/main/java/uk/govuk/app/settings/ui/SettingsSubScreen.kt rename to feature/settings/src/main/kotlin/uk/govuk/app/settings/ui/SettingsSubScreen.kt diff --git a/feature/settings/src/main/java/uk/govuk/app/settings/ui/navigation/SettingsNavigation.kt b/feature/settings/src/main/kotlin/uk/govuk/app/settings/ui/navigation/SettingsNavigation.kt similarity index 100% rename from feature/settings/src/main/java/uk/govuk/app/settings/ui/navigation/SettingsNavigation.kt rename to feature/settings/src/main/kotlin/uk/govuk/app/settings/ui/navigation/SettingsNavigation.kt diff --git a/feature/settings/src/test/java/uk/govuk/app/settings/ExampleUnitTest.kt b/feature/settings/src/test/kotlin/uk/govuk/app/settings/ExampleUnitTest.kt similarity index 100% rename from feature/settings/src/test/java/uk/govuk/app/settings/ExampleUnitTest.kt rename to feature/settings/src/test/kotlin/uk/govuk/app/settings/ExampleUnitTest.kt