Skip to content

Commit

Permalink
Fix iOS build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
steviek committed Mar 1, 2024
1 parent 803f1bd commit 4f70350
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion iosApp/iosApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>x`
<string>2.1</string>
<key>CFBundleVersion</key>
<string>6</string>
<key>CFBundleLocalizations</key>
Expand Down
1 change: 1 addition & 0 deletions iosApp/widget/FetchResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ import ComposeApp

struct FetchResult {
let data: WidgetData?
let hadInternet: Bool
let hasError: Bool
}
6 changes: 6 additions & 0 deletions iosApp/widget/Interop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ extension Bool {
}
}

extension KotlinBoolean {
func toBool() -> Bool {
self.boolValue
}
}

extension ColorWrapper {
func toColor(isDark: Bool) -> SwiftUI.Color {
let adjusted = adjustForDarkMode(isDark: isDark)
Expand Down
16 changes: 11 additions & 5 deletions iosApp/widget/WidgetInterop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,24 @@ extension WidgetDataFetcher {
stations: stations,
sort: sort,
filter: filter,
force: false,
force: false,
includeClosestStation: false,
onSuccess: { data in
continuation.resume(returning: FetchResult(data: data, hasError: false))
continuation.resume(returning: FetchResult(data: data, hadInternet: true, hasError: false))
},
onFailure: { (e, data) in
continuation.resume(returning: FetchResult(data: data, hasError: true))
onFailure: { (e, hadInternet, data) in
continuation.resume(
returning: FetchResult(
data: data,
hadInternet: hadInternet.toBool(),
hasError: true
)
)
}
)
}
} catch {
return FetchResult(data: nil, hasError: true)
return FetchResult(data: nil, hadInternet: true, hasError: true)
}

}
Expand Down

0 comments on commit 4f70350

Please sign in to comment.