Skip to content

Commit

Permalink
Merge branch 'gil/4571_explore_rooms' into gil/4682_browsing_users_in…
Browse files Browse the repository at this point in the history
…_a_space
  • Loading branch information
gileluard committed Aug 16, 2021
2 parents 7caa033 + 36bfd3c commit 02c3d5f
Show file tree
Hide file tree
Showing 40 changed files with 793 additions and 145 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "space_room_icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions Riot/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"switch" = "Switch";
"more" = "More";
"less" = "Less";
"open" = "Open";

// Call Bar
"callbar_only_single_active" = "Tap to return to the call (%@)";
Expand Down Expand Up @@ -189,6 +190,7 @@
"room_recents_low_priority_section" = "LOW PRIORITY";
"room_recents_server_notice_section" = "SYSTEM ALERTS";
"room_recents_invites_section" = "INVITES";
"room_recents_suggested_rooms_section" = "SUGGESTED ROOMS";
"room_recents_start_chat_with" = "Start chat";
"room_recents_create_empty_room" = "Create room";
"room_recents_join_room" = "Join room";
Expand Down Expand Up @@ -1675,6 +1677,14 @@ Tap the + to start adding people.";
"leave_space_message" = "Are you sure you want to leave %@?";
"spaces_explore_rooms" = "Explore rooms";
"spaces_suggested_room" = "Suggested";
"space_tag" = "space";
"spaces_empty_space_title" = "This space has no rooms (yet)";
"spaces_empty_space_detail" = "Some rooms may be hidden because they’re private and you need an invite.";
"spaces_no_result_found_title" = "No results found";
"spaces_no_room_found_detail" = "Some results may be hidden because they’re private and you need an invite to join them.";
"spaces_no_member_found_detail" = "Looking for someone not in space name? For now, you can invite them on web or desktop.";
"spaces_coming_soon_title" = "Coming soon";
"spaces_coming_soon_detail" = "This feature hasn’t been implemented here, but it’s on the way. For now, you can do that with Element on your computer.";

// Mark: Avatar

Expand Down
32 changes: 32 additions & 0 deletions Riot/Categories/MXKImageView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// 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 Foundation

