Skip to content

Commit

Permalink
Rebase on SDK update.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Jul 2, 2024
1 parent ca895f7 commit c96102e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 25 deletions.
4 changes: 4 additions & 0 deletions ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
3F2148F11164C7C5609984EB /* GZIP in Frameworks */ = {isa = PBXBuildFile; productRef = 2B788C81F6369D164ADEB917 /* GZIP */; };
3F327A62D233933F54F0F33A /* SwiftOGG in Frameworks */ = {isa = PBXBuildFile; productRef = 3FE40E79C36E7903121E6E3B /* SwiftOGG */; };
3F70E237CE4C3FAB02FC227F /* NotificationConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C830A64609CBD152F06E0457 /* NotificationConstants.swift */; };
3F997171C3C79A45E92BF9EF /* ElementWellKnown.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FAC366FF299BCC555D756E /* ElementWellKnown.swift */; };
401BB28CD6B7DD6B4E7863E7 /* ServerConfirmationScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9342F5D6729627B6393AF853 /* ServerConfirmationScreenModels.swift */; };
407DCE030E0F9B7C9861D38A /* LRUCache in Frameworks */ = {isa = PBXBuildFile; productRef = 1081D3630AAD3ACEDDEC3A98 /* LRUCache */; };
40B79D20A873620F7F128A2C /* UserPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35FA991289149D31F4286747 /* UserPreference.swift */; };
Expand Down Expand Up @@ -1621,6 +1622,7 @@
78913D6E120D46138E97C107 /* NavigationSplitCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationSplitCoordinatorTests.swift; sourceTree = "<group>"; };
7893780A1FD6E3F38B3E9049 /* UserIndicatorControllerMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIndicatorControllerMock.swift; sourceTree = "<group>"; };
796CBD0C56FA0D3AEDAB255B /* SessionVerificationScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionVerificationScreenCoordinator.swift; sourceTree = "<group>"; };
79FAC366FF299BCC555D756E /* ElementWellKnown.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementWellKnown.swift; sourceTree = "<group>"; };
7A03E073077D92AA19C43DCF /* IdentityConfirmationScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdentityConfirmationScreenCoordinator.swift; sourceTree = "<group>"; };
7A5D2323D7B6BF4913EB7EED /* landscape_test_image.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = landscape_test_image.jpg; sourceTree = "<group>"; };
7AAD8C633AA57948B34EDCF7 /* RoomChangeRolesScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangeRolesScreenViewModelProtocol.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3862,6 +3864,7 @@
D09A267106B9585D3D0CFC0D /* ClientError.swift */,
18F2958E6D247AE2516BEEE8 /* ClientProxy.swift */,
6033779EB37259F27F938937 /* ClientProxyProtocol.swift */,
79FAC366FF299BCC555D756E /* ElementWellKnown.swift */,
);
path = Client;
sourceTree = "<group>";
Expand Down Expand Up @@ -6060,6 +6063,7 @@
48416BBEB8DDF3E4DED0EDB6 /* ElementCallServiceProtocol.swift in Sources */,
07CC13C5729C24255348CBBD /* ElementCallWidgetDriver.swift in Sources */,
370AF5BFCD4384DD455479B6 /* ElementCallWidgetDriverProtocol.swift in Sources */,
3F997171C3C79A45E92BF9EF /* ElementWellKnown.swift in Sources */,
7C1A7B594B2F8143F0DD0005 /* ElementXAttributeScope.swift in Sources */,
7361B011A79BF723D8C9782B /* EmojiCategory.swift in Sources */,
E45C9FA22BC13B477FD3B4AC /* EmojiDetection.swift in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
Task {
let baseURL = if let elementCallBaseURLOverride {
elementCallBaseURLOverride
} else if case .success(let wellKnown) = await clientProxy.getElementWellKnown(), let wellKnownCallWidgetURL = wellKnown?.call?.widgetURL {
wellKnownCallWidgetURL
} else if case .success(let wellKnown) = await clientProxy.getElementWellKnown(), let wellKnownCall = wellKnown?.call {
wellKnownCall.widgetURL
} else {
elementCallBaseURL
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ final class DeveloperOptionsScreenCoordinator: CoordinatorProtocol {
}

init() {
viewModel = DeveloperOptionsScreenViewModel(developerOptions: ServiceLocator.shared.settings)
viewModel = DeveloperOptionsScreenViewModel(developerOptions: ServiceLocator.shared.settings,
elementCallBaseURL: ServiceLocator.shared.settings.elementCallBaseURL)

viewModel.actions
.sink { [weak self] action in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ enum DeveloperOptionsScreenViewModelAction {
}

struct DeveloperOptionsScreenViewState: BindableState {
let elementCallBaseURL: URL
var bindings: DeveloperOptionsScreenViewStateBindings
}

Expand All @@ -46,7 +47,6 @@ enum DeveloperOptionsScreenViewAction {
protocol DeveloperOptionsProtocol: AnyObject {
var logLevel: TracingConfiguration.LogLevel { get set }
var hideUnreadMessagesBadge: Bool { get set }
var elementCallBaseURL: URL { get set }
var elementCallBaseURLOverride: URL? { get set }
var fuzzyRoomListSearchEnabled: Bool { get set }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve
actionsSubject.eraseToAnyPublisher()
}

init(developerOptions: DeveloperOptionsProtocol) {
init(developerOptions: DeveloperOptionsProtocol, elementCallBaseURL: URL) {
let bindings = DeveloperOptionsScreenViewStateBindings(developerOptions: developerOptions)
let state = DeveloperOptionsScreenViewState(bindings: bindings)
let state = DeveloperOptionsScreenViewState(elementCallBaseURL: elementCallBaseURL, bindings: bindings)

super.init(initialViewState: state)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,10 @@ struct DeveloperOptionsScreen: View {
}

Section("Element Call") {
TextField(context.elementCallBaseURL?.absoluteString ?? elementCallBaseURLOverride?.absoluteString,
text: $elementCallBaseURLString)
TextField(context.viewState.elementCallBaseURL.absoluteString, text: $elementCallBaseURLString)
.submitLabel(.done)
.onSubmit {
guard let url = URL(string: elementCallBaseURLString) else {
return
}

guard let url = URL(string: elementCallBaseURLString) else { return }
context.elementCallBaseURLOverride = url
}
.autocorrectionDisabled(true)
Expand Down Expand Up @@ -149,7 +145,8 @@ private struct LogLevelConfigurationView: View {
// MARK: - Previews

struct DeveloperOptionsScreen_Previews: PreviewProvider {
static let viewModel = DeveloperOptionsScreenViewModel(developerOptions: ServiceLocator.shared.settings)
static let viewModel = DeveloperOptionsScreenViewModel(developerOptions: ServiceLocator.shared.settings,
elementCallBaseURL: ServiceLocator.shared.settings.elementCallBaseURL)
static var previews: some View {
NavigationStack {
DeveloperOptionsScreen(context: viewModel.context)
Expand Down
17 changes: 5 additions & 12 deletions ElementX/Sources/Services/Client/ElementWellKnown.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,17 @@ import MatrixRustSDK

struct ElementWellKnown {
struct Call {
let widgetURL: URL?
let widgetURL: URL

init?(_ wellKnown: MatrixRustSDK.ElementCallWellKnown?) {
guard let wellKnown else {
return nil
}

widgetURL = URL(string: wellKnown.widgetUrl)
init?(_ wellKnown: MatrixRustSDK.ElementCallWellKnown) {
guard let widgetURL = URL(string: wellKnown.widgetUrl) else { return nil }
self.widgetURL = widgetURL
}
}

let call: Call?

init?(_ wellKnown: MatrixRustSDK.ElementWellKnown?) {
guard let wellKnown else {
return nil
}

init?(_ wellKnown: MatrixRustSDK.ElementWellKnown) {
call = Call(wellKnown.call)
}
}

0 comments on commit c96102e

Please sign in to comment.