├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── iosApp
├── iosApp
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ ├── AccentColor.colorset
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Preview Content
│ │ └── Preview Assets.xcassets
│ │ │ └── Contents.json
│ ├── ContentView.swift
│ ├── iOSApp.swift
│ ├── Colors.swift
│ ├── note_list
│ │ ├── HideableSearchTextField.swift
│ │ ├── NoteItem.swift
│ │ ├── NoteListViewModel.swift
│ │ └── NoteListScreen.swift
│ ├── note_detail
│ │ ├── NoteDetailScreen.swift
│ │ └── NoteDetailViewModel.swift
│ └── Info.plist
└── iosApp.xcodeproj
│ └── project.pbxproj
├── androidApp
├── src
│ └── main
│ │ ├── res
│ │ └── values
│ │ │ └── styles.xml
│ │ ├── java
│ │ └── com
│ │ │ └── plcoding
│ │ │ └── noteappkmm
│ │ │ └── android
│ │ │ ├── NoteApp.kt
│ │ │ ├── note_list
│ │ │ ├── NoteListState.kt
│ │ │ ├── NoteListViewModel.kt
│ │ │ ├── NoteItem.kt
│ │ │ ├── HideableSearchTextField.kt
│ │ │ └── NoteListScreen.kt
│ │ │ ├── note_detail
│ │ │ ├── NoteDetailState.kt
│ │ │ ├── TransparentHintTextField.kt
│ │ │ ├── NoteDetailScreen.kt
│ │ │ └── NoteDetailViewModel.kt
│ │ │ ├── di
│ │ │ └── AppModule.kt
│ │ │ └── MainActivity.kt
│ │ └── AndroidManifest.xml
└── build.gradle.kts
├── .gitignore
├── shared
├── src
│ ├── commonMain
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── plcoding
│ │ │ │ └── noteappkmm
│ │ │ │ ├── data
│ │ │ │ ├── local
│ │ │ │ │ └── DatabaseDriverFactory.kt
│ │ │ │ └── note
│ │ │ │ │ ├── NoteMapper.kt
│ │ │ │ │ └── SqlDelightNoteDataSource.kt
│ │ │ │ ├── presentation
│ │ │ │ └── Colors.kt
│ │ │ │ └── domain
│ │ │ │ ├── note
│ │ │ │ ├── NoteDataSource.kt
│ │ │ │ ├── Note.kt
│ │ │ │ └── SearchNotes.kt
│ │ │ │ └── time
│ │ │ │ └── DateTimeUtil.kt
│ │ └── sqldelight
│ │ │ └── database
│ │ │ └── note.sq
│ ├── iosMain
│ │ └── kotlin
│ │ │ └── com
│ │ │ └── plcoding
│ │ │ └── noteappkmm
│ │ │ ├── data
│ │ │ └── local
│ │ │ │ └── DatabaseDriverFactory.kt
│ │ │ └── di
│ │ │ └── DatabaseModule.kt
│ └── androidMain
│ │ └── kotlin
│ │ └── com
│ │ └── plcoding
│ │ └── noteappkmm
│ │ └── data
│ │ └── local
│ │ └── DatabaseDriverFactory.kt
└── build.gradle.kts
├── gradle.properties
├── settings.gradle.kts
├── gradlew.bat
└── gradlew
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/philipplackner/NoteAppKMM/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
--------------------------------------------------------------------------------
/androidApp/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | .idea
4 | .DS_Store
5 | build
6 | captures
7 | .externalNativeBuild
8 | .cxx
9 | local.properties
10 | xcuserdata
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/NoteApp.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android
2 |
3 | import android.app.Application
4 | import dagger.hilt.android.HiltAndroidApp
5 |
6 | @HiltAndroidApp
7 | class NoteApp: Application()
--------------------------------------------------------------------------------
/shared/src/commonMain/kotlin/com/plcoding/noteappkmm/data/local/DatabaseDriverFactory.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.data.local
2 |
3 | import com.squareup.sqldelight.db.SqlDriver
4 |
5 | expect class DatabaseDriverFactory {
6 | fun createDriver(): SqlDriver
7 | }
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Sep 25 11:20:53 CEST 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/iosApp/iosApp/ContentView.swift:
--------------------------------------------------------------------------------
1 | import SwiftUI
2 | import shared
3 |
4 | struct ContentView: View {
5 |
6 | var body: some View {
7 | Text("Hello world!")
8 | }
9 | }
10 |
11 | struct ContentView_Previews: PreviewProvider {
12 | static var previews: some View {
13 | ContentView()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/shared/src/commonMain/kotlin/com/plcoding/noteappkmm/presentation/Colors.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.presentation
2 |
3 | const val RedOrangeHex = 0xffffab91
4 | const val RedPinkHex = 0xfff48fb1
5 | const val BabyBlueHex = 0xff81deea
6 | const val VioletHex = 0xffcf94da
7 | const val LightGreenHex = 0xffe7ed9b
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #Gradle
2 | org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
3 |
4 | #Kotlin
5 | kotlin.code.style=official
6 |
7 | #Android
8 | android.useAndroidX=true
9 | android.nonTransitiveRClass=true
10 |
11 | #MPP
12 | kotlin.mpp.enableCInteropCommonization=true
--------------------------------------------------------------------------------
/shared/src/commonMain/kotlin/com/plcoding/noteappkmm/domain/note/NoteDataSource.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.domain.note
2 |
3 | interface NoteDataSource {
4 | suspend fun insertNote(note: Note)
5 | suspend fun getNoteById(id: Long): Note?
6 | suspend fun getAllNotes(): List
7 | suspend fun deleteNoteById(id: Long)
8 | }
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/note_list/NoteListState.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.note_list
2 |
3 | import com.plcoding.noteappkmm.domain.note.Note
4 |
5 | data class NoteListState(
6 | val notes: List = emptyList(),
7 | val searchText: String = "",
8 | val isSearchActive: Boolean = false
9 | )
10 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google()
4 | gradlePluginPortal()
5 | mavenCentral()
6 | }
7 | }
8 |
9 | dependencyResolutionManagement {
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | }
15 |
16 | rootProject.name = "NoteAppKMM"
17 | include(":androidApp")
18 | include(":shared")
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/note_detail/NoteDetailState.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.note_detail
2 |
3 | data class NoteDetailState(
4 | val noteTitle: String = "",
5 | val isNoteTitleHintVisible: Boolean = false,
6 | val noteContent: String = "",
7 | val isNoteContentHintVisible: Boolean = false,
8 | val noteColor: Long = 0xFFFFFF
9 | )
10 |
--------------------------------------------------------------------------------
/iosApp/iosApp/iOSApp.swift:
--------------------------------------------------------------------------------
1 | import SwiftUI
2 | import shared
3 |
4 | @main
5 | struct iOSApp: App {
6 |
7 | private let databaseModule = DatabaseModule()
8 |
9 | var body: some Scene {
10 | WindowGroup {
11 | NavigationView {
12 | NoteListScreen(noteDataSource: databaseModule.noteDataSource)
13 | }.accentColor(.black)
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/shared/src/iosMain/kotlin/com/plcoding/noteappkmm/data/local/DatabaseDriverFactory.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.data.local
2 |
3 | import com.plcoding.noteappkmm.database.NoteDatabase
4 | import com.squareup.sqldelight.db.SqlDriver
5 | import com.squareup.sqldelight.drivers.native.NativeSqliteDriver
6 |
7 | actual class DatabaseDriverFactory {
8 | actual fun createDriver(): SqlDriver {
9 | return NativeSqliteDriver(NoteDatabase.Schema, "note.db")
10 | }
11 | }
--------------------------------------------------------------------------------
/shared/src/androidMain/kotlin/com/plcoding/noteappkmm/data/local/DatabaseDriverFactory.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.data.local
2 |
3 | import android.content.Context
4 | import com.plcoding.noteappkmm.database.NoteDatabase
5 | import com.squareup.sqldelight.android.AndroidSqliteDriver
6 | import com.squareup.sqldelight.db.SqlDriver
7 |
8 | actual class DatabaseDriverFactory(private val context: Context) {
9 | actual fun createDriver(): SqlDriver {
10 | return AndroidSqliteDriver(NoteDatabase.Schema, context, "note.db")
11 | }
12 | }
--------------------------------------------------------------------------------
/iosApp/iosApp/Colors.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Colors.swift
3 | // iosApp
4 | //
5 | // Created by Philipp Lackner on 26.09.22.
6 | // Copyright © 2022 orgName. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import SwiftUI
11 |
12 | extension Color {
13 | init(hex: Int64, alpha: Double = 1) {
14 | self.init(
15 | .sRGB,
16 | red: Double((hex >> 16) & 0xff) / 255,
17 | green: Double((hex >> 08) & 0xff) / 255,
18 | blue: Double((hex >> 00) & 0xff) / 255,
19 | opacity: alpha
20 | )
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/shared/src/commonMain/kotlin/com/plcoding/noteappkmm/domain/note/Note.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.domain.note
2 |
3 | import com.plcoding.noteappkmm.presentation.*
4 | import kotlinx.datetime.LocalDateTime
5 |
6 | data class Note(
7 | val id: Long?,
8 | val title: String,
9 | val content: String,
10 | val colorHex: Long,
11 | val created: LocalDateTime
12 | ) {
13 | companion object {
14 | private val colors = listOf(RedOrangeHex, RedPinkHex, LightGreenHex, BabyBlueHex, VioletHex)
15 |
16 | fun generateRandomColor() = colors.random()
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/shared/src/iosMain/kotlin/com/plcoding/noteappkmm/di/DatabaseModule.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.di
2 |
3 | import com.plcoding.noteappkmm.data.local.DatabaseDriverFactory
4 | import com.plcoding.noteappkmm.data.note.SqlDelightNoteDataSource
5 | import com.plcoding.noteappkmm.database.NoteDatabase
6 | import com.plcoding.noteappkmm.domain.note.NoteDataSource
7 |
8 | class DatabaseModule {
9 |
10 | private val factory by lazy { DatabaseDriverFactory() }
11 | val noteDataSource: NoteDataSource by lazy {
12 | SqlDelightNoteDataSource(NoteDatabase(factory.createDriver()))
13 | }
14 | }
--------------------------------------------------------------------------------
/shared/src/commonMain/sqldelight/database/note.sq:
--------------------------------------------------------------------------------
1 | CREATE TABLE noteEntity(
2 | id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
3 | title TEXT NOT NULL,
4 | content TEXT NOT NULL,
5 | colorHex INTEGER NOT NULL,
6 | created INTEGER NOT NULL
7 | );
8 |
9 | getAllNotes:
10 | SELECT *
11 | FROM noteEntity;
12 |
13 | getNoteById:
14 | SELECT *
15 | FROM noteEntity
16 | WHERE id = ?;
17 |
18 | insertNote:
19 | INSERT OR REPLACE
20 | INTO noteEntity(
21 | id,
22 | title,
23 | content,
24 | colorHex,
25 | created
26 | ) VALUES(?, ?, ?, ?, ?);
27 |
28 | deleteNoteById:
29 | DELETE FROM noteEntity
30 | WHERE id = ?;
--------------------------------------------------------------------------------
/shared/src/commonMain/kotlin/com/plcoding/noteappkmm/domain/note/SearchNotes.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.domain.note
2 |
3 | import com.plcoding.noteappkmm.domain.time.DateTimeUtil
4 |
5 | class SearchNotes {
6 |
7 | fun execute(notes: List, query: String): List {
8 | if(query.isBlank()) {
9 | return notes
10 | }
11 | return notes.filter {
12 | it.title.trim().lowercase().contains(query.lowercase()) ||
13 | it.content.trim().lowercase().contains(query.lowercase())
14 | }.sortedBy {
15 | DateTimeUtil.toEpochMillis(it.created)
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/shared/src/commonMain/kotlin/com/plcoding/noteappkmm/data/note/NoteMapper.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.data.note
2 |
3 | import com.plcoding.noteappkmm.domain.note.Note
4 | import com.plcoding.noteappkmm.domain.time.DateTimeUtil
5 | import database.NoteEntity
6 | import kotlinx.datetime.Instant
7 | import kotlinx.datetime.TimeZone
8 | import kotlinx.datetime.toLocalDateTime
9 |
10 | fun NoteEntity.toNote(): Note {
11 | return Note(
12 | id = id,
13 | title = title,
14 | content = content,
15 | colorHex = colorHex,
16 | created = Instant
17 | .fromEpochMilliseconds(created)
18 | .toLocalDateTime(TimeZone.currentSystemDefault())
19 | )
20 | }
--------------------------------------------------------------------------------
/androidApp/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/di/AppModule.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.di
2 |
3 | import android.app.Application
4 | import com.plcoding.noteappkmm.data.local.DatabaseDriverFactory
5 | import com.plcoding.noteappkmm.data.note.SqlDelightNoteDataSource
6 | import com.plcoding.noteappkmm.database.NoteDatabase
7 | import com.plcoding.noteappkmm.domain.note.NoteDataSource
8 | import com.squareup.sqldelight.db.SqlDriver
9 | import dagger.Module
10 | import dagger.Provides
11 | import dagger.hilt.InstallIn
12 | import dagger.hilt.components.SingletonComponent
13 | import javax.inject.Singleton
14 |
15 | @Module
16 | @InstallIn(SingletonComponent::class)
17 | object AppModule {
18 |
19 | @Provides
20 | @Singleton
21 | fun provideSqlDriver(app: Application): SqlDriver {
22 | return DatabaseDriverFactory(app).createDriver()
23 | }
24 |
25 | @Provides
26 | @Singleton
27 | fun provideNoteDataSource(driver: SqlDriver): NoteDataSource {
28 | return SqlDelightNoteDataSource(NoteDatabase(driver))
29 | }
30 | }
--------------------------------------------------------------------------------
/shared/src/commonMain/kotlin/com/plcoding/noteappkmm/domain/time/DateTimeUtil.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.domain.time
2 |
3 | import kotlinx.datetime.*
4 |
5 | object DateTimeUtil {
6 |
7 | fun now(): LocalDateTime {
8 | return Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault())
9 | }
10 |
11 | fun toEpochMillis(dateTime: LocalDateTime): Long {
12 | return dateTime.toInstant(TimeZone.currentSystemDefault()).toEpochMilliseconds()
13 | }
14 |
15 | fun formatNoteDate(dateTime: LocalDateTime): String {
16 | val month = dateTime.month.name.lowercase().take(3).replaceFirstChar { it.uppercase() }
17 | val day = if(dateTime.dayOfMonth < 10) "0${dateTime.dayOfMonth}" else dateTime.dayOfMonth
18 | val year = dateTime.year
19 | val hour = if(dateTime.hour < 10) "0${dateTime.hour}" else dateTime.hour
20 | val minute = if(dateTime.minute < 10) "0${dateTime.minute}" else dateTime.minute
21 |
22 | return buildString {
23 | append(month)
24 | append(" ")
25 | append(day)
26 | append(" ")
27 | append(year)
28 | append(", ")
29 | append(hour)
30 | append(":")
31 | append(minute)
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/shared/src/commonMain/kotlin/com/plcoding/noteappkmm/data/note/SqlDelightNoteDataSource.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.data.note
2 |
3 | import com.plcoding.noteappkmm.database.NoteDatabase
4 | import com.plcoding.noteappkmm.domain.note.Note
5 | import com.plcoding.noteappkmm.domain.note.NoteDataSource
6 | import com.plcoding.noteappkmm.domain.time.DateTimeUtil
7 |
8 | class SqlDelightNoteDataSource(db: NoteDatabase): NoteDataSource {
9 |
10 | private val queries = db.noteQueries
11 |
12 | override suspend fun insertNote(note: Note) {
13 | queries.insertNote(
14 | id = note.id,
15 | title = note.title,
16 | content = note.content,
17 | colorHex = note.colorHex,
18 | created = DateTimeUtil.toEpochMillis(note.created)
19 | )
20 | }
21 |
22 | override suspend fun getNoteById(id: Long): Note? {
23 | return queries
24 | .getNoteById(id)
25 | .executeAsOneOrNull()
26 | ?.toNote()
27 | }
28 |
29 | override suspend fun getAllNotes(): List {
30 | return queries
31 | .getAllNotes()
32 | .executeAsList()
33 | .map { it.toNote() }
34 | }
35 |
36 | override suspend fun deleteNoteById(id: Long) {
37 | queries.deleteNoteById(id)
38 | }
39 | }
--------------------------------------------------------------------------------
/iosApp/iosApp/note_list/HideableSearchTextField.swift:
--------------------------------------------------------------------------------
1 | //
2 | // HideableSearchTextField.swift
3 | // iosApp
4 | //
5 | // Created by Philipp Lackner on 26.09.22.
6 | // Copyright © 2022 orgName. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | struct HideableSearchTextField: View {
12 |
13 | var onSearchToggled: () -> Void
14 | var destinationProvider: () -> Destination
15 | var isSearchActive: Bool
16 | @Binding var searchText: String
17 |
18 | var body: some View {
19 | HStack {
20 | TextField("Search...", text: $searchText)
21 | .textFieldStyle(.roundedBorder)
22 | .opacity(isSearchActive ? 1 : 0)
23 | if !isSearchActive {
24 | Spacer()
25 | }
26 | Button(action: onSearchToggled) {
27 | Image(systemName: isSearchActive ? "xmark" : "magnifyingglass")
28 | .foregroundColor(.black)
29 | }
30 | NavigationLink(destination: destinationProvider()) {
31 | Image(systemName: "plus")
32 | .foregroundColor(.black)
33 | }
34 | }
35 | }
36 | }
37 |
38 | struct HideableSearchTextField_Previews: PreviewProvider {
39 | static var previews: some View {
40 | HideableSearchTextField(
41 | onSearchToggled: {},
42 | destinationProvider: { EmptyView() },
43 | isSearchActive: true,
44 | searchText: .constant("YouTube")
45 | )
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/note_detail/TransparentHintTextField.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.note_detail
2 |
3 | import androidx.compose.foundation.layout.Box
4 | import androidx.compose.foundation.layout.fillMaxWidth
5 | import androidx.compose.foundation.text.BasicTextField
6 | import androidx.compose.material.Text
7 | import androidx.compose.runtime.Composable
8 | import androidx.compose.ui.Modifier
9 | import androidx.compose.ui.focus.FocusState
10 | import androidx.compose.ui.focus.onFocusChanged
11 | import androidx.compose.ui.graphics.Color
12 | import androidx.compose.ui.text.TextStyle
13 |
14 | @Composable
15 | fun TransparentHintTextField(
16 | text: String,
17 | hint: String,
18 | isHintVisible: Boolean,
19 | onValueChanged: (String) -> Unit,
20 | modifier: Modifier = Modifier,
21 | textStyle: TextStyle = TextStyle(),
22 | singleLine: Boolean = false,
23 | onFocusChanged: (FocusState) -> Unit
24 | ) {
25 | Box(modifier = modifier) {
26 | BasicTextField(
27 | value = text,
28 | onValueChange = onValueChanged,
29 | singleLine = singleLine,
30 | textStyle = textStyle,
31 | modifier = Modifier
32 | .fillMaxWidth()
33 | .onFocusChanged { state ->
34 | onFocusChanged(state)
35 | }
36 | )
37 | if(isHintVisible) {
38 | Text(
39 | text = hint,
40 | style = textStyle,
41 | color = Color.DarkGray
42 | )
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/iosApp/iosApp/note_list/NoteItem.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NoteItem.swift
3 | // iosApp
4 | //
5 | // Created by Philipp Lackner on 26.09.22.
6 | // Copyright © 2022 orgName. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 | import shared
11 |
12 | struct NoteItem: View {
13 | var note: Note
14 | var onDeleteClick: () -> Void
15 |
16 | var body: some View {
17 | VStack(alignment: .leading) {
18 | HStack {
19 | Text(note.title)
20 | .font(.title3)
21 | .fontWeight(.semibold)
22 | Spacer()
23 | Button(action: onDeleteClick) {
24 | Image(systemName: "xmark").foregroundColor(.black)
25 | }
26 | }.padding(.bottom, 3)
27 |
28 | Text(note.content)
29 | .fontWeight(.light)
30 | .padding(.bottom, 3)
31 |
32 | HStack {
33 | Spacer()
34 | Text(DateTimeUtil().formatNoteDate(dateTime: note.created))
35 | .font(.footnote)
36 | .fontWeight(.light)
37 | }
38 | }
39 | .padding()
40 | .background(Color(hex: note.colorHex))
41 | .clipShape(RoundedRectangle(cornerRadius: 5.0))
42 | }
43 | }
44 |
45 | struct NoteItem_Previews: PreviewProvider {
46 | static var previews: some View {
47 | NoteItem(
48 | note: Note(id: nil, title: "My note", content: "Note content", colorHex: 0xFF2341, created: DateTimeUtil().now()),
49 | onDeleteClick: {}
50 | )
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/iosApp/iosApp/note_detail/NoteDetailScreen.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NoteDetailScreen.swift
3 | // iosApp
4 | //
5 | // Created by Philipp Lackner on 26.09.22.
6 | // Copyright © 2022 orgName. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 | import shared
11 |
12 | struct NoteDetailScreen: View {
13 | private var noteDataSource: NoteDataSource
14 | private var noteId: Int64? = nil
15 |
16 | @StateObject var viewModel = NoteDetailViewModel(noteDataSource: nil)
17 |
18 | @Environment(\.presentationMode) var presentation
19 |
20 | init(noteDataSource: NoteDataSource, noteId: Int64? = nil) {
21 | self.noteDataSource = noteDataSource
22 | self.noteId = noteId
23 | }
24 |
25 | var body: some View {
26 | VStack(alignment: .leading) {
27 | TextField("Enter a title...", text: $viewModel.noteTitle)
28 | .font(.title)
29 | TextField("Enter some content...", text: $viewModel.noteContent)
30 | Spacer()
31 | }.toolbar(content: {
32 | Button(action: {
33 | viewModel.saveNote {
34 | self.presentation.wrappedValue.dismiss()
35 | }
36 | }) {
37 | Image(systemName: "checkmark")
38 | }
39 | })
40 | .padding()
41 | .background(Color(hex: viewModel.noteColor))
42 | .onAppear {
43 | viewModel.setParamsAndLoadNote(noteDataSource: noteDataSource, noteId: noteId)
44 | }
45 | }
46 | }
47 |
48 | struct NoteDetailScreen_Previews: PreviewProvider {
49 | static var previews: some View {
50 | EmptyView()
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UIApplicationSceneManifest
24 |
25 | UIApplicationSupportsMultipleScenes
26 |
27 |
28 | UIRequiredDeviceCapabilities
29 |
30 | armv7
31 |
32 | UISupportedInterfaceOrientations
33 |
34 | UIInterfaceOrientationPortrait
35 | UIInterfaceOrientationLandscapeLeft
36 | UIInterfaceOrientationLandscapeRight
37 |
38 | UISupportedInterfaceOrientations~ipad
39 |
40 | UIInterfaceOrientationPortrait
41 | UIInterfaceOrientationPortraitUpsideDown
42 | UIInterfaceOrientationLandscapeLeft
43 | UIInterfaceOrientationLandscapeRight
44 |
45 | UILaunchScreen
46 |
47 |
48 |
--------------------------------------------------------------------------------
/androidApp/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("com.android.application")
3 | kotlin("android")
4 | id("kotlin-kapt")
5 | id("dagger.hilt.android.plugin")
6 | }
7 |
8 | android {
9 | namespace = "com.plcoding.noteappkmm.android"
10 | compileSdk = 33
11 | defaultConfig {
12 | applicationId = "com.plcoding.noteappkmm.android"
13 | minSdk = 21
14 | targetSdk = 33
15 | versionCode = 1
16 | versionName = "1.0"
17 | }
18 | buildFeatures {
19 | compose = true
20 | }
21 | compileOptions {
22 | isCoreLibraryDesugaringEnabled = true
23 | }
24 | composeOptions {
25 | kotlinCompilerExtensionVersion = "1.3.0"
26 | }
27 | packagingOptions {
28 | resources {
29 | excludes += "/META-INF/{AL2.0,LGPL2.1}"
30 | }
31 | }
32 | buildTypes {
33 | getByName("release") {
34 | isMinifyEnabled = false
35 | }
36 | }
37 | }
38 |
39 | dependencies {
40 | implementation(project(":shared"))
41 | implementation("androidx.compose.ui:ui:1.2.1")
42 | implementation("androidx.compose.ui:ui-tooling:1.2.1")
43 | implementation("androidx.compose.ui:ui-tooling-preview:1.2.1")
44 | implementation("androidx.compose.foundation:foundation:1.2.1")
45 | implementation("androidx.compose.material:material:1.2.1")
46 | implementation("androidx.activity:activity-compose:1.5.1")
47 | coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.5")
48 |
49 | implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
50 |
51 | implementation("com.google.dagger:hilt-android:2.42")
52 | kapt("com.google.dagger:hilt-android-compiler:2.42")
53 | kapt("androidx.hilt:hilt-compiler:1.0.0")
54 | implementation("androidx.hilt:hilt-navigation-compose:1.0.0")
55 | }
--------------------------------------------------------------------------------
/iosApp/iosApp/note_list/NoteListViewModel.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NoteListViewModel.swift
3 | // iosApp
4 | //
5 | // Created by Philipp Lackner on 26.09.22.
6 | // Copyright © 2022 orgName. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import shared
11 |
12 | extension NoteListScreen {
13 | @MainActor class NoteListViewModel: ObservableObject {
14 | private var noteDataSource: NoteDataSource? = nil
15 |
16 | private let searchNotes = SearchNotes()
17 |
18 | private var notes = [Note]()
19 | @Published private(set) var filteredNotes = [Note]()
20 | @Published var searchText = "" {
21 | didSet {
22 | self.filteredNotes = searchNotes.execute(notes: self.notes, query: searchText)
23 | }
24 | }
25 | @Published private(set) var isSearchActive = false
26 |
27 | init(noteDataSource: NoteDataSource? = nil) {
28 | self.noteDataSource = noteDataSource
29 | }
30 |
31 | func loadNotes() {
32 | noteDataSource?.getAllNotes(completionHandler: { notes, error in
33 | self.notes = notes ?? []
34 | self.filteredNotes = self.notes
35 | })
36 | }
37 |
38 | func deleteNoteById(id: Int64?) {
39 | if id != nil {
40 | noteDataSource?.deleteNoteById(id: id!, completionHandler: { error in
41 | self.loadNotes()
42 | })
43 | }
44 | }
45 |
46 | func toggleIsSearchActive() {
47 | isSearchActive = !isSearchActive
48 | if !isSearchActive {
49 | searchText = ""
50 | }
51 | }
52 |
53 | func setNoteDataSource(noteDataSource: NoteDataSource) {
54 | self.noteDataSource = noteDataSource
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/iosApp/iosApp/note_detail/NoteDetailViewModel.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NoteDetailViewModel.swift
3 | // iosApp
4 | //
5 | // Created by Philipp Lackner on 26.09.22.
6 | // Copyright © 2022 orgName. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import shared
11 |
12 | extension NoteDetailScreen {
13 | @MainActor class NoteDetailViewModel: ObservableObject {
14 | private var noteDataSource: NoteDataSource?
15 |
16 | private var noteId: Int64? = nil
17 | @Published var noteTitle = ""
18 | @Published var noteContent = ""
19 | @Published private(set) var noteColor = Note.Companion().generateRandomColor()
20 |
21 | init(noteDataSource: NoteDataSource? = nil) {
22 | self.noteDataSource = noteDataSource
23 | }
24 |
25 | func loadNoteIfExists(id: Int64?) {
26 | if id != nil {
27 | self.noteId = id
28 | noteDataSource?.getNoteById(id: id!, completionHandler: { note, error in
29 | self.noteTitle = note?.title ?? ""
30 | self.noteContent = note?.content ?? ""
31 | self.noteColor = note?.colorHex ?? Note.Companion().generateRandomColor()
32 | })
33 | }
34 | }
35 |
36 | func saveNote(onSaved: @escaping () -> Void) {
37 | noteDataSource?.insertNote(
38 | note: Note(id: noteId == nil ? nil : KotlinLong(value: noteId!), title: self.noteTitle, content: self.noteContent, colorHex: self.noteColor, created: DateTimeUtil().now()), completionHandler: { error in
39 | onSaved()
40 | })
41 | }
42 |
43 | func setParamsAndLoadNote(noteDataSource: NoteDataSource, noteId: Int64?) {
44 | self.noteDataSource = noteDataSource
45 | loadNoteIfExists(id: noteId)
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "scale" : "1x",
46 | "size" : "20x20"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "scale" : "2x",
51 | "size" : "20x20"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "scale" : "1x",
56 | "size" : "29x29"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "scale" : "2x",
61 | "size" : "29x29"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "scale" : "1x",
66 | "size" : "40x40"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "scale" : "2x",
71 | "size" : "40x40"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "scale" : "1x",
76 | "size" : "76x76"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "scale" : "2x",
81 | "size" : "76x76"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "scale" : "2x",
86 | "size" : "83.5x83.5"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "scale" : "1x",
91 | "size" : "1024x1024"
92 | }
93 | ],
94 | "info" : {
95 | "author" : "xcode",
96 | "version" : 1
97 | }
98 | }
--------------------------------------------------------------------------------
/shared/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | kotlin("multiplatform")
3 | id("com.android.library")
4 | id("com.squareup.sqldelight")
5 | }
6 |
7 | kotlin {
8 | android()
9 |
10 | listOf(
11 | iosX64(),
12 | iosArm64(),
13 | iosSimulatorArm64()
14 | ).forEach {
15 | it.binaries.framework {
16 | baseName = "shared"
17 | }
18 | }
19 |
20 | sourceSets {
21 | val commonMain by getting {
22 | dependencies {
23 | implementation("com.squareup.sqldelight:runtime:1.5.3")
24 | implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
25 | }
26 | }
27 | val commonTest by getting {
28 | dependencies {
29 | implementation(kotlin("test"))
30 | }
31 | }
32 | val androidMain by getting {
33 | dependencies {
34 | implementation("com.squareup.sqldelight:android-driver:1.5.3")
35 | }
36 | }
37 | val androidTest by getting
38 | val iosX64Main by getting
39 | val iosArm64Main by getting
40 | val iosSimulatorArm64Main by getting
41 | val iosMain by creating {
42 | dependencies {
43 | implementation("com.squareup.sqldelight:native-driver:1.5.3")
44 | }
45 |
46 | dependsOn(commonMain)
47 | iosX64Main.dependsOn(this)
48 | iosArm64Main.dependsOn(this)
49 | iosSimulatorArm64Main.dependsOn(this)
50 | }
51 | val iosX64Test by getting
52 | val iosArm64Test by getting
53 | val iosSimulatorArm64Test by getting
54 | val iosTest by creating {
55 | dependsOn(commonTest)
56 | iosX64Test.dependsOn(this)
57 | iosArm64Test.dependsOn(this)
58 | iosSimulatorArm64Test.dependsOn(this)
59 | }
60 | }
61 | }
62 |
63 | sqldelight {
64 | database("NoteDatabase") {
65 | packageName = "com.plcoding.noteappkmm.database"
66 | sourceFolders = listOf("sqldelight")
67 | }
68 | }
69 |
70 | android {
71 | namespace = "com.plcoding.noteappkmm"
72 | compileSdk = 33
73 | defaultConfig {
74 | minSdk = 21
75 | targetSdk = 33
76 | }
77 | }
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/note_list/NoteListViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.note_list
2 |
3 | import androidx.lifecycle.SavedStateHandle
4 | import androidx.lifecycle.ViewModel
5 | import androidx.lifecycle.viewModelScope
6 | import com.plcoding.noteappkmm.domain.note.Note
7 | import com.plcoding.noteappkmm.domain.note.NoteDataSource
8 | import com.plcoding.noteappkmm.domain.note.SearchNotes
9 | import com.plcoding.noteappkmm.domain.time.DateTimeUtil
10 | import com.plcoding.noteappkmm.presentation.RedOrangeHex
11 | import dagger.hilt.android.lifecycle.HiltViewModel
12 | import kotlinx.coroutines.flow.SharingStarted
13 | import kotlinx.coroutines.flow.combine
14 | import kotlinx.coroutines.flow.stateIn
15 | import kotlinx.coroutines.launch
16 | import javax.inject.Inject
17 |
18 | @HiltViewModel
19 | class NoteListViewModel @Inject constructor(
20 | private val noteDataSource: NoteDataSource,
21 | private val savedStateHandle: SavedStateHandle
22 | ): ViewModel() {
23 |
24 | private val searchNotes = SearchNotes()
25 |
26 | private val notes = savedStateHandle.getStateFlow("notes", emptyList())
27 | private val searchText = savedStateHandle.getStateFlow("searchText", "")
28 | private val isSearchActive = savedStateHandle.getStateFlow("isSearchActive", false)
29 |
30 | val state = combine(notes, searchText, isSearchActive) { notes, searchText, isSearchActive ->
31 | NoteListState(
32 | notes = searchNotes.execute(notes, searchText),
33 | searchText = searchText,
34 | isSearchActive = isSearchActive
35 | )
36 | }.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), NoteListState())
37 |
38 | fun loadNotes() {
39 | viewModelScope.launch {
40 | savedStateHandle["notes"] = noteDataSource.getAllNotes()
41 | }
42 | }
43 |
44 | fun onSearchTextChange(text: String) {
45 | savedStateHandle["searchText"] = text
46 | }
47 |
48 | fun onToggleSearch() {
49 | savedStateHandle["isSearchActive"] = !isSearchActive.value
50 | if(!isSearchActive.value) {
51 | savedStateHandle["searchText"] = ""
52 | }
53 | }
54 |
55 | fun deleteNoteById(id: Long) {
56 | viewModelScope.launch {
57 | noteDataSource.deleteNoteById(id)
58 | loadNotes()
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/iosApp/iosApp/note_list/NoteListScreen.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NoteListScreen.swift
3 | // iosApp
4 | //
5 | // Created by Philipp Lackner on 26.09.22.
6 | // Copyright © 2022 orgName. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 | import shared
11 |
12 | struct NoteListScreen: View {
13 | private var noteDataSource: NoteDataSource
14 | @StateObject var viewModel = NoteListViewModel(noteDataSource: nil)
15 |
16 | @State private var isNoteSelected = false
17 | @State private var selectedNoteId: Int64? = nil
18 |
19 | init(noteDataSource: NoteDataSource) {
20 | self.noteDataSource = noteDataSource
21 | }
22 |
23 | var body: some View {
24 | VStack {
25 | ZStack {
26 | NavigationLink(destination: NoteDetailScreen(noteDataSource: self.noteDataSource, noteId: selectedNoteId), isActive: $isNoteSelected) {
27 | EmptyView()
28 | }.hidden()
29 | HideableSearchTextField(onSearchToggled: {
30 | viewModel.toggleIsSearchActive()
31 | }, destinationProvider: {
32 | NoteDetailScreen(
33 | noteDataSource: noteDataSource,
34 | noteId: selectedNoteId
35 | )
36 | }, isSearchActive: viewModel.isSearchActive, searchText: $viewModel.searchText)
37 | .frame(maxWidth: .infinity, minHeight: 40)
38 | .padding()
39 |
40 | if !viewModel.isSearchActive {
41 | Text("All notes")
42 | .font(.title2)
43 | }
44 | }
45 |
46 | List {
47 | ForEach(viewModel.filteredNotes, id: \.self.id) { note in
48 | Button(action: {
49 | isNoteSelected = true
50 | selectedNoteId = note.id?.int64Value
51 | }) {
52 | NoteItem(note: note, onDeleteClick: {
53 | viewModel.deleteNoteById(id: note.id?.int64Value)
54 | })
55 | }
56 | }
57 | }
58 | .onAppear {
59 | viewModel.loadNotes()
60 | }
61 | .listStyle(.plain)
62 | .listRowSeparator(.hidden)
63 | }
64 | .onAppear {
65 | viewModel.setNoteDataSource(noteDataSource: noteDataSource)
66 | }
67 | }
68 | }
69 |
70 | struct NoteListScreen_Previews: PreviewProvider {
71 | static var previews: some View {
72 | EmptyView()
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/note_list/NoteItem.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.note_list
2 |
3 | import androidx.compose.foundation.background
4 | import androidx.compose.foundation.clickable
5 | import androidx.compose.foundation.interaction.MutableInteractionSource
6 | import androidx.compose.foundation.layout.*
7 | import androidx.compose.foundation.shape.RoundedCornerShape
8 | import androidx.compose.material.Icon
9 | import androidx.compose.material.Text
10 | import androidx.compose.material.icons.Icons
11 | import androidx.compose.material.icons.filled.Close
12 | import androidx.compose.runtime.Composable
13 | import androidx.compose.runtime.remember
14 | import androidx.compose.ui.Alignment
15 | import androidx.compose.ui.Modifier
16 | import androidx.compose.ui.draw.clip
17 | import androidx.compose.ui.graphics.Color
18 | import androidx.compose.ui.text.font.FontWeight
19 | import androidx.compose.ui.unit.dp
20 | import androidx.compose.ui.unit.sp
21 | import com.plcoding.noteappkmm.domain.note.Note
22 | import com.plcoding.noteappkmm.domain.time.DateTimeUtil
23 |
24 | @Composable
25 | fun NoteItem(
26 | note: Note,
27 | backgroundColor: Color,
28 | onNoteClick: () -> Unit,
29 | onDeleteClick: () -> Unit,
30 | modifier: Modifier = Modifier
31 | ) {
32 | val formattedDate = remember(note.created) {
33 | DateTimeUtil.formatNoteDate(note.created)
34 | }
35 | Column(
36 | modifier = modifier
37 | .clip(RoundedCornerShape(5.dp))
38 | .background(backgroundColor)
39 | .clickable { onNoteClick() }
40 | .padding(16.dp)
41 | ) {
42 | Row(
43 | horizontalArrangement = Arrangement.SpaceBetween,
44 | verticalAlignment = Alignment.CenterVertically,
45 | modifier = Modifier.fillMaxWidth()
46 | ) {
47 | Text(
48 | text = note.title,
49 | fontWeight = FontWeight.SemiBold,
50 | fontSize = 20.sp
51 | )
52 | Icon(
53 | imageVector = Icons.Default.Close,
54 | contentDescription = "Delete note",
55 | modifier = Modifier
56 | .clickable(MutableInteractionSource(), null) {
57 | onDeleteClick()
58 | }
59 | )
60 | }
61 | Spacer(modifier = Modifier.height(16.dp))
62 | Text(text = note.content, fontWeight = FontWeight.Light)
63 | Spacer(modifier = Modifier.height(16.dp))
64 | Text(
65 | text = formattedDate,
66 | color = Color.DarkGray,
67 | modifier = Modifier.align(Alignment.End)
68 | )
69 | }
70 | }
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/note_list/HideableSearchTextField.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.note_list
2 |
3 | import androidx.compose.animation.AnimatedVisibility
4 | import androidx.compose.animation.fadeIn
5 | import androidx.compose.animation.fadeOut
6 | import androidx.compose.foundation.layout.Box
7 | import androidx.compose.foundation.layout.fillMaxWidth
8 | import androidx.compose.foundation.layout.padding
9 | import androidx.compose.foundation.shape.RoundedCornerShape
10 | import androidx.compose.material.Icon
11 | import androidx.compose.material.IconButton
12 | import androidx.compose.material.OutlinedTextField
13 | import androidx.compose.material.Text
14 | import androidx.compose.material.icons.Icons
15 | import androidx.compose.material.icons.filled.Close
16 | import androidx.compose.material.icons.filled.Search
17 | import androidx.compose.runtime.Composable
18 | import androidx.compose.ui.Alignment
19 | import androidx.compose.ui.Modifier
20 | import androidx.compose.ui.unit.dp
21 |
22 | @Composable
23 | fun HideableSearchTextField(
24 | text: String,
25 | isSearchActive: Boolean,
26 | onTextChange: (String) -> Unit,
27 | onSearchClick: () -> Unit,
28 | onCloseClick: () -> Unit,
29 | modifier: Modifier = Modifier
30 | ) {
31 | Box(modifier = modifier) {
32 | AnimatedVisibility(
33 | visible = isSearchActive,
34 | enter = fadeIn(),
35 | exit = fadeOut()
36 | ) {
37 | OutlinedTextField(
38 | value = text,
39 | onValueChange = onTextChange,
40 | shape = RoundedCornerShape(50.dp),
41 | placeholder = { Text(text = "Search") },
42 | modifier = Modifier
43 | .fillMaxWidth()
44 | .padding(16.dp)
45 | .padding(end = 40.dp)
46 | )
47 | }
48 | AnimatedVisibility(
49 | visible = isSearchActive,
50 | enter = fadeIn(),
51 | exit = fadeOut(),
52 | modifier = Modifier.align(Alignment.CenterEnd)
53 | ) {
54 | IconButton(onClick = onCloseClick) {
55 | Icon(
56 | imageVector = Icons.Default.Close,
57 | contentDescription = "Close search"
58 | )
59 | }
60 | }
61 | AnimatedVisibility(
62 | visible = !isSearchActive,
63 | enter = fadeIn(),
64 | exit = fadeOut(),
65 | modifier = Modifier.align(Alignment.CenterEnd)
66 | ) {
67 | IconButton(onClick = onSearchClick) {
68 | Icon(
69 | imageVector = Icons.Default.Search,
70 | contentDescription = "Open search"
71 | )
72 | }
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/note_detail/NoteDetailScreen.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.note_detail
2 |
3 | import androidx.compose.foundation.background
4 | import androidx.compose.foundation.layout.*
5 | import androidx.compose.material.FloatingActionButton
6 | import androidx.compose.material.Icon
7 | import androidx.compose.material.Scaffold
8 | import androidx.compose.material.icons.Icons
9 | import androidx.compose.material.icons.filled.Check
10 | import androidx.compose.runtime.Composable
11 | import androidx.compose.runtime.LaunchedEffect
12 | import androidx.compose.runtime.collectAsState
13 | import androidx.compose.runtime.getValue
14 | import androidx.compose.ui.Modifier
15 | import androidx.compose.ui.graphics.Color
16 | import androidx.compose.ui.text.TextStyle
17 | import androidx.compose.ui.unit.dp
18 | import androidx.compose.ui.unit.sp
19 | import androidx.hilt.navigation.compose.hiltViewModel
20 | import androidx.navigation.NavController
21 |
22 | @Composable
23 | fun NoteDetailScreen(
24 | noteId: Long,
25 | navController: NavController,
26 | viewModel: NoteDetailViewModel = hiltViewModel()
27 | ) {
28 | val state by viewModel.state.collectAsState()
29 | val hasNoteBeenSaved by viewModel.hasNoteBeenSaved.collectAsState()
30 |
31 | LaunchedEffect(key1 = hasNoteBeenSaved) {
32 | if(hasNoteBeenSaved) {
33 | navController.popBackStack()
34 | }
35 | }
36 |
37 | Scaffold(
38 | floatingActionButton = {
39 | FloatingActionButton(
40 | onClick = viewModel::saveNote,
41 | backgroundColor = Color.Black
42 | ) {
43 | Icon(
44 | imageVector = Icons.Default.Check,
45 | contentDescription = "Save note",
46 | tint = Color.White
47 | )
48 | }
49 | }
50 | ) { padding ->
51 | Column(
52 | modifier = Modifier
53 | .background(Color(state.noteColor))
54 | .fillMaxSize()
55 | .padding(padding)
56 | .padding(16.dp)
57 | ) {
58 | TransparentHintTextField(
59 | text = state.noteTitle,
60 | hint = "Enter a title...",
61 | isHintVisible = state.isNoteTitleHintVisible,
62 | onValueChanged = viewModel::onNoteTitleChanged,
63 | onFocusChanged = {
64 | viewModel.onNoteTitleFocusChanged(it.isFocused)
65 | },
66 | singleLine = true,
67 | textStyle = TextStyle(fontSize = 20.sp)
68 | )
69 | Spacer(modifier = Modifier.height(16.dp))
70 | TransparentHintTextField(
71 | text = state.noteContent,
72 | hint = "Enter some content...",
73 | isHintVisible = state.isNoteContentHintVisible,
74 | onValueChanged = viewModel::onNoteContentChanged,
75 | onFocusChanged = {
76 | viewModel.onNoteContentFocusChanged(it.isFocused)
77 | },
78 | singleLine = false,
79 | textStyle = TextStyle(fontSize = 20.sp),
80 | modifier = Modifier.weight(1f)
81 | )
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android
2 |
3 | import android.os.Bundle
4 | import androidx.activity.ComponentActivity
5 | import androidx.activity.compose.setContent
6 | import androidx.compose.foundation.isSystemInDarkTheme
7 | import androidx.compose.foundation.layout.fillMaxSize
8 | import androidx.compose.foundation.shape.RoundedCornerShape
9 | import androidx.compose.material.*
10 | import androidx.compose.runtime.Composable
11 | import androidx.compose.ui.Modifier
12 | import androidx.compose.ui.graphics.Color
13 | import androidx.compose.ui.text.TextStyle
14 | import androidx.compose.ui.text.font.FontFamily
15 | import androidx.compose.ui.text.font.FontWeight
16 | import androidx.compose.ui.tooling.preview.Preview
17 | import androidx.compose.ui.unit.dp
18 | import androidx.compose.ui.unit.sp
19 | import androidx.navigation.NavType
20 | import androidx.navigation.compose.NavHost
21 | import androidx.navigation.compose.composable
22 | import androidx.navigation.compose.rememberNavController
23 | import androidx.navigation.navArgument
24 | import com.plcoding.noteappkmm.android.note_detail.NoteDetailScreen
25 | import com.plcoding.noteappkmm.android.note_list.NoteListScreen
26 | import dagger.hilt.android.AndroidEntryPoint
27 |
28 | @Composable
29 | fun MyApplicationTheme(
30 | darkTheme: Boolean = isSystemInDarkTheme(),
31 | content: @Composable () -> Unit
32 | ) {
33 | val colors = if (darkTheme) {
34 | darkColors(
35 | primary = Color(0xFFBB86FC),
36 | primaryVariant = Color(0xFF3700B3),
37 | secondary = Color(0xFF03DAC5)
38 | )
39 | } else {
40 | lightColors(
41 | primary = Color(0xFF6200EE),
42 | primaryVariant = Color(0xFF3700B3),
43 | secondary = Color(0xFF03DAC5)
44 | )
45 | }
46 | val typography = Typography(
47 | body1 = TextStyle(
48 | fontFamily = FontFamily.Default,
49 | fontWeight = FontWeight.Normal,
50 | fontSize = 16.sp
51 | )
52 | )
53 | val shapes = Shapes(
54 | small = RoundedCornerShape(4.dp),
55 | medium = RoundedCornerShape(4.dp),
56 | large = RoundedCornerShape(0.dp)
57 | )
58 |
59 | MaterialTheme(
60 | colors = colors,
61 | typography = typography,
62 | shapes = shapes,
63 | content = content
64 | )
65 | }
66 |
67 | @AndroidEntryPoint
68 | class MainActivity : ComponentActivity() {
69 | override fun onCreate(savedInstanceState: Bundle?) {
70 | super.onCreate(savedInstanceState)
71 | setContent {
72 | MyApplicationTheme {
73 | val navController = rememberNavController()
74 | NavHost(navController = navController, startDestination = "note_list") {
75 | composable(route = "note_list") {
76 | NoteListScreen(navController = navController)
77 | }
78 | composable(
79 | route = "note_detail/{noteId}",
80 | arguments = listOf(
81 | navArgument(name = "noteId") {
82 | type = NavType.LongType
83 | defaultValue = -1L
84 | }
85 | )
86 | ) { backStackEntry ->
87 | val noteId = backStackEntry.arguments?.getLong("noteId") ?: -1L
88 | NoteDetailScreen(noteId = noteId, navController = navController)
89 | }
90 | }
91 | }
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/note_detail/NoteDetailViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.note_detail
2 |
3 | import androidx.lifecycle.SavedStateHandle
4 | import androidx.lifecycle.ViewModel
5 | import androidx.lifecycle.viewModelScope
6 | import com.plcoding.noteappkmm.domain.note.Note
7 | import com.plcoding.noteappkmm.domain.note.NoteDataSource
8 | import com.plcoding.noteappkmm.domain.time.DateTimeUtil
9 | import dagger.hilt.android.lifecycle.HiltViewModel
10 | import kotlinx.coroutines.flow.*
11 | import kotlinx.coroutines.launch
12 | import javax.inject.Inject
13 |
14 | @HiltViewModel
15 | class NoteDetailViewModel @Inject constructor(
16 | private val noteDataSource: NoteDataSource,
17 | private val savedStateHandle: SavedStateHandle
18 | ): ViewModel() {
19 |
20 | private val noteTitle = savedStateHandle.getStateFlow("noteTitle", "")
21 | private val isNoteTitleFocused = savedStateHandle.getStateFlow("isNoteTitleFocused", false)
22 | private val noteContent = savedStateHandle.getStateFlow("noteContent", "")
23 | private val isNoteContentFocused = savedStateHandle.getStateFlow("isNoteContentFocused", false)
24 | private val noteColor = savedStateHandle.getStateFlow(
25 | "noteColor",
26 | Note.generateRandomColor()
27 | )
28 |
29 | val state = combine(
30 | noteTitle,
31 | isNoteTitleFocused,
32 | noteContent,
33 | isNoteContentFocused,
34 | noteColor
35 | ) { title, isTitleFocused, content, isContentFocused, color ->
36 | NoteDetailState(
37 | noteTitle = title,
38 | isNoteTitleHintVisible = title.isEmpty() && !isTitleFocused,
39 | noteContent = content,
40 | isNoteContentHintVisible = content.isEmpty() && !isContentFocused,
41 | noteColor = color
42 | )
43 | }.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), NoteDetailState())
44 |
45 | private val _hasNoteBeenSaved = MutableStateFlow(false)
46 | val hasNoteBeenSaved = _hasNoteBeenSaved.asStateFlow()
47 |
48 | private var existingNoteId: Long? = null
49 |
50 | init {
51 | savedStateHandle.get("noteId")?.let { existingNoteId ->
52 | if(existingNoteId == -1L) {
53 | return@let
54 | }
55 | this.existingNoteId = existingNoteId
56 | viewModelScope.launch {
57 | noteDataSource.getNoteById(existingNoteId)?.let { note ->
58 | savedStateHandle["noteTitle"] = note.title
59 | savedStateHandle["noteContent"] = note.content
60 | savedStateHandle["noteColor"] = note.colorHex
61 | }
62 | }
63 | }
64 | }
65 |
66 | fun onNoteTitleChanged(text: String) {
67 | savedStateHandle["noteTitle"] = text
68 | }
69 |
70 | fun onNoteContentChanged(text: String) {
71 | savedStateHandle["noteContent"] = text
72 | }
73 |
74 | fun onNoteTitleFocusChanged(isFocused: Boolean) {
75 | savedStateHandle["isNoteTitleFocused"] = isFocused
76 | }
77 |
78 | fun onNoteContentFocusChanged(isFocused: Boolean) {
79 | savedStateHandle["isNoteContentFocused"] = isFocused
80 | }
81 |
82 | fun saveNote() {
83 | viewModelScope.launch {
84 | noteDataSource.insertNote(
85 | Note(
86 | id = existingNoteId,
87 | title = noteTitle.value,
88 | content = noteContent.value,
89 | colorHex = noteColor.value,
90 | created = DateTimeUtil.now()
91 | )
92 | )
93 | _hasNoteBeenSaved.value = true
94 | }
95 | }
96 | }
--------------------------------------------------------------------------------
/androidApp/src/main/java/com/plcoding/noteappkmm/android/note_list/NoteListScreen.kt:
--------------------------------------------------------------------------------
1 | package com.plcoding.noteappkmm.android.note_list
2 |
3 | import androidx.compose.animation.AnimatedVisibility
4 | import androidx.compose.animation.fadeIn
5 | import androidx.compose.animation.fadeOut
6 | import androidx.compose.foundation.ExperimentalFoundationApi
7 | import androidx.compose.foundation.layout.*
8 | import androidx.compose.foundation.lazy.LazyColumn
9 | import androidx.compose.foundation.lazy.items
10 | import androidx.compose.material.FloatingActionButton
11 | import androidx.compose.material.Icon
12 | import androidx.compose.material.Scaffold
13 | import androidx.compose.material.Text
14 | import androidx.compose.material.icons.Icons
15 | import androidx.compose.material.icons.filled.Add
16 | import androidx.compose.runtime.Composable
17 | import androidx.compose.runtime.LaunchedEffect
18 | import androidx.compose.runtime.collectAsState
19 | import androidx.compose.runtime.getValue
20 | import androidx.compose.ui.Alignment
21 | import androidx.compose.ui.Modifier
22 | import androidx.compose.ui.graphics.Color
23 | import androidx.compose.ui.text.font.FontWeight
24 | import androidx.compose.ui.unit.dp
25 | import androidx.compose.ui.unit.sp
26 | import androidx.hilt.navigation.compose.hiltViewModel
27 | import androidx.navigation.NavController
28 |
29 | @OptIn(ExperimentalFoundationApi::class)
30 | @Composable
31 | fun NoteListScreen(
32 | navController: NavController,
33 | viewModel: NoteListViewModel = hiltViewModel()
34 | ) {
35 | val state by viewModel.state.collectAsState()
36 |
37 | LaunchedEffect(key1 = true) {
38 | viewModel.loadNotes()
39 | }
40 |
41 | Scaffold(
42 | floatingActionButton = {
43 | FloatingActionButton(
44 | onClick = {
45 | navController.navigate("note_detail/-1L")
46 | },
47 | backgroundColor = Color.Black
48 | ) {
49 | Icon(
50 | imageVector = Icons.Default.Add,
51 | contentDescription = "Add note",
52 | tint = Color.White
53 | )
54 | }
55 | }
56 | ) { padding ->
57 | Column(
58 | modifier = Modifier
59 | .fillMaxSize()
60 | .padding(padding)
61 | ) {
62 | Box(
63 | modifier = Modifier.fillMaxWidth(),
64 | contentAlignment = Alignment.Center
65 | ) {
66 | HideableSearchTextField(
67 | text = state.searchText,
68 | isSearchActive = state.isSearchActive,
69 | onTextChange = viewModel::onSearchTextChange,
70 | onSearchClick = viewModel::onToggleSearch,
71 | onCloseClick = viewModel::onToggleSearch,
72 | modifier = Modifier
73 | .fillMaxWidth()
74 | .height(90.dp)
75 | )
76 | this@Column.AnimatedVisibility(
77 | visible = !state.isSearchActive,
78 | enter = fadeIn(),
79 | exit = fadeOut()
80 | ) {
81 | Text(
82 | text = "All notes",
83 | fontWeight = FontWeight.Bold,
84 | fontSize = 30.sp
85 | )
86 | }
87 | }
88 | LazyColumn(
89 | modifier = Modifier.weight(1f)
90 | ) {
91 | items(
92 | items = state.notes,
93 | key = { it.id!! }
94 | ) { note ->
95 | NoteItem(
96 | note = note,
97 | backgroundColor = Color(note.colorHex),
98 | onNoteClick = {
99 | navController.navigate("note_detail/${note.id}")
100 | },
101 | onDeleteClick = {
102 | viewModel.deleteNoteById(note.id!!)
103 | },
104 | modifier = Modifier
105 | .fillMaxWidth()
106 | .padding(16.dp)
107 | .animateItemPlacement()
108 | )
109 | }
110 | }
111 | }
112 | }
113 | }
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/iosApp/iosApp.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; };
11 | 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; };
12 | 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; };
13 | 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; };
14 | C32119F828E1D866009AD973 /* NoteListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32119F728E1D866009AD973 /* NoteListViewModel.swift */; };
15 | C32119FA28E1D89A009AD973 /* NoteListScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32119F928E1D89A009AD973 /* NoteListScreen.swift */; };
16 | C32119FC28E1DC53009AD973 /* HideableSearchTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32119FB28E1DC53009AD973 /* HideableSearchTextField.swift */; };
17 | C3A8986428E1E22800F50A4C /* NoteItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A8986328E1E22800F50A4C /* NoteItem.swift */; };
18 | C3A8986628E1E42800F50A4C /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A8986528E1E42800F50A4C /* Colors.swift */; };
19 | C3A8986928E1E9F900F50A4C /* NoteDetailScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A8986828E1E9F900F50A4C /* NoteDetailScreen.swift */; };
20 | C3A8986B28E1ED1B00F50A4C /* NoteDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A8986A28E1ED1B00F50A4C /* NoteDetailViewModel.swift */; };
21 | /* End PBXBuildFile section */
22 |
23 | /* Begin PBXCopyFilesBuildPhase section */
24 | 7555FFB4242A642300829871 /* Embed Frameworks */ = {
25 | isa = PBXCopyFilesBuildPhase;
26 | buildActionMask = 2147483647;
27 | dstPath = "";
28 | dstSubfolderSpec = 10;
29 | files = (
30 | );
31 | name = "Embed Frameworks";
32 | runOnlyForDeploymentPostprocessing = 0;
33 | };
34 | /* End PBXCopyFilesBuildPhase section */
35 |
36 | /* Begin PBXFileReference section */
37 | 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
38 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
39 | 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; };
40 | 7555FF7B242A565900829871 /* iosApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iosApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
41 | 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
42 | 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
43 | C32119F728E1D866009AD973 /* NoteListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteListViewModel.swift; sourceTree = ""; };
44 | C32119F928E1D89A009AD973 /* NoteListScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteListScreen.swift; sourceTree = ""; };
45 | C32119FB28E1DC53009AD973 /* HideableSearchTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HideableSearchTextField.swift; sourceTree = ""; };
46 | C3A8986328E1E22800F50A4C /* NoteItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteItem.swift; sourceTree = ""; };
47 | C3A8986528E1E42800F50A4C /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = ""; };
48 | C3A8986828E1E9F900F50A4C /* NoteDetailScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteDetailScreen.swift; sourceTree = ""; };
49 | C3A8986A28E1ED1B00F50A4C /* NoteDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteDetailViewModel.swift; sourceTree = ""; };
50 | /* End PBXFileReference section */
51 |
52 | /* Begin PBXFrameworksBuildPhase section */
53 | 7555FF78242A565900829871 /* Frameworks */ = {
54 | isa = PBXFrameworksBuildPhase;
55 | buildActionMask = 2147483647;
56 | files = (
57 | );
58 | runOnlyForDeploymentPostprocessing = 0;
59 | };
60 | /* End PBXFrameworksBuildPhase section */
61 |
62 | /* Begin PBXGroup section */
63 | 058557D7273AAEEB004C7B11 /* Preview Content */ = {
64 | isa = PBXGroup;
65 | children = (
66 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */,
67 | );
68 | path = "Preview Content";
69 | sourceTree = "";
70 | };
71 | 7555FF72242A565900829871 = {
72 | isa = PBXGroup;
73 | children = (
74 | 7555FF7D242A565900829871 /* iosApp */,
75 | 7555FF7C242A565900829871 /* Products */,
76 | 7555FFB0242A642200829871 /* Frameworks */,
77 | );
78 | sourceTree = "";
79 | };
80 | 7555FF7C242A565900829871 /* Products */ = {
81 | isa = PBXGroup;
82 | children = (
83 | 7555FF7B242A565900829871 /* iosApp.app */,
84 | );
85 | name = Products;
86 | sourceTree = "";
87 | };
88 | 7555FF7D242A565900829871 /* iosApp */ = {
89 | isa = PBXGroup;
90 | children = (
91 | C3A8986728E1E9EB00F50A4C /* note_detail */,
92 | C32119F628E1D84A009AD973 /* note_list */,
93 | 058557BA273AAA24004C7B11 /* Assets.xcassets */,
94 | 7555FF82242A565900829871 /* ContentView.swift */,
95 | 7555FF8C242A565B00829871 /* Info.plist */,
96 | 2152FB032600AC8F00CF470E /* iOSApp.swift */,
97 | 058557D7273AAEEB004C7B11 /* Preview Content */,
98 | C3A8986528E1E42800F50A4C /* Colors.swift */,
99 | );
100 | path = iosApp;
101 | sourceTree = "";
102 | };
103 | 7555FFB0242A642200829871 /* Frameworks */ = {
104 | isa = PBXGroup;
105 | children = (
106 | );
107 | name = Frameworks;
108 | sourceTree = "";
109 | };
110 | C32119F628E1D84A009AD973 /* note_list */ = {
111 | isa = PBXGroup;
112 | children = (
113 | C32119F728E1D866009AD973 /* NoteListViewModel.swift */,
114 | C32119F928E1D89A009AD973 /* NoteListScreen.swift */,
115 | C32119FB28E1DC53009AD973 /* HideableSearchTextField.swift */,
116 | C3A8986328E1E22800F50A4C /* NoteItem.swift */,
117 | );
118 | path = note_list;
119 | sourceTree = "";
120 | };
121 | C3A8986728E1E9EB00F50A4C /* note_detail */ = {
122 | isa = PBXGroup;
123 | children = (
124 | C3A8986828E1E9F900F50A4C /* NoteDetailScreen.swift */,
125 | C3A8986A28E1ED1B00F50A4C /* NoteDetailViewModel.swift */,
126 | );
127 | path = note_detail;
128 | sourceTree = "";
129 | };
130 | /* End PBXGroup section */
131 |
132 | /* Begin PBXNativeTarget section */
133 | 7555FF7A242A565900829871 /* iosApp */ = {
134 | isa = PBXNativeTarget;
135 | buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */;
136 | buildPhases = (
137 | 7555FFB5242A651A00829871 /* ShellScript */,
138 | 7555FF77242A565900829871 /* Sources */,
139 | 7555FF78242A565900829871 /* Frameworks */,
140 | 7555FF79242A565900829871 /* Resources */,
141 | 7555FFB4242A642300829871 /* Embed Frameworks */,
142 | );
143 | buildRules = (
144 | );
145 | dependencies = (
146 | );
147 | name = iosApp;
148 | productName = iosApp;
149 | productReference = 7555FF7B242A565900829871 /* iosApp.app */;
150 | productType = "com.apple.product-type.application";
151 | };
152 | /* End PBXNativeTarget section */
153 |
154 | /* Begin PBXProject section */
155 | 7555FF73242A565900829871 /* Project object */ = {
156 | isa = PBXProject;
157 | attributes = {
158 | LastSwiftUpdateCheck = 1130;
159 | LastUpgradeCheck = 1130;
160 | ORGANIZATIONNAME = orgName;
161 | TargetAttributes = {
162 | 7555FF7A242A565900829871 = {
163 | CreatedOnToolsVersion = 11.3.1;
164 | };
165 | };
166 | };
167 | buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */;
168 | compatibilityVersion = "Xcode 9.3";
169 | developmentRegion = en;
170 | hasScannedForEncodings = 0;
171 | knownRegions = (
172 | en,
173 | Base,
174 | );
175 | mainGroup = 7555FF72242A565900829871;
176 | productRefGroup = 7555FF7C242A565900829871 /* Products */;
177 | projectDirPath = "";
178 | projectRoot = "";
179 | targets = (
180 | 7555FF7A242A565900829871 /* iosApp */,
181 | );
182 | };
183 | /* End PBXProject section */
184 |
185 | /* Begin PBXResourcesBuildPhase section */
186 | 7555FF79242A565900829871 /* Resources */ = {
187 | isa = PBXResourcesBuildPhase;
188 | buildActionMask = 2147483647;
189 | files = (
190 | 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */,
191 | 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */,
192 | );
193 | runOnlyForDeploymentPostprocessing = 0;
194 | };
195 | /* End PBXResourcesBuildPhase section */
196 |
197 | /* Begin PBXShellScriptBuildPhase section */
198 | 7555FFB5242A651A00829871 /* ShellScript */ = {
199 | isa = PBXShellScriptBuildPhase;
200 | buildActionMask = 2147483647;
201 | files = (
202 | );
203 | inputFileListPaths = (
204 | );
205 | inputPaths = (
206 | );
207 | outputFileListPaths = (
208 | );
209 | outputPaths = (
210 | );
211 | runOnlyForDeploymentPostprocessing = 0;
212 | shellPath = /bin/sh;
213 | shellScript = "cd \"$SRCROOT/..\"\n./gradlew :shared:embedAndSignAppleFrameworkForXcode\n";
214 | };
215 | /* End PBXShellScriptBuildPhase section */
216 |
217 | /* Begin PBXSourcesBuildPhase section */
218 | 7555FF77242A565900829871 /* Sources */ = {
219 | isa = PBXSourcesBuildPhase;
220 | buildActionMask = 2147483647;
221 | files = (
222 | C3A8986428E1E22800F50A4C /* NoteItem.swift in Sources */,
223 | 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */,
224 | C3A8986928E1E9F900F50A4C /* NoteDetailScreen.swift in Sources */,
225 | C32119FA28E1D89A009AD973 /* NoteListScreen.swift in Sources */,
226 | C3A8986628E1E42800F50A4C /* Colors.swift in Sources */,
227 | C3A8986B28E1ED1B00F50A4C /* NoteDetailViewModel.swift in Sources */,
228 | 7555FF83242A565900829871 /* ContentView.swift in Sources */,
229 | C32119F828E1D866009AD973 /* NoteListViewModel.swift in Sources */,
230 | C32119FC28E1DC53009AD973 /* HideableSearchTextField.swift in Sources */,
231 | );
232 | runOnlyForDeploymentPostprocessing = 0;
233 | };
234 | /* End PBXSourcesBuildPhase section */
235 |
236 | /* Begin XCBuildConfiguration section */
237 | 7555FFA3242A565B00829871 /* Debug */ = {
238 | isa = XCBuildConfiguration;
239 | buildSettings = {
240 | ALWAYS_SEARCH_USER_PATHS = NO;
241 | CLANG_ANALYZER_NONNULL = YES;
242 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
244 | CLANG_CXX_LIBRARY = "libc++";
245 | CLANG_ENABLE_MODULES = YES;
246 | CLANG_ENABLE_OBJC_ARC = YES;
247 | CLANG_ENABLE_OBJC_WEAK = YES;
248 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
249 | CLANG_WARN_BOOL_CONVERSION = YES;
250 | CLANG_WARN_COMMA = YES;
251 | CLANG_WARN_CONSTANT_CONVERSION = YES;
252 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
254 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
255 | CLANG_WARN_EMPTY_BODY = YES;
256 | CLANG_WARN_ENUM_CONVERSION = YES;
257 | CLANG_WARN_INFINITE_RECURSION = YES;
258 | CLANG_WARN_INT_CONVERSION = YES;
259 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
260 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
261 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
263 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
264 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
265 | CLANG_WARN_STRICT_PROTOTYPES = YES;
266 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
267 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
268 | CLANG_WARN_UNREACHABLE_CODE = YES;
269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
270 | COPY_PHASE_STRIP = NO;
271 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
272 | ENABLE_STRICT_OBJC_MSGSEND = YES;
273 | ENABLE_TESTABILITY = YES;
274 | GCC_C_LANGUAGE_STANDARD = gnu11;
275 | GCC_DYNAMIC_NO_PIC = NO;
276 | GCC_NO_COMMON_BLOCKS = YES;
277 | GCC_OPTIMIZATION_LEVEL = 0;
278 | GCC_PREPROCESSOR_DEFINITIONS = (
279 | "DEBUG=1",
280 | "$(inherited)",
281 | );
282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
284 | GCC_WARN_UNDECLARED_SELECTOR = YES;
285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
286 | GCC_WARN_UNUSED_FUNCTION = YES;
287 | GCC_WARN_UNUSED_VARIABLE = YES;
288 | IPHONEOS_DEPLOYMENT_TARGET = 14.1;
289 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
290 | MTL_FAST_MATH = YES;
291 | ONLY_ACTIVE_ARCH = YES;
292 | SDKROOT = iphoneos;
293 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
294 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
295 | };
296 | name = Debug;
297 | };
298 | 7555FFA4242A565B00829871 /* Release */ = {
299 | isa = XCBuildConfiguration;
300 | buildSettings = {
301 | ALWAYS_SEARCH_USER_PATHS = NO;
302 | CLANG_ANALYZER_NONNULL = YES;
303 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
305 | CLANG_CXX_LIBRARY = "libc++";
306 | CLANG_ENABLE_MODULES = YES;
307 | CLANG_ENABLE_OBJC_ARC = YES;
308 | CLANG_ENABLE_OBJC_WEAK = YES;
309 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
310 | CLANG_WARN_BOOL_CONVERSION = YES;
311 | CLANG_WARN_COMMA = YES;
312 | CLANG_WARN_CONSTANT_CONVERSION = YES;
313 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
315 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
316 | CLANG_WARN_EMPTY_BODY = YES;
317 | CLANG_WARN_ENUM_CONVERSION = YES;
318 | CLANG_WARN_INFINITE_RECURSION = YES;
319 | CLANG_WARN_INT_CONVERSION = YES;
320 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
321 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
322 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
324 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
326 | CLANG_WARN_STRICT_PROTOTYPES = YES;
327 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
328 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
329 | CLANG_WARN_UNREACHABLE_CODE = YES;
330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
331 | COPY_PHASE_STRIP = NO;
332 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
333 | ENABLE_NS_ASSERTIONS = NO;
334 | ENABLE_STRICT_OBJC_MSGSEND = YES;
335 | GCC_C_LANGUAGE_STANDARD = gnu11;
336 | GCC_NO_COMMON_BLOCKS = YES;
337 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
338 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
339 | GCC_WARN_UNDECLARED_SELECTOR = YES;
340 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
341 | GCC_WARN_UNUSED_FUNCTION = YES;
342 | GCC_WARN_UNUSED_VARIABLE = YES;
343 | IPHONEOS_DEPLOYMENT_TARGET = 14.1;
344 | MTL_ENABLE_DEBUG_INFO = NO;
345 | MTL_FAST_MATH = YES;
346 | SDKROOT = iphoneos;
347 | SWIFT_COMPILATION_MODE = wholemodule;
348 | SWIFT_OPTIMIZATION_LEVEL = "-O";
349 | VALIDATE_PRODUCT = YES;
350 | };
351 | name = Release;
352 | };
353 | 7555FFA6242A565B00829871 /* Debug */ = {
354 | isa = XCBuildConfiguration;
355 | buildSettings = {
356 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
357 | CODE_SIGN_STYLE = Automatic;
358 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
359 | ENABLE_PREVIEWS = YES;
360 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
361 | INFOPLIST_FILE = iosApp/Info.plist;
362 | IPHONEOS_DEPLOYMENT_TARGET = 15.0;
363 | LD_RUNPATH_SEARCH_PATHS = (
364 | "$(inherited)",
365 | "@executable_path/Frameworks",
366 | );
367 | OTHER_LDFLAGS = (
368 | "$(inherited)",
369 | "-framework",
370 | shared,
371 | );
372 | PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosApp;
373 | PRODUCT_NAME = "$(TARGET_NAME)";
374 | SWIFT_VERSION = 5.0;
375 | TARGETED_DEVICE_FAMILY = "1,2";
376 | };
377 | name = Debug;
378 | };
379 | 7555FFA7242A565B00829871 /* Release */ = {
380 | isa = XCBuildConfiguration;
381 | buildSettings = {
382 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
383 | CODE_SIGN_STYLE = Automatic;
384 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
385 | ENABLE_PREVIEWS = YES;
386 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
387 | INFOPLIST_FILE = iosApp/Info.plist;
388 | IPHONEOS_DEPLOYMENT_TARGET = 15.0;
389 | LD_RUNPATH_SEARCH_PATHS = (
390 | "$(inherited)",
391 | "@executable_path/Frameworks",
392 | );
393 | OTHER_LDFLAGS = (
394 | "$(inherited)",
395 | "-framework",
396 | shared,
397 | );
398 | PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosApp;
399 | PRODUCT_NAME = "$(TARGET_NAME)";
400 | SWIFT_VERSION = 5.0;
401 | TARGETED_DEVICE_FAMILY = "1,2";
402 | };
403 | name = Release;
404 | };
405 | /* End XCBuildConfiguration section */
406 |
407 | /* Begin XCConfigurationList section */
408 | 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = {
409 | isa = XCConfigurationList;
410 | buildConfigurations = (
411 | 7555FFA3242A565B00829871 /* Debug */,
412 | 7555FFA4242A565B00829871 /* Release */,
413 | );
414 | defaultConfigurationIsVisible = 0;
415 | defaultConfigurationName = Release;
416 | };
417 | 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = {
418 | isa = XCConfigurationList;
419 | buildConfigurations = (
420 | 7555FFA6242A565B00829871 /* Debug */,
421 | 7555FFA7242A565B00829871 /* Release */,
422 | );
423 | defaultConfigurationIsVisible = 0;
424 | defaultConfigurationName = Release;
425 | };
426 | /* End XCConfigurationList section */
427 | };
428 | rootObject = 7555FF73242A565900829871 /* Project object */;
429 | }
430 |
--------------------------------------------------------------------------------