mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Use RustSDK permalink builders:
- replace event permalinks on the room screen interaction handler - replace the one use don the room details screen - deprecate previous AttributedStringBuilder methods - there's more work required on the AttributedStringBuilder mentions handler before we can completely drop the iOS implementations
This commit is contained in:
@@ -38,7 +38,7 @@ struct RoomDetailsScreenViewState: BindableState {
|
||||
|
||||
let isEncrypted: Bool
|
||||
let isDirect: Bool
|
||||
let permalink: URL?
|
||||
var permalink: URL?
|
||||
|
||||
var topic: AttributedString?
|
||||
var topicSummary: AttributedString?
|
||||
|
||||
@@ -59,7 +59,6 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
super.init(initialViewState: .init(details: roomProxy.details,
|
||||
isEncrypted: roomProxy.isEncrypted,
|
||||
isDirect: roomProxy.isDirect,
|
||||
permalink: roomProxy.permalink,
|
||||
topic: topic,
|
||||
topicSummary: topic?.unattributedStringByReplacingNewlinesWithSpaces(),
|
||||
joinedMembersCount: roomProxy.joinedMembersCount,
|
||||
@@ -67,6 +66,12 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
bindings: .init()),
|
||||
imageProvider: mediaProvider)
|
||||
|
||||
Task {
|
||||
if case let .success(permalinkURL) = await roomProxy.matrixToPermalink() {
|
||||
state.permalink = permalinkURL
|
||||
}
|
||||
}
|
||||
|
||||
updateRoomInfo()
|
||||
Task { await updatePowerLevelPermissions() }
|
||||
|
||||
|
||||
@@ -208,17 +208,18 @@ class RoomScreenInteractionHandler {
|
||||
MXLog.error("Cannot edit item with id: \(timelineItem.id)")
|
||||
}
|
||||
case .copyPermalink:
|
||||
do {
|
||||
guard let eventID = eventTimelineItem.id.eventID else {
|
||||
actionsSubject.send(.displayError(.alert(L10n.errorFailedCreatingThePermalink)))
|
||||
break
|
||||
}
|
||||
|
||||
let permalink = try PermalinkBuilder.permalinkTo(eventIdentifier: eventID, roomIdentifier: timelineController.roomID,
|
||||
baseURL: appSettings.permalinkBaseURL)
|
||||
UIPasteboard.general.url = permalink
|
||||
} catch {
|
||||
guard let eventID = eventTimelineItem.id.eventID else {
|
||||
actionsSubject.send(.displayError(.alert(L10n.errorFailedCreatingThePermalink)))
|
||||
return
|
||||
}
|
||||
|
||||
Task {
|
||||
guard case let .success(permalinkURL) = await roomProxy.matrixToEventPermalink(eventID) else {
|
||||
actionsSubject.send(.displayError(.alert(L10n.errorFailedCreatingThePermalink)))
|
||||
return
|
||||
}
|
||||
|
||||
UIPasteboard.general.url = permalinkURL
|
||||
}
|
||||
case .redact:
|
||||
Task {
|
||||
|
||||
Reference in New Issue
Block a user