diff --git a/DemoApp/Info.plist b/DemoApp/Info.plist
index eeb3c26bb..dc16586a7 100644
--- a/DemoApp/Info.plist
+++ b/DemoApp/Info.plist
@@ -101,5 +101,9 @@
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
+ GOOGLE_CLIENT_ID
+ $(GOOGLE_CLIENT_ID)
+ REVERSED_GOOGLE_CLIENT_ID
+ $(REVERSED_GOOGLE_CLIENT_ID)
diff --git a/DemoApp/Sources/Components/AppEnvironment.swift b/DemoApp/Sources/Components/AppEnvironment.swift
index f30a415d3..4faa61c0d 100644
--- a/DemoApp/Sources/Components/AppEnvironment.swift
+++ b/DemoApp/Sources/Components/AppEnvironment.swift
@@ -105,14 +105,17 @@ extension AppEnvironment {
extension AppEnvironment {
+ enum InfoPlistValue: String {
+ case googleClientId = "GOOGLE_CLIENT_ID"
+ case googleReversedClientId = "REVERSED_GOOGLE_CLIENT_ID"
+ }
+
enum Argument: String {
case mockJWT = "MOCK_JWT"
}
enum Variable: String {
case JWTExpiration = "JWT_EXPIRATION"
- case googleClientId = "GOOGLE_CLIENT_ID"
- case googleReversedClientId = "REVERSED_GOOGLE_CLIENT_ID"
}
static func contains(_ argument: Argument) -> Bool {
@@ -127,6 +130,12 @@ extension AppEnvironment {
.processInfo
.environment[variable.rawValue]
}
+
+ static func value(for variable: InfoPlistValue) -> T? {
+ Bundle
+ .main
+ .infoDictionary?[variable.rawValue] as? T
+ }
}
extension AppEnvironment {
diff --git a/DemoApp/Sources/Views/Login/GoogleHelper.swift b/DemoApp/Sources/Views/Login/GoogleHelper.swift
index 7b7427505..07bd9b413 100644
--- a/DemoApp/Sources/Views/Login/GoogleHelper.swift
+++ b/DemoApp/Sources/Views/Login/GoogleHelper.swift
@@ -19,7 +19,7 @@ enum GoogleHelper {
static func signIn() async throws -> UserCredentials {
guard
let rootViewController = UIApplication.shared.windows.first?.rootViewController,
- let clientId = AppEnvironment.value(for: .googleClientId)
+ let clientId: String = AppEnvironment.value(for: .googleClientId)
else {
throw ClientError.Unexpected("No view controller available")
}
diff --git a/DemoApp/Sources/Views/Login/LoginView.swift b/DemoApp/Sources/Views/Login/LoginView.swift
index f73b6eeea..388df7ec9 100644
--- a/DemoApp/Sources/Views/Login/LoginView.swift
+++ b/DemoApp/Sources/Views/Login/LoginView.swift
@@ -54,10 +54,7 @@ struct LoginView: View {
Image(systemName: "person.crop.circle.badge.clock.fill")
}
- if
- AppEnvironment.value(for: .googleClientId)?.isEmpty == false,
- AppEnvironment.value(for: .googleReversedClientId)?.isEmpty == false
- {
+ if isGoogleSignInAvailable {
LoginItemView {
Task {
let credentials = try await GoogleHelper.signIn()
@@ -102,6 +99,19 @@ struct LoginView: View {
}
}
}
+
+ private var isGoogleSignInAvailable: Bool {
+ guard
+ let clientId: String = AppEnvironment.value(for: .googleClientId),
+ let reversedClientId: String = AppEnvironment.value(for: .googleReversedClientId),
+ !clientId.isEmpty,
+ !reversedClientId.isEmpty
+ else{
+ return false
+ }
+
+ return true
+ }
}
struct LoginItemView: View {
diff --git a/Gemfile.lock b/Gemfile.lock
index d969aecb6..db95ef399 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -193,7 +193,7 @@ GEM
bundler
fastlane
pry
- fastlane-plugin-stream_actions (0.3.22)
+ fastlane-plugin-stream_actions (0.3.23)
xctest_list (= 1.2.1)
fastlane-plugin-versioning (0.5.2)
ffi (1.16.2)
@@ -411,7 +411,7 @@ DEPENDENCIES
fastlane
fastlane-plugin-emerge
fastlane-plugin-lizard
- fastlane-plugin-stream_actions (= 0.3.22)
+ fastlane-plugin-stream_actions (= 0.3.23)
fastlane-plugin-versioning
jazzy
json
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
index c5706347e..2f0a3372f 100644
--- a/fastlane/Fastfile
+++ b/fastlane/Fastfile
@@ -87,16 +87,28 @@ lane :match_me do |options|
)
end
+private_lane :update_google_plist do |options|
+ next if gci.nil?
+
+ Dir.glob(File.join("../#{options[:app_target]}", '**', '*.plist')).each do |plist_file|
+ old_content = File.read(plist_file)
+ new_content = old_content.gsub('$(GOOGLE_CLIENT_ID)', gci).gsub('$(REVERSED_GOOGLE_CLIENT_ID)', reversed_gci)
+ File.write(plist_file, new_content)
+ end
+end
+
lane :swiftui_testflight_build do |options|
- beta = options[:configuration] == 'Debug'
- badge(path: 'DemoApp/') if beta
- xcargs = beta ? "GOOGLE_CLIENT_ID='#{gci}' REVERSED_GOOGLE_CLIENT_ID='#{reversed_gci}'" : nil
+ app_target = 'DemoApp'
+
+ if options[:configuration] == 'Debug'
+ badge(path: app_target)
+ update_google_plist(app_target: app_target)
+ end
upload_beta(
- app_target: 'DemoApp',
+ app_target: app_target,
app_identifier: 'io.getstream.iOS.VideoDemoApp',
- configuration: options[:configuration],
- xcargs: xcargs
+ configuration: options[:configuration]
)
end
@@ -113,8 +125,7 @@ private_lane :upload_beta do |options|
app_target: options[:app_target],
app_identifier: options[:app_identifier],
configuration: options[:configuration] || 'Release',
- extensions: ['CallIntent', 'ScreenSharing'],
- xcargs: options[:xcargs]
+ extensions: ['CallIntent', 'ScreenSharing']
)
end
diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile
index e715b9d38..412c59d26 100644
--- a/fastlane/Pluginfile
+++ b/fastlane/Pluginfile
@@ -1,3 +1,3 @@
gem 'fastlane-plugin-versioning'
gem 'fastlane-plugin-emerge'
-gem 'fastlane-plugin-stream_actions', '0.3.22'
+gem 'fastlane-plugin-stream_actions', '0.3.23'