From 246677bd0bd8013fea195eaff70cf226a40df576 Mon Sep 17 00:00:00 2001
From: Karan Sharma <55722391+ksharma-xyz@users.noreply.github.com>
Date: Sat, 23 Nov 2024 21:16:40 +1100
Subject: [PATCH] Update CI for Krail
---
.github/workflows/ci.yml | 14 ++--
android-app/build.gradle.kts | 63 ------------------
android-app/src/main/AndroidManifest.xml | 31 ---------
android-app/src/main/proguard-rules.pro | 65 -------------------
.../main/res/color/gradient_background.xml | 10 ---
.../res/drawable/ic_launcher_background.xml | 11 ----
.../res/drawable/ic_launcher_foreground.xml | 9 ---
.../res/mipmap-anydpi-v26/ic_launcher.xml | 6 --
.../mipmap-anydpi-v26/ic_launcher_round.xml | 6 --
.../src/main/res/values-night/colors.xml | 5 --
android-app/src/main/res/values/colors.xml | 5 --
android-app/src/main/res/values/strings.xml | 3 -
android-app/src/main/res/values/themes.xml | 7 --
android-app/src/main/res/xml/backup_rules.xml | 13 ----
.../main/res/xml/data_extraction_rules.xml | 19 ------
composeApp/src/androidDebug/kotlin/.gitkeep | 0
feature/trip-planner/ui/build.gradle.kts | 14 ----
.../timetable/business/TripResponseMapper.kt | 12 ++--
18 files changed, 14 insertions(+), 279 deletions(-)
delete mode 100644 android-app/build.gradle.kts
delete mode 100644 android-app/src/main/AndroidManifest.xml
delete mode 100644 android-app/src/main/proguard-rules.pro
delete mode 100644 android-app/src/main/res/color/gradient_background.xml
delete mode 100644 android-app/src/main/res/drawable/ic_launcher_background.xml
delete mode 100644 android-app/src/main/res/drawable/ic_launcher_foreground.xml
delete mode 100644 android-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
delete mode 100644 android-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
delete mode 100644 android-app/src/main/res/values-night/colors.xml
delete mode 100644 android-app/src/main/res/values/colors.xml
delete mode 100644 android-app/src/main/res/values/strings.xml
delete mode 100644 android-app/src/main/res/values/themes.xml
delete mode 100644 android-app/src/main/res/xml/backup_rules.xml
delete mode 100644 android-app/src/main/res/xml/data_extraction_rules.xml
create mode 100644 composeApp/src/androidDebug/kotlin/.gitkeep
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fe58573c..e1f91c15 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,10 +1,10 @@
-name: Android CI
+name: Krail App CI
on:
push:
- branches: [ commonMain ]
+ branches: [ main ]
pull_request:
- branches: [ commonMain ]
+ branches: [ main ]
jobs:
build:
@@ -40,15 +40,15 @@ jobs:
- name: Firebase (Release) - Google Services.json file
env:
DATA: ${{ secrets.FIREBASE_GOOGLE_SERVICES_JSON_RELEASE }}
- run: echo $DATA | base64 -di > android-app/google-services.json
+ run: echo $DATA | base64 -di > composeApp/src/androidMain/google-services.json
- name: Firebase (Debug) - Google Services.json file
env:
DATA: ${{ secrets.FIREBASE_GOOGLE_SERVICES_JSON_DEBUG }}
- run: echo $DATA | base64 -di > android-app/src/debug/google-services.json
+ run: echo $DATA | base64 -di > composeApp/src/androidDebug/google-services.json
- - name: Detekt Checks
- run: ./gradlew detekt
+# - name: Detekt Checks
+# run: ./gradlew detekt
- name: Build Debug
run: ./gradlew assembleDebug test
diff --git a/android-app/build.gradle.kts b/android-app/build.gradle.kts
deleted file mode 100644
index ea91a28c..00000000
--- a/android-app/build.gradle.kts
+++ /dev/null
@@ -1,63 +0,0 @@
-plugins {
- alias(libs.plugins.krail.kotlin.android)
-}
-
-android {
- namespace = "xyz.ksharma.krail"
-
- defaultConfig {
- applicationId = "xyz.ksharma.krail"
- versionCode = 12
- versionName = "1.0-alpha03"
-
- testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
- vectorDrawables {
- useSupportLibrary = true
- }
- }
-
- buildTypes {
-
- debug {
- applicationIdSuffix = ".debug"
- isDebuggable = true
- ndk {
- isDebuggable = true
- debugSymbolLevel = "FULL"
- }
- }
-
- release {
- isMinifyEnabled = true
- isDebuggable = false
- isShrinkResources = true
- ndk {
- isDebuggable = false
- debugSymbolLevel = "FULL"
- }
- proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
- }
- }
-}
-
-dependencies {
-
- // Projects
- implementation(projects.composeApp)
- implementation(projects.sandook)
-
- /* implementation(projects.core.network)
- implementation(projects.feature.tripPlanner.network.api)
- implementation(projects.feature.tripPlanner.network.real)
- implementation(projects.feature.tripPlanner.state)
- implementation(projects.feature.tripPlanner.ui)
- implementation(projects.sandook.api)
- implementation(projects.sandook.real)*/
-
- implementation(libs.activity.compose)
- implementation(compose.foundation)
- implementation(libs.core.ktx)
- implementation(libs.kotlinx.serialization.json)
- implementation(libs.lifecycle.runtime.ktx)
-
-}
diff --git a/android-app/src/main/AndroidManifest.xml b/android-app/src/main/AndroidManifest.xml
deleted file mode 100644
index 8226f6db..00000000
--- a/android-app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android-app/src/main/proguard-rules.pro b/android-app/src/main/proguard-rules.pro
deleted file mode 100644
index 1b92f1c8..00000000
--- a/android-app/src/main/proguard-rules.pro
+++ /dev/null
@@ -1,65 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
-
-#Need this to keep serializable members as is
--keepclassmembers class * implements java.io.Serializable {
- static final long serialVersionUID;
- private static final java.io.ObjectStreamField[] serialPersistentFields;
- private void writeObject(java.io.ObjectOutputStream);
- private void readObject(java.io.ObjectInputStream);
- java.lang.Object writeReplace();
- java.lang.Object readResolve();
-}
-
-
-# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
--keepclasseswithmembernames class * {
- native ;
-}
-
-#This will print mappings - very useful for troubleshooting.
--printseeds ./build/seeds.txt
--printusage ./build/unused.txt
--printmapping ./build/mapping.txt
-
-#Some recommended settings for running with Android
--keep public class * extends android.app.Activity
--keep public class * extends android.app.Application
-
--keep public enum * {}
--keep public interface * {}
-
--keepattributes *Annotation*
-
--keepclassmembers,allowobfuscation class * {
- @javax.inject.* *;
- @dagger.* *;
- ();
-}
-
-
--keepattributes *Annotation*,Signature
--dontwarn retrofit.**
--keep class retrofit.** { *; }
--keepclasseswithmembers class * {
- @retrofit.* ;
-}
diff --git a/android-app/src/main/res/color/gradient_background.xml b/android-app/src/main/res/color/gradient_background.xml
deleted file mode 100644
index 7ce4c3e7..00000000
--- a/android-app/src/main/res/color/gradient_background.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
diff --git a/android-app/src/main/res/drawable/ic_launcher_background.xml b/android-app/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index 532196b3..00000000
--- a/android-app/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
diff --git a/android-app/src/main/res/drawable/ic_launcher_foreground.xml b/android-app/src/main/res/drawable/ic_launcher_foreground.xml
deleted file mode 100644
index e686afd5..00000000
--- a/android-app/src/main/res/drawable/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/android-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100644
index b3e26b4c..00000000
--- a/android-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/android-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index b3e26b4c..00000000
--- a/android-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/android-app/src/main/res/values-night/colors.xml b/android-app/src/main/res/values-night/colors.xml
deleted file mode 100644
index fc622448..00000000
--- a/android-app/src/main/res/values-night/colors.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- #1F1B16
- #EAE1D9
-
diff --git a/android-app/src/main/res/values/colors.xml b/android-app/src/main/res/values/colors.xml
deleted file mode 100644
index 18779681..00000000
--- a/android-app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- #FFFBFF
- #1F1B16
-
diff --git a/android-app/src/main/res/values/strings.xml b/android-app/src/main/res/values/strings.xml
deleted file mode 100644
index 53906e3d..00000000
--- a/android-app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Krail App
-
diff --git a/android-app/src/main/res/values/themes.xml b/android-app/src/main/res/values/themes.xml
deleted file mode 100644
index 931e639d..00000000
--- a/android-app/src/main/res/values/themes.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/android-app/src/main/res/xml/backup_rules.xml b/android-app/src/main/res/xml/backup_rules.xml
deleted file mode 100644
index fa0f996d..00000000
--- a/android-app/src/main/res/xml/backup_rules.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/android-app/src/main/res/xml/data_extraction_rules.xml b/android-app/src/main/res/xml/data_extraction_rules.xml
deleted file mode 100644
index 9ee9997b..00000000
--- a/android-app/src/main/res/xml/data_extraction_rules.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/composeApp/src/androidDebug/kotlin/.gitkeep b/composeApp/src/androidDebug/kotlin/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/feature/trip-planner/ui/build.gradle.kts b/feature/trip-planner/ui/build.gradle.kts
index 42ccf8e9..3eaab54a 100644
--- a/feature/trip-planner/ui/build.gradle.kts
+++ b/feature/trip-planner/ui/build.gradle.kts
@@ -42,20 +42,6 @@ kotlin {
implementation(libs.kotlinx.serialization.json)
implementation(libs.navigation.compose)
implementation(libs.lifecycle.viewmodel.compose)
-
- // TODO - remove once DI added - start
-/*
- implementation(libs.ktor.client.core)
- implementation(libs.ktor.client.cio)
- implementation(libs.ktor.client.auth)
- implementation(libs.ktor.client.content.negotiation)
- implementation(libs.ktor.client.logging)
- implementation(libs.ktor.serialization.kotlinx.json)
- implementation(libs.kotlinx.datetime)
- implementation(libs.slf4j.simple) // Logging
-*/
- // TODO - remove once DI added - end
-
api(libs.di.koinComposeViewmodel)
}
}
diff --git a/feature/trip-planner/ui/src/commonMain/kotlin/xyz/ksharma/krail/trip/planner/ui/timetable/business/TripResponseMapper.kt b/feature/trip-planner/ui/src/commonMain/kotlin/xyz/ksharma/krail/trip/planner/ui/timetable/business/TripResponseMapper.kt
index 2fc502f6..afc24d11 100644
--- a/feature/trip-planner/ui/src/commonMain/kotlin/xyz/ksharma/krail/trip/planner/ui/timetable/business/TripResponseMapper.kt
+++ b/feature/trip-planner/ui/src/commonMain/kotlin/xyz/ksharma/krail/trip/planner/ui/timetable/business/TripResponseMapper.kt
@@ -4,9 +4,11 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import xyz.ksharma.krail.core.datetime.DateTimeHelper.calculateTimeDifference
import xyz.ksharma.krail.core.datetime.DateTimeHelper.calculateTimeDifferenceFromNow
+import xyz.ksharma.krail.core.datetime.DateTimeHelper.formatTo12HourTime
import xyz.ksharma.krail.core.datetime.DateTimeHelper.toFormattedDurationTimeString
import xyz.ksharma.krail.core.datetime.DateTimeHelper.toGenericFormattedTimeString
import xyz.ksharma.krail.core.datetime.DateTimeHelper.toHHMM
+import xyz.ksharma.krail.core.datetime.DateTimeHelper.utcToAEST
import xyz.ksharma.krail.core.datetime.DateTimeHelper.utcToLocalDateTimeAEST
import xyz.ksharma.krail.trip.planner.network.api.model.TripResponse
import xyz.ksharma.krail.trip.planner.ui.state.TransportMode
@@ -66,7 +68,7 @@ internal fun TripResponse.buildJourneyList(): ImmutableList leg.infos.orEmpty() }.toSet().size,
).also {
- //println("\tJourneyId: ${it.journeyId}")
+ println("\tJourneyId: ${it.journeyId}")
}
} else {
null
@@ -246,7 +248,7 @@ private fun TripResponse.StopSequence.toUiModel(): TimeTableState.JourneyCardInf
}
}
-/*internal fun TripResponse.logForUnderstandingData() {
+internal fun TripResponse.logForUnderstandingData() {
println("Journeys: ${journeys?.size}")
journeys?.mapIndexed { jindex, j ->
println("JOURNEY #${jindex + 1}")
@@ -277,12 +279,12 @@ private fun TripResponse.StopSequence.toUiModel(): TimeTableState.JourneyCardInf
)
}
}
-}*/
+}
/**
* Prints the stops for legs when interchange required.
*/
-/*private fun List.interchangeStopsList() = this.mapNotNull {
+private fun List.interchangeStopsList() = this.mapNotNull {
// TODO - figure role of ARR vs DEP time
val timeArr = it.arrivalTimeEstimated?.utcToAEST()
?.formatTo12HourTime() ?: it.arrivalTimePlanned?.utcToAEST()?.formatTo12HourTime()
@@ -296,7 +298,7 @@ private fun TripResponse.StopSequence.toUiModel(): TimeTableState.JourneyCardInf
"\n\t\t\t\t Stop: ${it.name}," +
" depTime: ${timeArr ?: depTime}"
}
-}*/
+}
private fun String.fromUTCToDisplayTimeString() = this.utcToLocalDateTimeAEST().toHHMM()