Merge pull request #4321 from vector-im/spaces_beta

Merge spaces beta branch to develop
This commit is contained in:
SBiOSoftWhare 2021-05-12 09:21:22 +02:00 committed by GitHub
commit 4a7ee3276b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 802 additions and 28 deletions

View file

@ -38,6 +38,9 @@ Changes in 1.3.6 (2021-05-07)
* Add Jitsi widget remove banner for privileged users.
* Update "Jump to unread" banner to a pill style button.
* CallVC: Add transfer button.
* Spaces: Hide spaces from room list and home but keep space invites (#4252).
* Spaces: Show space invites and advertise that they are not available (#4277).
* Advertise that spaces are not available when tapping on a space link or a space invite (#4279).
🐛 Bugfix
* RoomVC: Avoid navigation to integration management using integration popup with settings set to integration disabled (#4261).

View file

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "feature_unavaible_artwork.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "feature_unavaible_artwork@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "feature_unavaible_artwork@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "feature_unavaible_artwork_dark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "feature_unavaible_artwork_dark@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "feature_unavaible_artwork_dark@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -1632,3 +1632,14 @@ Tap the + to start adding people.";
"room_intro_cell_information_dm_sentence2" = "Only the two of you are in this conversation, no one else can join.";
"room_intro_cell_information_multiple_dm_sentence2" = "Only you are in this conversation, unless any of you invites someone to join.";
// Mark: - Spaces
"space_feature_unavailable_title" = "Spaces arent here yet";
"space_feature_unavailable_subtitle" = "Spaces aren't on iOS yet, but you can use them now on Web and Desktop";
"space_feature_unavailable_information" = "Spaces are a new way to group rooms and people.\n\nTheyll be here soon. For now, if you join one on another platform, you will be able to access any rooms you join here.";
"space_beta_announce_badge" = "BETA";
"space_beta_announce_title" = "Spaces are coming soon";
"space_beta_announce_subtitle" = "The new version of communities";
"space_beta_announce_information" = "Spaces are a new way to group rooms and people. Theyre not on iOS yet, but you can use them now on Web and Desktop.";

View file

@ -33,6 +33,11 @@ extension UITableViewCell {
return result
}
// Hide separator for one cell, otherwise use `tableView.separatorStyle = .none`
@objc func vc_hideSeparator() {
self.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: .greatestFiniteMagnitude)
}
@objc func vc_setAccessoryDisclosureIndicator(withTintColor tintColor: UIColor) {
let disclosureImage = Asset.Images.disclosureIcon.image.withRenderingMode(.alwaysTemplate)
let disclosureImageView = UIImageView(image: disclosureImage)

View file

@ -158,6 +158,8 @@ internal enum Asset {
internal static let secretsResetWarning = ImageAsset(name: "secrets_reset_warning")
internal static let removeIconPink = ImageAsset(name: "remove_icon_pink")
internal static let settingsIcon = ImageAsset(name: "settings_icon")
internal static let featureUnavaibleArtwork = ImageAsset(name: "feature_unavaible_artwork")
internal static let featureUnavaibleArtworkDark = ImageAsset(name: "feature_unavaible_artwork_dark")
internal static let tabFavourites = ImageAsset(name: "tab_favourites")
internal static let tabGroups = ImageAsset(name: "tab_groups")
internal static let tabHome = ImageAsset(name: "tab_home")

View file

@ -229,6 +229,11 @@ internal enum StoryboardScene {
internal static let initialScene = InitialSceneType<Riot.SimpleScreenTemplateViewController>(storyboard: SimpleScreenTemplateViewController.self)
}
internal enum SpaceFeatureUnaivableViewController: StoryboardType {
internal static let storyboardName = "SpaceFeatureUnaivableViewController"
internal static let initialScene = InitialSceneType<Riot.SpaceFeatureUnaivableViewController>(storyboard: SpaceFeatureUnaivableViewController.self)
}
internal enum TemplateScreenViewController: StoryboardType {
internal static let storyboardName = "TemplateScreenViewController"

View file

@ -4562,6 +4562,34 @@ internal enum VectorL10n {
internal static var socialLoginListTitleSignUp: String {
return VectorL10n.tr("Vector", "social_login_list_title_sign_up")
}
/// BETA
internal static var spaceBetaAnnounceBadge: String {
return VectorL10n.tr("Vector", "space_beta_announce_badge")
}
/// Spaces are a new way to group rooms and people. Theyre not on iOS yet, but you can use them now on Web and Desktop.
internal static var spaceBetaAnnounceInformation: String {
return VectorL10n.tr("Vector", "space_beta_announce_information")
}
/// The new version of communities
internal static var spaceBetaAnnounceSubtitle: String {
return VectorL10n.tr("Vector", "space_beta_announce_subtitle")
}
/// Spaces are coming soon
internal static var spaceBetaAnnounceTitle: String {
return VectorL10n.tr("Vector", "space_beta_announce_title")
}
/// Spaces are a new way to group rooms and people.\n\nTheyll be here soon. For now, if you join one on another platform, you will be able to access any rooms you join here.
internal static var spaceFeatureUnavailableInformation: String {
return VectorL10n.tr("Vector", "space_feature_unavailable_information")
}
/// Spaces aren't on iOS yet, but you can use them now on Web and Desktop
internal static var spaceFeatureUnavailableSubtitle: String {
return VectorL10n.tr("Vector", "space_feature_unavailable_subtitle")
}
/// Spaces arent here yet
internal static var spaceFeatureUnavailableTitle: String {
return VectorL10n.tr("Vector", "space_feature_unavailable_title")
}
/// Start
internal static var start: String {
return VectorL10n.tr("Vector", "start")

View file

@ -79,6 +79,7 @@ final class RiotSettings: NSObject {
static let roomInfoScreenShowIntegrations = "roomInfoScreenShowIntegrations"
static let roomMemberScreenShowIgnore = "roomMemberScreenShowIgnore"
static let unifiedSearchScreenShowPublicDirectory = "unifiedSearchScreenShowPublicDirectory"
static let hideSpaceBetaAnnounce = "hideSpaceBetaAnnounce"
}
static let shared = RiotSettings()
@ -707,4 +708,13 @@ final class RiotSettings: NSObject {
}
}
// MARK: - Beta
var hideSpaceBetaAnnounce: Bool {
get {
return defaults.bool(forKey: UserDefaultsKeys.hideSpaceBetaAnnounce)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.hideSpaceBetaAnnounce)
}
}
}

View file

@ -224,6 +224,38 @@ UINavigationControllerDelegate
*/
- (BOOL)handleUniversalLinkFragment:(NSString*)fragment;
/**
Process the fragment part of a vector.im link.
@param fragment the fragment part of the universal link.
@param universalLinkURL the unprocessed the universal link URL (optional).
@return YES in case of processing success.
*/
- (BOOL)handleUniversalLinkFragment:(NSString*)fragment fromURL:(NSURL*)universalLinkURL;
/**
Process the URL of a vector.im link.
@param universalLinkURL the universal link URL.
@return YES in case of processing success.
*/
- (BOOL)handleUniversalLinkURL:(NSURL*)universalLinkURL;
#pragma mark - Jitsi call
/**
Open the Jitsi view controller from a widget.
@param jitsiWidget the jitsi widget.
@param video to indicate voice or video call.
*/
- (void)displayJitsiViewControllerWithWidget:(Widget*)jitsiWidget andVideo:(BOOL)video;
/**
The current Jitsi view controller being displayed.
*/
@property (nonatomic, readonly) JitsiViewController *jitsiViewController;
#pragma mark - Call status handling
/**

View file

@ -228,6 +228,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
@property (nonatomic, strong) MajorUpdateManager *majorUpdateManager;
@property (nonatomic, strong) SpaceFeatureUnavailablePresenter *spaceFeatureUnavailablePresenter;
@end
@implementation LegacyAppDelegate
@ -461,6 +463,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
self.pushNotificationStore = [PushNotificationStore new];
self.pushNotificationService = [[PushNotificationService alloc] initWithPushNotificationStore:self.pushNotificationStore];
self.pushNotificationService.delegate = self;
self.spaceFeatureUnavailablePresenter = [SpaceFeatureUnavailablePresenter new];
// Add matrix observers, and initialize matrix sessions if the app is not launched in background.
[self initMatrixSessions];
@ -1212,7 +1216,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// Continue the registration with the passed nextLink
NSLog(@"[AppDelegate] handleUniversalLink. Complete registration with nextLink");
NSURL *nextLink = [NSURL URLWithString:queryParams[@"nextLink"]];
[self handleUniversalLinkFragment:nextLink.fragment];
[self handleUniversalLinkFragment:nextLink.fragment fromURL:nextLink];
}
else
{
@ -1238,10 +1242,15 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
return YES;
}
return [self handleUniversalLinkFragment:webURL.fragment];
return [self handleUniversalLinkFragment:webURL.fragment fromURL:webURL];
}
- (BOOL)handleUniversalLinkFragment:(NSString*)fragment
{
return [self handleUniversalLinkFragment:fragment fromURL:nil];
}
- (BOOL)handleUniversalLinkFragment:(NSString*)fragment fromURL:(NSURL*)universalLinkURL
{
BOOL continueUserActivity = NO;
MXKAccountManager *accountManager = [MXKAccountManager sharedManager];
@ -1325,19 +1334,32 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
if (account)
{
NSString *roomId = roomIdOrAlias;
MXRoom *room;
// Translate the alias into the room id
if ([roomIdOrAlias hasPrefix:@"#"])
{
MXRoom *room = [account.mxSession roomWithAlias:roomIdOrAlias];
room = [account.mxSession roomWithAlias:roomIdOrAlias];
if (room)
{
roomId = room.roomId;
}
}
else
{
room = [account.mxSession roomWithRoomId:roomId];
}
// Open the room page
[self showRoom:roomId andEventId:eventId withMatrixSession:account.mxSession];
if (room.summary.roomType == MXRoomTypeSpace)
{
// Indicates that spaces are not supported
[self.spaceFeatureUnavailablePresenter presentUnavailableFeatureFrom:self.presentedViewController animated:YES];
}
else
{
// Open the room page
[self showRoom:roomId andEventId:eventId withMatrixSession:account.mxSession];
}
continueUserActivity = YES;
}
@ -1387,7 +1409,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
{
universalLinkFragmentPendingRoomAlias = @{roomId: roomIdOrAlias};
[self handleUniversalLinkFragment:newUniversalLinkFragment];
[self handleUniversalLinkFragment:newUniversalLinkFragment fromURL:universalLinkURL];
}
else
{
@ -1425,7 +1447,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
if (notif.object == account.mxSession && account.mxSession.state == MXSessionStateRunning)
{
NSLog(@"[AppDelegate] Universal link: The session is running. Retry the link");
[self handleUniversalLinkFragment:fragment];
[self handleUniversalLinkFragment:fragment fromURL:universalLinkURL];
}
}
}];
@ -1486,7 +1508,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
if ([universalLinkFragmentPending isEqualToString:fragment])
{
NSLog(@"[AppDelegate] Universal link: The user is now logged in. Retry the link");
[self handleUniversalLinkFragment:fragment];
[self handleUniversalLinkFragment:fragment fromURL:universalLinkURL];
}
}];
}
@ -1551,7 +1573,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
if ([universalLinkFragmentPending isEqualToString:fragment])
{
NSLog(@"[AppDelegate] Universal link: The user is now logged in. Retry the link");
[self handleUniversalLinkFragment:fragment];
[self handleUniversalLinkFragment:fragment fromURL:universalLinkURL];
}
}];
}
@ -1575,6 +1597,14 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
return continueUserActivity;
}
- (BOOL)handleUniversalLinkURL:(NSURL*)universalLinkURL
{
// iOS Patch: fix vector.im urls before using it
NSURL *fixedURL = [Tools fixURLWithSeveralHashKeys:universalLinkURL];
return [self handleUniversalLinkFragment:fixedURL.fragment fromURL:universalLinkURL];
}
- (void)resetPendingUniversalLink
{
universalLinkFragmentPending = nil;
@ -2740,6 +2770,25 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
- (void)showRoom:(NSString*)roomId andEventId:(NSString*)eventId withMatrixSession:(MXSession*)mxSession restoreInitialDisplay:(BOOL)restoreInitialDisplay completion:(void (^)(void))completion
{
if (roomId && mxSession)
{
MXRoom *room = [mxSession roomWithRoomId:roomId];
// Indicates that spaces are not supported
if (room.summary.roomType == MXRoomTypeSpace)
{
[self.spaceFeatureUnavailablePresenter presentUnavailableFeatureFrom:self.presentedViewController animated:YES];
if (completion)
{
completion();
}
return;
}
}
void (^selectRoom)(void) = ^() {
// Select room to display its details (dispatch this action in order to let TabBarController end its refresh)
[self.masterTabBarController selectRoomWithId:roomId andEventId:eventId inMatrixSession:mxSession completion:^{

View file

@ -21,9 +21,9 @@ final class CloseButton: UIButton, Themable {
// MARK: - Constants
private enum CircleBackgroundConstants {
static let height: CGFloat = 30.0
static let height: CGFloat = 26.0
static let highlightedAlha: CGFloat = 0.5
static let normalAlha: CGFloat = 1.0
static let normalAlha: CGFloat = 0.8
}
// MARK: - Properties
@ -109,6 +109,6 @@ final class CloseButton: UIButton, Themable {
func update(theme: Theme) {
self.theme = theme
self.circleBackgroundView.backgroundColor = theme.headerTextSecondaryColor
self.circleBackgroundView.backgroundColor = theme.secondaryCircleButtonBackgroundColor
}
}

View file

@ -1188,7 +1188,11 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
}
else
{
[conversationCellDataArray addObject:recentCellDataStoring];
// Hide spaces from home (keep space invites)
if (room.summary.roomType != MXRoomTypeSpace)
{
[conversationCellDataArray addObject:recentCellDataStoring];
}
}
}
else if (_recentsDataSourceMode == RecentsDataSourceModeFavourites)
@ -1219,12 +1223,12 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
// Consider only non direct rooms.
if (!room.isDirect)
{
// Keep only the invites, the favourites and the rooms without tag
// Keep only the invites, the favourites and the rooms without tag and room type different from space
if (room.summary.membership == MXMembershipInvite)
{
[invitesCellDataArray addObject:recentCellDataStoring];
}
else if (!room.accountData.tags.count || room.accountData.tags[kMXRoomTagFavourite])
else if ((!room.accountData.tags.count || room.accountData.tags[kMXRoomTagFavourite]) && room.summary.roomType != MXRoomTypeSpace)
{
[conversationCellDataArray addObject:recentCellDataStoring];
}

View file

@ -70,6 +70,8 @@
@property (nonatomic, strong) RoomsDirectoryCoordinatorBridgePresenter *roomsDirectoryCoordinatorBridgePresenter;
@property (nonatomic, strong) SpaceFeatureUnavailablePresenter *spaceFeatureUnavailablePresenter;
@end
@implementation RecentsViewController
@ -870,6 +872,16 @@
return recentsDataSource;
}
- (void)showSpaceInviteNotAvailable
{
if (!self.spaceFeatureUnavailablePresenter)
{
self.spaceFeatureUnavailablePresenter = [SpaceFeatureUnavailablePresenter new];
}
[self.spaceFeatureUnavailablePresenter presentUnavailableFeatureFrom:self animated:YES];
}
#pragma mark - MXKDataSourceDelegate
- (Class<MXKCellRendering>)cellViewClassForCellData:(MXKCellData*)cellData
@ -905,6 +917,13 @@
{
// Retrieve the invited room
MXRoom *invitedRoom = userInfo[kInviteRecentTableViewCellRoomKey];
if (invitedRoom.summary.roomType == MXRoomTypeSpace)
{
// Indicates that spaces are not supported
[self showSpaceInviteNotAvailable];
return;
}
// Display the room preview
[self dispayRoomWithRoomId:invitedRoom.roomId inMatrixSession:invitedRoom.mxSession];
@ -913,6 +932,13 @@
{
// Retrieve the invited room
MXRoom *invitedRoom = userInfo[kInviteRecentTableViewCellRoomKey];
if (invitedRoom.summary.roomType == MXRoomTypeSpace)
{
// Indicates that spaces are not supported
[self showSpaceInviteNotAvailable];
return;
}
// Accept invitation
[self joinRoom:invitedRoom completion:nil];
@ -921,7 +947,7 @@
{
// Retrieve the invited room
MXRoom *invitedRoom = userInfo[kInviteRecentTableViewCellRoomKey];
[self cancelEditionMode:isRefreshPending];
// Decline the invitation
@ -1372,8 +1398,13 @@
// Retrieve the invited room
MXRoom* invitedRoom = cellData.roomSummary.room;
if (invitedRoom.summary.roomType == MXRoomTypeSpace)
{
// Indicates that spaces are not supported
[self showSpaceInviteNotAvailable];
}
// Check if can show preview for the invited room
if ([self canShowRoomPreviewFor:invitedRoom])
else if ([self canShowRoomPreviewFor:invitedRoom])
{
// Display the room preview
[self dispayRoomWithRoomId:invitedRoom.roomId inMatrixSession:invitedRoom.mxSession];

View file

@ -15,9 +15,79 @@
*/
#import "GroupsDataSource.h"
#import "Riot-Swift.h"
@interface GroupsDataSource() <BetaAnnounceCellDelegate>
@property (nonatomic) NSInteger betaAnnounceSection;
@property (nonatomic) BOOL showBetaAnnounce;
@end
@implementation GroupsDataSource
- (instancetype)initWithMatrixSession:(MXSession *)matrixSession
{
self = [super initWithMatrixSession:matrixSession];
if (self)
{
// TODO: Hide the banner for the moment. Wait for iterations on it.
// _showBetaAnnounce = !RiotSettings.shared.hideSpaceBetaAnnounce;
_showBetaAnnounce = NO;
}
return self;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSInteger count = 0;
self.betaAnnounceSection = self.groupInvitesSection = self.joinedGroupsSection = -1;
// Check whether all data sources are ready before rendering groups.
if (self.state == MXKDataSourceStateReady)
{
if (self.showBetaAnnounce)
{
self.betaAnnounceSection = count++;
}
if (groupsInviteCellDataArray.count)
{
self.groupInvitesSection = count++;
}
if (groupsCellDataArray.count)
{
self.joinedGroupsSection = count++;
}
}
return count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == self.betaAnnounceSection)
{
BetaAnnounceCell *cell = [tableView dequeueReusableCellWithIdentifier:BetaAnnounceCell.reuseIdentifier forIndexPath:indexPath];
[cell vc_hideSeparator];
[cell updateWithTheme:ThemeService.shared.theme];
cell.delegate = self;
return cell;
}
return [super tableView:tableView cellForRowAtIndexPath:indexPath];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == self.betaAnnounceSection)
{
return 1;
}
return [super tableView:tableView numberOfRowsInSection:section];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
NSString* sectionTitle = nil;
@ -44,4 +114,13 @@
return (indexPath.section == self.joinedGroupsSection);
}
#pragma mark - BetaAnnounceCellDelegate
- (void)betaAnnounceCellDidTapCloseButton:(BetaAnnounceCell *)cell
{
self.showBetaAnnounce = NO;
RiotSettings.shared.hideSpaceBetaAnnounce = YES;
[self.delegate dataSource:self didCellChange:nil];
}
@end

View file

@ -79,6 +79,7 @@
//Register here the customized cell view class used to render groups
[self.groupsTableView registerNib:GroupTableViewCell.nib forCellReuseIdentifier:GroupTableViewCell.defaultReuseIdentifier];
[self.groupsTableView registerNib:GroupInviteTableViewCell.nib forCellReuseIdentifier:GroupInviteTableViewCell.defaultReuseIdentifier];
[self.groupsTableView registerNib:BetaAnnounceCell.nib forCellReuseIdentifier:BetaAnnounceCell.reuseIdentifier];
// Hide line separators of empty cells
self.groupsTableView.tableFooterView = [[UIView alloc] init];

View file

@ -786,11 +786,8 @@
if ([Tools isUniversalLink:URL])
{
shouldInteractWithURL = NO;
// iOS Patch: fix vector.im urls before using it
NSURL *fixedURL = [Tools fixURLWithSeveralHashKeys:URL];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fixedURL.fragment];
[[AppDelegate theDelegate] handleUniversalLinkURL:URL];
}
// Open a detail screen about the clicked user
else if ([MXTools isMatrixUserIdentifier:absoluteURLString])

View file

@ -3410,10 +3410,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
{
shouldDoAction = NO;
// iOS Patch: fix vector.im urls before using it
NSURL *fixedURL = [Tools fixURLWithSeveralHashKeys:url];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fixedURL.fragment];
[[AppDelegate theDelegate] handleUniversalLinkURL:url];
}
// Open a detail screen about the clicked user
else if ([MXTools isMatrixUserIdentifier:absoluteURLString])
@ -3452,7 +3449,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
// Open the room or preview it
NSString *fragment = [NSString stringWithFormat:@"/room/%@", [MXTools encodeURIComponent:roomIdOrAlias]];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fragment];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fragment fromURL:url];
}
// Preview the clicked group
else if ([MXTools isMatrixGroupIdentifier:absoluteURLString])
@ -3461,7 +3458,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
// Open the group or preview it
NSString *fragment = [NSString stringWithFormat:@"/group/%@", [MXTools encodeURIComponent:absoluteURLString]];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fragment];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fragment fromURL:url];
}
else if ([absoluteURLString hasPrefix:EventFormatterOnReRequestKeysLinkAction])
{

View file

@ -0,0 +1,94 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
import Reusable
@objc protocol BetaAnnounceCellDelegate: class {
func betaAnnounceCellDidTapCloseButton(_ cell: BetaAnnounceCell)
}
/// BetaAnnounceCell enables to show coming beta feature
final class BetaAnnounceCell: UITableViewCell, Themable {
// MARK: - Constants
private enum Constants {
static let cardBackgroundViewCornersRadius: CGFloat = 8.0
}
// MARK: - Properties
@IBOutlet private weak var cardBackgroundView: UIView!
@IBOutlet private weak var closeButton: CloseButton!
@IBOutlet private weak var badgeView: UIView!
@IBOutlet private weak var badgeLabel: UILabel!
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var subtitleLabel: UILabel!
@IBOutlet private weak var informationLabel: UILabel!
@objc weak var delegate: BetaAnnounceCellDelegate?
// MARK: - Life cycle
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
self.badgeLabel.text = VectorL10n.spaceBetaAnnounceBadge
self.titleLabel.text = VectorL10n.spaceBetaAnnounceTitle
self.subtitleLabel.text = VectorL10n.spaceBetaAnnounceSubtitle
self.informationLabel.text = VectorL10n.spaceBetaAnnounceInformation
self.badgeView.layer.masksToBounds = true
self.cardBackgroundView.layer.masksToBounds = true
}
override func layoutSubviews() {
super.layoutSubviews()
self.cardBackgroundView.layer.cornerRadius = Constants.cardBackgroundViewCornersRadius
self.badgeView.layer.cornerRadius = self.badgeView.frame.height/2
}
// MARK: - Public
func update(theme: Theme) {
self.closeButton.update(theme: theme)
self.titleLabel.textColor = theme.textPrimaryColor
self.subtitleLabel.textColor = theme.textPrimaryColor
self.informationLabel.textColor = theme.textSecondaryColor
self.cardBackgroundView.backgroundColor = theme.baseColor
self.contentView.backgroundColor = theme.backgroundColor
}
// MARK: - Actions
@IBAction private func closeButtonAction(_ sender: Any) {
self.delegate?.betaAnnounceCellDidTapCloseButton(self)
}
}
// Copy past from NibReusable in order to expose these methods to ObjC
extension BetaAnnounceCell {
@objc static var reuseIdentifier: String {
return String(describing: self)
}
@objc static var nib: UINib {
return UINib(nibName: String(describing: self), bundle: Bundle(for: self))
}
}

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="327" id="KGk-i7-Jjw" customClass="BetaAnnounceCell" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="331" height="327"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="331" height="327"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vuH-Jo-iN1">
<rect key="frame" x="20" y="20" width="291" height="287"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aTW-9I-M53">
<rect key="frame" x="15" y="15" width="46" height="19"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="BETA" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Szn-LE-OSt">
<rect key="frame" x="8" y="2" width="30" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" systemColor="secondarySystemBackgroundColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBlueColor"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="Szn-LE-OSt" secondAttribute="bottom" constant="2" id="Dz7-J1-Fd9"/>
<constraint firstAttribute="trailing" secondItem="Szn-LE-OSt" secondAttribute="trailing" constant="8" id="KQR-Wz-FzB"/>
<constraint firstItem="Szn-LE-OSt" firstAttribute="leading" secondItem="aTW-9I-M53" secondAttribute="leading" constant="8" id="Kwa-X4-z2j"/>
<constraint firstItem="Szn-LE-OSt" firstAttribute="top" secondItem="aTW-9I-M53" secondAttribute="top" constant="2" id="TwD-zu-wYb"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kel-VV-C0f" customClass="CloseButton" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="237" y="6" width="44" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="BOd-JJ-paV"/>
<constraint firstAttribute="height" constant="44" id="tdl-KN-AnH"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<state key="normal" image="close_button"/>
<connections>
<action selector="closeButtonAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="yXe-P8-tRC"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Meet Spaces" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aSK-Uf-CjE">
<rect key="frame" x="15" y="49" width="261" height="24"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="20"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="246" verticalCompressionResistancePriority="749" text="The new version of communities" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vu4-y4-3xv">
<rect key="frame" x="15" y="83" width="261" height="87.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Spaces are new ways to group rooms and people. You can try them out now on Android, or on your computer." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="npW-wC-Sab">
<rect key="frame" x="15" y="185.5" width="261" height="81.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemGray5Color"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="aSK-Uf-CjE" secondAttribute="trailing" constant="15" id="1T1-zJ-fup"/>
<constraint firstAttribute="bottom" secondItem="npW-wC-Sab" secondAttribute="bottom" constant="20" id="2lh-cu-mmZ"/>
<constraint firstAttribute="trailing" secondItem="kel-VV-C0f" secondAttribute="trailing" constant="10" id="CH2-5q-a51"/>
<constraint firstItem="npW-wC-Sab" firstAttribute="trailing" secondItem="vu4-y4-3xv" secondAttribute="trailing" id="D0P-in-hDZ"/>
<constraint firstItem="aTW-9I-M53" firstAttribute="leading" secondItem="vuH-Jo-iN1" secondAttribute="leading" constant="15" id="EiU-im-VWT"/>
<constraint firstItem="npW-wC-Sab" firstAttribute="leading" secondItem="vu4-y4-3xv" secondAttribute="leading" id="MD1-a4-T1w"/>
<constraint firstItem="aSK-Uf-CjE" firstAttribute="top" secondItem="aTW-9I-M53" secondAttribute="bottom" constant="15" id="ey5-aY-n3y"/>
<constraint firstItem="aSK-Uf-CjE" firstAttribute="leading" secondItem="aTW-9I-M53" secondAttribute="leading" id="ihA-R5-fpd"/>
<constraint firstItem="kel-VV-C0f" firstAttribute="top" secondItem="vuH-Jo-iN1" secondAttribute="top" constant="6" id="ilP-Uo-PLu"/>
<constraint firstItem="npW-wC-Sab" firstAttribute="top" secondItem="vu4-y4-3xv" secondAttribute="bottom" constant="15" id="nbH-gK-EU6"/>
<constraint firstItem="vu4-y4-3xv" firstAttribute="trailing" secondItem="aSK-Uf-CjE" secondAttribute="trailing" id="ox3-Gb-PVP"/>
<constraint firstItem="vu4-y4-3xv" firstAttribute="leading" secondItem="aSK-Uf-CjE" secondAttribute="leading" id="pCR-Vy-sbf"/>
<constraint firstItem="aTW-9I-M53" firstAttribute="top" secondItem="vuH-Jo-iN1" secondAttribute="top" constant="15" id="pkY-VS-aCB"/>
<constraint firstItem="vu4-y4-3xv" firstAttribute="top" secondItem="aSK-Uf-CjE" secondAttribute="bottom" constant="10" id="rg4-3n-uSE"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="vuH-Jo-iN1" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="20" id="Gt7-qL-q6P"/>
<constraint firstAttribute="trailing" secondItem="vuH-Jo-iN1" secondAttribute="trailing" constant="20" id="RJH-X8-eno"/>
<constraint firstItem="vuH-Jo-iN1" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="20" id="exf-6Z-LN6"/>
<constraint firstAttribute="bottom" secondItem="vuH-Jo-iN1" secondAttribute="bottom" constant="20" id="tAe-8X-9LN"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="badgeLabel" destination="Szn-LE-OSt" id="Ts2-O8-9Hm"/>
<outlet property="badgeView" destination="aTW-9I-M53" id="6iH-DI-CN1"/>
<outlet property="cardBackgroundView" destination="vuH-Jo-iN1" id="bJL-Ib-scJ"/>
<outlet property="closeButton" destination="kel-VV-C0f" id="h6d-is-LyE"/>
<outlet property="informationLabel" destination="npW-wC-Sab" id="caK-gm-MRm"/>
<outlet property="subtitleLabel" destination="vu4-y4-3xv" id="uRJ-2B-3nP"/>
<outlet property="titleLabel" destination="aSK-Uf-CjE" id="S09-2y-xWL"/>
</connections>
<point key="canvasLocation" x="-25.362318840579711" y="53.90625"/>
</tableViewCell>
</objects>
<resources>
<image name="close_button" width="16" height="16"/>
<systemColor name="secondarySystemBackgroundColor">
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBlueColor">
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemGray5Color">
<color red="0.89803921568627454" green="0.89803921568627454" blue="0.91764705882352937" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="lF3-B1-QSM">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Space Feature Unaivable View Controller-->
<scene sceneID="GxM-11-zLQ">
<objects>
<viewController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="lF3-B1-QSM" customClass="SpaceFeatureUnaivableViewController" customModule="Riot" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="xml-pK-Qwj">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1B8-AI-sNF">
<rect key="frame" x="0.0" y="44" width="414" height="852"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nR7-UU-l9H">
<rect key="frame" x="0.0" y="0.0" width="414" height="398"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="27X-Of-wNa">
<rect key="frame" x="0.0" y="0.0" width="414" height="398"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="50" translatesAutoresizingMaskIntoConstraints="NO" id="ylT-1L-OLp">
<rect key="frame" x="25" y="50" width="364" height="328"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="feature_unavaible_artwork" translatesAutoresizingMaskIntoConstraints="NO" id="sGd-vk-QZn">
<rect key="frame" x="0.0" y="0.0" width="364" height="106"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Youre trying to open a link to a Space. Spaces are currently only available in beta on web, or Android" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0bq-od-FQz">
<rect key="frame" x="0.0" y="156" width="364" height="61"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Use your computer to open the link. If you do, well let you know when the feature comes to iOS." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9ZF-ov-Mf3">
<rect key="frame" x="0.0" y="267" width="364" height="61"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="ylT-1L-OLp" secondAttribute="bottom" constant="20" id="34J-bP-IoO"/>
<constraint firstAttribute="trailing" secondItem="ylT-1L-OLp" secondAttribute="trailing" constant="25" id="5Jt-g6-D8E"/>
<constraint firstItem="ylT-1L-OLp" firstAttribute="leading" secondItem="27X-Of-wNa" secondAttribute="leading" constant="25" id="pi6-0g-zBY"/>
<constraint firstItem="ylT-1L-OLp" firstAttribute="top" secondItem="27X-Of-wNa" secondAttribute="top" constant="50" id="q2s-te-4sL"/>
<constraint firstAttribute="width" priority="750" constant="500" id="ypd-Rv-SnZ"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="27X-Of-wNa" secondAttribute="bottom" id="8IE-H1-hHy"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="27X-Of-wNa" secondAttribute="trailing" id="9ES-BJ-i6i"/>
<constraint firstItem="27X-Of-wNa" firstAttribute="centerX" secondItem="nR7-UU-l9H" secondAttribute="centerX" id="Qaa-FG-9KG"/>
<constraint firstItem="27X-Of-wNa" firstAttribute="top" secondItem="nR7-UU-l9H" secondAttribute="top" id="lYG-Wh-gO8"/>
<constraint firstItem="27X-Of-wNa" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="nR7-UU-l9H" secondAttribute="leading" id="vN8-ue-jSD"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="nR7-UU-l9H" firstAttribute="width" secondItem="1B8-AI-sNF" secondAttribute="width" id="DDt-dv-KuK"/>
<constraint firstAttribute="bottom" secondItem="nR7-UU-l9H" secondAttribute="bottom" id="NEU-Tu-bEO"/>
<constraint firstItem="nR7-UU-l9H" firstAttribute="top" secondItem="1B8-AI-sNF" secondAttribute="top" id="RUb-FJ-n39"/>
<constraint firstAttribute="trailing" secondItem="nR7-UU-l9H" secondAttribute="trailing" id="baF-fE-9RM"/>
<constraint firstItem="nR7-UU-l9H" firstAttribute="leading" secondItem="1B8-AI-sNF" secondAttribute="leading" id="m9t-z5-09A"/>
</constraints>
</scrollView>
</subviews>
<viewLayoutGuide key="safeArea" id="EKA-x2-Dp6"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="EKA-x2-Dp6" firstAttribute="top" secondItem="1B8-AI-sNF" secondAttribute="top" id="4JH-b0-GAR"/>
<constraint firstItem="1B8-AI-sNF" firstAttribute="leading" secondItem="EKA-x2-Dp6" secondAttribute="leading" id="FyW-NO-hPT"/>
<constraint firstAttribute="bottom" secondItem="1B8-AI-sNF" secondAttribute="bottom" id="amp-xt-t4Z"/>
<constraint firstItem="EKA-x2-Dp6" firstAttribute="trailing" secondItem="1B8-AI-sNF" secondAttribute="trailing" id="fBG-DS-i4e"/>
</constraints>
</view>
<connections>
<outlet property="artworkImageView" destination="sGd-vk-QZn" id="823-PG-zoL"/>
<outlet property="informationLabel" destination="9ZF-ov-Mf3" id="9Oc-Zg-QZE"/>
<outlet property="subtitleLabel" destination="0bq-od-FQz" id="fLM-1x-mjU"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="aGN-2E-nEI" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-3198" y="-647"/>
</scene>
</scenes>
<resources>
<image name="feature_unavaible_artwork" width="160" height="106"/>
</resources>
</document>

