Skip to content

Commit 03e23b9

Browse files
committed
Refactor: Decouple Snackbar logic and implement OPFS for Web
- Introduce `SnackbarInteractor` to decouple Snackbar logic from ViewModels and Composables. - Create a `GlobalSnackbarHost` to provide a single, app-wide `SnackbarHostState`. - Make the `App` composable parameterless by using `koinInject()` for dependencies. - Remove `SnackbarHostState` passing from all screens and dialogs. - Update ViewModels to use `SnackbarInteractor` for showing messages, removing direct state manipulation. - Move `AdaptiveInteractor` to the presentation layer and `SnackbarInteractor` to a new `interactorModule`. - feat(web): Implement OPFS (Origin-Private FileSystem) for persistent database storage, replacing the previous in-memory solution. - Add a Gradle task to download the official SQLite WASM build. - Configure webpack and a custom service worker (`coi-serviceworker.js`) to set required cross-origin headers. - Update `WebDatabaseHolder` to use a custom worker (`sqlite.worker.js`) that initializes the database with the OPFS VFS. - build: Upgrade various dependencies, including Compose, Firebase, and Gradle wrapper.
1 parent a202aa9 commit 03e23b9

File tree

70 files changed

+1291
-704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1291
-704
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,10 @@
11
version: 2
22
updates:
3-
- package-ecosystem: gradle
3+
#- package-ecosystem: gradle
4+
# directory: "/"
5+
# schedule:
6+
# interval: "daily"
7+
- package-ecosystem: "github-actions"
48
directory: "/"
59
schedule:
6-
interval: daily
7-
time: "00:00"
8-
open-pull-requests-limit: 10
9-
ignore:
10-
- dependency-name: com.google.firebase:firebase-bom
11-
versions:
12-
- 26.6.0
13-
- 26.7.0
14-
- 26.8.0
15-
- 27.0.0
16-
- dependency-name: androidx.recyclerview:recyclerview
17-
versions:
18-
- 1.2.0
19-
- dependency-name: org.mockito:mockito-inline
20-
versions:
21-
- 3.8.0
22-
- 3.9.0
23-
- dependency-name: org.mockito:mockito-core
24-
versions:
25-
- 3.8.0
26-
- 3.9.0
27-
- dependency-name: com.google.android.gms:oss-licenses-plugin
28-
versions:
29-
- 0.10.3
30-
- dependency-name: com.squareup.leakcanary:leakcanary-android-instrumentation
31-
versions:
32-
- "2.7"
33-
- dependency-name: com.squareup.leakcanary:plumber-android
34-
versions:
35-
- "2.7"
36-
- dependency-name: com.squareup.leakcanary:leakcanary-android-process
37-
versions:
38-
- "2.7"
39-
- dependency-name: com.google.firebase:firebase-crashlytics-gradle
40-
versions:
41-
- 2.5.1
42-
- 2.5.2
43-
- dependency-name: androidx.fragment:fragment-ktx
44-
versions:
45-
- 1.3.1
46-
- 1.3.2
47-
- dependency-name: androidx.activity:activity-ktx
48-
versions:
49-
- 1.2.1
50-
- 1.2.2
51-
- dependency-name: androidx.annotation:annotation
52-
versions:
53-
- 1.2.0
54-
- dependency-name: org.jetbrains.kotlin:kotlin-gradle-plugin
55-
versions:
56-
- 1.4.31
57-
- 1.4.32
58-
- dependency-name: com.android.tools.build:gradle
59-
versions:
60-
- 4.1.3
61-
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-android
62-
versions:
63-
- 1.4.3-native-mt
64-
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-test
65-
versions:
66-
- 1.4.3-native-mt
67-
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core
68-
versions:
69-
- 1.4.3-native-mt
70-
- dependency-name: com.kirich1409.viewbindingpropertydelegate:vbpd-noreflection
71-
versions:
72-
- 1.4.2
73-
- dependency-name: com.android.tools:desugar_jdk_libs
74-
versions:
75-
- 1.1.5
10+
interval: "weekly"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,7 @@ app/android/note_room_key_store.jks
7676
/app/iosApp/fastlane/28F5CB4337.json
7777
/app/iosApp/fastlane/ios_distribution.p12
7878
/app/iosApp/fastlane/NoteDelight_Distribution_Profile.mobileprovision
79+
80+
### Kotlin/JS & Kotlin/Wasm
81+
# Kotlin/JS store for dependencies
82+
kotlin-js-store/

