Skip to content

Commit

Permalink
fix compiler issue
Browse files Browse the repository at this point in the history
  • Loading branch information
storytellerF committed Jan 28, 2025
1 parent e27ff3a commit ca4db96
Show file tree
Hide file tree
Showing 34 changed files with 91 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.storyteller_f.media

import com.storyteller_f.shared.model.MediaInfo
import java.io.File
const val AMEDIA_BUCKET = "amedia"

data class UploadPack(val name: String, val path: File, val contentType: String? = null)

Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/kotlin/com/storyteller_f/tables/Rooms.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.storyteller_f.tables

import com.storyteller_f.*
import com.storyteller_f.media.AMEDIA_BUCKET
import com.storyteller_f.shared.model.AMEDIA_BUCKET
import com.storyteller_f.shared.model.RoomInfo
import com.storyteller_f.shared.obj.JoinStatusSearch
import com.storyteller_f.shared.type.ObjectType
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/kotlin/com/storyteller_f/tables/Users.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.storyteller_f.tables

import com.storyteller_f.*
import com.storyteller_f.media.AMEDIA_BUCKET
import com.storyteller_f.shared.model.AMEDIA_BUCKET
import com.storyteller_f.shared.model.UserInfo
import com.storyteller_f.shared.type.ObjectType
import com.storyteller_f.shared.type.PrimaryKey
Expand Down
2 changes: 1 addition & 1 deletion cli/src/main/kotlin/com/storyteller_f/cli/AddPreset.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import com.storyteller_f.DatabaseFactory
import com.storyteller_f.ROOM_ID_LENGTH
import com.storyteller_f.crypto_jvm.addProviderForJvm
import com.storyteller_f.index.TopicDocument
import com.storyteller_f.media.AMEDIA_BUCKET
import com.storyteller_f.media.UploadPack
import com.storyteller_f.shared.*
import com.storyteller_f.shared.model.AMEDIA_BUCKET
import com.storyteller_f.shared.obj.PresetCommunity
import com.storyteller_f.shared.obj.PresetTopic
import com.storyteller_f.shared.obj.PresetValue
Expand Down
2 changes: 1 addition & 1 deletion cli/src/main/kotlin/com/storyteller_f/cli/CleanCommand.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.storyteller_f.cli

