Skip to content

Commit

Permalink
refactor(networking-screens): migrate module to kmp.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed Sep 1, 2024
1 parent 12000f4 commit 09b2d3a
Show file tree
Hide file tree
Showing 15 changed files with 138 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.compose.ui.Modifier
import org.gdglille.devfest.android.shared.resources.Resource
import org.gdglille.devfest.android.shared.resources.text_error
import org.gdglille.devfest.android.shared.resources.text_loading
import org.gdglille.devfest.android.theme.m3.networking.screens.ContactsScreen
import org.gdglille.devfest.theme.m3.networking.screens.ContactsScreen
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource
import org.koin.androidx.compose.koinViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import androidx.compose.ui.Modifier
import org.gdglille.devfest.android.shared.resources.Resource
import org.gdglille.devfest.android.shared.resources.text_error
import org.gdglille.devfest.android.shared.resources.text_loading
import org.gdglille.devfest.android.theme.m3.networking.screens.EmptyNetworkingScreen
import org.gdglille.devfest.android.theme.m3.networking.screens.MyProfileScreen
import org.gdglille.devfest.theme.m3.networking.screens.EmptyNetworkingScreen
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource
import org.koin.androidx.compose.koinViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import androidx.compose.ui.Modifier
import org.gdglille.devfest.android.shared.resources.Resource
import org.gdglille.devfest.android.shared.resources.screen_networking
import org.gdglille.devfest.android.shared.resources.text_error
import org.gdglille.devfest.android.theme.m3.networking.screens.EmptyNetworkingScreen
import org.gdglille.devfest.android.theme.m3.style.Scaffold
import org.gdglille.devfest.models.ui.ExportNetworkingUi
import org.gdglille.devfest.theme.m3.navigation.ActionIds
import org.gdglille.devfest.theme.m3.navigation.TabActions
import org.gdglille.devfest.theme.m3.networking.screens.EmptyNetworkingScreen
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource
import org.koin.androidx.compose.koinViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.compose.ui.Modifier
import org.gdglille.devfest.android.shared.resources.Resource
import org.gdglille.devfest.android.shared.resources.text_error
import org.gdglille.devfest.android.shared.resources.text_loading
import org.gdglille.devfest.android.theme.m3.networking.screens.ProfileInputScreen
import org.gdglille.devfest.theme.m3.networking.screens.ProfileInputScreen
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource
import org.koin.androidx.compose.koinViewModel
Expand Down
46 changes: 33 additions & 13 deletions theme-m3/networking/networking-screens/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
id("conferences4hall.android.library")
id("conferences4hall.multiplatform.library")
id("conferences4hall.android.library.compose")
id("conferences4hall.quality")
}
Expand All @@ -8,18 +10,36 @@ android {
namespace = "org.gdglille.devfest.android.theme.m3.networking.screens"
}

