Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Wasm compatibility in features modules #110

Merged
merged 18 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
93a72c4
refactor(core-kvalue): move settings to dedicated module.
GerardPaligot Oct 12, 2024
28a66ab
refactor(core): move SQLDelight dao in mobileMain sourceset.
GerardPaligot Oct 12, 2024
b6a3e92
feat(core): add wasmJs target support.
GerardPaligot Oct 13, 2024
eb536db
feat(core-di): add wasmJs target support.
GerardPaligot Oct 13, 2024
bfb7953
feat(speakers-presentation): add wasmJs target support.
GerardPaligot Oct 13, 2024
fddf45d
feat(speakers-di): add wasmJs target support.
GerardPaligot Oct 13, 2024
8f87e7c
feat(event-list-presentation): add wasmJs target support.
GerardPaligot Oct 13, 2024
fd0f608
feat(event-list-di): add wasmJs target support.
GerardPaligot Oct 13, 2024
72b2b5a
feat(schedules-presentation): add wasmJs target support.
GerardPaligot Oct 14, 2024
4049987
feat(schedules-di): add wasmJs target support.
GerardPaligot Oct 14, 2024
1e2091c
feat(partners-presentation): add wasmJs target support.
GerardPaligot Oct 14, 2024
c944daf
feat(partners-di): add wasmJs target support.
GerardPaligot Oct 14, 2024
3eb53bb
feat(infos-presentation): add wasmJs target support.
GerardPaligot Oct 14, 2024
bac1564
feat(infos-di): add wasmJs target support.
GerardPaligot Oct 14, 2024
2d3c41e
feat(networking-presentation): add wasmJs target support.
GerardPaligot Oct 14, 2024
3467087
feat(networking-di): add wasmJs target support.
GerardPaligot Oct 14, 2024
5fce0f2
fix(core): remove properly db models in wasm target.
GerardPaligot Oct 15, 2024
878c2ae
chore: remove os check to add ios targets.
GerardPaligot Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import android.content.Context
import android.content.Intent
import com.paligot.confily.core.AlarmIntentFactory
import com.paligot.confily.core.AlarmScheduler
import com.paligot.confily.core.AlarmSchedulerAndroid
import org.koin.android.ext.koin.androidContext
import org.koin.androidx.workmanager.dsl.worker
import org.koin.dsl.module

