Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into feat/profile/create
Browse files Browse the repository at this point in the history
  • Loading branch information
Harrish92 committed Oct 13, 2024
2 parents a8f0644 + 2b6183b commit ae0c64a
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 40 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
push:
branches:
- main
- 'setup/**'
- 'feat/**'

pull_request:
types:
Expand Down Expand Up @@ -40,6 +42,16 @@ jobs:
distribution: "temurin"
java-version: "17"

# Hello Hello, Alonso here ^_~
# For whatever reason Android SDK is weird and I can't get the emulator to work
# vvv this new plugin should install v12.0 that was published Sep 2024 to be updated
- name: Setup Android SDK
uses: Swisyn/setup-android-sdk@v1
with:
cmdline-tools-version: 11076708
##TODO: Check if I need to install adb and avdmanager manually with cli cmds


# Caching is a very useful part of a CI, as a workflow is executed in a clean environment every time,
# this means that one would need to re-download and re-process gradle files for every run. Which is very time consuming.
#
Expand All @@ -66,7 +78,7 @@ jobs:
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
disable-animations: true
script: echo "Generated AVD snapshot for caching."

- name: Grant execute permission for gradlew
Expand Down Expand Up @@ -97,8 +109,9 @@ jobs:
api-level: 34
target: google_apis
arch: x86_64
avd-name: github
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -skin 1080x1920
disable-animations: true
script: ./gradlew connectedCheck --parallel --build-cache

Expand Down
47 changes: 25 additions & 22 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,26 @@ android {

sonar {
properties {
property("sonar.projectKey", "PeriodPals_periodpals")
property("sonar.projectKey", "periodpals_periodpals")
property("sonar.organization", "periodpals")
property("sonar.host.url", "https://sonarcloud.io")
// Comma-separated paths to the various directories containing the *.xml JUnit report files.
// Each path may be absolute or relative to the project base directory.
property(
"sonar.junit.reportPaths",
"${project.layout.buildDirectory.get()}/test-results/testDebugunitTest/")
"sonar.junit.reportPaths",
"${project.layout.buildDirectory.get()}/test-results/testDebugunitTest/"
)
// Paths to xml files with Android Lint issues. If the main flavor is changed, this file will
// have to be changed too.
property(
"sonar.androidLint.reportPaths",
"${project.layout.buildDirectory.get()}/reports/lint-results-debug.xml")
"sonar.androidLint.reportPaths",
"${project.layout.buildDirectory.get()}/reports/lint-results-debug.xml"
)
// Paths to JaCoCo XML coverage report files.
property(
"sonar.coverage.jacoco.xmlReportPaths",
"${project.layout.buildDirectory.get()}/reports/jacoco/jacocoTestReport/jacocoTestReport.xml")
"sonar.coverage.jacoco.xmlReportPaths",
"${project.layout.buildDirectory.get()}/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
)
}
}

Expand Down Expand Up @@ -210,26 +213,26 @@ tasks.register("jacocoTestReport", JacocoReport::class) {
}

val fileFilter =
listOf(
"**/R.class",
"**/R$*.class",
"**/BuildConfig.*",
"**/Manifest*.*",
"**/*Test*.*",
"android/**/*.*",
)
listOf(
"**/R.class",
"**/R$*.class",
"**/BuildConfig.*",
"**/Manifest*.*",
"**/*Test*.*",
"android/**/*.*",
)

val debugTree =
fileTree("${project.layout.buildDirectory.get()}/tmp/kotlin-classes/debug") {
exclude(fileFilter)
}
fileTree("${project.layout.buildDirectory.get()}/tmp/kotlin-classes/debug") {
exclude(fileFilter)
}

val mainSrc = "${project.layout.projectDirectory}/src/main/java"
sourceDirectories.setFrom(files(mainSrc))
classDirectories.setFrom(files(debugTree))
executionData.setFrom(
fileTree(project.layout.buildDirectory.get()) {
include("outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec")
include("outputs/code_coverage/debugAndroidTest/connected/*/coverage.ec")
})
fileTree(project.layout.buildDirectory.get()) {
include("outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec")
include("outputs/code_coverage/debugAndroidTest/connected/*/coverage.ec")
})
}
52 changes: 36 additions & 16 deletions app/src/main/java/com/android/periodpals/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.pointer.PointerIcon.Companion.Text
import androidx.compose.ui.unit.dp
import com.android.periodpals.ui.profile.CreateProfile
import com.android.periodpals.ui.theme.PeriodPalsAppTheme

// import kotlinx.serialization.Serializable
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import kotlinx.serialization.Serializable

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -27,17 +40,24 @@ class MainActivity : ComponentActivity() {
}
}

/**
* @Composable fun CountriesList(dispatcher: CoroutineDispatcher = Dispatchers.IO) { var countries
* by remember { mutableStateOf<List<Country>>(listOf()) } LaunchedEffect(Unit) {
* withContext(dispatcher) { countries = supabase.from("countries").select().decodeList<Country>()
* } } LazyColumn { items( countries.size, ) { idx -> Text( countries[idx].name, modifier =
* Modifier.padding(8.dp), ) } } }
*
* val supabase = createSupabaseClient( supabaseUrl = "https://bhhjdcvdcfrxczbudraf.supabase.co",
* supabaseKey =
* "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJoaGpkY3ZkY2ZyeGN6YnVkcmFmIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Mjc4ODA4MjMsImV4cCI6MjA0MzQ1NjgyM30.teiPmTsMGNbXBx808uX7enVVLdgxqn4ftvSKjIgfCyQ")
* { install(Postgrest) }
*
* @Serializable data class Country( val id: Int, val name: String, )
*/
@Composable
fun CountriesList(dispatcher: CoroutineDispatcher = Dispatchers.IO) {
var countries by remember { mutableStateOf<List<Country>>(listOf()) }
LaunchedEffect(Unit) { withContext(dispatcher) { countries = listOf(Country(1, "eyyo pogger")) } }
LazyColumn {
items(
countries.size,
) { idx ->
Text(
countries[idx].name,
modifier = Modifier.padding(8.dp),
)
}
}
}

@Serializable
data class Country(
val id: Int,
val name: String,
)

0 comments on commit ae0c64a

Please sign in to comment.