Merge pull request #6333 from vector-im/johannes/clean-up-available

Clean up iOS 14 availability checks
This commit is contained in:
Johannes Marbach 2022-06-23 14:00:28 +02:00 committed by GitHub
commit 17c2b20f33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
284 changed files with 114 additions and 881 deletions

View file

@ -398,13 +398,7 @@ final class BuildSettings: NSObject {
// MARK: - Polls
static var pollsEnabled: Bool {
guard #available(iOS 14, *) else {
return false
}
return true
}
static let pollsEnabled = true
// MARK: - Location Sharing

View file

@ -20,7 +20,6 @@ import SwiftUI
/**
Struct for holding colors for use in SwiftUI.
*/
@available(iOS 14.0, *)
public struct ColorSwiftUI: Colors {
public let accent: Color

View file

@ -20,7 +20,6 @@ import SwiftUI
/**
Struct for holding fonts for use in SwiftUI.
*/
@available(iOS 14.0, *)
public struct FontSwiftUI: Fonts {
public let uiFonts: FontsUIKit

View file

@ -30,7 +30,6 @@ import UIKit
}
/// Theme v2 for SwiftUI.
@available(iOS 14.0, *)
public protocol ThemeSwiftUIType {
/// Colors object

View file

@ -47,6 +47,5 @@ public class DarkColors {
)
public static var uiKit = ColorsUIKit(values: values)
@available(iOS 14.0, *)
public static var swiftUI = ColorSwiftUI(values: values)
}

View file

@ -48,7 +48,6 @@ public class LightColors {
)
public static var uiKit = ColorsUIKit(values: values)
@available(iOS 14.0, *)
public static var swiftUI = ColorSwiftUI(values: values)
}

View file

