Skip to content

Commit

Permalink
Drop compose locals (#415)
Browse files Browse the repository at this point in the history
* Drop compose locals

* Remove actual module

* Disable property naming rule

---------

Co-authored-by: Davies Ashley <[email protected]>
  • Loading branch information
ashdavies and ashdavies authored Jul 28, 2023
1 parent d1be8fa commit dcd4aad
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 34 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ stateDiagram-v2
EventsApp --> AppCheckClient
EventsApp --> Auth0Auth
EventsApp --> ComposeLocals
EventsApp --> HttpClient
EventsApp --> ImageLoader
EventsApp --> LocalStorage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spotless {
val editorConfig = mapOf(
"ij_kotlin_allow_trailing_comma_on_call_site" to "true",
"ktlint_standard_function-naming" to "disabled",
"ktlint_standard_property-naming" to "disabled",
"ij_kotlin_allow_trailing_comma" to "true",
"ktlint_experimental" to "enabled",
"ktlint_filename" to "disabled",
Expand Down
1 change: 0 additions & 1 deletion cloud-run/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ kotlin {
with(projects) {
implementation(appCheck.appCheckSdk)
implementation(cloudFirestore)
implementation(composeLocals)
implementation(httpClient)
implementation(eventsAggregator)
implementation(localStorage)
Expand Down
7 changes: 0 additions & 7 deletions compose-locals/build.gradle.kts

This file was deleted.

2 changes: 0 additions & 2 deletions compose-locals/src/androidMain/AndroidManifest.xml

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion events-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ kotlin {

with(projects) {
implementation(appCheck.appCheckClient)
implementation(composeLocals)
implementation(httpClient)
implementation(imageLoader)
implementation(localStorage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.ashdavies.playground
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import io.ashdavies.compose.noLocalProvidedFor
import io.ashdavies.events.PlaygroundDatabase

@RequiresOptIn(
Expand All @@ -14,7 +13,7 @@ import io.ashdavies.events.PlaygroundDatabase
internal annotation class MultipleReferenceWarning

internal val LocalPlaygroundDatabase = compositionLocalOf<PlaygroundDatabase> {
noLocalProvidedFor("LocalPlaygroundDatabase")
error("CompositionLocal LocalPlaygroundDatabase not present")
}

@Composable
Expand Down
4 changes: 0 additions & 4 deletions firebase-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ android {
}

kotlin {
commonMain.dependencies {
implementation(projects.composeLocals)
}

androidMain.dependencies {
with(libs.google.firebase) {
implementation(dependencies.platform(bom))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.google.android.gms.common.util.ProcessUtils
import com.google.firebase.FirebaseApp

public val LocalFirebaseAndroidApp: ProvidableCompositionLocal<FirebaseApp> = staticCompositionLocalOf {
noLocalProvidedFor("LocalFirebaseAndroidApp")
error("CompositionLocal LocalFirebaseAndroidApp not present")
}

@Composable
Expand All @@ -22,12 +22,15 @@ public fun ProvideFirebaseApp(context: Context = LocalContext.current, content:
}

private fun requireFirebaseApp(context: Context): FirebaseApp {
val firebaseApp = if (FirebaseApp.getApps(context).size > 0) FirebaseApp.getInstance()
else FirebaseApp.initializeApp(context)
val firebaseApp = if (FirebaseApp.getApps(context).size > 0) {
FirebaseApp.getInstance()
} else {
FirebaseApp.initializeApp(context)
}

return requireNotNull(firebaseApp) {
"Default FirebaseApp is not initialized in this " +
"process ${ProcessUtils.getMyProcessName()}. Make sure " +
"to call FirebaseApp.initializeApp(Context) first."
"process ${ProcessUtils.getMyProcessName()}. Make sure " +
"to call FirebaseApp.initializeApp(Context) first."
}
}
1 change: 0 additions & 1 deletion gallery-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ android {

kotlin {
commonMain.dependencies {
implementation(projects.composeLocals)
implementation(projects.httpClient)
implementation(projects.imageLoader)
implementation(projects.localStorage)
Expand Down
1 change: 0 additions & 1 deletion notion-console/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ application {
kotlin {
commonMain.dependencies {
with(projects) {
implementation(composeLocals)
implementation(localStorage)
implementation(notionClient)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ package io.ashdavies.notion
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import io.ashdavies.compose.noLocalProvidedFor
import io.ashdavies.playground.rememberDatabase
import org.jraf.klibnotion.client.Authentication
import org.jraf.klibnotion.client.ClientConfiguration
import org.jraf.klibnotion.client.NotionClient

internal val LocalNotionClient = compositionLocalOf<NotionClient> {
noLocalProvidedFor("LocalNotionClient")
error("CompositionLocal LocalNotionClient not present")
}

internal val LocalPlaygroundDatabase = compositionLocalOf<PlaygroundDatabase> {
noLocalProvidedFor("LocalPlaygroundDatabase")
error("CompositionLocal LocalPlaygroundDatabase not present")
}

@Composable
Expand Down
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ include(
":app-launcher:desktop",
":cloud-firestore",
":cloud-run",
":compose-locals",
":dominion-app",
":events-aggregator",
":events-app",
Expand Down

0 comments on commit dcd4aad

Please sign in to comment.