Skip to content

Instantly share code, notes, and snippets.

View Aidanvii7's full-sized avatar
👾

Aidan McWilliams Aidanvii7

👾
View GitHub Profile
@Aidanvii7
Aidanvii7 / SharedPreferenceDelegates.kt
Last active March 24, 2022 11:39
mutableStateOf for SharedPreferences
import android.content.SharedPreferences
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.core.content.edit
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
fun SharedPreferences.mutableStateOf(
key: String,
@Aidanvii7
Aidanvii7 / example.kt
Last active March 30, 2024 11:47
possible solution to syncing the OtrKeyManagerStoreImpl with a Room DB
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi
@Aidanvii7
Aidanvii7 / FirebaseIosPlugin.kt
Last active July 26, 2024 13:24
FirebaseIosPlugin example
package com.yourapp.plugins
import org.gradle.api.Action
import org.gradle.api.NamedDomainObjectContainer
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.provider.Property
import org.gradle.kotlin.dsl.configure
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension