mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 23:18:27 +02:00
Cleanup code
This commit is contained in:
@@ -46,4 +46,14 @@ extension MXEvent {
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
var isTimelinePollEvent: Bool {
|
||||
switch eventType {
|
||||
case .pollStart, .pollEnd:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2881,11 +2881,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (event.eventType == MXEventTypePollStart) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (event.eventType == MXEventTypePollEnd) {
|
||||
if (event.isTimelinePollEvent) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@@ -636,7 +636,7 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
__block NSInteger firstVisibleComponentIndex = NSNotFound;
|
||||
|
||||
MXEvent *firstEvent = self.events.firstObject;
|
||||
BOOL isPoll = (self.events.firstObject.eventType == MXEventTypePollStart || self.events.firstObject.eventType == MXEventTypePollEnd);
|
||||
BOOL isPoll = firstEvent.isTimelinePollEvent;
|
||||
BOOL isVoiceBroadcast = (firstEvent.eventType == MXEventTypeCustom && [firstEvent.type isEqualToString: VoiceBroadcastSettings.voiceBroadcastInfoContentKeyType]);
|
||||
|
||||
if ((isPoll || self.attachment || isVoiceBroadcast) && self.bubbleComponents.count)
|
||||
|
||||
@@ -3971,7 +3971,7 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
}]];
|
||||
}
|
||||
|
||||
if (!isJitsiCallEvent && selectedEvent.eventType != MXEventTypePollStart &&
|
||||
if (!isJitsiCallEvent && !selectedEvent.isTimelinePollEvent &&
|
||||
selectedEvent.eventType != MXEventTypeBeaconInfo)
|
||||
{
|
||||
[self.eventMenuBuilder addItemWithType:EventMenuItemTypeQuote
|
||||
@@ -3992,7 +3992,7 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
}
|
||||
|
||||
if (selectedEvent.sentState == MXEventSentStateSent &&
|
||||
selectedEvent.eventType != MXEventTypePollStart &&
|
||||
!selectedEvent.isTimelinePollEvent &&
|
||||
// Forwarding of live-location shares still to be implemented
|
||||
selectedEvent.eventType != MXEventTypeBeaconInfo)
|
||||
{
|
||||
@@ -4008,7 +4008,7 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
}]];
|
||||
}
|
||||
|
||||
if (!isJitsiCallEvent && BuildSettings.messageDetailsAllowShare && selectedEvent.eventType != MXEventTypePollStart &&
|
||||
if (!isJitsiCallEvent && BuildSettings.messageDetailsAllowShare && !selectedEvent.isTimelinePollEvent &&
|
||||
selectedEvent.eventType != MXEventTypeBeaconInfo)
|
||||
{
|
||||
[self.eventMenuBuilder addItemWithType:EventMenuItemTypeShare
|
||||
@@ -7147,6 +7147,7 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
case MXEventTypeKeyVerificationDone:
|
||||
case MXEventTypeKeyVerificationCancel:
|
||||
case MXEventTypePollStart:
|
||||
case MXEventTypePollEnd:
|
||||
case MXEventTypeBeaconInfo:
|
||||
result = NO;
|
||||
break;
|
||||
|
||||
@@ -19,7 +19,6 @@ import Foundation
|
||||
class PollPlainCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, RoomCellReadMarkerDisplayable {
|
||||
|
||||
private var event: MXEvent?
|
||||
private var supportedEventTypes: Set<__MXEventType> = [.pollStart, .pollEnd]
|
||||
|
||||
override func render(_ cellData: MXKCellData!) {
|
||||
super.render(cellData)
|
||||
@@ -28,7 +27,7 @@ class PollPlainCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, RoomCell
|
||||
let contentView = roomCellContentView?.innerContentView,
|
||||
let bubbleData = cellData as? RoomBubbleCellData,
|
||||
let event = bubbleData.events.last,
|
||||
supportedEventTypes.contains(event.eventType),
|
||||
event.isTimelinePollEvent,
|
||||
let controller = TimelinePollProvider.shared.buildTimelinePollVCForEvent(event)
|
||||
else {
|
||||
return
|
||||
|
||||
@@ -54,6 +54,7 @@ targets:
|
||||
- path: ../Riot/Managers/Locale/LocaleProviderType.swift
|
||||
- path: ../Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift
|
||||
- path: ../Riot/Categories/Bundle.swift
|
||||
- path: ../Riot/Categories/MXEvent.swift
|
||||
- path: ../Riot/Generated/Strings.swift
|
||||
- path: ../Riot/Generated/Images.swift
|
||||
- path: ../Riot/Managers/KeyValueStorage/KeychainStore.swift
|
||||
|
||||
@@ -42,6 +42,7 @@ targets:
|
||||
- path: .
|
||||
- path: ../Riot/Modules/Common/SegmentedViewController/SegmentedViewController.m
|
||||
- path: ../Riot/Categories/Bundle.swift
|
||||
- path: ../Riot/Categories/MXEvent.swift
|
||||
- path: ../Riot/Managers/Theme/
|
||||
- path: ../Riot/Utils/AvatarGenerator.m
|
||||
- path: ../Config/BuildSettings.swift
|
||||
|
||||
@@ -42,6 +42,7 @@ targets:
|
||||
sources:
|
||||
- path: .
|
||||
- path: ../Riot/Categories/Bundle.swift
|
||||
- path: ../Riot/Categories/MXEvent.swift
|
||||
- path: ../Config/CommonConfiguration.swift
|
||||
- path: ../Config/BuildSettings.swift
|
||||
- path: ../Config/Configurable.swift
|
||||
|
||||
Reference in New Issue
Block a user