Skip to content

Commit

Permalink
Changed application context to be Application for ios (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reedyuk authored Dec 6, 2024
1 parent 70b75c9 commit f154a1f
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/ComposeMultiplatform-Example/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ kotlin.mpp.androidSourceSetLayoutVersion=2

org.jetbrains.compose.experimental.uikit.enabled=true

kotlin.version=2.0.0
kotlin.version=2.0.20
agp.version=8.3.0
compose.version=1.6.11
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ kotlin {
implementation("dev.icerock.moko:mvvm-flow-compose:0.16.1")

// BlueFalcon dependency here
implementation("dev.bluefalcon:blue-falcon:2.0.0")
implementation("dev.bluefalcon:blue-falcon:2.2.0")
}
}
val commonTest by getting {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fun DeviceScanView(
) {
LazyColumn {
items(state.devices.values.toList().sortedByDescending { it.peripheral.name }) { device ->
@OptIn(kotlin.uuid.ExperimentalUuidApi::class)
FoundDeviceCard(
deviceName = if (!device.peripheral.name.isNullOrBlank()) device.peripheral.name else "No Name",
macId = device.peripheral.uuid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ package com.example.bluefalconcomposemultiplatform.di

import dev.bluefalcon.ApplicationContext
import dev.bluefalcon.BlueFalcon
import platform.UIKit.UIApplication

actual class AppModule {
actual val blueFalcon: BlueFalcon
get() = BlueFalcon(ApplicationContext())
get() = BlueFalcon(
log = null,
context = UIApplication.sharedApplication
)
}
2 changes: 1 addition & 1 deletion examples/KotlinMP-Example/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref =
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
blue-falcon = { module = "dev.bluefalcon:blue-falcon", version = "2.0.0" }
blue-falcon = { module = "dev.bluefalcon:blue-falcon", version = "2.2.0" }
kmm-viewmodel = { module = "com.rickclephas.kmp:kmp-observableviewmodel-core", version = "1.0.0-BETA-3" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
compose-permissions = { group = "com.github.dawidraszka.compose-permission-handler", name = "core", version = "1.5.0" }
Expand Down
2 changes: 1 addition & 1 deletion examples/KotlinMP-Example/iosApp/iosApp/iOSApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import shared

@main
struct iOSApp: App {
let blueFalconApp = BlueFalconApplication(context: UIView())
let blueFalconApp = BlueFalconApplication(context: UIApplication.shared)
var body: some Scene {
WindowGroup {
DevicesView(viewModel: blueFalconApp.createDevicesViewModel())
Expand Down
2 changes: 1 addition & 1 deletion library/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ org.gradle.configureondemand = false
android.useAndroidX=true
android.enableJetifier=true

version=2.1.0
version=2.2.0
group=dev.bluefalcon
libraryName=blue-falcon
kotlinx_coroutines_version=1.9.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package dev.bluefalcon

import platform.UIKit.UIView
import platform.UIKit.UIApplication

actual typealias ApplicationContext = UIView
actual typealias ApplicationContext = UIApplication
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package dev.bluefalcon

import platform.AppKit.NSView
import platform.AppKit.NSApplication

actual typealias ApplicationContext = NSView
actual typealias ApplicationContext = NSApplication

0 comments on commit f154a1f

Please sign in to comment.