app/android/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ android {
2424
applicationId = "com.softartdev.noteroom"
2525
minSdk = libs.versions.minSdk.get().toInt()
2626
targetSdk = libs.versions.targetSdk.get().toInt()
27-
versionCode = 842
28-
versionName = "8.4.2"
27+
versionCode = 843
28+
versionName = "8.4.3"
2929
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3030
testInstrumentationRunnerArguments["clearPackageData"] = "true"
3131
vectorDrawables.useSupportLibrary = true

app/android/src/main/java/com/softartdev/notedelight/MainActivity.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ package com.softartdev.notedelight
33
import android.os.Bundle
44
import androidx.activity.ComponentActivity
55
import androidx.activity.compose.setContent
6-
import com.softartdev.notedelight.navigation.Router
7-
import org.koin.android.ext.android.inject
86

97
class MainActivity : ComponentActivity() {
108

11-
private val router: Router by inject()
12-
139
override fun onCreate(savedInstanceState: Bundle?) {
1410
super.onCreate(savedInstanceState)
1511
setContent {
16-
App(router)
12+
App()
1713
}
1814
}
1915
}

app/desktop/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ compose.desktop {
4949
nativeDistributions {
5050
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
5151
packageName = "Note Delight"
52-
packageVersion = "4.0.0"
52+
packageVersion = "5.0.0"
5353
description = "Note app with encryption"
5454
copyright = "© 2023 SoftArtDev"
5555
macOS.iconFile.set(project.file("src/jvmMain/resources/app_icon.icns"))

app/desktop/src/jvmMain/kotlin/com/softartdev/notedelight/Main.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import androidx.compose.ui.window.application
88
import androidx.compose.ui.window.rememberWindowState
99
import com.softartdev.notedelight.di.sharedModules
1010
import com.softartdev.notedelight.di.uiModules
11-
import com.softartdev.notedelight.navigation.Router
1211
import com.softartdev.notedelight.ui.icon.FileLock
1312
import com.softartdev.notedelight.util.NapierKoinLogger
1413
import io.github.aakira.napier.DebugAntilog
@@ -18,16 +17,13 @@ import notedelight.ui.shared.generated.resources.app_name
1817
import org.jetbrains.compose.resources.stringResource
1918
import org.koin.core.context.startKoin
2019
import org.koin.core.logger.Level
21-
import org.koin.java.KoinJavaComponent.get
2220

2321
fun main() {
2422
Napier.base(antilog = DebugAntilog())
2523
startKoin {
2624
logger(NapierKoinLogger(Level.DEBUG))
2725
modules(sharedModules + uiModules)
2826
}
29-
val router: Router = get(Router::class.java)
30-
3127
application {
3228
Window(
3329
onCloseRequest = ::exitApplication,
@@ -36,7 +32,7 @@ fun main() {
3632
icon = rememberVectorPainter(image = Icons.Filled.FileLock),
3733
) {
3834
CustomDesktopTheme {
39-
App(router)
35+
App()
4036
}
4137
}
4238
}

app/desktop/src/jvmTest/kotlin/com/softartdev/notedelight/ui/DesktopUiTests.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import com.softartdev.notedelight.TestLifecycleOwner
1717
import com.softartdev.notedelight.db.NoteDAO
1818
import com.softartdev.notedelight.di.sharedModules
1919
import com.softartdev.notedelight.di.uiTestModules
20-
import com.softartdev.notedelight.navigation.Router
2120
import com.softartdev.notedelight.repository.SafeRepo
2221
import io.github.aakira.napier.Napier
2322
import kotlinx.coroutines.Dispatchers
@@ -51,14 +50,13 @@ class DesktopUiTests : AbstractUiTests() {
5150
}
5251
val safeRepo: SafeRepo = get(SafeRepo::class.java)
5352
safeRepo.buildDbIfNeed()
54-
val router: Router = get(Router::class.java)
5553
val noteDAO: NoteDAO = get(NoteDAO::class.java)
5654
noteDAO.deleteAll()
5755
super.setUp()
5856
val lifecycleOwner = TestLifecycleOwner(coroutineDispatcher = Dispatchers.Swing)
5957
composeTestRule.setContent {
6058
CompositionLocalProvider(LocalLifecycleOwner provides lifecycleOwner) {
61-
App(router)
59+
App()
6260
}
6361
}
6462
}

app/ios-kit/src/commonMain/kotlin/com/softartdev/notedelight/AppHelper.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,16 @@ package com.softartdev.notedelight
33
import androidx.compose.ui.window.ComposeUIViewController
44
import com.softartdev.notedelight.di.sharedModules
55
import com.softartdev.notedelight.di.uiModules
6-
import com.softartdev.notedelight.navigation.Router
76
import com.softartdev.notedelight.util.NapierKoinLogger
87
import io.github.aakira.napier.DebugAntilog
98
import io.github.aakira.napier.Napier
109
import org.koin.core.component.KoinComponent
11-
import org.koin.core.component.inject
1210
import org.koin.core.context.startKoin
1311
import org.koin.core.logger.Level
1412
import platform.UIKit.UIViewController
1513

1614
class AppHelper : KoinComponent {
17-
private val router: Router by inject()
18-
val appUIViewController: UIViewController = ComposeUIViewController { App(router) }
15+
val appUIViewController: UIViewController = ComposeUIViewController { App() }
1916

2017
fun appInit() {
2118
Napier.base(antilog = DebugAntilog())

app/iosApp/iosApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@
473473
"$(inherited)",
474474
"@executable_path/Frameworks",
475475
);
476-
MARKETING_VERSION = 4.0;
476+
MARKETING_VERSION = 5.0;
477477
OTHER_LDFLAGS = (
478478
"$(inherited)",
479479
"-ObjC",
@@ -514,7 +514,7 @@
514514
"$(inherited)",
515515
"@executable_path/Frameworks",
516516
);
517-
MARKETING_VERSION = 4.0;
517+
MARKETING_VERSION = 5.0;
518518
OTHER_LDFLAGS = (
519519
"$(inherited)",
520520
"-ObjC",
Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1620"
43
version = "1.3">
5-
<BuildAction
6-
parallelizeBuildables = "YES"
7-
buildImplicitDependencies = "YES">
4+
<BuildAction>
85
<BuildActionEntries>
96
<BuildActionEntry
10-
buildForTesting = "YES"
11-
buildForRunning = "YES"
12-
buildForProfiling = "YES"
13-
buildForArchiving = "YES"
14-
buildForAnalyzing = "YES">
7+
buildForRunning = "YES">
158
<BuildableReference
169
BuildableIdentifier = "primary"
1710
BlueprintIdentifier = "7555FF7A242A565900829871"
@@ -22,26 +15,11 @@
2215
</BuildActionEntry>
2316
</BuildActionEntries>
2417
</BuildAction>
25-
<TestAction
26-
buildConfiguration = "Debug"
27-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
shouldUseLaunchSchemeArgsEnv = "YES">
30-
<Testables>
31-
</Testables>
32-
</TestAction>
3318
<LaunchAction
34-
buildConfiguration = "Debug"
35-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37-
launchStyle = "0"
3819
useCustomWorkingDirectory = "NO"
39-
ignoresPersistentStateOnLaunch = "NO"
40-
debugDocumentVersioning = "YES"
41-
debugServiceExtension = "internal"
20+
buildConfiguration = "Debug"
4221
allowLocationSimulation = "YES">
43-
<BuildableProductRunnable
44-
runnableDebuggingMode = "0">
22+
<BuildableProductRunnable>
4523
<BuildableReference
4624
BuildableIdentifier = "primary"
4725
BlueprintIdentifier = "7555FF7A242A565900829871"
@@ -55,28 +33,4 @@
5533
referenceType = "1">
5634
</LocationScenarioReference>
5735
</LaunchAction>
58-
<ProfileAction
59-
buildConfiguration = "Release"
60-
shouldUseLaunchSchemeArgsEnv = "YES"
61-
savedToolIdentifier = ""
62-
useCustomWorkingDirectory = "NO"
63-
debugDocumentVersioning = "YES">
64-
<BuildableProductRunnable
65-
runnableDebuggingMode = "0">
66-
<BuildableReference
67-
BuildableIdentifier = "primary"
68-
BlueprintIdentifier = "7555FF7A242A565900829871"
69-
BuildableName = "iosApp.app"
70-
BlueprintName = "iosApp"
71-
ReferencedContainer = "container:iosApp.xcodeproj">
72-
</BuildableReference>
73-
</BuildableProductRunnable>
74-
</ProfileAction>
75-
<AnalyzeAction
76-
buildConfiguration = "Debug">
77-
</AnalyzeAction>
78-
<ArchiveAction
79-
buildConfiguration = "Release"
80-
revealArchiveInOrganizer = "YES">
81-
</ArchiveAction>
8236
</Scheme>

0 commit comments

Comments
 (0)