Skip to content

Commit

Permalink
Add an iOS app and update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinto committed Aug 10, 2024
1 parent 7cbaa9a commit 7ee89f1
Show file tree
Hide file tree
Showing 57 changed files with 2,297 additions and 287 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.iml
.gradle
.kotlin
.idea
.DS_Store
build
Expand Down
4 changes: 1 addition & 3 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.parcelize)
}

Expand All @@ -19,9 +20,6 @@ android {
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ClassmatesViewModel(
coursesRepository.getCourseClassmates(savedStateHandle[KEY_COURSE_ID]!!)

val state = classmates
.asFlow()
.flow
.map {
when (it) {
is DomainResponse.Loading -> ClassmatesState.Loading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GroupsViewModel(
private val courses = coursesRepository.getCourseGroups(courseId)

val state = courses
.asFlow()
.flow
.map {
when (it) {
is DomainResponse.Loading -> GroupsState.Loading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ScoresViewModel(
private val course = coursesRepository.getCourseScores(savedStateHandle[KEY_COURSE_ID]!!)

val state = course
.asFlow()
.flow
.map {
when (it) {
is DomainResponse.Loading -> ScoresState.Loading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SyllabusViewModel(
private val syllabus = coursesRepository.getCourseSyllabus(savedStateHandle[KEY_COURSE_ID]!!)

val state = syllabus
.asFlow()
.flow
.map {
when (it) {
is DomainResponse.Loading -> SyllabusState.Loading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ class MainViewModel(
private val userRepository: UserRepository
) : ViewModel() {

private val meUserInfo = userRepository.getMeUserInfo()
private val meUserState = userRepository.getMeUserState()

val state = combine(meUserInfo.asFlow(), meUserState.asFlow()) { info, state ->
val state = combine(
userRepository.meUserInfo.flow,
userRepository.meUserState.flow
) { info, state ->
info to state
}.map {
when (it) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class UserInfoViewModel(
) : ViewModel() {

val state = combine(
userRepository.getMeUserInfo().asFlow(),
userRepository.getMeUserState().asFlow()
) { info, state -> info to state }.map {
userRepository.meUserInfo.flow,
userRepository.meUserState.flow,
::Pair
).map {
when (it) {
is DomainResponse.Loading -> UserInfoState.Loading
is DomainResponse.Success -> UserInfoState.Success(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MessageViewModel(
)

val state = message
.asFlow()
.flow
.map {
when (it) {
is DomainResponse.Loading -> MessageState.Loading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class MeUserProfileViewModel(

private val tempInfo = MutableStateFlow<DomainMeUserInfo?>(null)

private val userInfo = userRepository.getMeUserInfo()

val state = combine(userInfo.asFlow(), tempInfo) { userInfo, tempUserInfo ->
val state = combine(userRepository.meUserInfo.flow, tempInfo) { userInfo, tempUserInfo ->
when (userInfo) {
is DomainResponse.Loading -> MeUserProfileState.Loading
is DomainResponse.Success -> {
Expand All @@ -39,7 +37,7 @@ class MeUserProfileViewModel(
private val _saving = MutableStateFlow(false)
val saving = _saving.asStateFlow()

val canSave = combine(userInfo.asFlow(), tempInfo) { userInfo, tempInfo ->
val canSave = combine(userRepository.meUserInfo.flow, tempInfo) { userInfo, tempInfo ->
userInfo is DomainResponse.Success && tempInfo != null && userInfo.value != tempInfo
}.stateIn(
scope = viewModelScope,
Expand Down Expand Up @@ -78,7 +76,7 @@ class MeUserProfileViewModel(
viewModelScope.launch {
_saving.value = true
if (userRepository.updateUserInfo(tempInfo.value!!)) {
userInfo.refresh()
userRepository.meUserInfo.refresh()
tempInfo.value = null
}
_saving.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.paging.LoadState
import app.cash.paging.compose.LazyPagingItems
import app.cash.paging.compose.collectAsLazyPagingItems
import androidx.paging.compose.LazyPagingItems
import androidx.paging.compose.collectAsLazyPagingItems
import dev.xinto.argos.R
import dev.xinto.argos.domain.notifications.DomainNotification
import dev.xinto.argos.ui.component.SegmentedListItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class UserProfileViewModel(
private val profile = userRepository.getUserProfile(savedStateHandle[KEY_USER_ID]!!)

val state = profile
.asFlow()
.flow
.map {
when (it) {
is DomainResponse.Loading -> UserProfileState.Loading
Expand Down
16 changes: 10 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
plugins {
//trick: for the same plugin versions in all sub-modules
alias(libs.plugins.kotlin.multiplatform).apply(false)
alias(libs.plugins.kotlin.android).apply(false)
alias(libs.plugins.kotlin.serialization).apply(false)
alias(libs.plugins.kotlin.parcelize).apply(false)
alias(libs.plugins.android.library).apply(false)
alias(libs.plugins.android.application).apply(false)
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.kotlin.cocoapods) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.skie) apply false
}
30 changes: 17 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
[versions]
agp = "8.2.0"
kotlin = "1.9.21"
compose = "1.5.4"
compose-compiler = "1.5.7"
ktor = "2.3.6"
agp = "8.2.2"
kotlin = "2.0.10"
compose = "1.6.8"
ktor = "2.3.11"
coil = "2.5.0"
paging = "3.3.0-alpha02-0.4.0"
paging = "3.3.2"
skie = "0.8.4"

[libraries]
androidx-core = { group = "androidx.core", name = "core-ktx", version = "1.12.0"}
androidx-activity-compose = { module = "androidx.activity:activity-compose", version = "1.8.2" }
androidx-browser = { module = "androidx.browser:browser", version = "1.7.0" }
androidx-core = { group = "androidx.core", name = "core-ktx", version = "1.13.1"}
androidx-activity-compose = { module = "androidx.activity:activity-compose", version = "1.9.1" }
androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" }
androidx-crypto = { group = "androidx.security", name = "security-crypto", version = "1.1.0-alpha06" }
androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version = "2.6.2" }

desugaring = { module = "com.android.tools:desugar_jdk_libs", version = "2.0.4" }

paging-common = { group = "app.cash.paging", name = "paging-common", version.ref = "paging" }
paging-compose = { group = "app.cash.paging", name = "paging-compose-common", version.ref = "paging" }
paging-uikit = { group = "app.cash.paging", name = "paging-uikit", version.ref = "paging" }
paging-common = { group = "androidx.paging", name = "paging-common", version.ref = "paging" }
paging-compose = { group = "androidx.paging", name = "paging-compose", version.ref = "paging" }

compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material3:material3", version = "1.2.0-beta01" }
compose-material3 = { module = "androidx.compose.material3:material3", version = "1.2.1" }

kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version = "0.4.1" }
Expand All @@ -49,6 +48,8 @@ coil-svg = { group = "io.coil-kt", name = "coil-svg", version.ref = "coil" }

jsoup = { group = "org.jsoup", name = "jsoup", version = "1.17.1"}

skie-annotations = { group = "co.touchlab.skie", name = "configuration-annotations", version.ref="skie" }

[bundles]
ktor = ["ktor-core", "ktor-auth", "ktor-serialization", "ktor-serialization-json"]
coil = ["coil-compose", "coil-svg"]
Expand All @@ -61,3 +62,6 @@ kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref
kotlin-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
skie = { id = "co.touchlab.skie", version.ref="skie" }
ksp = { id = "com.google.devtools.ksp", version = "2.0.0-1.0.23" }
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Nov 10 13:02:55 GET 2023
#Thu Jul 25 21:46:33 GET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 7ee89f1

Please sign in to comment.