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
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,172 @@
package com.wire.kalium.persistence.config

import com.russhwolf.settings.MapSettings
import com.wire.kalium.persistence.dao.SupportedProtocolEntity
import com.wire.kalium.persistence.kmmSettings.KaliumPreferencesSettings
import kotlinx.coroutines.flow.Flow

fun inMemoryUserConfigStorage(): UserConfigStorage = UserConfigStorageImpl(
KaliumPreferencesSettings(MapSettings())
)

@Suppress("TooManyFunctions")
class FakeUserConfigStorage(
val backingStorage: MutableMap<String, Any> = mutableMapOf()
) : UserConfigStorage {
override suspend fun persistAppLockStatus(
isEnforced: Boolean,
inactivityTimeoutSecs: Int,
isStatusChanged: Boolean?
) {
backingStorage["appLockStatus"] = AppLockConfigEntity(
inactivityTimeoutSecs = 60,
enforceAppLock = true,
isStatusChanged = false,
)
}

override suspend fun appLockStatus(): AppLockConfigEntity? {
return backingStorage["appLockStatus"] as? AppLockConfigEntity
}

override fun appLockFlow(): Flow<AppLockConfigEntity?> {
throw NotImplementedError()
}

override suspend fun setTeamAppLockAsNotified() {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistFileSharingStatus(status: Boolean, isStatusChanged: Boolean?) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun isFileSharingEnabled(): IsFileSharingEnabledEntity? {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override fun isFileSharingEnabledFlow(): Flow<IsFileSharingEnabledEntity?> {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun setFileSharingAsNotified() {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override fun isClassifiedDomainsEnabledFlow(): Flow<ClassifiedDomainsEntity?> {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistClassifiedDomainsStatus(status: Boolean, classifiedDomains: List<String>) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistSecondFactorPasswordChallengeStatus(isRequired: Boolean) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun isSecondFactorPasswordChallengeRequired(): Boolean {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistDefaultProtocol(protocol: SupportedProtocolEntity) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun defaultProtocol(): SupportedProtocolEntity {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun enableMLS(enabled: Boolean) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun isMLSEnabled(): Boolean {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun setE2EISettings(settingEntity: E2EISettingsEntity?) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun getE2EISettings(): E2EISettingsEntity? {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override fun e2EISettingsFlow(): Flow<E2EISettingsEntity?> {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistConferenceCalling(enabled: Boolean) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun isConferenceCallingEnabled(): Boolean {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun isConferenceCallingEnabledFlow(): Flow<Boolean> {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistUseSftForOneOnOneCalls(shouldUse: Boolean) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun shouldUseSftForOneOnOneCalls(): Boolean {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun areReadReceiptsEnabled(): Flow<Boolean> {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistReadReceipts(enabled: Boolean) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun isTypingIndicatorEnabled(): Flow<Boolean> {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistTypingIndicator(enabled: Boolean) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistGuestRoomLinkFeatureFlag(status: Boolean, isStatusChanged: Boolean?) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun isGuestRoomLinkEnabled(): IsGuestRoomLinkEnabledEntity? {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override fun isGuestRoomLinkEnabledFlow(): Flow<IsGuestRoomLinkEnabledEntity?> {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun isScreenshotCensoringEnabledFlow(): Flow<Boolean> {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun persistScreenshotCensoring(enabled: Boolean) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun setIfAbsentE2EINotificationTime(timeStamp: Long) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun getE2EINotificationTime(): Long? {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun e2EINotificationTimeFlow(): Flow<Long?> {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

override suspend fun updateE2EINotificationTime(timeStamp: Long) {
throw NotImplementedError("Implement your fake logic if needed using the map provided.")
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Wire
* Copyright (C) 2026 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.wire.kalium.persistence.config

import android.content.Context
import com.wire.kalium.persistence.dao.UserIDEntity
import com.wire.kalium.persistence.kmmSettings.EncryptedSettingsPlatformParam
import com.wire.kalium.persistence.kmmSettings.KaliumPreferencesSettings
import com.wire.kalium.persistence.kmmSettings.SettingOptions
import com.wire.kalium.persistence.kmmSettings.buildSettings

@Suppress("DEPRECATION")
@Deprecated(
"Scheduled for removal in future versions, User KMM Settings are now replaced by database implementation." +
"Just kept for migration purposes.",
ReplaceWith("No replacement available"),
)
actual class UserConfigStorageFactory actual constructor() {
/**
* Creates a [UserConfigStorage] instance for Android.
* @param userId The user ID entity
* @param shouldEncryptData Whether to encrypt the data
* @param platformParam Must be an Android [Context]
*/
actual fun create(
userId: UserIDEntity,
shouldEncryptData: Boolean,
platformParam: Any
): UserConfigStorage {
require(platformParam is Context) { "platformParam must be an Android Context" }
val settings = buildSettings(
SettingOptions.UserSettings(shouldEncryptData, userId),
EncryptedSettingsPlatformParam(platformParam)
)
return UserConfigStorageImpl(KaliumPreferencesSettings(settings))
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Wire
* Copyright (C) 2026 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.wire.kalium.persistence.config

import com.wire.kalium.persistence.dao.UserIDEntity
import com.wire.kalium.persistence.kmmSettings.EncryptedSettingsPlatformParam
import com.wire.kalium.persistence.kmmSettings.KaliumPreferencesSettings
import com.wire.kalium.persistence.kmmSettings.SettingOptions
import com.wire.kalium.persistence.kmmSettings.buildSettings

@Suppress("DEPRECATION")
@Deprecated(
"Scheduled for removal in future versions, User KMM Settings are now replaced by database implementation." +
"Just kept for migration purposes.",
ReplaceWith("No replacement available"),
)
actual class UserConfigStorageFactory actual constructor() {
/**
* Creates a [UserConfigStorage] instance for Apple platforms.
* @param userId The user ID entity
* @param shouldEncryptData Whether to encrypt the data (ignored on Apple, uses Keychain)
* @param platformParam Must be a [String] representing the service name for Keychain
*/
actual fun create(
userId: UserIDEntity,
shouldEncryptData: Boolean,
platformParam: Any
): UserConfigStorage {
require(platformParam is String) { "platformParam must be a String (service name)" }
val settings = buildSettings(
SettingOptions.UserSettings(shouldEncryptData, userId),
EncryptedSettingsPlatformParam(platformParam)
)
return UserConfigStorageImpl(KaliumPreferencesSettings(settings))
}
}

This file was deleted.

Loading
Loading