@ -16,7 +16,6 @@
import Combine
@available(iOS 14.0, *)
extension Publisher {
///

View file

@ -41,7 +41,6 @@ extension UISIAutoReportData: Codable {
/// Listens for failed decryption events and silently sends reports RageShake server.
/// Also requests that message senders send a matching report to have both sides of the interaction.
@available(iOS 14.0, *)
@objcMembers class UISIAutoReporter: NSObject, UISIDetectorDelegate {
struct ReportInfo: Hashable {

View file

@ -119,21 +119,20 @@ final class AppCoordinator: NSObject, AppCoordinatorType {
private func setupTheme() {
ThemeService.shared().themeId = RiotSettings.shared.userInterfaceTheme
if #available(iOS 14.0, *) {
// Set theme id from current theme.identifier, themeId can be nil.
if let themeId = ThemeIdentifier(rawValue: ThemeService.shared().theme.identifier) {
ThemePublisher.configure(themeId: themeId)
} else {
MXLog.error("[AppCoordinator] No theme id found to update ThemePublisher")
}
// Always republish theme change events, and again always getting the identifier from the theme.
let themeIdPublisher = NotificationCenter.default.publisher(for: Notification.Name.themeServiceDidChangeTheme)
.compactMap({ _ in ThemeIdentifier(rawValue: ThemeService.shared().theme.identifier) })
.eraseToAnyPublisher()
ThemePublisher.shared.republish(themeIdPublisher: themeIdPublisher)
// Set theme id from current theme.identifier, themeId can be nil.
if let themeId = ThemeIdentifier(rawValue: ThemeService.shared().theme.identifier) {
ThemePublisher.configure(themeId: themeId)
} else {
MXLog.error("[AppCoordinator] No theme id found to update ThemePublisher")
}
// Always republish theme change events, and again always getting the identifier from the theme.
let themeIdPublisher = NotificationCenter.default.publisher(for: Notification.Name.themeServiceDidChangeTheme)
.compactMap({ _ in ThemeIdentifier(rawValue: ThemeService.shared().theme.identifier) })
.eraseToAnyPublisher()
ThemePublisher.shared.republish(themeIdPublisher: themeIdPublisher)
}
private func excludeAllItemsFromBackup() {

View file

@ -476,11 +476,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
self.pushNotificationService.delegate = self;
self.spaceFeatureUnavailablePresenter = [SpaceFeatureUnavailablePresenter new];
if (@available(iOS 14.0, *)) {
self.uisiAutoReporter = [[UISIAutoReporter alloc] init];
}
self.uisiAutoReporter = [[UISIAutoReporter alloc] init];
// Add matrix observers, and initialize matrix sessions if the app is not launched in background.
[self initMatrixSessions];
@ -2022,11 +2020,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// register the session to the uisi auto-reporter
if (_uisiAutoReporter != nil)
{
if (@available(iOS 14.0, *))
{
UISIAutoReporter* uisiAutoReporter = (UISIAutoReporter*)_uisiAutoReporter;
[uisiAutoReporter add:mxSession];
}
UISIAutoReporter* uisiAutoReporter = (UISIAutoReporter*)_uisiAutoReporter;
[uisiAutoReporter add:mxSession];
}
[mxSessionArray addObject:mxSession];
@ -2048,11 +2043,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// register the session to the uisi auto-reporter
if (_uisiAutoReporter != nil)
{
if (@available(iOS 14.0, *))
{
UISIAutoReporter* uisiAutoReporter = (UISIAutoReporter*)_uisiAutoReporter;
[uisiAutoReporter remove:mxSession];
}
UISIAutoReporter* uisiAutoReporter = (UISIAutoReporter*)_uisiAutoReporter;
[uisiAutoReporter remove:mxSession];
}
// Update the widgets manager

View file

@ -21,7 +21,6 @@ import SwiftUI
UIHostingController that applies some app-level specific configuration
(E.g. `vectorContent` modifier and theming to the NavigationController container.
*/
@available(iOS 14.0, *)
class VectorHostingController: UIHostingController<AnyView> {
// MARK: Private

View file

@ -104,13 +104,7 @@ class RoomActionProvider: RoomActionProviderProtocol {
}
private var leaveAction: UIAction {
let image: UIImage?
if #available(iOS 14.0, *) {
image = UIImage(systemName: "rectangle.righthalf.inset.fill.arrow.right")
} else {
image = UIImage(systemName: "rectangle.xmark")
}
let image = UIImage(systemName: "rectangle.righthalf.inset.fill.arrow.right")
let action = UIAction(title: VectorL10n.homeContextMenuLeave, image: image) { [weak self] action in
guard let self = self else { return }
self.service.leaveRoom(promptUser: true)

View file

@ -75,7 +75,7 @@ final class CreateRoomCoordinator: CreateRoomCoordinatorType {
self.add(childCoordinator: createRoomCoordinator)
if let parentSpace = self.parentSpace, #available(iOS 14, *) {
if let parentSpace = self.parentSpace {
let roomSelectionCoordinator = self.createRoomSelectorCoordinator(parentSpace: parentSpace)
roomSelectionCoordinator.completion = { [weak self] result in
guard let self = self else {
@ -114,7 +114,6 @@ final class CreateRoomCoordinator: CreateRoomCoordinatorType {
return coordinator
}
@available(iOS 14.0, *)
private func createRoomSelectorCoordinator(parentSpace: MXSpace) -> MatrixItemChooserCoordinator {
let paramaters = MatrixItemChooserCoordinatorParameters(session: self.parameters.session, viewProvider: AddRoomSelectorViewProvider(), itemsProcessor: AddRoomItemsProcessor(parentSpace: parentSpace))
let coordinator = MatrixItemChooserCoordinator(parameters: paramaters)

View file

@ -74,7 +74,6 @@ final class MediaPickerPresenter: NSObject {
}
// MARK: - PHPickerViewControllerDelegate
@available(iOS 14, *)
extension MediaPickerPresenter: PHPickerViewControllerDelegate {
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
// TODO: Handle videos and multi-selection

View file

@ -88,9 +88,7 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {
self.roomViewController.parentSpaceId = parameters.parentSpaceId
if #available(iOS 14, *) {
TimelinePollProvider.shared.session = parameters.session
}
TimelinePollProvider.shared.session = parameters.session
super.init()
}
@ -331,10 +329,6 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {
}
private func showLocationCoordinatorWithEvent(_ event: MXEvent, bubbleData: MXKRoomBubbleCellDataStoring) {
guard #available(iOS 14.0, *) else {
return
}
guard let navigationRouter = self.navigationRouter,
let mediaManager = mxSession?.mediaManager,
let locationContent = event.location else {
@ -377,10 +371,6 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {
}
private func startLocationCoordinator() {
guard #available(iOS 14.0, *) else {
return
}
guard let navigationRouter = self.navigationRouter,
let mediaManager = mxSession?.mediaManager,
let user = mxSession?.myUser else {
@ -414,10 +404,6 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {
}
private func startEditPollCoordinator(startEvent: MXEvent? = nil) {
guard #available(iOS 14.0, *) else {
return
}
let parameters = PollEditFormCoordinatorParameters(room: roomViewController.roomDataSource.room, pollStartEvent: startEvent)
let coordinator = PollEditFormCoordinator(parameters: parameters)
@ -562,26 +548,14 @@ extension RoomCoordinator: RoomViewControllerDelegate {
}
func roomViewController(_ roomViewController: RoomViewController, canEndPollWithEventIdentifier eventIdentifier: String) -> Bool {
guard #available(iOS 14.0, *) else {
return false
}
return TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.canEndPoll() ?? false
}
func roomViewController(_ roomViewController: RoomViewController, endPollWithEventIdentifier eventIdentifier: String) {
guard #available(iOS 14.0, *) else {
return
}
TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.endPoll()
}
func roomViewController(_ roomViewController: RoomViewController, canEditPollWithEventIdentifier eventIdentifier: String) -> Bool {
guard #available(iOS 14.0, *) else {
return false
}
return TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.canEditPoll() ?? false
}

View file

@ -60,9 +60,6 @@ enum
enum
{
ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ACCESS,
ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_INVITED_ONLY,
ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE_APART_FROM_GUEST,
ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE,
ROOM_SETTINGS_ROOM_ACCESS_DIRECTORY_VISIBILITY,
ROOM_SETTINGS_ROOM_ACCESS_MISSING_ADDRESS_WARNING
};
@ -147,9 +144,6 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
// Room Access items
TableViewCellWithCheckBoxAndLabel *accessInvitedOnlyTickCell;
TableViewCellWithCheckBoxAndLabel *accessAnyoneApartGuestTickCell;
TableViewCellWithCheckBoxAndLabel *accessAnyoneTickCell;
UISwitch *directoryVisibilitySwitch;
MXRoomDirectoryVisibility actualDirectoryVisibility;
MXHTTPOperation* actualDirectoryVisibilityRequest;
@ -546,44 +540,20 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
if (RiotSettings.shared.roomSettingsScreenAllowChangingAccessSettings)
{
Section *sectionAccess = [Section sectionWithTag:SECTION_TAG_ACCESS];
if (@available(iOS 14, *))
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ACCESS];
// Check whether a room address is required for the current join rule
NSString *joinRule = updatedItemsDict[kRoomSettingsJoinRuleKey];
if (!joinRule)
{
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ACCESS];
// Check whether a room address is required for the current join rule
NSString *joinRule = updatedItemsDict[kRoomSettingsJoinRuleKey];
if (!joinRule)
{
// Use the actual values if no change is pending.
joinRule = mxRoomState.joinRule;
}
if ([joinRule isEqualToString:kMXRoomJoinRulePublic] && !roomAddresses.count)
{
// Notify the user that a room address is required.
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_MISSING_ADDRESS_WARNING];
}
// Use the actual values if no change is pending.
joinRule = mxRoomState.joinRule;
}
else
if ([joinRule isEqualToString:kMXRoomJoinRulePublic] && !roomAddresses.count)
{
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_INVITED_ONLY];
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE_APART_FROM_GUEST];
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE];
// Check whether a room address is required for the current join rule
NSString *joinRule = updatedItemsDict[kRoomSettingsJoinRuleKey];
if (!joinRule)
{
// Use the actual values if no change is pending.
joinRule = mxRoomState.joinRule;
}
if ([joinRule isEqualToString:kMXRoomJoinRulePublic] && !roomAddresses.count)
{
// Notify the user that a room address is required.
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_MISSING_ADDRESS_WARNING];
}
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_DIRECTORY_VISIBILITY];
// Notify the user that a room address is required.
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_MISSING_ADDRESS_WARNING];
}
if (mxRoom.isDirect)
@ -596,15 +566,13 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
}
[tmpSections addObject:sectionAccess];
if (@available(iOS 14, *)) {
if (RiotSettings.shared.roomSettingsScreenAllowChangingAccessSettings)
{
Section *promotionAccess = [Section sectionWithTag:SECTION_TAG_PROMOTION];
promotionAccess.headerTitle = VectorL10n.roomDetailsPromoteRoomTitle;
[promotionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_DIRECTORY_VISIBILITY];
[promotionAccess addRowWithTag:ROOM_SETTINGS_ROOM_PROMOTE_SECTION_ROW_SUGGEST];
[tmpSections addObject:promotionAccess];
}
if (RiotSettings.shared.roomSettingsScreenAllowChangingAccessSettings)
{
Section *promotionAccess = [Section sectionWithTag:SECTION_TAG_PROMOTION];
promotionAccess.headerTitle = VectorL10n.roomDetailsPromoteRoomTitle;
[promotionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_DIRECTORY_VISIBILITY];
[promotionAccess addRowWithTag:ROOM_SETTINGS_ROOM_PROMOTE_SECTION_ROW_SUGGEST];
[tmpSections addObject:promotionAccess];
}
}
@ -2610,46 +2578,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
{
guestAccess = mxRoomState.guestAccess;
}
if (row == ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_INVITED_ONLY)
{
roomAccessCell.label.text = [VectorL10n roomDetailsAccessSectionInvitedOnly];
roomAccessCell.enabled = ([joinRule isEqualToString:kMXRoomJoinRuleInvite]);
accessInvitedOnlyTickCell = roomAccessCell;
}
else if (row == ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE_APART_FROM_GUEST)
{
if (mxRoom.isDirect)
{
roomAccessCell.label.text = [VectorL10n roomDetailsAccessSectionAnyoneApartFromGuestForDm];
}
else
{
roomAccessCell.label.text = [VectorL10n roomDetailsAccessSectionAnyoneApartFromGuest];
}
roomAccessCell.enabled = ([joinRule isEqualToString:kMXRoomJoinRulePublic] && [guestAccess isEqualToString:kMXRoomGuestAccessForbidden]);
accessAnyoneApartGuestTickCell = roomAccessCell;
}
else if (row == ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE)
{
if (mxRoom.isDirect)
{
roomAccessCell.label.text = [VectorL10n roomDetailsAccessSectionAnyoneForDm];
}
else
{
roomAccessCell.label.text = [VectorL10n roomDetailsAccessSectionAnyone];
}
roomAccessCell.enabled = ([joinRule isEqualToString:kMXRoomJoinRulePublic] && [guestAccess isEqualToString:kMXRoomGuestAccessCanJoin]);
accessAnyoneTickCell = roomAccessCell;
}
// Check whether the user can change this option
roomAccessCell.userInteractionEnabled = (oneSelfPowerLevel >= [powerLevels minimumPowerLevelForSendingEventAsStateEvent:kMXEventTypeStringRoomJoinRules]);
roomAccessCell.checkBox.alpha = roomAccessCell.userInteractionEnabled ? 1.0f : 0.5f;
@ -3150,129 +3079,8 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
else if (section == SECTION_TAG_ACCESS)
{
BOOL isUpdated = NO;
if (row == ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_INVITED_ONLY)
{
// Ignore the selection if the option is already enabled
if (! accessInvitedOnlyTickCell.isEnabled)
{
// Enable this option
accessInvitedOnlyTickCell.enabled = YES;
// Disable other options
accessAnyoneApartGuestTickCell.enabled = NO;
accessAnyoneTickCell.enabled = NO;
// Check the actual option
if ([mxRoomState.joinRule isEqualToString:kMXRoomJoinRuleInvite])
{
// No change on room access
[updatedItemsDict removeObjectForKey:kRoomSettingsJoinRuleKey];
[updatedItemsDict removeObjectForKey:kRoomSettingsGuestAccessKey];
}
else
{
updatedItemsDict[kRoomSettingsJoinRuleKey] = kMXRoomJoinRuleInvite;
// Update guest access to allow guest on invitation.
// Note: if guest_access is "forbidden" here, guests cannot join this room even if explicitly invited.
if ([mxRoomState.guestAccess isEqualToString:kMXRoomGuestAccessCanJoin])
{
[updatedItemsDict removeObjectForKey:kRoomSettingsGuestAccessKey];
}
else
{
updatedItemsDict[kRoomSettingsGuestAccessKey] = kMXRoomGuestAccessCanJoin;
}
}
isUpdated = YES;
}
}
else if (row == ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE_APART_FROM_GUEST)
{
// Ignore the selection if the option is already enabled
if (! accessAnyoneApartGuestTickCell.isEnabled)
{
// Enable this option
accessAnyoneApartGuestTickCell.enabled = YES;
// Disable other options
accessInvitedOnlyTickCell.enabled = NO;
accessAnyoneTickCell.enabled = NO;
// Check the actual option
if ([mxRoomState.joinRule isEqualToString:kMXRoomJoinRulePublic] && [mxRoomState.guestAccess isEqualToString:kMXRoomGuestAccessForbidden])
{
// No change on room access
[updatedItemsDict removeObjectForKey:kRoomSettingsJoinRuleKey];
[updatedItemsDict removeObjectForKey:kRoomSettingsGuestAccessKey];
}
else
{
if ([mxRoomState.joinRule isEqualToString:kMXRoomJoinRulePublic])
{
[updatedItemsDict removeObjectForKey:kRoomSettingsJoinRuleKey];
}
else
{
updatedItemsDict[kRoomSettingsJoinRuleKey] = kMXRoomJoinRulePublic;
}
if ([mxRoomState.guestAccess isEqualToString:kMXRoomGuestAccessForbidden])
{
[updatedItemsDict removeObjectForKey:kRoomSettingsGuestAccessKey];
}
else
{
updatedItemsDict[kRoomSettingsGuestAccessKey] = kMXRoomGuestAccessForbidden;
}
}
isUpdated = YES;
}
}
else if (row == ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE)
{
// Ignore the selection if the option is already enabled
if (! accessAnyoneTickCell.isEnabled)
{
// Enable this option
accessAnyoneTickCell.enabled = YES;
// Disable other options
accessInvitedOnlyTickCell.enabled = NO;
accessAnyoneApartGuestTickCell.enabled = NO;
// Check the actual option
if ([mxRoomState.joinRule isEqualToString:kMXRoomJoinRulePublic] && [mxRoomState.guestAccess isEqualToString:kMXRoomGuestAccessCanJoin])
{
// No change on room access
[updatedItemsDict removeObjectForKey:kRoomSettingsJoinRuleKey];
[updatedItemsDict removeObjectForKey:kRoomSettingsGuestAccessKey];
}
else
{
if ([mxRoomState.joinRule isEqualToString:kMXRoomJoinRulePublic])
{
[updatedItemsDict removeObjectForKey:kRoomSettingsJoinRuleKey];
}
else
{
updatedItemsDict[kRoomSettingsJoinRuleKey] = kMXRoomJoinRulePublic;
}
if ([mxRoomState.guestAccess isEqualToString:kMXRoomGuestAccessCanJoin])
{
[updatedItemsDict removeObjectForKey:kRoomSettingsGuestAccessKey];
}
else
{
updatedItemsDict[kRoomSettingsGuestAccessKey] = kMXRoomGuestAccessCanJoin;
}
}
isUpdated = YES;
}
}
else if (row == ROOM_SETTINGS_ROOM_ACCESS_MISSING_ADDRESS_WARNING)
if (row == ROOM_SETTINGS_ROOM_ACCESS_MISSING_ADDRESS_WARNING)
{
// Scroll to room addresses section
NSIndexPath *addressIndexPath = [_tableViewSections exactIndexPathForRowTag:0 sectionTag:SECTION_TAG_ADDRESSES];
@ -3832,29 +3640,23 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
- (void)showRoomAccessFlow
{
if (@available(iOS 14.0, *))
{
MXRoom *room = [self.mainSession roomWithRoomId:self.roomId];
if (room) {
roomAccessPresenter = [[RoomAccessCoordinatorBridgePresenter alloc] initWithRoom:room parentSpaceId:self.parentSpaceId];
roomAccessPresenter.delegate = self;
[roomAccessPresenter presentFrom:self animated:YES];
}
MXRoom *room = [self.mainSession roomWithRoomId:self.roomId];
if (room) {
roomAccessPresenter = [[RoomAccessCoordinatorBridgePresenter alloc] initWithRoom:room parentSpaceId:self.parentSpaceId];
roomAccessPresenter.delegate = self;
[roomAccessPresenter presentFrom:self animated:YES];
}
}
- (void)showSuggestToSpaceMembers
{
if (@available(iOS 14.0, *))
{
MXRoom *room = [self.mainSession roomWithRoomId:self.roomId];
if (room) {
roomSuggestionPresenter = [[RoomSuggestionCoordinatorBridgePresenter alloc] initWithRoom:room];
roomSuggestionPresenter.delegate = self;
[roomSuggestionPresenter presentFrom:self animated:YES];
}
MXRoom *room = [self.mainSession roomWithRoomId:self.roomId];
if (room) {
roomSuggestionPresenter = [[RoomSuggestionCoordinatorBridgePresenter alloc] initWithRoom:room];
roomSuggestionPresenter.delegate = self;
[roomSuggestionPresenter presentFrom:self animated:YES];
}
}

View file

@ -25,8 +25,7 @@ class LocationPlainCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, Room
override func render(_ cellData: MXKCellData!) {
super.render(cellData)
guard #available(iOS 14.0, *),
let bubbleData = cellData as? RoomBubbleCellData,
guard let bubbleData = cellData as? RoomBubbleCellData,
let event = bubbleData.events.last
else {
return
@ -118,8 +117,7 @@ class LocationPlainCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, Room
roomCellContentView?.showSenderInfo = true
roomCellContentView?.showPaginationTitle = false
guard #available(iOS 14.0, *),
let contentView = roomCellContentView?.innerContentView else {
guard let contentView = roomCellContentView?.innerContentView else {
return
}

View file

@ -24,8 +24,7 @@ class PollPlainCell: SizableBaseRoomCell, RoomCellReactionsDisplayable, RoomCell
override func render(_ cellData: MXKCellData!) {
super.render(cellData)
guard #available(iOS 14.0, *),
let contentView = roomCellContentView?.innerContentView,
guard let contentView = roomCellContentView?.innerContentView,
let bubbleData = cellData as? RoomBubbleCellData,
let event = bubbleData.events.last,
event.eventType == __MXEventType.pollStart,

View file

@ -414,23 +414,13 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
{
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT];
}
if (@available(iOS 14.0, *)) {
// Don't display Global settings footer for iOS 14+
} else {
sectionNotificationSettings.footerTitle = [VectorL10n settingsGlobalSettingsInfo:AppInfo.current.displayName];
}
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_PIN_MISSED_NOTIFICATIONS_INDEX];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_PIN_UNREAD_INDEX];
if (@available(iOS 14.0, *)) {
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX];
} else {
// Don't add new sections on pre iOS 14
}
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX];
sectionNotificationSettings.headerTitle = [VectorL10n settingsNotifications];
[tmpSections addObject:sectionNotificationSettings];
@ -2941,18 +2931,16 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
}
else if (section == SECTION_TAG_NOTIFICATIONS)
{
if (@available(iOS 14.0, *)) {
switch (row) {
case NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenDefaultNotifications];
break;
case NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenMentionsAndKeywords];
break;
case NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenOther];
break;
}
switch (row) {
case NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenDefaultNotifications];
break;
case NOTIFICATION_SETTINGS_MENTION_AND_KEYWORDS_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenMentionsAndKeywords];
break;
case NOTIFICATION_SETTINGS_OTHER_SETTINGS_INDEX:
[self showNotificationSettings:NotificationSettingsScreenOther];
break;
}
}

View file

@ -260,7 +260,6 @@ final class SideMenuCoordinator: NSObject, SideMenuCoordinatorType {
self.spaceDetailPresenter.present(forSpaceWithId: spaceId, from: self.sideMenuViewController, sourceView: sourceView, session: session, animated: true)
}
@available(iOS 14.0, *)
private func showCreateSpace() {
guard let session = self.parameters.userSessionsService.mainUserSession?.matrixSession else {
return
@ -301,7 +300,6 @@ final class SideMenuCoordinator: NSObject, SideMenuCoordinatorType {
self.createRoomCoordinator = createRoomCoordinator
}
@available(iOS 14.0, *)
private func showSpaceSettings(spaceId: String, session: MXSession) {
let coordinator = SpaceSettingsModalCoordinator(parameters: SpaceSettingsModalCoordinatorParameters(session: session, spaceId: spaceId, parentSpaceId: nil))
coordinator.callback = { [weak self] result in
@ -432,9 +430,7 @@ extension SideMenuCoordinator: SpaceListCoordinatorDelegate {
}
func spaceListCoordinatorDidSelectCreateSpace(_ coordinator: SpaceListCoordinatorType) {
if #available(iOS 14.0, *) {
self.showCreateSpace()
}
self.showCreateSpace()
}
}
@ -462,11 +458,7 @@ extension SideMenuCoordinator: SpaceMenuPresenterDelegate {
case .addSpace:
AppDelegate.theDelegate().showAlert(withTitle: VectorL10n.spacesAddSpace, message: VectorL10n.spacesFeatureNotAvailable(AppInfo.current.displayName))
case .settings:
if #available(iOS 14.0, *) {
self.showSpaceSettings(spaceId: spaceId, session: session)
} else {
AppDelegate.theDelegate().showAlert(withTitle: VectorL10n.settingsTitle, message: VectorL10n.spacesFeatureNotAvailable(AppInfo.current.displayName))
}
self.showSpaceSettings(spaceId: spaceId, session: session)
case .invite:
self.showSpaceInvite(spaceId: spaceId, session: session)
}

View file

@ -167,10 +167,8 @@ final class SpaceListViewModel: SpaceListViewModelType {
]
let spacesSectionIndex = sections.count - 1
if #available(iOS 14.0, *) {
let addSpaceViewData = self.createAddSpaceViewData(session: session)
sections.append(.addSpace(addSpaceViewData))
}
let addSpaceViewData = self.createAddSpaceViewData(session: session)
sections.append(.addSpace(addSpaceViewData))
self.sections = sections
let homeIndexPath = viewDataList.invites.isEmpty ? IndexPath(row: 0, section: 0) : IndexPath(row: 0, section: 1)

View file

@ -100,7 +100,6 @@ class SpaceMenuPresenter: NSObject {
}
}
@available(iOS 14.0, *)
private func showLeaveSpace() {
let name = session.spaceService.getSpace(withId: spaceId)?.summary?.displayname ?? VectorL10n.spaceTag
@ -147,9 +146,7 @@ extension SpaceMenuPresenter: SpaceMenuModelViewModelCoordinatorDelegate {
case .invite:
self.delegate?.spaceMenuPresenter(self, didCompleteWith: .invite, forSpaceWithId: self.spaceId, with: self.session)
case .leaveSpaceAndChooseRooms:
if #available(iOS 14.0, *) {
self.showLeaveSpace()
}
self.showLeaveSpace()
default:
MXLog.error("[SpaceMenuPresenter] spaceListViewModel didSelectItem: invalid action \(action)")
}

View file

@ -85,22 +85,6 @@ class SpaceMenuViewModel: SpaceMenuViewModelType {
}
private func leaveSpace() {
guard #available(iOS 14, *) else {
guard let room = self.session.room(withRoomId: self.spaceId), let displayName = room.summary?.displayname else {
return
}
var isAdmin = false
if let roomState = room.dangerousSyncState, let powerLevels = roomState.powerLevels {
let powerLevel = powerLevels.powerLevelOfUser(withUserID: self.session.myUserId)
let roomPowerLevel = RoomPowerLevelHelper.roomPowerLevel(from: powerLevel)
isAdmin = roomPowerLevel == .admin
}
self.viewDelegate?.spaceMenuViewModel(self, didUpdateViewState: .leaveOptions(displayName, isAdmin))
return
}
self.viewDelegate?.spaceMenuViewModel(self, didUpdateViewState: .deselect)
self.coordinatorDelegate?.spaceMenuViewModel(self, didSelectItemWith: .leaveSpaceAndChooseRooms)
}

