creating the coordinator for the link action view

This commit is contained in:
Mauro Romito
2022-12-07 18:17:28 +01:00
parent c0b4e19c9b
commit 34ca74d0c2
9 changed files with 116 additions and 3 deletions
@@ -36,6 +36,7 @@ enum FormatType {
case italic
case underline
case strikethrough
case link
}
extension FormatType: CaseIterable, Identifiable {
@@ -58,6 +59,8 @@ extension FormatItem {
return Asset.Images.strikethrough.name
case .underline:
return Asset.Images.underlined.name
case .link:
return Asset.Images.link.name
}
}
@@ -71,6 +74,8 @@ extension FormatItem {
return "strikethroughButton"
case .underline:
return "underlineButton"
case .link:
return "linkButton"
}
}
@@ -84,6 +89,9 @@ extension FormatItem {
return VectorL10n.wysiwygComposerFormatActionStrikethrough
case .underline:
return VectorL10n.wysiwygComposerFormatActionUnderline
case .link:
// TODO: Add link accessibility label translation
return "link"
}
}
}
@@ -100,11 +108,12 @@ extension FormatType {
return .strikeThrough
case .underline:
return .underline
case .link:
return .link
}
}
// TODO: We probably don't need to expose this, clean up.
/// Convenience method to map it to the external rust binging action
var composerAction: ComposerAction {
switch self {
@@ -116,6 +125,8 @@ extension FormatType {
return .strikeThrough
case .underline:
return .underline
case .link:
return .link
}
}
}
@@ -130,11 +141,22 @@ enum ComposerSendMode: Equatable {
enum ComposerViewAction: Equatable {
case cancel
case contentDidChange(isEmpty: Bool)
case linkTapped(linkAction: LinkAction)
}
enum ComposerViewModelResult: Equatable {
case cancel
case contentDidChange(isEmpty: Bool)
case linkTapped(LinkAction: LinkAction)
}
final class LinkActionWrapper: NSObject {
let linkAction: LinkAction
init(_ linkAction: LinkAction) {
self.linkAction = linkAction
super.init()
}
}