Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ios/RNAptabaseModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ import Foundation

@objc(RNAptabaseModule)
class RNAptabaseModule: NSObject {

@objc
func constantsToExport() -> [AnyHashable : Any]! {
return [
"appVersion": Bundle.main.infoDictionary?["CFBundleShortVersionString"] as Any,
"appBuildNumber": Bundle.main.infoDictionary?["CFBundleVersion"] as Any
]
"appBuildNumber": Bundle.main.infoDictionary?["CFBundleVersion"] as Any,
"isiOSAppOnMac": {
if #available(iOS 14.0, *) {
return ProcessInfo.processInfo.isiOSAppOnMac
} else {
return false
}
}()
]
}

@objc
Expand Down
4 changes: 4 additions & 0 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ function getOperatingSystem(): [string, string] {
return ["Android", Platform.constants.Release];
case "ios":
if (Platform.isPad) {
if (version.isiOSAppOnMac) {
// Version represents the emulated iPadOS version and not the MacOS version
return ["MacOS", Platform.Version];
}
return ["iPadOS", Platform.Version];
}
return ["iOS", Platform.Version];
Expand Down
2 changes: 2 additions & 0 deletions src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ const { RNAptabaseModule } = NativeModules;
type VersionObject = {
appVersion: string;
appBuildNumber: string;
isiOSAppOnMac: boolean;
};

const Version: VersionObject = {
appVersion: RNAptabaseModule?.appVersion?.toString() ?? "",
appBuildNumber: RNAptabaseModule?.appBuildNumber?.toString() ?? "",
isiOSAppOnMac: RNAptabaseModule?.isiOSAppOnMac ?? false,
};

export default Version;