File tree Expand file tree Collapse file tree 4 files changed +25
-15
lines changed
compose-ui/src/iosMain/kotlin/dev/dimension/flare/ui/controllers Expand file tree Collapse file tree 4 files changed +25
-15
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,12 @@ import dev.dimension.flare.di.KoinHelper
1111import dev.dimension.flare.ui.humanizer.SwiftFormatter
1212import kotlinx.coroutines.CoroutineScope
1313import kotlinx.coroutines.Dispatchers
14+ import kotlinx.coroutines.IO
1415import kotlinx.coroutines.launch
16+ import kotlinx.coroutines.runBlocking
1517import kotlinx.coroutines.withContext
1618import org.koin.core.context.startKoin
17- import org.koin.dsl.binds
19+ import org.koin.dsl.bind
1820import org.koin.dsl.module
1921
2022public object ComposeUIHelper {
@@ -28,10 +30,10 @@ public object ComposeUIHelper {
2830 module {
2931 single {
3032 ProxyInAppNotification (inAppNotification, get())
31- } binds arrayOf( InAppNotification ::class )
33+ } bind InAppNotification ::class
3234 single {
3335 swiftFormatter
34- }
36+ } bind SwiftFormatter :: class
3537 },
3638 )
3739 modules(dev.dimension.flare.di.composeUiModule)
Original file line number Diff line number Diff line change 1+ import Foundation
2+ import KotlinSharedUI
3+
4+ class Formatter : SwiftFormatter {
5+ private init ( ) { }
6+
7+ static let shared = Formatter ( )
8+ nonisolated func formatNumber( number: Int64 ) -> String {
9+ return Int ( number)
10+ . formatted (
11+ . number
12+ . notation ( . compactName)
13+ . grouping ( . never)
14+ . precision ( . fractionLength( 0 ... 2 ) )
15+ )
16+ }
17+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ struct FlareApp: App {
88 configureAudioSessionForMixing ( )
99 ComposeUIHelper . shared. initialize (
1010 inAppNotification: SwiftInAppNotification . shared,
11+ swiftFormatter: Formatter . shared
1112 )
1213 }
1314 var body : some Scene {
Original file line number Diff line number Diff line change @@ -7,19 +7,9 @@ struct DateTimeText: View {
77
88 var body : some View {
99 if fullTime {
10- HStack {
11- Text ( data. platformValue, style: . date)
12- Text ( data. platformValue, style: . time)
13- }
10+ Text ( data. platformValue, style: . date) + Text( data. platformValue, style: . time)
1411 } else {
15- switch data. diff {
16- case . days: Text ( data. platformValue, style: . relative)
17- case . hours: Text ( data. platformValue, style: . relative)
18- case . minutes: Text ( data. platformValue, style: . relative)
19- case . seconds: Text ( data. platformValue, style: . relative)
20- case . monthDay: Text ( data. platformValue, style: . date)
21- case . yearMonthDay: Text ( data. platformValue, style: . date)
22- }
12+ Text ( data. platformValue, style: . relative)
2313 }
2414 }
2515}
You can’t perform that action at this time.
0 commit comments