diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index b3a2b5a1f..0e91df701 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ @@ -762,12 +762,12 @@ 892E29C98C4E8182C9037F84 /* TimelineStyler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStyler.swift; sourceTree = ""; }; 8A9AE4967817E9608E22EB44 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = ""; }; 8AC1A01C3A745BDF1D3697D3 /* SessionVerificationScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionVerificationScreen.swift; sourceTree = ""; }; - 8B9A55AC2FB0FE0AEAA3DF1F /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; + 8B9A55AC2FB0FE0AEAA3DF1F /* LICENSE */ = {isa = PBXFileReference; path = LICENSE; sourceTree = ""; }; 8C0AA893D6F8A2F563E01BB9 /* in */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = in; path = in.lproj/Localizable.stringsdict; sourceTree = ""; }; 8D6094DEAAEB388E1AE118C6 /* MockRoomTimelineProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockRoomTimelineProvider.swift; sourceTree = ""; }; 8D8169443E5AC5FF71BFB3DB /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = ""; }; 8DC2C9E0E15C79BBDA80F0A2 /* TimelineStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStyle.swift; sourceTree = ""; }; - 8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UITests.xctestplan; sourceTree = ""; }; + 8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; path = UITests.xctestplan; sourceTree = ""; }; 8ED2D2F6A137A95EA50413BE /* UserNotificationControllerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserNotificationControllerProtocol.swift; sourceTree = ""; }; 8F7D42E66E939B709C1EC390 /* MockRoomSummaryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockRoomSummaryProvider.swift; sourceTree = ""; }; 8FC803282F9268D49F4ABF14 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; @@ -962,7 +962,7 @@ EBE5502760CF6CA2D7201883 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ja; path = ja.lproj/Localizable.stringsdict; sourceTree = ""; }; ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenRoomCell.swift; sourceTree = ""; }; ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = ""; }; - ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = message.caf; sourceTree = ""; }; + ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; path = message.caf; sourceTree = ""; }; EDAA4472821985BF868CC21C /* ServerSelectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionViewModelTests.swift; sourceTree = ""; }; EDB6E40BAD4504D899FAAC9A /* TemplateViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateViewModel.swift; sourceTree = ""; }; EE8BCD14EFED23459A43FDFF /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; @@ -3445,6 +3445,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; + KEYCHAIN_ACCESS_GROUP_IDENTIFIER = "$(AppIdentifierPrefix)$(BASE_BUNDLE_IDENTIFIER)"; MACOSX_DEPLOYMENT_TARGET = 13.0; MARKETING_VERSION = 1.0.9; MTL_ENABLE_DEBUG_INFO = NO; @@ -3516,6 +3517,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; + KEYCHAIN_ACCESS_GROUP_IDENTIFIER = "$(AppIdentifierPrefix)$(BASE_BUNDLE_IDENTIFIER)"; MACOSX_DEPLOYMENT_TARGET = 13.0; MARKETING_VERSION = 1.0.9; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; diff --git a/ElementX/Sources/Other/InfoPlistReader.swift b/ElementX/Sources/Other/InfoPlistReader.swift index 616bf42e7..9a73c1452 100644 --- a/ElementX/Sources/Other/InfoPlistReader.swift +++ b/ElementX/Sources/Other/InfoPlistReader.swift @@ -20,6 +20,7 @@ struct InfoPlistReader { private enum Keys { static let appGroupIdentifier = "appGroupIdentifier" static let baseBundleIdentifier = "baseBundleIdentifier" + static let keychainAccessGroupIdentifier = "keychainAccessGroupIdentifier" static let bundleShortVersion = "CFBundleShortVersionString" static let bundleDisplayName = "CFBundleDisplayName" } @@ -44,6 +45,11 @@ struct InfoPlistReader { var baseBundleIdentifier: String { infoPlistStringValue(forKey: Keys.baseBundleIdentifier) } + + /// Keychain access group identifier set in Info.plist of the target + var keychainAccessGroupIdentifier: String { + infoPlistStringValue(forKey: Keys.keychainAccessGroupIdentifier) + } /// Bundle executable of the target var bundleExecutable: String { diff --git a/ElementX/Sources/Services/UserSession/UserSessionStore.swift b/ElementX/Sources/Services/UserSession/UserSessionStore.swift index a099ab509..3f9f3d7b7 100644 --- a/ElementX/Sources/Services/UserSession/UserSessionStore.swift +++ b/ElementX/Sources/Services/UserSession/UserSessionStore.swift @@ -30,7 +30,7 @@ class UserSessionStore: UserSessionStoreProtocol { init(backgroundTaskService: BackgroundTaskServiceProtocol) { keychainController = KeychainController(service: .sessions, - accessGroup: InfoPlistReader.target.appGroupIdentifier) + accessGroup: InfoPlistReader.target.keychainAccessGroupIdentifier) self.backgroundTaskService = backgroundTaskService baseDirectory = .sessionsBaseDirectory MXLog.debug("Setup base directory at: \(baseDirectory)") diff --git a/ElementX/SupportingFiles/ElementX.entitlements b/ElementX/SupportingFiles/ElementX.entitlements index 641b4256d..b8687301e 100644 --- a/ElementX/SupportingFiles/ElementX.entitlements +++ b/ElementX/SupportingFiles/ElementX.entitlements @@ -14,5 +14,9 @@ com.apple.security.network.client + keychain-access-groups + + $(AppIdentifierPrefix)$(BASE_BUNDLE_IDENTIFIER) + diff --git a/ElementX/SupportingFiles/Info.plist b/ElementX/SupportingFiles/Info.plist index 02d3abf79..a7b84056f 100644 --- a/ElementX/SupportingFiles/Info.plist +++ b/ElementX/SupportingFiles/Info.plist @@ -39,5 +39,7 @@ $(APP_GROUP_IDENTIFIER) baseBundleIdentifier $(BASE_BUNDLE_IDENTIFIER) + keychainAccessGroupIdentifier + $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) diff --git a/ElementX/SupportingFiles/target.yml b/ElementX/SupportingFiles/target.yml index 5c086822b..2af5800c7 100644 --- a/ElementX/SupportingFiles/target.yml +++ b/ElementX/SupportingFiles/target.yml @@ -54,6 +54,7 @@ targets: ] appGroupIdentifier: $(APP_GROUP_IDENTIFIER) baseBundleIdentifier: $(BASE_BUNDLE_IDENTIFIER) + keychainAccessGroupIdentifier: $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) ITSAppUsesNonExemptEncryption: false NSUserActivityTypes: [ INSendMessageIntent diff --git a/NSE/Sources/NotificationServiceExtension.swift b/NSE/Sources/NotificationServiceExtension.swift index cf7a28be2..689e38f44 100644 --- a/NSE/Sources/NotificationServiceExtension.swift +++ b/NSE/Sources/NotificationServiceExtension.swift @@ -20,7 +20,7 @@ import UserNotifications class NotificationServiceExtension: UNNotificationServiceExtension { private lazy var keychainController = KeychainController(service: .sessions, - accessGroup: InfoPlistReader.target.appGroupIdentifier) + accessGroup: InfoPlistReader.target.keychainAccessGroupIdentifier) var handler: ((UNNotificationContent) -> Void)? var modifiedContent: UNMutableNotificationContent? diff --git a/NSE/SupportingFiles/Info.plist b/NSE/SupportingFiles/Info.plist index 66e371933..48adae1ec 100644 --- a/NSE/SupportingFiles/Info.plist +++ b/NSE/SupportingFiles/Info.plist @@ -31,5 +31,7 @@ $(APP_GROUP_IDENTIFIER) baseBundleIdentifier $(BASE_BUNDLE_IDENTIFIER) + keychainAccessGroupIdentifier + $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) diff --git a/NSE/SupportingFiles/NSE.entitlements b/NSE/SupportingFiles/NSE.entitlements index d18babef6..b0c64e349 100644 --- a/NSE/SupportingFiles/NSE.entitlements +++ b/NSE/SupportingFiles/NSE.entitlements @@ -8,5 +8,9 @@ $(APP_GROUP_IDENTIFIER) + keychain-access-groups + + $(AppIdentifierPrefix)$(BASE_BUNDLE_IDENTIFIER) + diff --git a/NSE/SupportingFiles/target.yml b/NSE/SupportingFiles/target.yml index 1bb7dda40..5a81f4749 100644 --- a/NSE/SupportingFiles/target.yml +++ b/NSE/SupportingFiles/target.yml @@ -45,6 +45,7 @@ targets: CFBundleVersion: $(CURRENT_PROJECT_VERSION) appGroupIdentifier: $(APP_GROUP_IDENTIFIER) baseBundleIdentifier: $(BASE_BUNDLE_IDENTIFIER) + keychainAccessGroupIdentifier: $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER) NSExtension: NSExtensionPointIdentifier: com.apple.usernotifications.service NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).NotificationServiceExtension diff --git a/UnitTests/Sources/KeychainControllerTests.swift b/UnitTests/Sources/KeychainControllerTests.swift index a40faf698..8197964d5 100644 --- a/UnitTests/Sources/KeychainControllerTests.swift +++ b/UnitTests/Sources/KeychainControllerTests.swift @@ -22,7 +22,7 @@ class KeychainControllerTests: XCTestCase { override func setUp() { keychain = KeychainController(service: .tests, - accessGroup: InfoPlistReader.target.appGroupIdentifier) + accessGroup: InfoPlistReader.target.keychainAccessGroupIdentifier) keychain.removeAllRestorationTokens() } diff --git a/changelog.d/pr-354.bugfix b/changelog.d/pr-354.bugfix new file mode 100644 index 000000000..660879605 --- /dev/null +++ b/changelog.d/pr-354.bugfix @@ -0,0 +1 @@ +Fix a bug where the access token wasn't stored on macOS (Designed for iPad). \ No newline at end of file diff --git a/project.yml b/project.yml index 4b284fe72..5f6132c5f 100644 --- a/project.yml +++ b/project.yml @@ -25,6 +25,7 @@ settings: BASE_APP_GROUP_IDENTIFIER: io.element APP_GROUP_IDENTIFIER: group.$(BASE_APP_GROUP_IDENTIFIER) BASE_BUNDLE_IDENTIFIER: io.element.elementx + KEYCHAIN_ACCESS_GROUP_IDENTIFIER: $(AppIdentifierPrefix)$(BASE_BUNDLE_IDENTIFIER) MARKETING_VERSION: 1.0.9 CURRENT_PROJECT_VERSION: 1 DEVELOPMENT_TEAM: 7J4U792NQT