View file

@ -0,0 +1,97 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
final class SpaceFeatureUnaivableViewController: UIViewController {
// MARK: - Properties
// MARK: Outlets
@IBOutlet private weak var artworkImageView: UIImageView!
@IBOutlet private weak var subtitleLabel: UILabel!
@IBOutlet private weak var informationLabel: UILabel!
// MARK: Private
private var theme: Theme!
// MARK: - Setup
class func instantiate() -> SpaceFeatureUnaivableViewController {
let viewController = StoryboardScene.SpaceFeatureUnaivableViewController.initialScene.instantiate()
viewController.theme = ThemeService.shared().theme
return viewController
}
// MARK: - Life cycle
override func viewDidLoad() {
super.viewDidLoad()
self.setupViews()
self.registerThemeServiceDidChangeThemeNotification()
self.update(theme: self.theme)
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return self.theme.statusBarStyle
}
// MARK: - Private
private func registerThemeServiceDidChangeThemeNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .themeServiceDidChangeTheme, object: nil)
}
@objc private func themeDidChange() {
self.update(theme: ThemeService.shared().theme)
}
private func setupViews() {
self.title = VectorL10n.spaceFeatureUnavailableTitle
self.subtitleLabel.text = VectorL10n.spaceFeatureUnavailableSubtitle
self.informationLabel.text = VectorL10n.spaceFeatureUnavailableInformation
}
// MARK: - Public
func update(theme: Theme) {
self.theme = theme
self.view.backgroundColor = theme.backgroundColor
if let navigationBar = self.navigationController?.navigationBar {
theme.applyStyle(onNavigationBar: navigationBar)
}
self.subtitleLabel.textColor = theme.textPrimaryColor
self.informationLabel.textColor = theme.textSecondaryColor
// Artwork image view
let artworkImage = ThemeService.shared().isCurrentThemeDark() ? Asset.Images.featureUnavaibleArtworkDark.image : Asset.Images.featureUnavaibleArtwork.image
self.artworkImageView.image = artworkImage
}
func fill(informationText: String, shareLink: URL) {
self.subtitleLabel.text = informationText
}
}