View file

@ -204,7 +204,6 @@ final class ExploreRoomCoordinator: NSObject, ExploreRoomCoordinatorType {
self.navigationRouter.present(coordinator, animated: true)
}
@available(iOS 14.0, *)
private func showSpaceSettings(of childInfo: MXSpaceChildInfo) {
let coordinator = SpaceSettingsModalCoordinator(parameters: SpaceSettingsModalCoordinatorParameters(session: session, spaceId: childInfo.childRoomId, parentSpaceId: spaceIdStack.last))
coordinator.callback = { [weak self] result in
@ -241,10 +240,6 @@ final class ExploreRoomCoordinator: NSObject, ExploreRoomCoordinatorType {
}
private func startEditPollCoordinator(room: MXRoom, startEvent: MXEvent? = nil) {
guard #available(iOS 14.0, *) else {
return
}
let parameters = PollEditFormCoordinatorParameters(room: room, pollStartEvent: startEvent)
let coordinator = PollEditFormCoordinator(parameters: parameters)
@ -284,9 +279,7 @@ extension ExploreRoomCoordinator: SpaceExploreRoomCoordinatorDelegate {
func spaceExploreRoomCoordinator(_ coordinator: SpaceExploreRoomCoordinatorType, openSettingsOf item: SpaceExploreRoomListItemViewData) {
if item.childInfo.roomType == .space {
if #available(iOS 14, *) {
self.showSpaceSettings(of: item.childInfo)
}
self.showSpaceSettings(of: item.childInfo)
} else {
if !presentSettings(ofRoomWithId: item.childInfo.childRoomId) {
self.navigateTo(roomWith: item.childInfo.childRoomId, showSettingsInitially: true, animated: true)
@ -439,18 +432,10 @@ extension ExploreRoomCoordinator: RoomViewControllerDelegate {
}
func roomViewController(_ roomViewController: RoomViewController, canEditPollWithEventIdentifier eventIdentifier: String) -> Bool {
guard #available(iOS 14.0, *) else {
return false
}
return TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.canEditPoll() ?? false
}
func roomViewController(_ roomViewController: RoomViewController, endPollWithEventIdentifier eventIdentifier: String) {
guard #available(iOS 14.0, *) else {
return
}
TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.endPoll()
}
@ -459,10 +444,6 @@ extension ExploreRoomCoordinator: RoomViewControllerDelegate {
}
func roomViewController(_ roomViewController: RoomViewController, canEndPollWithEventIdentifier eventIdentifier: String) -> Bool {
guard #available(iOS 14.0, *) else {
return false
}
return TimelinePollProvider.shared.timelinePollCoordinatorForEventIdentifier(eventIdentifier)?.canEndPoll() ?? false
}

View file

@ -17,11 +17,9 @@
import SwiftUI
import Combine
@available(iOS 14, *)
typealias AnalyticsPromptViewModelType = StateStoreViewModel<AnalyticsPromptViewState,
Never,
AnalyticsPromptViewAction>
@available(iOS 14, *)
class AnalyticsPromptViewModel: AnalyticsPromptViewModelType {
// MARK: - Properties

View file

@ -31,7 +31,6 @@ final class AnalyticsPromptCoordinator: Coordinator, Presentable {
private let analyticsPromptHostingController: UIViewController
private var _analyticsPromptViewModel: Any? = nil
@available(iOS 14.0, *)
fileprivate var analyticsPromptViewModel: AnalyticsPromptViewModel {
return _analyticsPromptViewModel as! AnalyticsPromptViewModel
}
@ -44,7 +43,6 @@ final class AnalyticsPromptCoordinator: Coordinator, Presentable {
// MARK: - Setup
@available(iOS 14.0, *)
init(parameters: AnalyticsPromptCoordinatorParameters) {
self.parameters = parameters
@ -67,11 +65,6 @@ final class AnalyticsPromptCoordinator: Coordinator, Presentable {
// MARK: - Public
func start() {
guard #available(iOS 14.0, *) else {
MXLog.debug("[AnalyticsPromptCoordinator] start: Invalid iOS version, returning.")
return
}
MXLog.debug("[AnalyticsPromptCoordinator] did start.")
analyticsPromptViewModel.completion = { [weak self] result in

View file

@ -17,7 +17,6 @@
import Foundation
import UIKit
@available(iOS 14.0, *)
struct AnalyticsPromptStrings: AnalyticsPromptStringsProtocol {
let point1 = HTMLFormatter.formatHTML(VectorL10n.analyticsPromptPoint1,
withAllowedTags: ["b", "p"],

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockAnalyticsPromptScreenState: MockScreenState, CaseIterable {
/// The type of prompt to display.
case promptType(AnalyticsPromptType)

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class AnalyticsPromptUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// A prompt that asks the user whether they would like to enable Analytics or not.
struct AnalyticsPrompt: View {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct AnalyticsPromptCheckmarkItem: View {
// MARK: - Properties
@ -75,7 +74,6 @@ struct AnalyticsPromptCheckmarkItem: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct AnalyticsPromptCheckmarkItem_Previews: PreviewProvider {
static let strings = MockAnalyticsPromptStrings()

View file

@ -28,7 +28,6 @@ enum AuthenticationChoosePasswordCoordinatorResult {
case cancel
}
@available(iOS 14.0, *)
final class AuthenticationChoosePasswordCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockAuthenticationChoosePasswordScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -29,7 +29,6 @@ enum AuthenticationForgotPasswordCoordinatorResult {
case cancel
}
@available(iOS 14.0, *)
final class AuthenticationForgotPasswordCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockAuthenticationForgotPasswordScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -49,7 +49,6 @@ enum AuthenticationSoftLogoutCoordinatorResult: CustomStringConvertible {
}
}
@available(iOS 14.0, *)
final class AuthenticationSoftLogoutCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockAuthenticationSoftLogoutScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -21,7 +21,6 @@ struct AuthenticationVerifyEmailCoordinatorParameters {
let registrationWizard: RegistrationWizard
}
@available(iOS 14.0, *)
final class AuthenticationVerifyEmailCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockAuthenticationVerifyEmailScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockAuthenticationVerifyMsisdnScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// A visual cue to user that something is in progress.
struct ActivityIndicator: View {
@ -34,7 +33,6 @@ struct ActivityIndicator: View {
}
}
@available(iOS 14.0, *)
struct ActivityIndicator_Previews: PreviewProvider {
static var previews: some View {
Group {

View file

@ -17,7 +17,6 @@
import Foundation
import SwiftUI
@available(iOS 14.0, *)
/// A modifier for showing the activity indicator centered over a view.
struct ActivityIndicatorModifier: ViewModifier {
var show: Bool
@ -36,9 +35,7 @@ struct ActivityIndicatorModifier: ViewModifier {
}
}
@available(iOS 14.0, *)
extension View {
@available(iOS 14.0, *)
func activityIndicator(show: Bool) -> some View {
self.modifier(ActivityIndicatorModifier(show: show))
}

View file

@ -48,7 +48,6 @@ class AvatarService: AvatarServiceProtocol {
/// - mxContentUri: matrix uri of the avatar to fetch
/// - avatarSize: The size of avatar to retrieve as defined in the DesignKit spec.
/// - Returns: A Future of UIImage that returns an error if it fails to fetch the image.
@available(iOS 14.0, *)
func avatarImage(mxContentUri: String, avatarSize: AvatarSize) -> Future<UIImage, Error> {
let cachePath = MXMediaManager.thumbnailCachePath(

View file

@ -19,7 +19,6 @@ import Combine
import DesignKit
import UIKit
@available(iOS 14.0, *)
class MockAvatarService: AvatarServiceProtocol {
static let example: AvatarServiceProtocol = MockAvatarService()
func avatarImage(mxContentUri: String, avatarSize: AvatarSize) -> Future<UIImage, Error> {

View file

@ -17,7 +17,6 @@
import SwiftUI
import DesignKit
@available(iOS 14.0, *)
struct AvatarImage: View {
@Environment(\.theme) var theme: ThemeSwiftUI
@ -57,7 +56,6 @@ struct AvatarImage: View {
}
}
@available(iOS 14.0, *)
extension AvatarImage {
init(avatarData: AvatarInputProtocol, size: AvatarSize) {
self.init(
@ -69,7 +67,6 @@ extension AvatarImage {
}
}
@available(iOS 14.0, *)
extension AvatarImage {
func border(color: Color) -> some View {
modifier(BorderModifier(color: color, borderWidth: 3, shape: Circle()))
@ -82,7 +79,6 @@ extension AvatarImage {
}
}
@available(iOS 14.0, *)
struct AvatarImage_Previews: PreviewProvider {
static let mxContentUri = "fakeUri"
static let name = "Alice"

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// A reusable view that will show a standard placeholder avatar with the
/// supplied character and colour index for the `namesAndAvatars` color array.
///
@ -50,7 +49,6 @@ struct PlaceholderAvatarImage: View {
}
}
@available(iOS 14.0, *)
struct Previews_TemplateAvatarImage_Previews: PreviewProvider {
static var previews: some View {
PlaceholderAvatarImage(firstCharacter: "X", colorIndex: 1)

View file

@ -17,7 +17,6 @@
import SwiftUI
import DesignKit
@available(iOS 14.0, *)
struct SpaceAvatarImage: View {
@Environment(\.theme) var theme: ThemeSwiftUI
@ -73,7 +72,6 @@ struct SpaceAvatarImage: View {
}
}
@available(iOS 14.0, *)
extension SpaceAvatarImage {
init(avatarData: AvatarInputProtocol, size: AvatarSize) {
self.init(
@ -85,7 +83,6 @@ extension SpaceAvatarImage {
}
}
@available(iOS 14.0, *)
struct LiveAvatarImage_Previews: PreviewProvider {
static let mxContentUri = "fakeUri"
static let name = "Alice"

View file

@ -22,6 +22,5 @@ import UIKit
/// Provides a simple api to retrieve and cache avatar images
protocol AvatarServiceProtocol {
@available(iOS 14.0, *)
func avatarImage(mxContentUri: String, avatarSize: AvatarSize) -> Future<UIImage, Error>
}

View file

@ -18,7 +18,6 @@ import Foundation
import Combine
import DesignKit
@available(iOS 14.0, *)
/// Simple ViewModel that supports loading an avatar image
class AvatarViewModel: InjectableObject, ObservableObject {

View file

@ -19,7 +19,6 @@ import SwiftUI
/// A Modifier to be called from the top-most SwiftUI view before being added to a HostViewController.
///
/// Provides any app level configuration the SwiftUI hierarchy might need (E.g. to monitor theme changes).
@available(iOS 14.0, *)
struct VectorContentModifier: ViewModifier {
@ObservedObject private var themePublisher = ThemePublisher.shared
@ -38,7 +37,6 @@ struct VectorContentModifier: ViewModifier {
}
}
@available(iOS 14.0, *)
extension View {
func vectorContent() -> some View {
self.modifier(VectorContentModifier())

View file

@ -25,7 +25,6 @@ private struct DependencyContainerKey: EnvironmentKey {
static let defaultValue = DependencyContainer()
}
@available(iOS 14.0, *)
extension EnvironmentValues {
var dependencies: DependencyContainer {
get { self[DependencyContainerKey.self] }
@ -33,7 +32,6 @@ extension EnvironmentValues {
}
}
@available(iOS 14.0, *)
extension View {
/// A modifier for adding a dependency to the SwiftUI view hierarchy's dependency container.

View file

@ -17,7 +17,6 @@
import SceneKit
import SwiftUI
@available(iOS 14.0, *)
class EffectsScene: SCNScene {
// MARK: - Constants
@ -61,7 +60,6 @@ class EffectsScene: SCNScene {
}
}
@available(iOS 14.0, *)
fileprivate extension Color {
/// The color's components as an array of floats in the extended linear sRGB colorspace.
///

View file

@ -17,7 +17,6 @@
import SwiftUI
import SceneKit
@available(iOS 14.0, *)
/// A SwiftUI wrapper around `SCNView`, that unlike `SceneView` allows the
/// scene to have a transparent background and be rendered on top of other views.
struct EffectsView: UIViewRepresentable {

View file

@ -17,7 +17,6 @@
import Foundation
import Combine
@available(iOS 14.0, *)
extension Publisher where Failure == Never {
/// Same as `assign(to:on:)` but maintains a weak reference to object
///

View file

@ -17,7 +17,6 @@
import Foundation
/// The static list of mocked screens in RiotSwiftUI
@available(iOS 14.0, *)
enum MockAppScreens {
static let appScreens: [MockScreenState.Type] = [
MockLiveLocationSharingViewerScreenState.self,

View file

@ -17,14 +17,12 @@
import SwiftUI
/// Used for mocking top level screens and their various states.
@available(iOS 14.0, *)
protocol MockScreenState {
static var screenStates: [MockScreenState] { get }
var screenType: Any.Type { get }
var screenView: ([Any], AnyView) { get }
}
@available(iOS 14.0, *)
extension MockScreenState {
/// Get a list of the screens for every screen state.
@ -60,7 +58,6 @@ extension MockScreenState {
}
}
@available(iOS 14.0, *)
extension MockScreenState where Self: CaseIterable {
static var screenStates: [MockScreenState] {
return Array(self.allCases)

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct ScreenList: View {
private var allStates: [ScreenStateInfo]
@ -49,7 +48,6 @@ struct ScreenList: View {
}
}
@available(iOS 14.0, *)
struct ScreenList_Previews: PreviewProvider {
static var previews: some View {
ScreenList(screens: [MockTemplateUserProfileScreenState.self])

View file

@ -17,7 +17,6 @@
import Foundation
import SwiftUI
@available(iOS 14.0, *)
struct ScreenStateInfo {
var dependencies: [Any]
var view: AnyView

View file

@ -17,7 +17,6 @@
import Foundation
import SwiftUI
@available(iOS 14.0, *)
class StateRenderer {
var states: [ScreenStateInfo]
init(states: [ScreenStateInfo]) {

View file

@ -21,7 +21,6 @@ import RiotSwiftUI
/// Creates a test case for each screen state, launches the app,
/// goes to the correct screen and provides the state and key for each
/// invocation of the test.
@available(iOS 14.0, *)
class MockScreenTest: XCTestCase {
enum Constants {

View file

@ -17,7 +17,6 @@
import XCTest
import Combine
@available(iOS 14.0, *)
extension XCTestCase {
/// XCTest utility to wait for results from publishers, so that the output can be used for assertions.
///

View file

@ -17,7 +17,6 @@
import Foundation
import DesignKit
@available(iOS 14.0, *)
extension ThemeIdentifier {
fileprivate static let defaultTheme = DefaultThemeSwiftUI()
fileprivate static let darkTheme = DarkThemeSwiftUI()

View file

@ -18,12 +18,10 @@ import Foundation
import SwiftUI
import DesignKit
@available(iOS 14.0, *)
private struct ThemeKey: EnvironmentKey {
static let defaultValue = ThemePublisher.shared.theme
}
@available(iOS 14.0, *)
extension EnvironmentValues {
var theme: ThemeSwiftUI {
get { self[ThemeKey.self] }
@ -31,7 +29,6 @@ extension EnvironmentValues {
}
}
@available(iOS 14.0, *)
extension View {
/// A theme modifier for setting the theme for this view and all its descendants in the hierarchy.
/// - Parameter theme: A theme to be set as the environment value.
@ -41,7 +38,6 @@ extension View {
}
}
@available(iOS 14.0, *)
extension View {
/// A theme modifier for setting the theme by id for this view and all its descendants in the hierarchy.
/// - Parameter themeId: ThemeIdentifier of a theme to be set as the environment value.

View file

@ -21,7 +21,6 @@ import Combine
///
/// Replaces the old ThemeObserver. Riot app can push updates to this class
/// removing the dependency of this class on the `ThemeService`.
@available(iOS 14.0, *)
class ThemePublisher: ObservableObject {
private static var _shared: ThemePublisher? = nil

View file

@ -17,7 +17,6 @@
import Foundation
import DesignKit
@available(iOS 14.0, *)
protocol ThemeSwiftUI: ThemeSwiftUIType {
var identifier: ThemeIdentifier { get }
var isDark: Bool { get }

View file

@ -17,7 +17,6 @@
import Foundation
import SwiftUI
@available(iOS 14.0, *)
extension ThemeSwiftUI {
/// Get the stable display user color based on userId.

View file

@ -17,7 +17,6 @@
import Foundation
import DesignKit
@available(iOS 14.0, *)
struct DarkThemeSwiftUI: ThemeSwiftUI {
var identifier: ThemeIdentifier = .dark
let isDark: Bool = true

View file

@ -17,7 +17,6 @@
import Foundation
import DesignKit
@available(iOS 14.0, *)
struct DefaultThemeSwiftUI: ThemeSwiftUI {
var identifier: ThemeIdentifier = .light
let isDark: Bool = false

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct BorderModifier<Shape: InsettableShape>: ViewModifier {
var color: Color
@ -29,7 +28,6 @@ struct BorderModifier<Shape: InsettableShape>: ViewModifier {
}
}
@available(iOS 14.0, *)
extension View {
func shapedBorder<Shape: InsettableShape>(color: Color, borderWidth: CGFloat, shape: Shape) -> some View {
modifier(BorderModifier(color: color, borderWidth: borderWidth, shape: shape))

View file

@ -18,7 +18,6 @@ import Foundation
import SwiftUI
import Introspect
@available(iOS 14.0, *)
/// A bordered style of text input
///
/// As defined in:
@ -90,7 +89,6 @@ struct BorderedInputFieldStyle: TextFieldStyle {
}
}
@available(iOS 14.0, *)
struct BorderedInputFieldStyle_Previews: PreviewProvider {
static var previews: some View {
Group {

View file

@ -78,7 +78,6 @@ struct InlineTextButton: View {
}
}
@available(iOS 14.0, *)
struct Previews_InlineButtonText_Previews: PreviewProvider {
static var previews: some View {
InlineTextButton("Hello there this is a sentence. %@.",

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct MultilineTextField: View {
@Environment(\.theme) private var theme: ThemeSwiftUI
@ -92,7 +91,6 @@ struct MultilineTextField: View {
}
}
@available(iOS 14.0, *)
fileprivate struct UITextViewWrapper: UIViewRepresentable {
typealias UIViewType = UITextView
@ -172,7 +170,6 @@ fileprivate struct UITextViewWrapper: UIViewRepresentable {
}
}
@available(iOS 14.0, *)
struct MultilineTextField_Previews: PreviewProvider {
static var previews: some View {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct OptionButton: View {
// MARK: - Style
@ -70,7 +69,6 @@ struct OptionButton: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct OptionButton_Previews: PreviewProvider {
static var previews: some View {
Group {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct PrimaryActionButtonStyle: ButtonStyle {
@Environment(\.theme) private var theme
@Environment(\.isEnabled) private var isEnabled
@ -48,7 +47,6 @@ struct PrimaryActionButtonStyle: ButtonStyle {
}
}
@available(iOS 14.0, *)
struct PrimaryActionButtonStyle_Previews: PreviewProvider {
static var buttons: some View {
Group {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct RadioButton: View {
// MARK: - Properties
@ -51,7 +50,6 @@ struct RadioButton: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct RadioButton_Previews: PreviewProvider {
static var previews: some View {
Group {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct RoundedBorderTextEditor: View {
// MARK: - Properties
@ -100,7 +99,6 @@ struct RoundedBorderTextEditor: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct ThemableTextEditor_Previews: PreviewProvider {
static var previews: some View {

View file

@ -17,7 +17,6 @@
import Foundation
import SwiftUI
@available(iOS 14.0, *)
struct RoundedCornerShape: Shape {
let radius: CGFloat

View file

@ -21,7 +21,6 @@ import SwiftUI
https://stackoverflow.com/q/65375372
Replace with Swift 5.5 bindings enumerator later.
*/
@available(iOS 14.0, *)
struct SafeBindingCollectionEnumerator<T: RandomAccessCollection & MutableCollection, C: View>: View {
typealias BoundElement = Binding<T.Element>

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// `ScreenTrackerViewModifier` is a helper class used to track PostHog screen from SwiftUI screens.
struct ScreenTrackerViewModifier: ViewModifier {
let screen: AnalyticsScreen
@ -32,7 +31,6 @@ struct ScreenTrackerViewModifier: ViewModifier {
}
}
@available(iOS 14.0, *)
extension View {
func track(screen: AnalyticsScreen) -> some View {
return self.modifier(ScreenTrackerViewModifier(screen: screen))

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct SearchBar: View {
// MARK: - Properties

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct SecondaryActionButtonStyle: ButtonStyle {
@Environment(\.theme) private var theme
@Environment(\.isEnabled) private var isEnabled
@ -41,7 +40,6 @@ struct SecondaryActionButtonStyle: ButtonStyle {
}
}
@available(iOS 14.0, *)
struct SecondaryActionButtonStyle_Previews: PreviewProvider {
static var theme: ThemeSwiftUI = DefaultThemeSwiftUI()

View file

@ -81,7 +81,6 @@ struct StyledText: View {
}
@available(iOS 14.0, *)
struct StyledText_Previews: PreviewProvider {
static func prettyText() -> NSAttributedString {
let string = NSMutableAttributedString(string: "T", attributes: [

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct ThemableButton: View {
// MARK: - Style
@ -64,7 +63,6 @@ struct ThemableButton: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct ThemableButton_Previews: PreviewProvider {
static var previews: some View {
Group {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct ThemableNavigationBar: View {
// MARK: - Style
@ -65,7 +64,6 @@ struct ThemableNavigationBar: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct NavigationBar_Previews: PreviewProvider {
static var previews: some View {
Group {

View file

@ -17,7 +17,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct ThemableTextEditor: UIViewRepresentable {
// MARK: Properties
@ -128,7 +127,6 @@ struct ThemableTextEditor: UIViewRepresentable {
// MARK: - modifiers
@available(iOS 14.0, *)
extension ThemableTextEditor {
func keyboardType(_ type: UIKeyboardType) -> ThemableTextEditor {
textView.keyboardType = type

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// A modifier for showing the wait overlay view over a view.
struct WaitOverlayModifier: ViewModifier {
@ -34,16 +33,13 @@ struct WaitOverlayModifier: ViewModifier {
}
}
@available(iOS 14.0, *)
extension View {
@available(iOS 14.0, *)
func waitOverlay(show: Bool, message: String? = nil, allowUserInteraction: Bool = true) -> some View {
self.modifier(WaitOverlayModifier(allowUserInteraction: allowUserInteraction, show: show, message: message))
}
}
/// `WaitOverlay` allows to easily add an overlay that covers the entire with an `ActivityIndicator` at the center
@available(iOS 14.0, *)
struct WaitOverlay: ViewModifier {
// MARK: - Properties
@ -103,7 +99,6 @@ struct WaitOverlay: ViewModifier {
}
}
@available(iOS 14.0, *)
struct WaitOverlay_Previews: PreviewProvider {
static var previews: some View {
Group {

View file

@ -17,7 +17,6 @@
import SwiftUI
/// A SwiftUI `PreferenceKey` for `CGRect` values such as a view's frame.
@available(iOS 14.0, *)
struct FramePreferenceKey: PreferenceKey {
static var defaultValue: CGRect = .zero

View file

@ -26,7 +26,6 @@ import SwiftUI
/// SomeView()
/// .background(ViewFrameReader(frame: $frame))
/// ```
@available(iOS 14.0, *)
struct ViewFrameReader: View {
@Binding var frame: CGRect

View file

@ -33,7 +33,6 @@ import Combine
/// A similar approach is taken in libraries like [CombineFeedback](https://github.com/sergdort/CombineFeedback).
/// It provides a nice layer of consistency and also safety. As we are not passing the `ViewModel` to the view directly, shortcuts/hacks
/// can't be made into the `ViewModel`.
@available(iOS 14, *)
@dynamicMemberLookup
class ViewModelContext<ViewState:BindableState, ViewAction>: ObservableObject {
// MARK: - Properties
@ -75,7 +74,6 @@ class ViewModelContext<ViewState:BindableState, ViewAction>: ObservableObject {
/// a specific portion of state that can be safely bound to.
/// If we decide to add more features to our state management (like doing state processing off the main thread)
/// we can do it in this centralised place.
@available(iOS 14, *)
class StateStoreViewModel<State: BindableState, StateAction, ViewAction> {
typealias Context = ViewModelContext<State, ViewAction>

View file

@ -35,7 +35,6 @@ struct OnboardingIconImage: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct OnboardingIconImage_Previews: PreviewProvider {
static var previews: some View {
OnboardingIconImage(image: Asset.Images.authenticationEmailIcon)

View file

@ -44,7 +44,6 @@ final class LiveLocationSharingViewerCoordinator: Coordinator, Presentable {
// MARK: - Setup
@available(iOS 14.0, *)
init(parameters: LiveLocationSharingViewerCoordinatorParameters) {
self.parameters = parameters

View file

@ -29,7 +29,6 @@ enum LiveLocationSharingViewerViewModelResult {
// MARK: View
@available(iOS 14, *)
struct LiveLocationSharingViewerViewState: BindableState {
/// Map style URL

View file

@ -18,11 +18,9 @@ import SwiftUI
import Combine
import Mapbox
@available(iOS 14, *)
typealias LiveLocationSharingViewerViewModelType = StateStoreViewModel<LiveLocationSharingViewerViewState,
Never,
LiveLocationSharingViewerViewAction>
@available(iOS 14, *)
class LiveLocationSharingViewerViewModel: LiveLocationSharingViewerViewModelType, LiveLocationSharingViewerViewModelProtocol {
// MARK: - Properties

View file

@ -19,6 +19,5 @@ import Foundation
protocol LiveLocationSharingViewerViewModelProtocol {
var completion: ((LiveLocationSharingViewerViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
var context: LiveLocationSharingViewerViewModelType.Context { get }
}

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockLiveLocationSharingViewerScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -18,7 +18,6 @@ import Foundation
import Combine
import CoreLocation
@available(iOS 14.0, *)
protocol LiveLocationSharingViewerServiceProtocol {
/// All shared users live location

View file

@ -18,7 +18,6 @@ import Foundation
import CoreLocation
import MatrixSDK
@available(iOS 14.0, *)
class LiveLocationSharingViewerService: LiveLocationSharingViewerServiceProtocol {
// MARK: - Properties

View file

@ -18,7 +18,6 @@ import Foundation
import Combine
import CoreLocation
@available(iOS 14.0, *)
class MockLiveLocationSharingViewerService: LiveLocationSharingViewerServiceProtocol {
// MARK: Properties

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class LiveLocationSharingViewerUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -19,7 +19,6 @@ import Combine
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class LiveLocationSharingViewerViewModelTests: XCTestCase {
var service: MockLiveLocationSharingViewerService!

Some files were not shown because too many files have changed in this diff Show more