From 6186b5bf0a9fce2a9e4244d752c0149dfa7b71b9 Mon Sep 17 00:00:00 2001 From: tatthangcntt Date: Wed, 5 Jun 2024 09:49:35 +0700 Subject: [PATCH] Fix issue: Repeat to create LPC connect/disconnect --- ios/BrekekeLPC/Settings/SettingsManager.swift | 7 +- .../BrekekeLPCExtension.entitlements | 25 ++++--- ios/BrekekePhone/BrekekePhone.entitlements | 69 +++++++++---------- 3 files changed, 52 insertions(+), 49 deletions(-) diff --git a/ios/BrekekeLPC/Settings/SettingsManager.swift b/ios/BrekekeLPC/Settings/SettingsManager.swift index 630884f44..d40319c01 100644 --- a/ios/BrekekeLPC/Settings/SettingsManager.swift +++ b/ios/BrekekeLPC/Settings/SettingsManager.swift @@ -18,8 +18,11 @@ class SettingsManager: NSObject { .eraseToAnyPublisher() private let settingsWillWriteSubject = PassthroughSubject() private static let settingsKey = "settings" + static var appGroupName = Settings + .bundleIdentifier == "com.brekeke.phonedev" ? "group.com.brekeke.lpcdev" : + "group.com.brekeke.lpc" private static let userDefaults = - UserDefaults(suiteName: "group.com.brekeke.lpc")! + UserDefaults(suiteName: appGroupName)! private let settingsSubject: CurrentValueSubject private static let logger = Logger( prependString: "SettingsManager", @@ -29,6 +32,8 @@ class SettingsManager: NSObject { override init() { var settings = Self.fetch() SettingsManager.logger.log("settings init(): \(settings)") + SettingsManager.logger + .log("settings init()::appGroupName:: \(SettingsManager.appGroupName)") if settings == nil { settings = Settings( token: "", diff --git a/ios/BrekekeLPCExtension/BrekekeLPCExtension.entitlements b/ios/BrekekeLPCExtension/BrekekeLPCExtension.entitlements index d1ecc84d7..275143f4c 100644 --- a/ios/BrekekeLPCExtension/BrekekeLPCExtension.entitlements +++ b/ios/BrekekeLPCExtension/BrekekeLPCExtension.entitlements @@ -1,15 +1,14 @@ - - + + - - com.apple.developer.networking.networkextension - - app-push-provider - - com.apple.security.application-groups - - group.com.brekeke.lpc - - + + com.apple.developer.networking.networkextension + + app-push-provider + + com.apple.security.application-groups + + group.com.brekeke.lpcdev + + diff --git a/ios/BrekekePhone/BrekekePhone.entitlements b/ios/BrekekePhone/BrekekePhone.entitlements index 69ad167f5..f443457ca 100644 --- a/ios/BrekekePhone/BrekekePhone.entitlements +++ b/ios/BrekekePhone/BrekekePhone.entitlements @@ -1,37 +1,36 @@ - - + + - - aps-environment - production - com.apple.developer.icloud-container-identifiers - - iCloud.$(CFBundleIdentifier) - - com.apple.developer.icloud-services - - CloudDocuments - - com.apple.developer.networking.networkextension - - app-push-provider - - com.apple.developer.networking.wifi-info - - com.apple.developer.ubiquity-container-identifiers - - iCloud.$(CFBundleIdentifier) - - com.apple.developer.ubiquity-kvstore-identifier - $(TeamIdentifierPrefix)$(CFBundleIdentifier) - com.apple.security.application-groups - - group.com.brekeke.lpc - - keychain-access-groups - - $(AppIdentifierPrefix)com.brekeke.phonedev - - + + aps-environment + production + com.apple.developer.icloud-container-identifiers + + iCloud.$(CFBundleIdentifier) + + com.apple.developer.icloud-services + + CloudDocuments + + com.apple.developer.networking.networkextension + + app-push-provider + + com.apple.developer.networking.wifi-info + + com.apple.developer.ubiquity-container-identifiers + + iCloud.$(CFBundleIdentifier) + + com.apple.developer.ubiquity-kvstore-identifier + $(TeamIdentifierPrefix)$(CFBundleIdentifier) + com.apple.security.application-groups + + group.com.brekeke.lpcdev + + keychain-access-groups + + $(AppIdentifierPrefix)com.brekeke.phonedev + +