extension MXKImageView {
@objc func vc_setRoomAvatarImage(with url: String?, displayName: String, mediaManager: MXMediaManager) {
// Use the display name to prepare the default avatar image.
let avatarImage = AvatarGenerator.generateAvatar(forText: displayName)

if let avatarUrl = url {
self.enableInMemoryCache = true
self.setImageURI(avatarUrl, withType: nil, andImageOrientation: .up, toFitViewSize: self.frame.size, with: MXThumbnailingMethodCrop, previewImage: avatarImage, mediaManager: mediaManager)
} else {
self.image = avatarImage
}
self.contentMode = .scaleAspectFill
}
}
1 change: 1 addition & 0 deletions Riot/Generated/Images.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ internal enum Asset {
internal static let spaceMenuLeave = ImageAsset(name: "space_menu_leave")
internal static let spaceMenuMembers = ImageAsset(name: "space_menu_members")
internal static let spaceMenuRooms = ImageAsset(name: "space_menu_rooms")
internal static let spaceRoomIcon = ImageAsset(name: "space_room_icon")
internal static let spaceUserIcon = ImageAsset(name: "space_user_icon")
internal static let spacesMore = ImageAsset(name: "spaces_more")
internal static let tabFavourites = ImageAsset(name: "tab_favourites")
Expand Down
40 changes: 40 additions & 0 deletions Riot/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2178,6 +2178,10 @@ internal enum VectorL10n {
internal static var on: String {
return VectorL10n.tr("Vector", "on")
}
/// Open
internal static var `open`: String {
return VectorL10n.tr("Vector", "open")
}
/// or
internal static var or: String {
return VectorL10n.tr("Vector", "or")
Expand Down Expand Up @@ -3402,6 +3406,10 @@ internal enum VectorL10n {
internal static var roomRecentsStartChatWith: String {
return VectorL10n.tr("Vector", "room_recents_start_chat_with")
}
/// SUGGESTED ROOMS
internal static var roomRecentsSuggestedRoomsSection: String {
return VectorL10n.tr("Vector", "room_recents_suggested_rooms_section")
}
/// Can't find this room. Make sure it exists
internal static var roomRecentsUnknownRoomErrorMessage: String {
return VectorL10n.tr("Vector", "room_recents_unknown_room_error_message")
Expand Down Expand Up @@ -4714,6 +4722,26 @@ internal enum VectorL10n {
internal static var spaceFeatureUnavailableTitle: String {
return VectorL10n.tr("Vector", "space_feature_unavailable_title")
}
/// space
internal static var spaceTag: String {
return VectorL10n.tr("Vector", "space_tag")
}
/// This feature hasn’t been implemented here, but it’s on the way. For now, you can do that with Element on your computer.
internal static var spacesComingSoonDetail: String {
return VectorL10n.tr("Vector", "spaces_coming_soon_detail")
}
/// Coming soon
internal static var spacesComingSoonTitle: String {
return VectorL10n.tr("Vector", "spaces_coming_soon_title")
}
/// Some rooms may be hidden because they’re private and you need an invite.
internal static var spacesEmptySpaceDetail: String {
return VectorL10n.tr("Vector", "spaces_empty_space_detail")
}
/// This space has no rooms (yet)
internal static var spacesEmptySpaceTitle: String {
return VectorL10n.tr("Vector", "spaces_empty_space_title")
}
/// Explore rooms
internal static var spacesExploreRooms: String {
return VectorL10n.tr("Vector", "spaces_explore_rooms")
Expand All @@ -4726,6 +4754,18 @@ internal enum VectorL10n {
internal static var spacesLeftPanelTitle: String {
return VectorL10n.tr("Vector", "spaces_left_panel_title")
}
/// Looking for someone not in space name? For now, you can invite them on web or desktop.
internal static var spacesNoMemberFoundDetail: String {
return VectorL10n.tr("Vector", "spaces_no_member_found_detail")
}
/// No results found
internal static var spacesNoResultFoundTitle: String {
return VectorL10n.tr("Vector", "spaces_no_result_found_title")
}
/// Some results may be hidden because they’re private and you need an invite to join them.
internal static var spacesNoRoomFoundDetail: String {
return VectorL10n.tr("Vector", "spaces_no_room_found_detail")
}
/// Suggested
internal static var spacesSuggestedRoom: String {
return VectorL10n.tr("Vector", "spaces_suggested_room")
Expand Down
8 changes: 8 additions & 0 deletions Riot/Model/Room/RoomPreviewData.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@
*/
- (instancetype)initWithPublicRoom:(MXPublicRoom*)publicRoom andSession:(MXSession*)mxSession;

/**
Contructors.
@param childInfo MXSpaceChildInfo instance that describes the child.
@param mxSession the session to open the room preview with.
*/
- (instancetype)initWithSpaceChildInfo:(MXSpaceChildInfo*)childInfo andSession:(MXSession*)mxSession;

/**
Attempt to peek into the room to get room data (state, messages history, etc).
Expand Down
16 changes: 16 additions & 0 deletions Riot/Model/Room/RoomPreviewData.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#import "RoomPreviewData.h"
#import <MatrixSDK-Swift.h>

@implementation RoomPreviewData

Expand Down Expand Up @@ -79,6 +80,21 @@ - (instancetype)initWithPublicRoom:(MXPublicRoom*)publicRoom andSession:(MXSessi
return self;
}

- (instancetype)initWithSpaceChildInfo:(MXSpaceChildInfo*)childInfo andSession:(MXSession*)mxSession
{
self = [self init];
if (self)
{
_roomId = childInfo.childRoomId;
_roomName = childInfo.name;
_roomAvatarUrl = childInfo.avatarUrl;
_roomTopic = childInfo.topic;
_numJoinedMembers = childInfo.activeMemberCount;
_mxSession = mxSession;
}
return self;
}

- (void)dealloc
{
if (_roomDataSource)
Expand Down
3 changes: 2 additions & 1 deletion Riot/Modules/Common/Recents/CellData/RecentCellData.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#import "RecentCellData.h"

#import "MXRoom+Riot.h"
#import "MatrixSDK-Swift.h"

@implementation RecentCellData
// trick to hide the mother class property as it is readonly one.
Expand Down Expand Up @@ -57,7 +58,7 @@ - (NSUInteger)notificationCount
- (void)update
{
[super update];
roomDisplayname = self.roomSummary.displayname;
roomDisplayname = self.spaceChildInfo ? self.spaceChildInfo.name: self.roomSummary.displayname;
if (!roomDisplayname.length)
{
roomDisplayname = [NSBundle mxk_localizedStringForKey:@"room_displayname_empty_room"];
Expand Down
2 changes: 2 additions & 0 deletions Riot/Modules/Common/Recents/DataSources/RecentsDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ extern NSString *const kRecentsDataSourceTapOnDirectoryServerChange;
@property (nonatomic) NSInteger conversationSection;
@property (nonatomic) NSInteger lowPrioritySection;
@property (nonatomic) NSInteger serverNoticeSection;
@property (nonatomic) NSInteger suggestedRoomsSection;

@property (nonatomic, readonly) NSArray* invitesCellDataArray;
@property (nonatomic, readonly) NSArray* favoriteCellDataArray;
@property (nonatomic, readonly) NSArray* peopleCellDataArray;
@property (nonatomic, readonly) NSArray* conversationCellDataArray;
@property (nonatomic, readonly) NSArray* lowPriorityCellDataArray;
@property (nonatomic, readonly) NSArray* serverNoticeCellDataArray;
@property (nonatomic, readonly) NSArray* suggestedRoomCellDataArray;

@property (nonatomic, readonly) SecureBackupBannerDisplay secureBackupBannerDisplay;
@property (nonatomic, readonly) CrossSigningBannerDisplay crossSigningBannerDisplay;
Expand Down
Loading

0 comments on commit 02c3d5f

Please sign in to comment.