val sampleModule = module {
single {
AlarmScheduler(
single<AlarmScheduler> {
AlarmSchedulerAndroid(
context = androidContext(),
repository = get(),
alarmManager = androidContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager,
alarmIntentFactory = object : AlarmIntentFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent
import com.paligot.confily.core.AlarmIntentFactory
import com.paligot.confily.core.AlarmScheduler
import com.paligot.confily.core.AlarmSchedulerAndroid
import com.paligot.confily.core.db.DatabaseWrapper
import com.paligot.confily.core.di.ApplicationIdNamed
import com.paligot.confily.core.di.ConfilyBaseUrlNamed
Expand All @@ -22,8 +23,9 @@ val instrumentedModule = module {
single(named(IsDebugNamed)) { true }
single(named(ApplicationIdNamed)) { "com.paligot.confily.core.test" }
single(named(ConfilyBaseUrlNamed)) { "" }
single {
AlarmScheduler(
single<AlarmScheduler> {
AlarmSchedulerAndroid(
androidContext(),
get(),
androidContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager,
object : AlarmIntentFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import android.content.Context
import com.paligot.confily.android.AlarmIntentFactoryImpl
import com.paligot.confily.android.ScheduleWorkManager
import com.paligot.confily.core.AlarmScheduler
import com.paligot.confily.core.AlarmSchedulerAndroid
import com.paligot.confily.main.di.mainModule
import org.koin.android.ext.koin.androidContext
import org.koin.androidx.workmanager.dsl.worker
import org.koin.dsl.module

val appModule = module {
includes(buildConfigModule, mainModule)
single {
AlarmScheduler(
single<AlarmScheduler> {
AlarmSchedulerAndroid(
androidContext(),
get(),
androidContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager,
AlarmIntentFactoryImpl
Expand Down
27 changes: 21 additions & 6 deletions features/event-list/event-list-di/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl

plugins {
id("confily.android.library")
id("confily.multiplatform.library")
id("confily.quality")
}

android {
namespace = "com.paligot.confily.events.di"
}

dependencies {
implementation(projects.features.eventList.eventListPresentation)
implementation(projects.shared.coreDi)
kotlin {
androidTarget()

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
useCommonJs()
browser()
}

sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.features.eventList.eventListPresentation)
implementation(projects.shared.coreDi)

implementation(libs.koin.core)
implementation(libs.koin.android)
implementation(libs.koin.compose.viewmodel)
}
}
}
}
46 changes: 28 additions & 18 deletions features/event-list/event-list-presentation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl

plugins {
id("confily.android.library")
id("confily.multiplatform.library")
id("confily.android.library.compose")
id("confily.quality")
}
Expand All @@ -8,25 +10,33 @@ android {
namespace = "com.paligot.confily.events.presentation"
}

dependencies {
implementation(projects.shared.core)
implementation(projects.shared.resources)
implementation(projects.features.eventList.eventListUi)
implementation(projects.features.eventList.eventListPanes)
implementation(projects.features.navigation)
implementation(projects.style.theme)
kotlin {
androidTarget()

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
useCommonJs()
browser()
}

implementation(libs.koin.androidx.compose)
sourceSets {
commonMain {
dependencies {
implementation(projects.shared.core)
implementation(projects.shared.resources)
implementation(projects.features.eventList.eventListUi)
implementation(projects.features.eventList.eventListPanes)
implementation(projects.features.navigation)
implementation(projects.style.theme)

implementation(libs.jetbrains.kotlinx.collections)
implementation(libs.jetbrains.lifecycle.viewmodel.compose)
implementation(compose.material3)
implementation(compose.components.resources)

implementation(compose.material3)
implementation(compose.components.resources)
implementation(compose.preview)
debugImplementation(compose.uiTooling)
implementation(libs.androidx.activity.compose)
implementation(libs.jetbrains.kotlinx.collections)
implementation(libs.jetbrains.lifecycle.viewmodel.compose)

implementation(platform(libs.google.firebase.bom))
implementation("com.google.firebase:firebase-crashlytics-ktx")
implementation(libs.koin.compose.viewmodel)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.paligot.confily.events.panes.EventList
import com.paligot.confily.resources.Resource
import com.paligot.confily.resources.text_error
import org.jetbrains.compose.resources.stringResource
import org.koin.androidx.compose.koinViewModel
import org.koin.compose.viewmodel.koinViewModel

@Composable
fun EventListVM(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.paligot.confily.events.presentation

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
import com.paligot.confily.core.events.EventRepository
import com.paligot.confily.models.ui.EventItemListUi
import kotlinx.coroutines.flow.SharingStarted
Expand All @@ -22,10 +20,7 @@ sealed class EventListUiState {
class EventListViewModel(private val repository: EventRepository) : ViewModel() {
val uiState: StateFlow<EventListUiState> = repository.events()
.map { EventListUiState.Success(it) as EventListUiState }
.catch {
Firebase.crashlytics.recordException(it)
emit(EventListUiState.Failure(it))
}
.catch { emit(EventListUiState.Failure(it)) }
.stateIn(
scope = viewModelScope,
started = SharingStarted.WhileSubscribed(),
Expand Down
27 changes: 21 additions & 6 deletions features/infos/infos-di/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl

plugins {
id("confily.android.library")
id("confily.multiplatform.library")
id("confily.quality")
}

android {
namespace = "com.paligot.confily.infos.di"
}

dependencies {
implementation(projects.features.infos.infosPresentation)
implementation(projects.shared.coreDi)
kotlin {
androidTarget()

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
useCommonJs()
browser()
}

sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.features.infos.infosPresentation)
implementation(projects.shared.coreDi)

implementation(libs.koin.core)
implementation(libs.koin.android)
implementation(libs.koin.compose.viewmodel)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.paligot.confily.infos.panes

import android.annotation.SuppressLint
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.paligot.confily.models.ui.EventUi
import com.paligot.confily.style.theme.ConfilyTheme

@ExperimentalFoundationApi
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@Preview
@Composable
private fun EventPreview() {
ConfilyTheme {
Scaffold {
Event(
event = EventUi.fake,
onLinkClicked = {},
onItineraryClicked = { _, _ -> }
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.paligot.confily.infos.panes

import android.annotation.SuppressLint
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
Expand All @@ -10,13 +8,11 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.paligot.confily.infos.ui.tickets.TicketDetailed
import com.paligot.confily.infos.ui.tickets.TicketQrCode
Expand All @@ -26,7 +22,6 @@ import com.paligot.confily.resources.title_plan
import com.paligot.confily.resources.title_ticket
import com.paligot.confily.style.events.cards.AddressCard
import com.paligot.confily.style.events.socials.SocialsSection
import com.paligot.confily.style.theme.ConfilyTheme
import org.jetbrains.compose.resources.stringResource

@Composable
Expand Down Expand Up @@ -96,19 +91,3 @@ fun Event(
}
}
}

@ExperimentalFoundationApi
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@Preview
@Composable
private fun EventPreview() {
ConfilyTheme {
Scaffold {
Event(
event = EventUi.fake,
onLinkClicked = {},
onItineraryClicked = { _, _ -> }
)
}
}
}
63 changes: 39 additions & 24 deletions features/infos/infos-presentation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl

plugins {
id("confily.android.library")
id("confily.multiplatform.library")
id("confily.android.library.compose")
id("confily.quality")
}
Expand All @@ -8,27 +10,40 @@ android {
namespace = "com.paligot.confily.infos.presentation"
}

dependencies {
implementation(projects.shared.core)
implementation(projects.shared.resources)
implementation(projects.features.infos.infosUi)
implementation(projects.features.infos.infosPanes)
implementation(projects.features.navigation)
implementation(projects.style.components.markdown)
implementation(projects.style.components.permissions)
implementation(projects.style.events)
implementation(projects.style.theme)

implementation(libs.koin.androidx.compose)

implementation(libs.jetbrains.kotlinx.collections)
implementation(libs.jetbrains.lifecycle.viewmodel.compose)

implementation(compose.material3)
implementation(compose.components.resources)
implementation(compose.preview)
debugImplementation(compose.uiTooling)

implementation(platform(libs.google.firebase.bom))
implementation("com.google.firebase:firebase-crashlytics-ktx")
kotlin {
androidTarget()

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
useCommonJs()
browser()
}

sourceSets {
commonMain {
dependencies {
implementation(projects.shared.core)
implementation(projects.shared.resources)
implementation(projects.features.infos.infosUi)
implementation(projects.features.infos.infosPanes)
implementation(projects.features.navigation)
implementation(projects.style.components.markdown)
implementation(projects.style.events)
implementation(projects.style.theme)

implementation(compose.material3)
implementation(compose.components.resources)

implementation(libs.jetbrains.kotlinx.collections)
implementation(libs.jetbrains.lifecycle.viewmodel.compose)

implementation(libs.koin.compose.viewmodel)
}
}
androidMain {
dependencies {
implementation(projects.style.components.permissions)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import com.paligot.confily.infos.panes.CoCScreen
import com.paligot.confily.resources.Resource
import com.paligot.confily.resources.text_error
import com.paligot.confily.resources.text_loading
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource
import org.koin.androidx.compose.koinViewModel
import org.koin.compose.viewmodel.koinViewModel

@OptIn(ExperimentalResourceApi::class)
@Composable
fun CoCVM(
onReportByPhoneClicked: (String) -> Unit,
Expand Down
Loading
Loading