Skip to content

Commit

Permalink
v1.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
YangDai2003 committed May 22, 2024
1 parent d8237d8 commit 49b64ff
Show file tree
Hide file tree
Showing 48 changed files with 1,474 additions and 1,515 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId = "com.yangdai.opennote"
minSdk = 29
targetSdk = 34
versionCode = 127
versionName = "1.2.7"
versionCode = 128
versionName = "1.2.8"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -69,7 +69,6 @@ android {
dependencies {
// Kotlin
implementation(libs.kotlinx.serialization)
implementation(libs.kotlinx.collections.immutable)

// CommonMark, for markdown rendering and parsing
implementation(libs.commonmark.ext.task.list.items)
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
2 changes: 0 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
android:name="android.hardware.camera"
android:required="false" />

<uses-permission android:name="com.google.android.gms.permission.AD_ID" />

<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import android.content.Intent
import android.os.Bundle
import androidx.core.app.TaskStackBuilder
import androidx.core.net.toUri
import com.yangdai.opennote.presentation.navigation.Screen
import com.yangdai.opennote.presentation.util.Constants.LINK

class ManageSpaceActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val intent = Intent(this, MainActivity::class.java).setData("$LINK/settings".toUri())
val intent =
Intent(this, MainActivity::class.java).setData("$LINK/${Screen.Settings.route}".toUri())
val pendingIntent = TaskStackBuilder.create(this).run {
addNextIntentWithParentStack(intent)
getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
Expand Down
11 changes: 5 additions & 6 deletions app/src/main/java/com/yangdai/opennote/data/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.yangdai.opennote.domain.usecase.DeleteNote
import com.yangdai.opennote.domain.usecase.DeleteNotesByFolderId
import com.yangdai.opennote.domain.usecase.GetFolders
import com.yangdai.opennote.domain.usecase.GetNotes
import com.yangdai.opennote.domain.usecase.Operations
import com.yangdai.opennote.domain.usecase.UseCases
import com.yangdai.opennote.domain.usecase.SearchNotes
import com.yangdai.opennote.domain.usecase.UpdateFolder
import com.yangdai.opennote.domain.usecase.UpdateNote
Expand All @@ -34,9 +34,8 @@ object AppModule {

@Singleton
@Provides
fun provideDataStoreRepository(
@ApplicationContext context: Context
): DataStoreRepository = DataStoreRepositoryImpl(context)
fun provideDataStoreRepository(@ApplicationContext context: Context): DataStoreRepository =
DataStoreRepositoryImpl(context)

@Provides
@Singleton
Expand All @@ -62,8 +61,8 @@ object AppModule {
fun provideNoteUseCases(
noteRepository: NoteRepository,
folderRepository: FolderRepository
): Operations {
return Operations(
): UseCases {
return UseCases(
getNotes = GetNotes(noteRepository),
getNoteById = GetNoteById(noteRepository),
deleteNote = DeleteNote(noteRepository),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class GetNotes(
is OrderType.Ascending -> {
when (noteOrder) {
is NoteOrder.Title -> notes.sortedBy { it.title.lowercase() }
is NoteOrder.Date -> notes.sortedBy { it.timestamp }
is NoteOrder.Date -> notes.reversed()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.yangdai.opennote.domain.usecase

data class Operations(
data class UseCases(
val getNotes: GetNotes,
val getNoteById: GetNoteById,
val deleteNote: DeleteNote,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.yangdai.opennote.presentation.component

import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.material3.DrawerState
import androidx.compose.material3.ModalDrawerSheet
import androidx.compose.material3.ModalNavigationDrawer
import androidx.compose.material3.PermanentDrawerSheet
import androidx.compose.material3.PermanentNavigationDrawer
import androidx.compose.runtime.Composable

/**
* A composable function that adapts the navigation drawer based on the screen size.
*
* @param isLargeScreen A boolean indicating whether the screen is large or not.
* @param drawerState The state of the drawer.
* @param gesturesEnabled A boolean indicating whether gestures are enabled or not.
* @param drawerContent The content of the drawer.
* @param content The main content.
*/
@Composable
fun AdaptiveNavigationScreen(
isLargeScreen: Boolean,
drawerState: DrawerState,
gesturesEnabled: Boolean,
drawerContent: @Composable (ColumnScope.() -> Unit),
content: @Composable () -> Unit
) = if (isLargeScreen) {
PermanentNavigationScreen(
drawerContent = drawerContent,
content = content
)
} else {
ModalNavigationScreen(
drawerContent = drawerContent,
drawerState = drawerState,
gesturesEnabled = gesturesEnabled,
content = content
)
}

@Composable
fun ModalNavigationScreen(
drawerContent: @Composable (ColumnScope.() -> Unit),
drawerState: DrawerState,
gesturesEnabled: Boolean,
content: @Composable () -> Unit
) = ModalNavigationDrawer(
drawerContent = {
ModalDrawerSheet(
drawerState = drawerState,
content = drawerContent
)
},
drawerState = drawerState,
gesturesEnabled = gesturesEnabled,
content = content
)

@Composable
fun PermanentNavigationScreen(
drawerContent: @Composable (ColumnScope.() -> Unit),
content: @Composable () -> Unit
) = PermanentNavigationDrawer(
drawerContent = {
PermanentDrawerSheet(
content = drawerContent
)
},
content = content
)
Loading

0 comments on commit 49b64ff

Please sign in to comment.