MESSENGER-4093 scan permalinks as qr

This commit is contained in:
Arnfried Griesert
2023-02-23 06:50:16 +00:00
committed by Frank Rotermund
parent 1bff461abb
commit eb618b395d
15 changed files with 325 additions and 127 deletions
@@ -22,6 +22,7 @@ enum AllChatsEditActionProviderOption {
case createRoom
case startChat
case createSpace
case scanPermalink
}
protocol AllChatsEditActionProviderDelegate: AnyObject {
@@ -50,29 +51,57 @@ class AllChatsEditActionProvider {
// MARK: - RoomActionProviderProtocol
var menu: UIMenu {
guard parentSpace != nil else {
var createActions = [
self.createRoomAction,
self.startChatAction
]
if rootSpaceCount > 0 && BWIBuildSettings.shared.enableSpaces {
createActions.insert(self.createSpaceAction, at: 0)
if BWIBuildSettings.shared.allowScanPermalinkQRCode {
guard parentSpace != nil else {
var createActions = [
self.exploreRoomsAction,
self.createRoomAction,
self.startChatAction
]
if rootSpaceCount > 0 && BWIBuildSettings.shared.enableSpaces {
createActions.insert(self.createSpaceAction, at: 0)
}
return UIMenu(title: "", children: [
self.scanPermalinkAction,
UIMenu(title: "", options: .displayInline, children: createActions)
])
}
return UIMenu(title: "", children: [
self.exploreRoomsAction,
UIMenu(title: "", options: .displayInline, children: createActions)
UIMenu(title: "", options: .displayInline, children: [
self.scanPermalinkAction
]),
UIMenu(title: "", options: .displayInline, children: [
self.exploreRoomsAction,
self.createSpaceAction,
self.createRoomAction
])
])
} else {
guard parentSpace != nil else {
var createActions = [
self.createRoomAction,
self.startChatAction
]
if rootSpaceCount > 0 && BWIBuildSettings.shared.enableSpaces {
createActions.insert(self.createSpaceAction, at: 0)
}
return UIMenu(title: "", children: [
self.exploreRoomsAction,
UIMenu(title: "", options: .displayInline, children: createActions)
])
}
return UIMenu(title: "", children: [
UIMenu(title: "", options: .displayInline, children: [
self.exploreRoomsAction
]),
UIMenu(title: "", options: .displayInline, children: [
self.createSpaceAction,
self.createRoomAction
])
])
}
return UIMenu(title: "", children: [
UIMenu(title: "", options: .displayInline, children: [
self.exploreRoomsAction
]),
UIMenu(title: "", options: .displayInline, children: [
self.createSpaceAction,
self.createRoomAction
])
])
}
// MARK: - Public
@@ -167,4 +196,14 @@ class AllChatsEditActionProvider {
self.delegate?.allChatsEditActionProvider(self, didSelect: .createSpace)
}
}
private var scanPermalinkAction: UIAction {
UIAction(title: BWIL10n.roomRecentsScanQrCode,
image: Asset.Images.qrcodeViewfinder.image) { [weak self] action in
guard let self = self else { return }
self.delegate?.allChatsEditActionProvider(self, didSelect: .scanPermalink)
}
}
}