Skip to content

Commit

Permalink
Merge pull request #163 from Team-B1ND/feature/162-onboarding-ios-view
Browse files Browse the repository at this point in the history
[Onboarding] Create iOS View
  • Loading branch information
8954sood authored Aug 23, 2024
2 parents dba521f + 99d151d commit 62529bc
Show file tree
Hide file tree
Showing 31 changed files with 523 additions and 522 deletions.
4 changes: 4 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ gradlePlugin {
id = "b1nd.dodam.primitive.multiplatform.compose"
implementationClass = "com.b1nd.dodam.primitive.MultiplatformComposePlugin"
}
register("multiplatformApplicationPlugin") {
id = "b1nd.dodam.primitive.multiplatform.application"
implementationClass = "com.b1nd.dodam.primitive.MultiplatformApplicationPlugin"
}
// convention
register("androidFeature") {
id = "b1nd.dodam.convention.android.feature"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class MultiplatformFeaturePlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("b1nd.dodam.primitive.multiplatform")
apply("b1nd.dodam.primitive.multiplatform.compose")
apply("b1nd.dodam.primitive.multiplatform.kotlin")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.b1nd.dodam.primitive

import com.b1nd.dodam.dsl.kotlin
import com.b1nd.dodam.dsl.library
import com.b1nd.dodam.dsl.libs
import com.b1nd.dodam.dsl.setupMultiplatform
import org.gradle.api.Plugin
import org.gradle.api.Project

class MultiplatformApplicationPlugin: Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.application")
apply("org.jetbrains.kotlin.multiplatform")
}
setupMultiplatform()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@ class MultiplatformComposePlugin: Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.application")
apply("org.jetbrains.kotlin.multiplatform")
apply("org.jetbrains.compose")
apply("org.jetbrains.kotlin.plugin.compose")
apply("org.jetbrains.kotlin.multiplatform")
}
setupMultiplatform()

