Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ captures/
output.json

# IntelliJ
*.iml
.idea/
misc.xml
deploymentTargetDropDown.xml
Expand All @@ -34,4 +33,4 @@ google-services.json

# Android Profiling
*.hprof
xcuserdata
xcuserdata
4 changes: 3 additions & 1 deletion apps/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ android {
dependencies {
implementation(project(":shared"))

implementation(platform(libs.compose.bom))
val composeBom = platform(libs.androidx.compose.bom)
implementation(composeBom)
androidTestImplementation(composeBom)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.core.splashscreen)
Expand Down
1 change: 1 addition & 0 deletions apps/androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MindSync"
android:windowSoftInputMode="adjustResize"
tools:targetApi="31"
android:usesCleartextTraffic="true"> <!-- This line must be removed when going to production environment -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.core.view.WindowCompat
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import io.astrum.mindsync.app.MainApp
import io.astrum.mindsync.app.common.model.theme.DarkThemeConfig
Expand All @@ -17,6 +18,8 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

WindowCompat.setDecorFitsSystemWindows(window, false)

val uiState: MainActivityUiState by mutableStateOf(MainActivityUiState.Loading)

setContent {
Expand Down
10 changes: 8 additions & 2 deletions apps/iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -331,17 +332,19 @@
);
INFOPLIST_FILE = iosApp/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = MindSync;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.0.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
shared,
);
PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_NAME = "MindSync (Debug)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -354,6 +357,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -362,17 +366,19 @@
);
INFOPLIST_FILE = iosApp/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = MindSync;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.0.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
shared,
);
PRODUCT_BUNDLE_IDENTIFIER = orgIdentifier.iosApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_NAME = "MindSync";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7555FF7A242A565900829871"
BuildableName = "iosApp.app"
BuildableName = "MindSync.app"
BlueprintName = "iosApp"
ReferencedContainer = "container:iosApp.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -44,7 +44,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7555FF7A242A565900829871"
BuildableName = "iosApp.app"
BuildableName = "MindSync.app"
BlueprintName = "iosApp"
ReferencedContainer = "container:iosApp.xcodeproj">
</BuildableReference>
Expand All @@ -61,7 +61,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7555FF7A242A565900829871"
BuildableName = "iosApp.app"
BuildableName = "MindSync.app"
BlueprintName = "iosApp"
ReferencedContainer = "container:iosApp.xcodeproj">
</BuildableReference>
Expand Down
15 changes: 11 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ kotlin = "1.9.20"
ktor-client = "2.3.6"
ktor-server = "2.3.6"
multiplatform-settings = "1.1.0"
uiToolingPreviewAndroid = "1.5.4"
voyager = "1.0.0-rc10"
koin = "3.5.0"
koin-compose = "1.1.0"
junit = "4.13.2"
androidGradlePlugin = "8.1.4"
composeMultiplatform = "1.5.10"
composeMultiplatform = "1.5.11"
compose-compiler = "1.5.4"
exposed = "0.37.3"
skiko = "0.7.85"
skiko = "0.7.85.4"
klint-plugin = "11.6.1"
klint = "1.0.1"
detekt = "1.23.3"
Expand All @@ -20,14 +21,16 @@ androidx-junit = "1.1.5"
espressoCore = "3.5.1"
accompanistSystemuicontroller = "0.32.0"
activityCompose = "1.8.1"
firebase = "32.5.0"
firebase = "32.6.0"
owasp = "8.4.3"
asciidoctor = "4.0.0-alpha.1"
dokka = "1.9.10"
androidxComposeBom = "2023.10.01"


