From c5a50fd203284ea8ee4fa21c99094c65890a7e72 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Wed, 27 Jul 2022 12:13:31 +0100 Subject: [PATCH] Stop using an ephemeral web browser session on SSO (#6464) Rename the bundle name to Element for the SSO alert. * Fix unit tests after bundle name change. * Update slather for bundle name change. --- .../xcshareddata/xcschemes/Riot.xcscheme | 40 ++++++++----------- Riot/Common.xcconfig | 4 +- .../SSO/SSOAuthentificationSession.swift | 11 +---- RiotTests/AnalyticsTests.swift | 2 +- RiotTests/EmojiServiceTests.swift | 2 +- RiotTests/EmojiStoreTests.swift | 2 +- RiotTests/EventMenuBuilderTests.swift | 2 +- RiotTests/HomeserverConfigurationTests.swift | 2 +- RiotTests/JitsiWellKnownTests.swift | 2 +- RiotTests/MarkdownToHTMLRendererTests.swift | 2 +- .../MXKRoomDataSourceTests.swift | 2 +- .../MatrixKitTests/UTI/MXKUTITests.swift | 2 +- .../AuthenticationServiceTests.swift | 2 +- .../Modules/Authentication/LoginTests.swift | 2 +- .../Mocks/MockAuthenticationRestClient.swift | 2 +- .../Mocks/MockSessionCreator.swift | 2 +- .../Authentication/RegistrationTests.swift | 2 +- .../RecentsDataSourceSectionsTests.swift | 2 +- .../UserIndicatorStoreTests.swift | 2 +- .../MXRoomAliasResolutionDeeplinkTests.swift | 2 +- RiotTests/OnboardingTests.swift | 2 +- RiotTests/PasswordValidatorTests.swift | 2 +- RiotTests/PillsFormatterTests.swift | 2 +- ...omNotificationSettingsViewModelTests.swift | 2 +- RiotTests/SessionCreatorTests.swift | 2 +- RiotTests/String+Element.swift | 2 +- RiotTests/URLPreviewStoreTests.swift | 2 +- RiotTests/URLValidatorTests.swift | 2 +- RiotTests/UniversalLinkTests.swift | 2 +- ...nteractiveAuthenticationServiceTests.swift | 2 +- RiotTests/VectorWellKnownTests.swift | 2 +- RiotTests/target.yml | 2 +- changelog.d/6462.api | 1 + changelog.d/6462.bugfix | 1 + 34 files changed, 51 insertions(+), 64 deletions(-) create mode 100644 changelog.d/6462.api create mode 100644 changelog.d/6462.bugfix diff --git a/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme b/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme index f973b344c..4e299eba2 100644 --- a/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme +++ b/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme @@ -1,11 +1,10 @@ + version = "1.3"> + buildImplicitDependencies = "YES"> @@ -27,9 +26,17 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - onlyGenerateCoverageForSpecifiedTargets = "NO" shouldUseLaunchSchemeArgsEnv = "YES" disableMainThreadChecker = "YES"> + + + + @@ -42,41 +49,28 @@ - - - - - - + allowLocationSimulation = "YES"> - - - - diff --git a/Riot/Common.xcconfig b/Riot/Common.xcconfig index b25a82689..6ecbeae9b 100644 --- a/Riot/Common.xcconfig +++ b/Riot/Common.xcconfig @@ -20,7 +20,7 @@ #include "Config/AppIdentifiers.xcconfig" #include "Config/AppVersion.xcconfig" -PRODUCT_NAME = Riot +PRODUCT_NAME = Element PRODUCT_BUNDLE_IDENTIFIER = $(BASE_BUNDLE_IDENTIFIER) INFOPLIST_FILE = Riot/SupportingFiles/Info.plist @@ -28,7 +28,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon CODE_SIGN_ENTITLEMENTS = Riot/SupportingFiles/Riot.entitlements -SWIFT_OBJC_BRIDGING_HEADER = $(SRCROOT)/$(PRODUCT_NAME)/SupportingFiles/Riot-Bridging-Header.h +SWIFT_OBJC_BRIDGING_HEADER = $(SRCROOT)/Riot/SupportingFiles/Riot-Bridging-Header.h LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks SWIFT_OBJC_INTERFACE_HEADER_NAME = GeneratedInterface-Swift.h diff --git a/Riot/Modules/Authentication/SSO/SSOAuthentificationSession.swift b/Riot/Modules/Authentication/SSO/SSOAuthentificationSession.swift index fa595fc15..e0b6d37dd 100644 --- a/Riot/Modules/Authentication/SSO/SSOAuthentificationSession.swift +++ b/Riot/Modules/Authentication/SSO/SSOAuthentificationSession.swift @@ -64,18 +64,11 @@ final class SSOAuthentificationSession: SSOAuthentificationSessionProtocol { completionHandler(callbackURL, finalError) } - - // Ask the browser for a private authentication session - if #available(iOS 13.0, *) { - authentificationSession.prefersEphemeralWebBrowserSession = true - } self.authentificationSession = authentificationSession - if #available(iOS 13.0, *) { - if let asWebContextProvider = contextProvider as? ASWebAuthenticationPresentationContextProviding { - authentificationSession.presentationContextProvider = asWebContextProvider - } + if let asWebContextProvider = contextProvider as? ASWebAuthenticationPresentationContextProviding { + authentificationSession.presentationContextProvider = asWebContextProvider } authentificationSession.start() diff --git a/RiotTests/AnalyticsTests.swift b/RiotTests/AnalyticsTests.swift index f5abbeb7f..ac66e3bc4 100644 --- a/RiotTests/AnalyticsTests.swift +++ b/RiotTests/AnalyticsTests.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element import AnalyticsEvents class AnalyticsTests: XCTestCase { diff --git a/RiotTests/EmojiServiceTests.swift b/RiotTests/EmojiServiceTests.swift index c43a6960e..63f9316df 100644 --- a/RiotTests/EmojiServiceTests.swift +++ b/RiotTests/EmojiServiceTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element class EmojiServiceTests: XCTestCase { diff --git a/RiotTests/EmojiStoreTests.swift b/RiotTests/EmojiStoreTests.swift index 99b47db47..0fb03fc79 100644 --- a/RiotTests/EmojiStoreTests.swift +++ b/RiotTests/EmojiStoreTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element class EmojiStoreTests: XCTestCase { diff --git a/RiotTests/EventMenuBuilderTests.swift b/RiotTests/EventMenuBuilderTests.swift index 783f6ef87..07cbdaf2e 100644 --- a/RiotTests/EventMenuBuilderTests.swift +++ b/RiotTests/EventMenuBuilderTests.swift @@ -16,7 +16,7 @@ import XCTest import UIKit -@testable import Riot +@testable import Element class EventMenuBuilderTests: XCTestCase { diff --git a/RiotTests/HomeserverConfigurationTests.swift b/RiotTests/HomeserverConfigurationTests.swift index 24cc50cd7..310748cbf 100644 --- a/RiotTests/HomeserverConfigurationTests.swift +++ b/RiotTests/HomeserverConfigurationTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element class HomeserverConfigurationTests: XCTestCase { diff --git a/RiotTests/JitsiWellKnownTests.swift b/RiotTests/JitsiWellKnownTests.swift index 1d32effa3..790b00a02 100644 --- a/RiotTests/JitsiWellKnownTests.swift +++ b/RiotTests/JitsiWellKnownTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element class JitsiWellKnownTests: XCTestCase { diff --git a/RiotTests/MarkdownToHTMLRendererTests.swift b/RiotTests/MarkdownToHTMLRendererTests.swift index 496308b4a..58626c1e3 100644 --- a/RiotTests/MarkdownToHTMLRendererTests.swift +++ b/RiotTests/MarkdownToHTMLRendererTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element final class MarkdownToHTMLRendererTests: XCTestCase { // MARK: - Tests diff --git a/RiotTests/MatrixKitTests/MXKRoomDataSourceTests.swift b/RiotTests/MatrixKitTests/MXKRoomDataSourceTests.swift index 1101c9ff1..ce8a3d44e 100644 --- a/RiotTests/MatrixKitTests/MXKRoomDataSourceTests.swift +++ b/RiotTests/MatrixKitTests/MXKRoomDataSourceTests.swift @@ -17,7 +17,7 @@ import Foundation import XCTest -@testable import Riot +@testable import Element class MXKRoomDataSourceTests: XCTestCase { diff --git a/RiotTests/MatrixKitTests/UTI/MXKUTITests.swift b/RiotTests/MatrixKitTests/UTI/MXKUTITests.swift index fc9d053b2..3c1dd90cb 100644 --- a/RiotTests/MatrixKitTests/UTI/MXKUTITests.swift +++ b/RiotTests/MatrixKitTests/UTI/MXKUTITests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element import MobileCoreServices diff --git a/RiotTests/Modules/Authentication/AuthenticationServiceTests.swift b/RiotTests/Modules/Authentication/AuthenticationServiceTests.swift index bf979b81f..ef983c792 100644 --- a/RiotTests/Modules/Authentication/AuthenticationServiceTests.swift +++ b/RiotTests/Modules/Authentication/AuthenticationServiceTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element @MainActor class AuthenticationServiceTests: XCTestCase { var service: AuthenticationService! diff --git a/RiotTests/Modules/Authentication/LoginTests.swift b/RiotTests/Modules/Authentication/LoginTests.swift index e659ac5d9..1c99af5ef 100644 --- a/RiotTests/Modules/Authentication/LoginTests.swift +++ b/RiotTests/Modules/Authentication/LoginTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element class LoginTests: XCTestCase { func testUserParameterIdentifier() { diff --git a/RiotTests/Modules/Authentication/Mocks/MockAuthenticationRestClient.swift b/RiotTests/Modules/Authentication/Mocks/MockAuthenticationRestClient.swift index ff3c4e6af..3dff46b7b 100644 --- a/RiotTests/Modules/Authentication/Mocks/MockAuthenticationRestClient.swift +++ b/RiotTests/Modules/Authentication/Mocks/MockAuthenticationRestClient.swift @@ -16,7 +16,7 @@ import Foundation -@testable import Riot +@testable import Element /// A mock REST client that can be used for authentication. class MockAuthenticationRestClient: AuthenticationRestClient { diff --git a/RiotTests/Modules/Authentication/Mocks/MockSessionCreator.swift b/RiotTests/Modules/Authentication/Mocks/MockSessionCreator.swift index 699d7f86b..e62578d37 100644 --- a/RiotTests/Modules/Authentication/Mocks/MockSessionCreator.swift +++ b/RiotTests/Modules/Authentication/Mocks/MockSessionCreator.swift @@ -16,7 +16,7 @@ import Foundation -@testable import Riot +@testable import Element struct MockSessionCreator: SessionCreatorProtocol { /// Returns a basic session created from the supplied credentials. This prevents the app from setting up the account during tests. diff --git a/RiotTests/Modules/Authentication/RegistrationTests.swift b/RiotTests/Modules/Authentication/RegistrationTests.swift index b2499240f..3ac2a8b8f 100644 --- a/RiotTests/Modules/Authentication/RegistrationTests.swift +++ b/RiotTests/Modules/Authentication/RegistrationTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element class RegistrationTests: XCTestCase { /// Makes an authentication session that mimics the matrix.org flow. diff --git a/RiotTests/Modules/Common/Recents/DataSources/RecentsDataSourceSectionsTests.swift b/RiotTests/Modules/Common/Recents/DataSources/RecentsDataSourceSectionsTests.swift index 489548f92..2e8d122e7 100644 --- a/RiotTests/Modules/Common/Recents/DataSources/RecentsDataSourceSectionsTests.swift +++ b/RiotTests/Modules/Common/Recents/DataSources/RecentsDataSourceSectionsTests.swift @@ -16,7 +16,7 @@ import Foundation import XCTest -@testable import Riot +@testable import Element class RecentsDataSourceSectionsTests: XCTestCase { func test_canCreateWithNSNumbers() { diff --git a/RiotTests/Modules/Common/UserIndicators/UserIndicatorStoreTests.swift b/RiotTests/Modules/Common/UserIndicators/UserIndicatorStoreTests.swift index abbe31a1b..79b2cce92 100644 --- a/RiotTests/Modules/Common/UserIndicators/UserIndicatorStoreTests.swift +++ b/RiotTests/Modules/Common/UserIndicators/UserIndicatorStoreTests.swift @@ -17,7 +17,7 @@ import Foundation import XCTest @testable import CommonKit -@testable import Riot +@testable import Element import MatrixSDK class UserIndicatorStoreTests: XCTestCase { diff --git a/RiotTests/Modules/DeepLink/MXRoomAliasResolutionDeeplinkTests.swift b/RiotTests/Modules/DeepLink/MXRoomAliasResolutionDeeplinkTests.swift index c465dad67..27116d070 100644 --- a/RiotTests/Modules/DeepLink/MXRoomAliasResolutionDeeplinkTests.swift +++ b/RiotTests/Modules/DeepLink/MXRoomAliasResolutionDeeplinkTests.swift @@ -16,7 +16,7 @@ import Foundation import XCTest -@testable import Riot +@testable import Element class MXRoomAliasResolutionDeeplinkTests: XCTestCase { func test_fragmentIsNilForInvalidResolution() { diff --git a/RiotTests/OnboardingTests.swift b/RiotTests/OnboardingTests.swift index 8597a174f..b7cb025c7 100644 --- a/RiotTests/OnboardingTests.swift +++ b/RiotTests/OnboardingTests.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element class OnboardingTests: XCTestCase { diff --git a/RiotTests/PasswordValidatorTests.swift b/RiotTests/PasswordValidatorTests.swift index f48af6e2a..293d049f7 100644 --- a/RiotTests/PasswordValidatorTests.swift +++ b/RiotTests/PasswordValidatorTests.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element class PasswordValidatorTests: XCTestCase { diff --git a/RiotTests/PillsFormatterTests.swift b/RiotTests/PillsFormatterTests.swift index 3b5d2a83c..edc18a70b 100644 --- a/RiotTests/PillsFormatterTests.swift +++ b/RiotTests/PillsFormatterTests.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element // MARK: - Inputs private enum Inputs { diff --git a/RiotTests/RoomNotificationSettingsViewModelTests.swift b/RiotTests/RoomNotificationSettingsViewModelTests.swift index 2d39b81ca..3bea3a097 100644 --- a/RiotTests/RoomNotificationSettingsViewModelTests.swift +++ b/RiotTests/RoomNotificationSettingsViewModelTests.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element class MockRoomNotificationSettingsView: RoomNotificationSettingsViewModelViewDelegate { diff --git a/RiotTests/SessionCreatorTests.swift b/RiotTests/SessionCreatorTests.swift index c26bfafbe..f2003545e 100644 --- a/RiotTests/SessionCreatorTests.swift +++ b/RiotTests/SessionCreatorTests.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element class SessionCreatorTests: XCTestCase { diff --git a/RiotTests/String+Element.swift b/RiotTests/String+Element.swift index ec6676b4d..fdf45f44c 100644 --- a/RiotTests/String+Element.swift +++ b/RiotTests/String+Element.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element class String_Element: XCTestCase { diff --git a/RiotTests/URLPreviewStoreTests.swift b/RiotTests/URLPreviewStoreTests.swift index a995aa1c6..9d5f3ee26 100644 --- a/RiotTests/URLPreviewStoreTests.swift +++ b/RiotTests/URLPreviewStoreTests.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element class URLPreviewStoreTests: XCTestCase { var store: URLPreviewStore! diff --git a/RiotTests/URLValidatorTests.swift b/RiotTests/URLValidatorTests.swift index f15da0d97..138303578 100644 --- a/RiotTests/URLValidatorTests.swift +++ b/RiotTests/URLValidatorTests.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element class URLValidatorTests: XCTestCase { diff --git a/RiotTests/UniversalLinkTests.swift b/RiotTests/UniversalLinkTests.swift index 3f856046a..011c3aa2b 100644 --- a/RiotTests/UniversalLinkTests.swift +++ b/RiotTests/UniversalLinkTests.swift @@ -15,7 +15,7 @@ // import XCTest -@testable import Riot +@testable import Element class UniversalLinkTests: XCTestCase { diff --git a/RiotTests/UserInteractiveAuthenticationServiceTests.swift b/RiotTests/UserInteractiveAuthenticationServiceTests.swift index 223a2bfb4..99014fc19 100644 --- a/RiotTests/UserInteractiveAuthenticationServiceTests.swift +++ b/RiotTests/UserInteractiveAuthenticationServiceTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element class UserInteractiveAuthenticationServiceTests: XCTestCase { diff --git a/RiotTests/VectorWellKnownTests.swift b/RiotTests/VectorWellKnownTests.swift index d27ebf020..9b98189dc 100644 --- a/RiotTests/VectorWellKnownTests.swift +++ b/RiotTests/VectorWellKnownTests.swift @@ -16,7 +16,7 @@ import XCTest -@testable import Riot +@testable import Element class VectorWellKnownTests: XCTestCase { diff --git a/RiotTests/target.yml b/RiotTests/target.yml index 089ce208f..990253346 100644 --- a/RiotTests/target.yml +++ b/RiotTests/target.yml @@ -46,7 +46,7 @@ targets: PRODUCT_BUNDLE_IDENTIFIER: org.matrix.$(PRODUCT_NAME:rfc1034identifier) PRODUCT_NAME: RiotTests SWIFT_OBJC_BRIDGING_HEADER: RiotTests/RiotTests-Bridging-Header.h - TEST_HOST: $(BUILT_PRODUCTS_DIR)/Riot.app/Riot + TEST_HOST: $(BUILT_PRODUCTS_DIR)/Element.app/Element configs: Debug: Release: diff --git a/changelog.d/6462.api b/changelog.d/6462.api new file mode 100644 index 000000000..2a15141cf --- /dev/null +++ b/changelog.d/6462.api @@ -0,0 +1 @@ +Update the app's bundle name to show Element during SSO. diff --git a/changelog.d/6462.bugfix b/changelog.d/6462.bugfix new file mode 100644 index 000000000..f005fe225 --- /dev/null +++ b/changelog.d/6462.bugfix @@ -0,0 +1 @@ +Stop using an ephemeral web browser session for SSO authentication.