View file

@ -0,0 +1,47 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
/// SpaceFeatureUnavailablePresenter enables to present modals for unavailable space features
@objcMembers
final class SpaceFeatureUnavailablePresenter: NSObject {
// MARK: - Constants
// MARK: - Properties
// MARK: Private
private weak var presentingViewController: UIViewController?
// MARK: - Public
func presentUnavailableFeature(from presentingViewController: UIViewController,
animated: Bool) {
let spaceFeatureUnavailableVC = SpaceFeatureUnaivableViewController.instantiate()
let navigationVC = RiotNavigationController(rootViewController: spaceFeatureUnavailableVC)
spaceFeatureUnavailableVC.navigationItem.rightBarButtonItem = MXKBarButtonItem(title: Bundle.mxk_localizedString(forKey: "ok"), style: .plain, action: { [weak navigationVC] in
navigationVC?.dismiss(animated: true)
})
navigationVC.modalPresentationStyle = .formSheet
presentingViewController.present(navigationVC, animated: animated, completion: nil)
}
}

View file

@ -365,6 +365,11 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
self.encryptedMessagesTextFont = [UIFont italicSystemFontOfSize:15];
self.emojiOnlyTextFont = [UIFont systemFontOfSize:48];
self.editionMentionTextFont = [UIFont systemFontOfSize:12];
// Handle space room type, enables to show space in room list
defaultRoomSummaryUpdater.showRoomTypeStrings = @[
MXRoomTypeStringSpace
];
}
return self;
}