import com.storyteller_f.DatabaseFactory
import com.storyteller_f.media.AMEDIA_BUCKET
import com.storyteller_f.shared.model.AMEDIA_BUCKET
import com.storyteller_f.shared.type.ObjectType
import io.github.aakira.napier.Napier
import kotlinx.cli.ExperimentalCli
Expand Down
1 change: 1 addition & 0 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ compose.desktop {

buildkonfig {
packageName = "com.storyteller_f.a.app"
objectName = "AppConfig"
val properties = Properties().apply {
val file = layout.projectDirectory.file("../${flavorStr}.env").asFile
load(FileInputStream(file))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import java.io.File
@Preview
@Composable
private fun PreviewCommunity(@PreviewParameter(CommunityProvider::class) communityInfo: CommunityInfo) {
CommunityDialogInternal(communityInfo = communityInfo, {})
CommunityDialogInternal(communityInfo = communityInfo) {}
}

@Preview
Expand All @@ -34,7 +34,7 @@ private fun PreviewCommunityPage() {
private class CommunityProvider : PreviewParameterProvider<CommunityInfo> {
override val values: Sequence<CommunityInfo>
get() = sequence {
val f = File(com.storyteller_f.a.app.BuildKonfig.PROJECT_PATH, "../../AData/data/preset_community.json")
val f = File(com.storyteller_f.a.app.AppConfig.PROJECT_PATH, "../../AData/data/preset_community.json")
if (f.exists()) {
val value = Json.decodeFromString<PresetValue>(f.readText())
yieldAll(value.communityData.orEmpty().map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.io.File
private class ContentListProvider : PreviewParameterProvider<String> {
override val values: Sequence<String>
get() = sequence {
val f = File(com.storyteller_f.a.app.BuildKonfig.PROJECT_PATH, "../../AData/data/preset_topic.json")
val f = File(com.storyteller_f.a.app.AppConfig.PROJECT_PATH, "../../AData/data/preset_topic.json")
if (f.exists()) {
val value = Json.decodeFromString<PresetValue>(f.readText())
yieldAll(value.topicData.orEmpty().filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import com.storyteller_f.a.app.BuildKonfig
import com.storyteller_f.a.app.AppConfig
import com.storyteller_f.a.app.pages.user.UserDialogInternal
import com.storyteller_f.shared.model.UserInfo
import com.storyteller_f.shared.obj.PresetValue
Expand All @@ -14,7 +14,7 @@ import java.io.File
private class UserInfoPreviewProvider : PreviewParameterProvider<UserInfo> {
override val values: Sequence<UserInfo>
get() = sequence {
val f = File(BuildKonfig.PROJECT_PATH, "../../AData/data/preset_user.json")
val f = File(AppConfig.PROJECT_PATH, "../../AData/data/preset_user.json")
if (f.exists()) {
val value = Json.decodeFromString<PresetValue>(f.readText())
yieldAll(value.userData.orEmpty().map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import java.io.File
private class CommunitiesProvider : PreviewParameterProvider<List<CommunityInfo>> {
override val values: Sequence<List<CommunityInfo>>
get() = sequence {
val f = File(com.storyteller_f.a.app.BuildKonfig.PROJECT_PATH, "../../AData/data/preset_community.json")
val f = File(com.storyteller_f.a.app.AppConfig.PROJECT_PATH, "../../AData/data/preset_community.json")
if (f.exists()) {
val value = Json.decodeFromString<PresetValue>(f.readText())
yield(value.communityData.orEmpty().map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private class MessageListProvider : PreviewParameterProvider<List<TopicInfo>> {
override val values: Sequence<List<TopicInfo>>
get() = sequence {
val p = Path(
com.storyteller_f.a.app.BuildKonfig.PROJECT_PATH,
com.storyteller_f.a.app.AppConfig.PROJECT_PATH,
"../../AData/data/preset_topic.json"
)
if (SystemFileSystem.exists(p)) {
Expand Down Expand Up @@ -76,7 +76,7 @@ private class RoomsProvider : PreviewParameterProvider<RoomInfo> {
override val values: Sequence<RoomInfo>
get() = sequence {
val p = Path(
com.storyteller_f.a.app.BuildKonfig.PROJECT_PATH,
com.storyteller_f.a.app.AppConfig.PROJECT_PATH,
"../../AData/data/preset_room.json"
)
if (SystemFileSystem.exists(p)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private class TopicPagePreviewProvider : PreviewParameterProvider<Pair<TopicInfo
override val values: Sequence<Pair<TopicInfo, List<TopicInfo>>>
get() = sequence {
val p = Path(
com.storyteller_f.a.app.BuildKonfig.PROJECT_PATH,
com.storyteller_f.a.app.AppConfig.PROJECT_PATH,
"../../AData/data/preset_topic.json"
)
if (SystemFileSystem.exists(p)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ import android.content.ComponentName
import android.content.ContentProvider
import com.storyteller_f.a.app.MainActivity
import kotbase.CouchbaseLite
import org.junit.Assume
import org.junit.Before
import org.junit.Rule
import org.junit.rules.TestWatcher
import org.junit.runner.Description
import org.junit.runner.RunWith
import org.robolectric.Robolectric
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.Shadows
import org.robolectric.annotation.Config
import org.robolectric.shadows.ShadowApplicationPackageManager

@RunWith(RobolectricTestRunner::class)
@Config(
Expand All @@ -23,6 +20,7 @@ import org.robolectric.shadows.ShadowApplicationPackageManager
actual abstract class UsingContextTest {
@Before
fun setup() {
Assume.assumeTrue(System.getProperty("os.name").orEmpty().contains("win", true))
System.loadLibrary("LiteCore")
System.loadLibrary("LiteCoreJNI")
val app = RuntimeEnvironment.getApplication()
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ data class MediaScreen(val url: String)

@Composable
fun App() {
val httpUrl = BuildKonfig.SERVER_URL
val wsServerUrl = BuildKonfig.WS_SERVER_URL
val httpUrl = AppConfig.SERVER_URL
val wsServerUrl = AppConfig.WS_SERVER_URL
AppInternal(httpUrl, wsServerUrl)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
import com.storyteller_f.a.app.BuildKonfig
import com.storyteller_f.a.app.AppConfig
import kotlinx.coroutines.flow.MutableStateFlow

class DialogSaveState {
Expand Down Expand Up @@ -104,7 +104,7 @@ fun GlobalDialogInternal(message: DialogState, updateNewState: (DialogState) ->
}, title = {
ExceptionView(throwable)
}, text = {
if (!BuildKonfig.IS_PROD) {
if (!AppConfig.IS_PROD) {
val text = throwable.stackTraceToString()
MeasureTextLineCount(text, LocalTextStyle.current, 0.dp) { _, total ->
Text(text, modifier = Modifier.verticalScroll(scrollState), maxLines = (total).coerceIn(2, 20))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jvm_based

import androidx.compose.ui.test.*
import com.storyteller_f.a.app.AppInternal
import com.storyteller_f.a.app.compontents.TopicContentField
import com.storyteller_f.shared.model.TopicInfo
import kotlin.test.Test
Expand All @@ -11,12 +12,13 @@ class TopicContentTest : UsingContextTest() {
@OptIn(ExperimentalTestApi::class)
@Test
fun myTest() = jvmBasedTest {

runComposeUiTest {
setContent {
TopicContentField(TopicInfo.EMPTY.copy(content = com.storyteller_f.shared.model.TopicContent.Plain("hello")))
AppInternal("http://localhost:8811", "ws://localhost:8811")
}

onNodeWithTag("content").performClick()
onNodeWithTag("me").performClick()
}
}
}
Expand Down
Binary file removed composeApp/src/desktopTest/jniLibs/LiteCore.dll
Binary file not shown.
Binary file removed composeApp/src/desktopTest/jniLibs/LiteCoreJNI.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package jvm_based

import com.storyteller_f.a.app.BuildKonfig
import com.storyteller_f.a.app.AppConfig
import kotbase.CouchbaseLite
import org.junit.Assume
import org.junit.Before
import java.io.File

actual abstract class UsingContextTest {
@Before
fun setup() {
System.load(File(BuildKonfig.PROJECT_PATH, "src/desktopTest/jniLibs/LiteCore.dll").absolutePath)
System.load(File(BuildKonfig.PROJECT_PATH, "src/desktopTest/jniLibs/LiteCoreJNI.dll").absolutePath)
Assume.assumeTrue(System.getProperty("os.name").orEmpty().contains("win", true))
System.load(File(AppConfig.PROJECT_PATH, "src/androidUnitTests/jniLibs/LiteCore.dll").absolutePath)
System.load(File(AppConfig.PROJECT_PATH, "src/androidUnitTests/jniLibs/LiteCoreJNI.dll").absolutePath)
CouchbaseLite.init()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.storyteller_f.a.app.compontents.TopicContentField
import com.storyteller_f.shared.model.TopicContent
import com.storyteller_f.shared.model.TopicInfo

class TopicPreviewsScreenshotsTest {

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
TopicContentField(TopicInfo.EMPTY.copy(content = TopicContent.Plain("hello")))
}
}
2 changes: 1 addition & 1 deletion deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ services:
POSTGRES_PASSWORD: ${DATABASE_PASS}
PGOPTIONS: --statement_timeout=5000
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER" ]
test: [ "CMD-SHELL", "pg_isready" ]
interval: 1s
start_period: 5s
volumes:
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ detekt.use.worker.api = false

target.ios=false
target.wasm=false
aboutLibraries.exportPath=src/commonMain/composeResources/files
aboutLibraries.exportPath=src/commonMain/composeResources/files
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ napier = "2.7.1"
navigationCompose = "2.8.0-alpha11"
pagingCommon = "3.3.0-alpha02-0.5.1"
pdfbox = "3.0.3"
pdfbox2LayoutVersion = "3.0.0-rc.0"
pdfboxLayout = "3.0.0-rc.0"
pgjdbcNg = "0.8.9"
postgresql = "42.7.4"
postgresqlVersion = "1.20.4"
recordCore = "0.4.0"
richeditorCompose = "1.0.0-rc10"
robolectric = "4.14.1"
screenshot = "0.0.1-alpha07"
simplemagic = "1.17"
slf4jSimple = "2.0.16"
sqliteJdbc = "3.47.1.0"
Expand All @@ -85,6 +85,7 @@ androidx-media3-exoplayer-hls = { module = "androidx.media3:media3-exoplayer-hls
androidx-media3-ui = { module = "androidx.media3:media3-ui", version.ref = "media3Exoplayer" }
androidx-ui-test-junit4-android = { module = "androidx.compose.ui:ui-test-junit4-android", version.ref = "uiTestJunit4Android" }
androidx-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "uiTestJunit4Android" }
androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "uiTestJunit4Android" }
bcpkix-jdk18on = { module = "org.bouncycastle:bcpkix-jdk18on", version.ref = "bcprovJdk18on" }
bcprov-jdk18on = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bcprovJdk18on" }
bctls-jdk18on = { module = "org.bouncycastle:bctls-jdk18on", version.ref = "bcprovJdk18on" }
Expand Down Expand Up @@ -207,6 +208,7 @@ kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
ktor = { id = "io.ktor.plugin", version.ref = "ktor" }
screenshot = { id = "com.android.compose.screenshot", version.ref = "screenshot"}
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

[bundles]
Expand Down
9 changes: 9 additions & 0 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,13 @@ dependencies {

tasks.withType<JavaExec> {
jvmArgs = listOf("--add-modules", "jdk.incubator.vector")
}

val isProd = project.findProperty("server.prod") == true
val flavor = project.findProperty("buildkonfig.flavor").toString()

buildConfig {
className = "ServerConfig"
buildConfigField<Boolean>("IS_PROD", isProd)
buildConfigField<String>("FLAVOR", flavor)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.maxmind.geoip2.DatabaseReader
import com.perraco.utils.SnowflakeFactory
import com.storyteller_f.Backend
import com.storyteller_f.DatabaseFactory
import com.storyteller_f.a.server.BuildConfig
import com.storyteller_f.a.server.ServerConfig
import com.storyteller_f.a.server.auth.CustomCredential.AidCredential
import com.storyteller_f.a.server.auth.CustomCredential.IdCredential
import com.storyteller_f.a.server.remoteIp
Expand Down Expand Up @@ -194,7 +194,7 @@ private suspend fun ApplicationCall.checkApiRequest(
): CustomPrincipal? {
val sig = credential.sig
return when {
!BuildConfig.IS_PROD && credential is IdCredential && sig == credential.id.toString() -> {
!ServerConfig.IS_PROD && credential is IdCredential && sig == credential.id.toString() -> {
val id = credential.id
if (DatabaseFactory.getRawUserById(id).getOrNull() != null) {
saveSuccessSession(session, id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.storyteller_f.a.server.service

import com.storyteller_f.*
import com.storyteller_f.a.server.route.RouteCommunities
import com.storyteller_f.media.AMEDIA_BUCKET
import com.storyteller_f.shared.model.AMEDIA_BUCKET
import com.storyteller_f.shared.model.CommunityInfo
import com.storyteller_f.shared.obj.JoinStatusSearch
import com.storyteller_f.shared.type.ObjectType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package com.storyteller_f.a.server.service
import com.storyteller_f.Backend
import com.storyteller_f.ForbiddenException
import com.storyteller_f.a.server.route.RouteMedia
import com.storyteller_f.media.AMEDIA_BUCKET
import com.storyteller_f.media.UploadPack
import com.storyteller_f.shared.model.AMEDIA_BUCKET
import com.storyteller_f.shared.model.MediaInfo
import com.storyteller_f.shared.obj.ServerResponse
import com.storyteller_f.shared.type.ObjectType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.storyteller_f.Backend
import com.storyteller_f.DatabaseFactory
import com.storyteller_f.ForbiddenException
import com.storyteller_f.isDup
import com.storyteller_f.media.AMEDIA_BUCKET
import com.storyteller_f.shared.model.AMEDIA_BUCKET
import com.storyteller_f.shared.model.RoomInfo
import com.storyteller_f.shared.type.PrimaryKey
import com.storyteller_f.shared.utils.mapResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.perraco.utils.SnowflakeFactory
import com.storyteller_f.*
import com.storyteller_f.a.server.route.RouteTopics
import com.storyteller_f.index.TopicDocument
import com.storyteller_f.media.AMEDIA_BUCKET
import com.storyteller_f.media.UploadPack
import com.storyteller_f.shared.model.AMEDIA_BUCKET
import com.storyteller_f.shared.model.MediaInfo
import com.storyteller_f.shared.model.TopicContent
import com.storyteller_f.shared.model.TopicInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.storyteller_f.Backend
import com.storyteller_f.CustomBadRequestException
import com.storyteller_f.DatabaseFactory
import com.storyteller_f.USER_NICKNAME
import com.storyteller_f.media.AMEDIA_BUCKET
import com.storyteller_f.shared.model.AMEDIA_BUCKET
import com.storyteller_f.shared.model.UserInfo
import com.storyteller_f.shared.type.PrimaryKey
import com.storyteller_f.shared.utils.mapResult
Expand Down
3 changes: 1 addition & 2 deletions server/src/test/kotlin/SnapshotTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.storyteller_f.a.server.service.generateSignedSnapshot
import com.storyteller_f.shared.model.TopicInfo
import com.storyteller_f.shared.model.UserInfo
import org.apache.pdfbox.examples.signature.ShowSignature
import org.apache.pdfbox.pdmodel.encryption.SecurityProvider
import java.io.File
import java.security.Security
Expand All @@ -24,6 +23,6 @@ class SnapshotTest {
"" to ""
).getOrThrow()

ShowSignature().showSignature(signedFile, "123456")
// ShowSignature().showSignature(signedFile, "123456")
}
}
Loading

0 comments on commit ca4db96

Please sign in to comment.