-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix]Deeplink handling #163
Changes from 4 commits
f365686
23288bf
dd34c06
1567e44
a48a86c
6467f00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,7 +229,7 @@ extension AppEnvironment { | |
case .debug: | ||
return [.staging, .pronto, .production] | ||
case .test: | ||
return [.staging] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update test environment to be able to process all available deeplinks |
||
return [.staging, .pronto, .production] | ||
case .release: | ||
return [.production] | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Copyright © 2023 Stream.io Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import StreamVideo | ||
import OSLog | ||
|
||
final class OSLogDestination: BaseLogDestination { | ||
|
||
override func write(message: String) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This allows us to see our logs from the AppStore versions using the Console.app |
||
os_log("%{public}s", message) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,15 +10,15 @@ import StreamVideoSwiftUI | |
|
||
struct DetailedCallingView: View { | ||
@ObservedObject var viewModel: CallViewModel | ||
|
||
@Injected(\.streamVideo) var streamVideo | ||
|
||
private let imageSize: CGFloat = 32 | ||
|
||
@State private var callId = "" | ||
|
||
@State private var callAction = CallAction.startCall | ||
|
||
@State private var callFlow: CallFlow = .joinImmediately | ||
|
||
var participants: [User] { | ||
|
@@ -28,13 +28,13 @@ struct DetailedCallingView: View { | |
} | ||
return participants | ||
} | ||
|
||
@State var selectedParticipants = [User]() | ||
@State var incomingCallInfo: IncomingCall? | ||
@State var logoutAlertShown = false | ||
|
||
@ObservedObject var appState = AppState.shared | ||
|
||
var body: some View { | ||
NavigationView { | ||
VStack { | ||
|
@@ -53,7 +53,7 @@ struct DetailedCallingView: View { | |
Text("Call details") | ||
.font(.title) | ||
.padding() | ||
|
||
HStack { | ||
Spacer() | ||
ZStack { | ||
|
@@ -71,18 +71,18 @@ struct DetailedCallingView: View { | |
.padding() | ||
} | ||
} | ||
|
||
Picker("Call action", selection: $callAction) { | ||
Text(CallAction.startCall.rawValue).tag(CallAction.startCall) | ||
Text(CallAction.joinCall.rawValue).tag(CallAction.joinCall) | ||
} | ||
.pickerStyle(.segmented) | ||
|
||
TextField("Insert a call id", text: $callId) | ||
.textFieldStyle(.roundedBorder) | ||
.padding() | ||
.accessibilityIdentifier("callId") | ||
|
||
if callAction == .startCall { | ||
startCallView | ||
.transition(.opacity) | ||
|
@@ -107,7 +107,7 @@ struct DetailedCallingView: View { | |
.alignedToReadableContentGuide() | ||
} | ||
.navigationViewStyle(StackNavigationViewStyle()) | ||
// .navigationBarHidden(true) | ||
// .navigationBarHidden(true) | ||
ipavlidakis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.onAppear() { | ||
CallService.shared.registerForIncomingCalls() | ||
} | ||
|
@@ -140,12 +140,16 @@ struct DetailedCallingView: View { | |
self.callId = callId | ||
viewModel.joinCall(callType: .default, callId: callId) | ||
} | ||
.onReceive(appState.$deeplinkInfo) { deeplinkInfo in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added this one to align the DetailedCallingView with the SimpleView and allow us to perform the DeeplinkTests |
||
self.callId = deeplinkInfo.callId | ||
joinCallIfNeeded(with: deeplinkInfo.callId, callType: deeplinkInfo.callType) | ||
} | ||
} | ||
|
||
private var makeCallEnabled: Bool { | ||
callId.isEmpty || participants.isEmpty | ||
} | ||
|
||
var startCallView: some View { | ||
Group { | ||
HStack { | ||
|
@@ -154,7 +158,7 @@ struct DetailedCallingView: View { | |
Spacer() | ||
} | ||
.padding(.horizontal) | ||
|
||
List(participants) { participant in | ||
Button { | ||
if selectedParticipants.contains(participant) { | ||
|
@@ -179,7 +183,7 @@ struct DetailedCallingView: View { | |
.frame(maxHeight: UIScreen.main.bounds.height / 4) | ||
.listStyle(PlainListStyle()) | ||
.accessibility(identifier: "participantList") | ||
|
||
Picker("Call flow", selection: $callFlow) { | ||
Text(CallFlow.joinImmediately.rawValue) | ||
.tag(CallFlow.joinImmediately) | ||
|
@@ -192,7 +196,7 @@ struct DetailedCallingView: View { | |
.accessibility(identifier: CallFlow.lobby.rawValue) | ||
} | ||
.pickerStyle(.segmented) | ||
|
||
Button { | ||
resignFirstResponder() | ||
if callFlow == .lobby { | ||
|
@@ -216,7 +220,7 @@ struct DetailedCallingView: View { | |
.cornerRadius(16) | ||
} | ||
} | ||
|
||
var members: [MemberRequest] { | ||
var members: [MemberRequest] = selectedParticipants.map { | ||
MemberRequest(custom: $0.customData, role: $0.role, userId: $0.id) | ||
|
@@ -232,7 +236,19 @@ struct DetailedCallingView: View { | |
} | ||
return members | ||
} | ||
|
||
|
||
private func joinCallIfNeeded(with callId: String, callType: String = .default) { | ||
guard !callId.isEmpty, viewModel.callingState == .idle else { | ||
return | ||
} | ||
|
||
Task { | ||
try await streamVideo.connect() | ||
await MainActor.run { | ||
viewModel.joinCall(callType: callType, callId: callId) | ||
} | ||
} | ||
} | ||
} | ||
|
||
enum CallAction: String { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed as the domain is the same and can be handled.