Skip to content

Commit

Permalink
Merge branch 'main' into twyatt/iosArm32
Browse files Browse the repository at this point in the history
  • Loading branch information
sdonn3 authored Sep 8, 2023
2 parents dd262f0 + a34a0c8 commit 902fdf8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion coroutines/api/android/coroutines.api
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public final class com/juul/tuulbox/coroutines/delay/FixedDelay : com/juul/tuulb
}

public final class com/juul/tuulbox/coroutines/flow/BroadcastReceiverFlowKt {
public static final fun broadcastReceiverFlow (Landroid/content/IntentFilter;)Lkotlinx/coroutines/flow/Flow;
public static final fun broadcastReceiverFlow (Landroid/content/IntentFilter;I)Lkotlinx/coroutines/flow/Flow;
public static synthetic fun broadcastReceiverFlow$default (Landroid/content/IntentFilter;IILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
}

public final class com/juul/tuulbox/coroutines/flow/FlowsKt {
Expand Down
1 change: 1 addition & 0 deletions coroutines/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ kotlin {
val androidMain by getting {
dependencies {
api(libs.kotlinx.coroutines.android)
implementation(libs.androidx.core)
implementation(libs.androidx.startup)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import androidx.core.content.ContextCompat
import androidx.core.content.ContextCompat.RECEIVER_NOT_EXPORTED
import androidx.core.content.ContextCompat.RegisterReceiverFlags
import com.juul.tuulbox.coroutines.applicationContext
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
Expand All @@ -12,6 +15,7 @@ import kotlinx.coroutines.flow.callbackFlow
@Suppress("EXPERIMENTAL_API_USAGE")
public fun broadcastReceiverFlow(
intentFilter: IntentFilter,
@RegisterReceiverFlags flags: Int = RECEIVER_NOT_EXPORTED,
): Flow<Intent> = callbackFlow {
val broadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
Expand All @@ -20,6 +24,6 @@ public fun broadcastReceiverFlow(
}
}
}
applicationContext.registerReceiver(broadcastReceiver, intentFilter)
ContextCompat.registerReceiver(applicationContext, broadcastReceiver, intentFilter, flags)
awaitClose { applicationContext.unregisterReceiver(broadcastReceiver) }
}
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ kotlin = "1.9.0"
ktor = "2.3.2"

[libraries]
androidx-core = { module = "androidx.core:core", version = "1.12.0" }
androidx-startup = { module = "androidx.startup:startup-runtime", version = "1.1.1" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
Expand All @@ -17,7 +18,7 @@ ktor-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
ktor-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }

[plugins]
android-library = { id = "com.android.library", version = "8.0.2" }
android-library = { id = "com.android.library", version = "8.1.1" }
android-publish = { id = "com.vanniktech.maven.publish", version = "0.25.3" }
atomicfu = { id = "kotlinx-atomicfu", version = "0.21.0" }
binary-compatibility-validator = { id = "binary-compatibility-validator", version = "0.13.0" }
Expand Down

0 comments on commit 902fdf8

Please sign in to comment.