mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-05-08 23:25:35 +02:00
32 lines
914 B
Swift
32 lines
914 B
Swift
import Foundation
|
|
|
|
public let FALLBACK_BASE_BUNDLE_ID: String = "app.swiftgram.ios"
|
|
|
|
public func sgBaseBundleIdentifier() -> String {
|
|
let baseBundleId: String
|
|
if let bundleId: String = Bundle.main.bundleIdentifier {
|
|
if Bundle.main.bundlePath.hasSuffix(".appex") {
|
|
if let lastDotRange: Range<String.Index> = bundleId.range(of: ".", options: [.backwards]) {
|
|
baseBundleId = String(bundleId[..<lastDotRange.lowerBound])
|
|
} else {
|
|
baseBundleId = FALLBACK_BASE_BUNDLE_ID
|
|
}
|
|
} else {
|
|
baseBundleId = bundleId
|
|
}
|
|
} else {
|
|
baseBundleId = FALLBACK_BASE_BUNDLE_ID
|
|
}
|
|
return baseBundleId
|
|
}
|
|
|
|
public func sgAppGroupIdentifier() -> String {
|
|
let result: String = "group.\(sgBaseBundleIdentifier())"
|
|
|
|
#if DEBUG
|
|
print("APP_GROUP_IDENTIFIER: \(result)")
|
|
#endif
|
|
|
|
return result
|
|
}
|