diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 36e2f71..08a2f48 100755 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -199,8 +199,10 @@ compose.desktop { mainClass = "com.github.springeye.memosc.MainKt" buildTypes.release { proguard { + version="7.4.0" isEnabled=false configurationFiles.from("rules.pro") + obfuscate=true } } nativeDistributions { diff --git a/composeApp/rules.pro b/composeApp/rules.pro index 6151ca9..94d2577 100644 --- a/composeApp/rules.pro +++ b/composeApp/rules.pro @@ -1,13 +1,20 @@ --dontwarn +-dontwarn org.apache.** +-dontwarn com.sun.** +-dontwarn javax.** +-dontwarn org.** -keep class kotlinx.coroutines.** {*;} -keep class org.jetbrains.skia.** {*;} -keep class org.jetbrains.skiko.** {*;} -keepclassmembernames class kotlinx.** { volatile ; } --keep public class MainKt { +-keepclasseswithmembers public class com.github.springeye.memosc.MainKt { public void main(); } +-keepattributes *Annotation* --keep class api.** {*;} --keep class model.** {*;} \ No newline at end of file +-keep class kotlin.Metadata { *; } + + +-keep class com.github.springeye.memosc.api.** {*;} +-keep class com.github.springeye.memosc.model.** {*;} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/MemosApi.kt b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/api/MemosApi.kt similarity index 99% rename from composeApp/src/commonMain/kotlin/com/github/springeye/memosc/MemosApi.kt rename to composeApp/src/commonMain/kotlin/com/github/springeye/memosc/api/MemosApi.kt index 9ea649d..9b9efab 100644 --- a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/MemosApi.kt +++ b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/api/MemosApi.kt @@ -1,4 +1,4 @@ -package com.github.springeye.memosc +package com.github.springeye.memosc.api import com.github.springeye.memosc.model.Memo import com.github.springeye.memosc.model.MemosRowStatus import com.github.springeye.memosc.model.MemosVisibility diff --git a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/di/module.kt b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/di/module.kt index 6c00ddf..a7cb255 100644 --- a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/di/module.kt +++ b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/di/module.kt @@ -3,7 +3,7 @@ package com.github.springeye.memosc.di import com.github.springeye.memosc.AppPreferences import com.github.springeye.memosc.CoreComponent import com.github.springeye.memosc.CoreComponentImpl -import com.github.springeye.memosc.MemosApi +import com.github.springeye.memosc.api.MemosApi import com.github.springeye.memosc.db.createAppDatabase import com.github.springeye.memosc.db.model.AppDatabase @@ -18,7 +18,6 @@ import com.github.springeye.memosc.ui.login.LoginScreenModel import de.jensklingenberg.ktorfit.Ktorfit import de.jensklingenberg.ktorfit.converter.builtin.CallConverterFactory import de.jensklingenberg.ktorfit.ktorfit -import io.github.aakira.napier.Napier import io.ktor.client.HttpClient import io.ktor.client.plugins.contentnegotiation.ContentNegotiation import io.ktor.client.plugins.cookies.CookiesStorage diff --git a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/repository/MemoRepository.kt b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/repository/MemoRepository.kt index cfab311..0cb7bca 100644 --- a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/repository/MemoRepository.kt +++ b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/repository/MemoRepository.kt @@ -1,11 +1,8 @@ package com.github.springeye.memosc.repository -import com.github.springeye.memosc.MemosApi +import com.github.springeye.memosc.api.MemosApi import com.github.springeye.memosc.db.MemoQueryWhere import com.github.springeye.memosc.model.Memo -import com.github.springeye.memosc.model.MemosRowStatus -import com.github.springeye.memosc.model.MemosVisibility -import kotlinx.coroutines.delay class MemoRepository(private val api: MemosApi,) { diff --git a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/app/AppScreenModel.kt b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/app/AppScreenModel.kt index 233440c..44f4116 100644 --- a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/app/AppScreenModel.kt +++ b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/app/AppScreenModel.kt @@ -2,10 +2,9 @@ package com.github.springeye.memosc.ui.app import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.screenModelScope import com.github.springeye.memosc.AppPreferences -import com.github.springeye.memosc.MemosApi +import com.github.springeye.memosc.api.MemosApi import com.github.springeye.memosc.getPlatform import io.ktor.client.HttpClient -import io.ktor.client.call.body import io.ktor.client.plugins.cookies.cookies import io.ktor.client.request.get import io.ktor.client.request.header @@ -13,7 +12,6 @@ import io.ktor.client.statement.bodyAsText import io.ktor.utils.io.printStack import kotlinx.coroutines.delay import kotlinx.coroutines.launch -import kotlinx.serialization.json.Json class AppScreenModel(private val api: MemosApi, private val httpClient: HttpClient, diff --git a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/ArchivedModel.kt b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/ArchivedModel.kt index ffa9126..46e600b 100644 --- a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/ArchivedModel.kt +++ b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/ArchivedModel.kt @@ -1,56 +1,21 @@ package com.github.springeye.memosc.ui.home -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateListOf -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue -import androidx.compose.runtime.snapshotFlow import androidx.paging.ExperimentalPagingApi import androidx.paging.PagingConfig import androidx.paging.PagingData import androidx.paging.cachedIn -import androidx.paging.filter import app.cash.paging.Pager -import app.cash.paging.map -import app.cash.sqldelight.Query -import app.cash.sqldelight.coroutines.asFlow -import app.cash.sqldelight.coroutines.mapToList import cafe.adriel.voyager.core.model.ScreenModel import cafe.adriel.voyager.core.model.screenModelScope -import com.github.springeye.memosc.CreateMemoInput -import com.github.springeye.memosc.MemosApi -import com.github.springeye.memosc.PatchMemoInput -import com.github.springeye.memosc.UpdateMemoOrganizerInput -import com.github.springeye.memosc.core.createIFile -import com.github.springeye.memosc.core.formatDate -import com.github.springeye.memosc.core.parseDate +import com.github.springeye.memosc.api.MemosApi +import com.github.springeye.memosc.api.UpdateMemoOrganizerInput import com.github.springeye.memosc.db.MemoQueryWhere import com.github.springeye.memosc.db.model.QueryQueries -import com.github.springeye.memosc.model.DailyUsageStat import com.github.springeye.memosc.model.Memo import com.github.springeye.memosc.model.MemosRowStatus -import com.github.springeye.memosc.model.MemosVisibility -import com.github.springeye.memosc.model.Resource -import com.github.springeye.memosc.model.calculateMatrix -import com.github.springeye.memosc.model.initialMatrix import com.github.springeye.memosc.repository.MemoPagingSource import com.github.springeye.memosc.repository.MemoRepository -import io.ktor.client.request.forms.MultiPartFormDataContent -import io.ktor.client.request.forms.formData -import io.ktor.http.Headers -import io.ktor.http.HttpHeaders -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.collectLatest -import kotlinx.coroutines.flow.flatMapLatest -import kotlinx.coroutines.flow.launchIn -import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.launch -import kotlinx.datetime.Instant -import org.jetbrains.compose.resources.LoadState @OptIn(ExperimentalPagingApi::class) class ArchivedModel( diff --git a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/MemoModel.kt b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/MemoModel.kt index cf0f306..825bb43 100644 --- a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/MemoModel.kt +++ b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/MemoModel.kt @@ -12,10 +12,10 @@ import app.cash.paging.Pager import app.cash.sqldelight.Query import cafe.adriel.voyager.core.model.ScreenModel import cafe.adriel.voyager.core.model.screenModelScope -import com.github.springeye.memosc.CreateMemoInput -import com.github.springeye.memosc.MemosApi -import com.github.springeye.memosc.PatchMemoInput -import com.github.springeye.memosc.UpdateMemoOrganizerInput +import com.github.springeye.memosc.api.CreateMemoInput +import com.github.springeye.memosc.api.MemosApi +import com.github.springeye.memosc.api.PatchMemoInput +import com.github.springeye.memosc.api.UpdateMemoOrganizerInput import com.github.springeye.memosc.core.createIFile import com.github.springeye.memosc.core.formatDate import com.github.springeye.memosc.core.parseDate @@ -40,7 +40,6 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch import kotlinx.datetime.Instant import kotlinx.datetime.TimeZone diff --git a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/ProfileModel.kt b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/ProfileModel.kt index 4aca8f7..4fae653 100644 --- a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/ProfileModel.kt +++ b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/home/ProfileModel.kt @@ -1,56 +1,20 @@ package com.github.springeye.memosc.ui.home -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateListOf -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue -import androidx.compose.runtime.snapshotFlow import androidx.paging.ExperimentalPagingApi import androidx.paging.PagingConfig import androidx.paging.PagingData import androidx.paging.cachedIn -import androidx.paging.filter import app.cash.paging.Pager -import app.cash.paging.map -import app.cash.sqldelight.Query -import app.cash.sqldelight.coroutines.asFlow -import app.cash.sqldelight.coroutines.mapToList import cafe.adriel.voyager.core.model.ScreenModel import cafe.adriel.voyager.core.model.screenModelScope -import com.github.springeye.memosc.CreateMemoInput -import com.github.springeye.memosc.MemosApi -import com.github.springeye.memosc.PatchMemoInput -import com.github.springeye.memosc.UpdateMemoOrganizerInput -import com.github.springeye.memosc.core.createIFile -import com.github.springeye.memosc.core.formatDate -import com.github.springeye.memosc.core.parseDate +import com.github.springeye.memosc.api.MemosApi +import com.github.springeye.memosc.api.UpdateMemoOrganizerInput import com.github.springeye.memosc.db.MemoQueryWhere import com.github.springeye.memosc.db.model.QueryQueries -import com.github.springeye.memosc.model.DailyUsageStat import com.github.springeye.memosc.model.Memo -import com.github.springeye.memosc.model.MemosRowStatus -import com.github.springeye.memosc.model.MemosVisibility -import com.github.springeye.memosc.model.Resource -import com.github.springeye.memosc.model.calculateMatrix -import com.github.springeye.memosc.model.initialMatrix import com.github.springeye.memosc.repository.MemoPagingSource import com.github.springeye.memosc.repository.MemoRepository -import io.ktor.client.request.forms.MultiPartFormDataContent -import io.ktor.client.request.forms.formData -import io.ktor.http.Headers -import io.ktor.http.HttpHeaders -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.collectLatest -import kotlinx.coroutines.flow.flatMapLatest -import kotlinx.coroutines.flow.launchIn -import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.launch -import kotlinx.datetime.Instant -import org.jetbrains.compose.resources.LoadState @OptIn(ExperimentalPagingApi::class) class ProfileModel( diff --git a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/login/LoginScreenModel.kt b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/login/LoginScreenModel.kt index 1b9bc14..51bb6e3 100644 --- a/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/login/LoginScreenModel.kt +++ b/composeApp/src/commonMain/kotlin/com/github/springeye/memosc/ui/login/LoginScreenModel.kt @@ -4,8 +4,8 @@ package com.github.springeye.memosc.ui.login import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.screenModelScope import com.github.springeye.memosc.AppPreferences -import com.github.springeye.memosc.MemosApi -import com.github.springeye.memosc.SignInInput +import com.github.springeye.memosc.api.MemosApi +import com.github.springeye.memosc.api.SignInInput import io.ktor.client.HttpClient import io.ktor.http.isSuccess import kotlinx.coroutines.launch