dependencies {
implementation(projects.shared.core)
implementation(projects.shared.resources)
implementation(projects.themeM3.networking.networkingUi)
implementation(projects.themeM3.navigation)
implementation(projects.themeM3.style.networking)
implementation(projects.themeM3.style.theme)
kotlin {
androidTarget()

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

sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.shared.uiModels)
implementation(projects.shared.resources)
implementation(projects.themeM3.networking.networkingUi)
implementation(projects.themeM3.navigation)
implementation(projects.themeM3.style.networking)
implementation(projects.themeM3.style.theme)

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

implementation(compose.material3)
implementation(compose.components.resources)
implementation(compose.preview)
debugImplementation(compose.uiTooling)
api(libs.jetbrains.kotlinx.collections)
}
}
val androidMain by getting {
dependencies {
implementation(compose.preview)
implementation(compose.uiTooling)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.gdglille.devfest.android.theme.m3.networking.screens

import android.annotation.SuppressLint
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.models.ui.NetworkingUi
import org.gdglille.devfest.theme.m3.networking.screens.ContactsScreen

@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@ExperimentalMaterial3Api
@Preview
@Composable
private fun ContactsPreview() {
Conferences4HallTheme {
Scaffold {
ContactsScreen(
users = NetworkingUi.fake.users,
onNetworkDeleted = {}
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.gdglille.devfest.android.theme.m3.networking.screens

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.theme.m3.networking.screens.EmptyContactsScreen

@Preview(showBackground = true)
@Composable
fun EmptyContactsScreenPreview() {
Conferences4HallTheme {
EmptyContactsScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.gdglille.devfest.android.theme.m3.networking.screens

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.theme.m3.networking.screens.EmptyNetworkingScreen

@Preview(showBackground = true)
@Composable
private fun EmptyNetworkingScreenPreview() {
Conferences4HallTheme {
EmptyNetworkingScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.gdglille.devfest.android.theme.m3.networking.screens

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.models.ui.UserProfileUi

@Preview
@Composable
private fun MyProfilePreview() {
Conferences4HallTheme {
MyProfileScreen(
profileUi = UserProfileUi.fake,
onEditInformation = {}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@ import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.gdglille.devfest.android.shared.resources.Resource
import org.gdglille.devfest.android.shared.resources.action_edit_profile
import org.gdglille.devfest.android.shared.resources.semantic_profile_qrcode
import org.gdglille.devfest.android.shared.resources.semantic_user_item_company
import org.gdglille.devfest.android.shared.resources.semantic_user_item_email
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.models.ui.UserProfileUi
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource

@OptIn(ExperimentalResourceApi::class)
@Composable
fun MyProfileScreen(
profileUi: UserProfileUi,
Expand Down Expand Up @@ -96,14 +92,3 @@ fun MyProfileScreen(
}
}
}

@Preview
@Composable
private fun MyProfilePreview() {
Conferences4HallTheme {
MyProfileScreen(
profileUi = UserProfileUi.fake,
onEditInformation = {}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.gdglille.devfest.android.theme.m3.networking.screens

import android.annotation.SuppressLint
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.models.ui.UserProfileUi
import org.gdglille.devfest.theme.m3.networking.screens.ProfileInputScreen

@ExperimentalMaterial3Api
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@Preview
@Composable
fun ProfileInputScreenPreview() {
Conferences4HallTheme {
Scaffold {
ProfileInputScreen(
profile = UserProfileUi.fake,
onValueChanged = { _, _ -> },
onValidation = {},
onBackClicked = {}
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.gdglille.devfest.android.theme.m3.networking.screens
package org.gdglille.devfest.theme.m3.networking.screens

import android.annotation.SuppressLint
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
Expand All @@ -9,28 +8,21 @@ import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.Divider
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kotlinx.collections.immutable.ImmutableList
import org.gdglille.devfest.android.shared.resources.Resource
import org.gdglille.devfest.android.shared.resources.action_submit_accept
import org.gdglille.devfest.android.shared.resources.action_submit_deny
import org.gdglille.devfest.android.shared.resources.text_networking_ask_to_delete
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.gdglille.devfest.models.ui.NetworkingUi
import org.gdglille.devfest.models.ui.UserNetworkingUi
import org.gdglille.devfest.theme.m3.style.networking.UserItem
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource

@OptIn(ExperimentalResourceApi::class)
@Composable
fun ContactsScreen(
users: ImmutableList<UserNetworkingUi>,
Expand Down Expand Up @@ -89,18 +81,3 @@ fun ContactsScreen(
}
}
}

@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@ExperimentalMaterial3Api
@Preview
@Composable
private fun ContactsPreview() {
Conferences4HallTheme {
Scaffold {
ContactsScreen(
users = NetworkingUi.fake.users,
onNetworkDeleted = {}
)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.gdglille.devfest.android.theme.m3.networking.screens
package org.gdglille.devfest.theme.m3.networking.screens

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -7,15 +7,11 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.gdglille.devfest.android.shared.resources.Resource
import org.gdglille.devfest.android.shared.resources.text_empty_contacts
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource

@OptIn(ExperimentalResourceApi::class)
@Composable
fun EmptyContactsScreen(modifier: Modifier = Modifier) {
Column(
Expand All @@ -29,11 +25,3 @@ fun EmptyContactsScreen(modifier: Modifier = Modifier) {
)
}
}

@Preview(showBackground = true)
@Composable
fun EmptyContactsScreenPreview() {
Conferences4HallTheme {
EmptyContactsScreen()
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.gdglille.devfest.android.theme.m3.networking.screens
package org.gdglille.devfest.theme.m3.networking.screens

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -7,17 +7,13 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.gdglille.devfest.android.shared.resources.Resource
import org.gdglille.devfest.android.shared.resources.text_empty_networking
import org.gdglille.devfest.android.shared.resources.text_empty_networking_warning
import org.gdglille.devfest.android.shared.resources.text_here_we_go
import org.gdglille.devfest.android.theme.m3.style.Conferences4HallTheme
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.stringResource

@OptIn(ExperimentalResourceApi::class)
@Composable
fun EmptyNetworkingScreen(
modifier: Modifier = Modifier
Expand All @@ -33,11 +29,3 @@ fun EmptyNetworkingScreen(
Text(text = stringResource(Resource.string.text_here_we_go))
}
}

@Preview(showBackground = true)
@Composable
private fun EmptyNetworkingScreenPreview() {
Conferences4HallTheme {
EmptyNetworkingScreen()
}
}
Loading

0 comments on commit 09b2d3a

Please sign in to comment.