kotlin {
sourceSets.commonMain.dependencies {
implementation(libs.library("androidx-lifecycle-viewmodel-compose"))
implementation(libs.library("koin-compose-multiplatform"))
implementation(libs.library("koin-compose-viewmodel"))
implementation(libs.library("multiplatform-compose-material3"))
implementation(libs.library("multiplatform-compose-navigation"))
implementation(libs.library("multiplatform-compose-components-resources"))
}

sourceSets.androidMain.dependencies {
implementation(libs.library("androidx-compose-ui-tooling-preview"))
implementation(libs.library("androidx-compose-ui-tooling"))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class MultiplatformKoinPlugin: Plugin<Project> {
kotlin {
sourceSets.commonMain.dependencies {
implementation(libs.library("koin-core"))
implementation(libs.library("koin-compose-multiplatform"))
implementation(libs.library("koin-compose-viewmodel"))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.fir.declarations.builder.buildScript

plugins {
alias(libs.plugins.android.application).apply(false)
alias(libs.plugins.kotlin.android).apply(false)
alias(libs.plugins.kotlin.jvm).apply(false)
alias(libs.plugins.ksp).apply(false)
alias(libs.plugins.kotlinx.serialization).apply(false)
// alias(libs.plugins.dagger.hilt).apply(false)
alias(libs.plugins.spotless).apply(false)
alias(libs.plugins.composeinvestigator).apply(false)
alias(libs.plugins.google.services).apply(false)
Expand All @@ -30,4 +30,4 @@ subprojects {
endWithNewline()
}
}
}
}
1 change: 1 addition & 0 deletions dodam-student/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ android {

dependencies {
implementation(libs.dodam.design.system)
implementation(libs.dodam.design.system.cmm)
implementation(projects.ui)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.junit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,43 +73,44 @@ class MainActivity : ComponentActivity() {
isLogin = datastoreRepository.token.first().isNotEmpty()
}
}

DodamTheme {
isLogin?.let {
DodamApp(
isLogin = it,
logout = {
lifecycleScope.launch {
datastoreRepository.deleteUser()
finish()
}
},
firebaseAnalytics = firebaseAnalytics,
firebaseCrashlytics = firebaseCrashlytics,
)
} ?: run {
Box(
modifier = Modifier
.background(MaterialTheme.colorScheme.background)
.fillMaxSize(),
) {
Icon(
modifier = Modifier
.size(180.dp)
.align(Alignment.Center),
imageVector = DodamLogo,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
com.b1nd.dodam.designsystem.DodamTheme {
DodamTheme {
isLogin?.let {
DodamApp(
isLogin = it,
logout = {
lifecycleScope.launch {
datastoreRepository.deleteUser()
finish()
}
},
firebaseAnalytics = firebaseAnalytics,
firebaseCrashlytics = firebaseCrashlytics,
)

Icon(
} ?: run {
Box(
modifier = Modifier
.size(60.dp)
.align(Alignment.BottomCenter),
imageVector = B1NDLogo,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
)
.background(MaterialTheme.colorScheme.background)
.fillMaxSize(),
) {
Icon(
modifier = Modifier
.size(180.dp)
.align(Alignment.Center),
imageVector = DodamLogo,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
)

Icon(
modifier = Modifier
.size(60.dp)
.align(Alignment.BottomCenter),
imageVector = B1NDLogo,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
)
}
}
}
}
Expand Down
18 changes: 6 additions & 12 deletions dodam-teacher-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import com.b1nd.dodam.dsl.android
import com.b1nd.dodam.dsl.kotlin
import com.b1nd.dodam.dsl.setIOS
import com.b1nd.dodam.dsl.setupMultiplatform
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework

plugins {
alias(libs.plugins.dodam.multiplatform.feature)
alias(libs.plugins.dodam.multiplatform.application)
alias(libs.plugins.dodam.multiplatform.compose)
alias(libs.plugins.dodam.multiplatform.kotlin)
alias(libs.plugins.dodam.multiplatform.koin)
}
kotlin {
Expand All @@ -22,12 +19,9 @@ kotlin {
implementation(projects.keystore)
}
commonMain.dependencies {
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.ui)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
implementation(libs.dodam.design.system.cmm)

implementation(projects.feature.onboarding)
implementation(projects.datastore)
implementation(projects.logging)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package com.b1nd.dodam.teacher

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.runtime.LaunchedEffect
import com.b1nd.dodam.keystore.keystoreManagerModule
import kotlinx.coroutines.launch
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidFileProperties
import org.koin.android.ext.koin.androidLogger
Expand All @@ -20,6 +24,20 @@ class MainActivity : ComponentActivity() {
)
}
setContent {
LaunchedEffect(Unit) {
launch {
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.auto(
android.graphics.Color.TRANSPARENT,
android.graphics.Color.TRANSPARENT,
),
navigationBarStyle = SystemBarStyle.auto(
android.graphics.Color.TRANSPARENT,
android.graphics.Color.TRANSPARENT,
),
)
}
}
DodamTeacherApp()
}
}
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions dodam-teacher-android/src/commonMain/kotlin/QWER.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,78 +1,26 @@
package com.b1nd.dodam.teacher

import androidx.compose.foundation.layout.Column
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.lifecycle.viewmodel.compose.viewModel
import org.koin.compose.viewmodel.koinViewModel
import org.koin.core.annotation.KoinExperimentalAPI
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import com.b1nd.dodam.designsystem.DodamTheme
import com.b1nd.dodam.onboarding.navigation.ONBOARDING_ROUTE
import com.b1nd.dodam.onboarding.navigation.onboardingScreen

@OptIn(KoinExperimentalAPI::class)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DodamTeacherApp(viewModel: TestViewModel = koinViewModel()) {
val state by viewModel.state.collectAsState()

var idText by remember { mutableStateOf("") }
var pwText by remember { mutableStateOf("") }
var tokenText by remember { mutableStateOf("") }

MaterialTheme {
Column {
Text(state.toString())

TextField(
value = idText,
onValueChange = {
idText = it
},
)
TextField(
value = pwText,
onValueChange = {
pwText = it
},
)
TextField(
value = tokenText,
onValueChange = {
tokenText = it
},
)
DodamTestButton(
text = "삭제",
onClick = {
viewModel.deleteUser()
},
)

DodamTestButton(
text = "저장",
onClick = {
viewModel.saveUser(
id = idText,
pw = pwText,
token = tokenText,
)
},
fun DodamTeacherApp() {
val navHostController = rememberNavController()
DodamTheme {
NavHost(
navController = navHostController,
startDestination = ONBOARDING_ROUTE,
) {
onboardingScreen(
onRegisterClick = {},
onLoginClick = {},
)
}
}
}

@Composable
private fun DodamTestButton(text: String, onClick: () -> Unit) {
Button(
onClick = onClick,
content = {
Text(text)
},
)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
package com.b1nd.dodam.teacher

import com.b1nd.dodam.datastore.di.dataStoreModule
import org.koin.compose.viewmodel.dsl.viewModel
import org.koin.core.KoinApplication
import org.koin.core.context.startKoin
import org.koin.dsl.module

fun initKoin(block: KoinApplication.() -> Unit = {}) {
startKoin {
modules(
dataStoreModule,
testViewModelModule,
)
block()
}
}

val testViewModelModule = module {
viewModel {
TestViewModel()
}
}
Loading

0 comments on commit 62529bc

Please sign in to comment.