[libraries]
# Gradle Plugins
androidx-ui-tooling-preview-android = { module = "androidx.compose.ui:ui-tooling-preview-android", version.ref = "uiToolingPreviewAndroid" }
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
gradle-ktlint = { module = "org.jlleitschuh.gradle.ktlint:org.jlleitschuh.gradle.ktlint.gradle.plugin", version.ref = "klint-plugin" }
gradle-ktlint-idea = { module = "org.jlleitschuh.gradle.ktlint-idea:org.jlleitschuh.gradle.ktlint-idea.gradle.plugin", version.ref = "klint-plugin" }
Expand Down Expand Up @@ -72,8 +75,12 @@ voyager-koin = { module = "cafe.adriel.voyager:voyager-koin", version.ref = "voy
koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" }
koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" }

# External Libs
rich-editor = { module = "com.mohamedrejeb.richeditor:richeditor-compose", version = "1.0.0-beta03"}

# Android
compose-bom = "androidx.compose:compose-bom:2023.10.01"
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" }
androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" }
koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" }

androidx-core-ktx = "androidx.core:core-ktx:1.12.0"
Expand Down
11 changes: 10 additions & 1 deletion shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class)
kotlin {
targetHierarchy.default()
kotlin.applyDefaultHierarchyTemplate()

androidTarget {
compilations.all {
Expand Down Expand Up @@ -70,14 +70,19 @@ kotlin {

// Logging
implementation(libs.kermit)

implementation(libs.rich.editor)
}
}
val androidMain by getting {
dependsOn(commonMain)
dependencies {
implementation(libs.ktor.client.android)
implementation(libs.androidx.core.ktx)
}
}
val iosMain by getting {
dependsOn(commonMain)
dependencies {
implementation(libs.ktor.client.darwin)
}
Expand Down Expand Up @@ -112,3 +117,7 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}
}
dependencies {
implementation("androidx.core:core-ktx:+")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.0.0")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package io.astrum.mindsync.app.data.repositories

import io.astrum.mindsync.app.ui.screens.viewmodel.SimpleRowCalendarUiModel
import kotlinx.datetime.Clock
import kotlinx.datetime.DateTimeUnit.Companion.DAY
import kotlinx.datetime.DayOfWeek
import kotlinx.datetime.LocalDate
import kotlinx.datetime.TimeZone
import kotlinx.datetime.minus
import kotlinx.datetime.plus
import kotlinx.datetime.todayIn

class SimpleRowCalendarDataSource {
private val today: LocalDate = Clock.System.todayIn(TimeZone.currentSystemDefault())

fun getData(
startDate: LocalDate = today,
lastSelectedDate: LocalDate
): SimpleRowCalendarUiModel {
val visibleDates = getVisibleDates(startDate)
val selectedDate = getSelectedDate(visibleDates, lastSelectedDate)
return SimpleRowCalendarUiModel(selectedDate, visibleDates)
}

private fun getSelectedDate(
visibleDates: List<SimpleRowCalendarUiModel.Date>,
lastSelectedDate: LocalDate
): SimpleRowCalendarUiModel.Date {
/* if the lastSelectedDate is not in the visibleDates,
then return the same position as the lastSelectedDate was before */
val index = visibleDates.indexOfFirst { it.date == lastSelectedDate }
val selectedDate = if (index == -1) {
// the day that has the same day of the week as the lastSelectedDate
val dayOfWeek = lastSelectedDate.dayOfWeek
visibleDates.firstOrNull { it.date.dayOfWeek == dayOfWeek } ?: visibleDates.first()
} else {
visibleDates[index]
}
return selectedDate.copy(isSelected = true)
}

private fun getVisibleDates(startDate: LocalDate): List<SimpleRowCalendarUiModel.Date> {
val dates = mutableListOf<SimpleRowCalendarUiModel.Date>()
// Get the current week day
val currentDayOfWeek: DayOfWeek = startDate.dayOfWeek
// Get the first day of the week
val firstDayOfWeek: LocalDate = startDate.minus(currentDayOfWeek.ordinal, DAY)
// fill the dates with the days of the week
for (i in 0..<DayOfWeek.values().size) {
val date = firstDayOfWeek.plus(i, DAY)
dates.add(
SimpleRowCalendarUiModel.Date(
date,
isSelected = false,
isToday = date == today
)
)
}
return dates
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package io.astrum.mindsync.app.navigation

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import cafe.adriel.voyager.navigator.Navigator
import cafe.adriel.voyager.navigator.tab.Tab
import cafe.adriel.voyager.navigator.tab.TabOptions
import cafe.adriel.voyager.transitions.ScaleTransition
import io.astrum.mindsync.app.ui.icon.ApplicationIcons
import io.astrum.mindsync.app.ui.screens.CurrentDayScreen
import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime

internal object CurrentDayTab : Tab {

override val options: TabOptions
@Composable
get() {
val icon = rememberVectorPainter(ApplicationIcons.Calendar)

return remember {
TabOptions(
index = 1u,
title = getCurrentDayTitle(),
icon = icon
)
}
}
private val localDateTime: LocalDateTime =
Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault())

private fun getCurrentDayTitle(): String =
localDateTime.dayOfMonth.toString()

@Composable
override fun Content() {
// Navigator(CurrentDayScreen(localDateTime.date)) {
// ScaleTransition(it)
// }
Navigator(CurrentDayScreen()) {
ScaleTransition(it)
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ object Resources {
const val mkLogo = "drawable/mklogo.xml"
const val features = "drawable/features_overview_cuate.xml"
const val productQuality = "drawable/product_quality_amico.xml"
const val matchCase = "drawable/match_case.xml"
}
}
Loading