diff --git a/DemoApp/Info.plist b/DemoApp/Info.plist index 0e167794f..32c02b2e5 100644 --- a/DemoApp/Info.plist +++ b/DemoApp/Info.plist @@ -40,17 +40,25 @@ CFBundleTypeRole Editor CFBundleURLName - com.googleusercontent.apps.347024607410-48j4atipav0tcr4pesap4elr1u9t11uh + $(GOOGLE_CLIENT_ID) CFBundleURLSchemes - com.googleusercontent.apps.347024607410-48j4atipav0tcr4pesap4elr1u9t11uh + $(GOOGLE_CLIENT_ID) + + + + CFBundleTypeRole + Editor + CFBundleURLName + $(REVERSED_GOOGLE_CLIENT_ID) + CFBundleURLSchemes + + $(REVERSED_GOOGLE_CLIENT_ID) CFBundleVersion 1 - GIDClientID - com.googleusercontent.apps.347024607410-48j4atipav0tcr4pesap4elr1u9t11uh ITSAppUsesNonExemptEncryption NSAppTransportSecurity diff --git a/DemoApp/Resources/GoogleSignIn.plist b/DemoApp/Resources/GoogleSignIn.plist index dc4978b57..5117c3f48 100644 --- a/DemoApp/Resources/GoogleSignIn.plist +++ b/DemoApp/Resources/GoogleSignIn.plist @@ -3,9 +3,9 @@ CLIENT_ID - 347024607410-48j4atipav0tcr4pesap4elr1u9t11uh.apps.googleusercontent.com + $(GOOGLE_CLIENT_ID) REVERSED_CLIENT_ID - com.googleusercontent.apps.347024607410-48j4atipav0tcr4pesap4elr1u9t11uh + $(REVERSED_GOOGLE_CLIENT_ID) PLIST_VERSION 1 BUNDLE_ID diff --git a/DemoApp/Sources/Components/AppEnvironment.swift b/DemoApp/Sources/Components/AppEnvironment.swift index ab008dc16..f30a415d3 100644 --- a/DemoApp/Sources/Components/AppEnvironment.swift +++ b/DemoApp/Sources/Components/AppEnvironment.swift @@ -61,10 +61,6 @@ extension AppEnvironment { return .production } }() - - static var googleClientId: String = { - return "347024607410-48j4atipav0tcr4pesap4elr1u9t11uh.apps.googleusercontent.com" - }() } extension AppEnvironment { @@ -115,6 +111,8 @@ extension AppEnvironment { enum Variable: String { case JWTExpiration = "JWT_EXPIRATION" + case googleClientId = "GOOGLE_CLIENT_ID" + case googleReversedClientId = "REVERSED_GOOGLE_CLIENT_ID" } static func contains(_ argument: Argument) -> Bool { diff --git a/DemoApp/Sources/DemoApp.swift b/DemoApp/Sources/DemoApp.swift index 45f2d5535..1ad39bcb1 100644 --- a/DemoApp/Sources/DemoApp.swift +++ b/DemoApp/Sources/DemoApp.swift @@ -17,8 +17,6 @@ struct DemoApp: App { @StateObject var appState: AppState private let router: Router - - lazy var signInConfig = GIDConfiguration(clientID: AppEnvironment.googleClientId) // MARK: - Lifecycle diff --git a/DemoApp/Sources/Views/Login/GoogleHelper.swift b/DemoApp/Sources/Views/Login/GoogleHelper.swift index d8e43746d..7b7427505 100644 --- a/DemoApp/Sources/Views/Login/GoogleHelper.swift +++ b/DemoApp/Sources/Views/Login/GoogleHelper.swift @@ -17,11 +17,14 @@ enum GoogleHelper { private static let directoryScope = "https://www.googleapis.com/auth/directory.readonly" static func signIn() async throws -> UserCredentials { - guard let rootViewController = UIApplication.shared.windows.first?.rootViewController else { + guard + let rootViewController = UIApplication.shared.windows.first?.rootViewController, + let clientId = AppEnvironment.value(for: .googleClientId) + else { throw ClientError.Unexpected("No view controller available") } - let config = GIDConfiguration(clientID: AppEnvironment.googleClientId) + let config = GIDConfiguration(clientID: clientId) return try await withCheckedThrowingContinuation { continuation in GIDSignIn.sharedInstance.signIn(with: config, presenting: rootViewController) { user, error in guard let userProfile = user?.profile else { diff --git a/DemoApp/Sources/Views/Login/LoginView.swift b/DemoApp/Sources/Views/Login/LoginView.swift index 69d3c15cb..f73b6eeea 100644 --- a/DemoApp/Sources/Views/Login/LoginView.swift +++ b/DemoApp/Sources/Views/Login/LoginView.swift @@ -54,15 +54,20 @@ struct LoginView: View { Image(systemName: "person.crop.circle.badge.clock.fill") } - LoginItemView { - Task { - let credentials = try await GoogleHelper.signIn() - completion(credentials) + if + AppEnvironment.value(for: .googleClientId)?.isEmpty == false, + AppEnvironment.value(for: .googleReversedClientId)?.isEmpty == false + { + LoginItemView { + Task { + let credentials = try await GoogleHelper.signIn() + completion(credentials) + } + } title: { + Text("Login with Stream account") + } icon: { + Image(systemName: "person.crop.circle.badge.clock.fill") } - } title: { - Text("Login with Stream account") - } icon: { - Image(systemName: "person.crop.circle.badge.clock.fill") } LoginItemView { diff --git a/Gemfile b/Gemfile index e37358f2d..85071c6eb 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ source 'https://rubygems.org' git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } +gem 'badge' gem 'cocoapods' gem 'danger' gem 'danger-commit_lint' diff --git a/Gemfile.lock b/Gemfile.lock index c4f0f81e1..d969aecb6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,6 +33,10 @@ GEM aws-sigv4 (1.6.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) + badge (0.13.0) + fastimage (>= 1.6) + fastlane (>= 2.0) + mini_magick (>= 4.9.4, < 5.0.0) claide (1.1.0) claide-plugins (0.9.2) cork @@ -189,7 +193,7 @@ GEM bundler fastlane pry - fastlane-plugin-stream_actions (0.3.20) + fastlane-plugin-stream_actions (0.3.22) xctest_list (= 1.2.1) fastlane-plugin-versioning (0.5.2) ffi (1.16.2) @@ -400,13 +404,14 @@ PLATFORMS ruby DEPENDENCIES + badge cocoapods danger danger-commit_lint fastlane fastlane-plugin-emerge fastlane-plugin-lizard - fastlane-plugin-stream_actions (= 0.3.20) + fastlane-plugin-stream_actions (= 0.3.22) fastlane-plugin-versioning jazzy json diff --git a/StreamVideo.xcodeproj/project.pbxproj b/StreamVideo.xcodeproj/project.pbxproj index 6f2bb950d..d6924f10f 100644 --- a/StreamVideo.xcodeproj/project.pbxproj +++ b/StreamVideo.xcodeproj/project.pbxproj @@ -3247,7 +3247,6 @@ isa = PBXNativeTarget; buildConfigurationList = 842D8BD12865B31D00801910 /* Build configuration list for PBXNativeTarget "DemoApp" */; buildPhases = ( - 82DE10C72A827B010057BDA8 /* ShellScript */, 842D8BBF2865B31B00801910 /* Sources */, 842D8BC02865B31B00801910 /* Frameworks */, 842D8BC12865B31B00801910 /* Resources */, @@ -3299,7 +3298,6 @@ isa = PBXNativeTarget; buildConfigurationList = 8493225D2908378B0013C029 /* Build configuration list for PBXNativeTarget "DemoAppUIKit" */; buildPhases = ( - 82010CAD2A851C06005C125D /* ShellScript */, 84932248290837890013C029 /* Sources */, 84932249290837890013C029 /* Frameworks */, 8493224A290837890013C029 /* Resources */, @@ -3347,7 +3345,6 @@ isa = PBXNativeTarget; buildConfigurationList = 84F737FF287C13AD00A363F4 /* Build configuration list for PBXNativeTarget "StreamVideoTests" */; buildPhases = ( - 827297E42A4585EA00774306 /* ShellScript */, 84F737F0287C13AD00A363F4 /* Sources */, 84F737F1287C13AD00A363F4 /* Frameworks */, 84F737F2287C13AD00A363F4 /* Resources */, @@ -3664,61 +3661,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 82010CAD2A851C06005C125D /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"$CONFIGURATION\" == \"Test\" ]; then\n touch \"$SRCROOT/TestTools/Credentials.xcconfig\"\nfi\n"; - }; - 827297E42A4585EA00774306 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"$CONFIGURATION\" == \"Test\" ]; then\n touch \"$SRCROOT/TestTools/Credentials.xcconfig\"\nfi\n"; - showEnvVarsInLog = 0; - }; - 82DE10C72A827B010057BDA8 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"$CONFIGURATION\" == \"Test\" ]; then\n touch \"$SRCROOT/TestTools/Credentials.xcconfig\"\nfi\n"; - }; 8434C53A289BBDF30001490A /* SwiftGen */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -5208,6 +5150,7 @@ }; 842D8BD22865B31D00801910 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 8206D84F2A5DB9300099F5EC /* Credentials.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; diff --git a/StreamVideo.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme b/StreamVideo.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme index 2f0cbea00..a338074bc 100644 --- a/StreamVideo.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme +++ b/StreamVideo.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + + + + + + + + + + + + + + version = "1.7"> + + + + + + + + + + + + + + + + + + + +