mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-08-16 11:00:22 +02:00
Update Ghostgram features
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "SGAppGroupIdentifier",
|
||||
module_name = "SGAppGroupIdentifier",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
copts = [
|
||||
"-warnings-as-errors",
|
||||
],
|
||||
deps = [
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,31 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user