Add new clickable title for conversations.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2018-07-23 18:21:00 +02:00
Родитель d03a6ef4b8
Коммит 642f54d171
8 изменённых файлов: 295 добавлений и 3 удалений

Просмотреть файл

@ -32,6 +32,8 @@
2C3F6AB81FBB4C9500E2705C /* NCRoom.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CA1CCC21F166CC5002FE6A2 /* NCRoom.m */; };
2C3F6AB91FBB4C9D00E2705C /* NCUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CA1CCCC1F181741002FE6A2 /* NCUser.m */; };
2C42ADB420B58E6300296DEA /* NCRoomController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C42ADB320B58E6300296DEA /* NCRoomController.m */; };
2C440D1120EA4A770005F9BB /* RoomInfoTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C440D0F20EA4A770005F9BB /* RoomInfoTableViewController.m */; };
2C440D1220EA4A770005F9BB /* RoomInfoTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2C440D1020EA4A770005F9BB /* RoomInfoTableViewController.xib */; };
2C4D7D631F2F7C2C00FF4A0D /* ARDCaptureController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D7D621F2F7C2C00FF4A0D /* ARDCaptureController.m */; };
2C4D7D691F2F7DBC00FF4A0D /* ARDSettingsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D7D651F2F7DBC00FF4A0D /* ARDSettingsModel.m */; };
2C4D7D6A1F2F7DBC00FF4A0D /* ARDSettingsStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D7D681F2F7DBC00FF4A0D /* ARDSettingsStore.m */; };
@ -39,6 +41,8 @@
2C4D7D731F309DA500FF4A0D /* RTCSessionDescription+JSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D7D701F309DA500FF4A0D /* RTCSessionDescription+JSON.m */; };
2C4D7D761F30F7B600FF4A0D /* ARDUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D7D751F30F7B600FF4A0D /* ARDUtilities.m */; };
2C5435ED1FB1E5E8003D4222 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2C5435EC1FB1E5E8003D4222 /* GoogleService-Info.plist */; };
2C7381562106136000CDB8DB /* NCChatTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C7381552106136000CDB8DB /* NCChatTitleView.m */; };
2C738158210613A200CDB8DB /* NCChatTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2C738157210613A200CDB8DB /* NCChatTitleView.xib */; };
2C78EF951F7E70EB008AFA74 /* NCPeerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C78EF941F7E70EB008AFA74 /* NCPeerConnection.m */; };
2C78EF991F80F81E008AFA74 /* NCSignalingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C78EF981F80F81E008AFA74 /* NCSignalingController.m */; };
2C78EF9C1F826B22008AFA74 /* NCCallController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C78EF9B1F826B22008AFA74 /* NCCallController.m */; };
@ -170,6 +174,9 @@
2C3F6AA91FBB1ACD00E2705C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2C42ADB220B58E6300296DEA /* NCRoomController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCRoomController.h; sourceTree = "<group>"; };
2C42ADB320B58E6300296DEA /* NCRoomController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCRoomController.m; sourceTree = "<group>"; };
2C440D0E20EA4A770005F9BB /* RoomInfoTableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomInfoTableViewController.h; sourceTree = "<group>"; };
2C440D0F20EA4A770005F9BB /* RoomInfoTableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomInfoTableViewController.m; sourceTree = "<group>"; };
2C440D1020EA4A770005F9BB /* RoomInfoTableViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RoomInfoTableViewController.xib; sourceTree = "<group>"; };
2C4D7D611F2F7C2C00FF4A0D /* ARDCaptureController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARDCaptureController.h; sourceTree = "<group>"; };
2C4D7D621F2F7C2C00FF4A0D /* ARDCaptureController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARDCaptureController.m; sourceTree = "<group>"; };
2C4D7D641F2F7DBC00FF4A0D /* ARDSettingsModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARDSettingsModel.h; sourceTree = "<group>"; };
@ -185,6 +192,9 @@
2C4D7D751F30F7B600FF4A0D /* ARDUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARDUtilities.m; sourceTree = "<group>"; };
2C5435EC1FB1E5E8003D4222 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
2C6085C11FB1063700B36A6E /* VideoCalls.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = VideoCalls.entitlements; sourceTree = "<group>"; };
2C7381542106136000CDB8DB /* NCChatTitleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCChatTitleView.h; sourceTree = "<group>"; };
2C7381552106136000CDB8DB /* NCChatTitleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCChatTitleView.m; sourceTree = "<group>"; };
2C738157210613A200CDB8DB /* NCChatTitleView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCChatTitleView.xib; sourceTree = "<group>"; };
2C78EF931F7E70EB008AFA74 /* NCPeerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCPeerConnection.h; sourceTree = "<group>"; };
2C78EF941F7E70EB008AFA74 /* NCPeerConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NCPeerConnection.m; sourceTree = "<group>"; };
2C78EF971F80F81E008AFA74 /* NCSignalingController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCSignalingController.h; sourceTree = "<group>"; };
@ -542,6 +552,9 @@
2CC007C720E125C20096D91F /* NewRoomTableViewController.h */,
2CC007C820E125C20096D91F /* NewRoomTableViewController.m */,
2CC007C920E125C20096D91F /* NewRoomTableViewController.xib */,
2C440D0E20EA4A770005F9BB /* RoomInfoTableViewController.h */,
2C440D0F20EA4A770005F9BB /* RoomInfoTableViewController.m */,
2C440D1020EA4A770005F9BB /* RoomInfoTableViewController.xib */,
);
name = Rooms;
sourceTree = "<group>";
@ -792,6 +805,9 @@
2CA15540208E350300CE8EF0 /* NCChatMessage.m */,
2CA15543208E41B500CE8EF0 /* NCChatViewController.h */,
2CA15544208E41B500CE8EF0 /* NCChatViewController.m */,
2C7381542106136000CDB8DB /* NCChatTitleView.h */,
2C7381552106136000CDB8DB /* NCChatTitleView.m */,
2C738157210613A200CDB8DB /* NCChatTitleView.xib */,
2CA15549208F2E5700CE8EF0 /* NCMessageTextView.h */,
2CA1554A208F2E5700CE8EF0 /* NCMessageTextView.m */,
2CC7158A20B8394A0045C789 /* ChatPlaceholderView.h */,
@ -933,11 +949,13 @@
2CC007B920D8139D0096D91F /* RoomCreationTableViewController.xib in Resources */,
2C7F47AA20289B9600081CC7 /* Localizable.strings in Resources */,
2C0574A51EDDA2E300D9E7F2 /* LoginViewController.xib in Resources */,
2C738158210613A200CDB8DB /* NCChatTitleView.xib in Resources */,
2CC007C620D90AE50096D91F /* RoomNameTableViewCell.xib in Resources */,
2C78EFA61F86FF4A008AFA74 /* CallParticipantViewCell.xib in Resources */,
2CC7158E20C51ABA0045C789 /* UnreadMessagesView.xib in Resources */,
2CC007CB20E125C20096D91F /* NewRoomTableViewController.xib in Resources */,
2C06BF6420AC64370031EB46 /* DateHeaderView.xib in Resources */,
2C440D1220EA4A770005F9BB /* RoomInfoTableViewController.xib in Resources */,
2CC7187F2007A9930055E02C /* LaunchScreen.xib in Resources */,
2C7A1237200E0A5700864818 /* UserSettingsTableViewCell.xib in Resources */,
2CA1CCAC1F067F35002FE6A2 /* Images.xcassets in Resources */,
@ -1093,6 +1111,7 @@
2CA1CCA41F025F64002FE6A2 /* RoomsTableViewController.m in Sources */,
2C90E5D31EE80C870093D85A /* AuthenticationViewController.m in Sources */,
2CA1CCD01F1E1779002FE6A2 /* SearchTableViewController.m in Sources */,
2C7381562106136000CDB8DB /* NCChatTitleView.m in Sources */,
2C0574A41EDDA2E300D9E7F2 /* LoginViewController.m in Sources */,
2C78EFA51F86FF4A008AFA74 /* CallParticipantViewCell.m in Sources */,
2C78EF991F80F81E008AFA74 /* NCSignalingController.m in Sources */,
@ -1121,6 +1140,7 @@
2CA1CCB51F0D0D5E002FE6A2 /* SettingsViewController.m in Sources */,
2CC7159120C51F7F0045C789 /* UnreadMessagesView.m in Sources */,
2CA1CC951F014EF9002FE6A2 /* NCSettingsController.m in Sources */,
2C440D1120EA4A770005F9BB /* RoomInfoTableViewController.m in Sources */,
2C4D7D631F2F7C2C00FF4A0D /* ARDCaptureController.m in Sources */,
2C4D7D6A1F2F7DBC00FF4A0D /* ARDSettingsStore.m in Sources */,
2CC7158C20B8394A0045C789 /* ChatPlaceholderView.m in Sources */,

Просмотреть файл

@ -0,0 +1,16 @@
//
// NCChatTitleView.h
// VideoCalls
//
// Created by Ivan Sein on 23.07.18.
// Copyright © 2018 struktur AG. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NCChatTitleView : UIView
@property (weak, nonatomic) IBOutlet UIButton *title;
@property (weak, nonatomic) IBOutlet UIImageView *image;
@end

Просмотреть файл

@ -0,0 +1,36 @@
//
// NCChatTitleView.m
// VideoCalls
//
// Created by Ivan Sein on 23.07.18.
// Copyright © 2018 struktur AG. All rights reserved.
//
#import "NCChatTitleView.h"
@interface NCChatTitleView ()
@property (strong, nonatomic) IBOutlet UIView *contentView;
@end
@implementation NCChatTitleView
- (instancetype)init
{
self = [super init];
if (self) {
[[NSBundle mainBundle] loadNibNamed:@"NCChatTitleView" owner:self options:nil];
[self addSubview:self.contentView];
self.contentView.frame = self.bounds;
self.image.layer.cornerRadius = 15.0f;
self.image.clipsToBounds = YES;
}
return self;
}
@end

Просмотреть файл

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="NCChatTitleView">
<connections>
<outlet property="contentView" destination="iN0-l3-epB" id="Ubk-5l-dVr"/>
<outlet property="image" destination="IxN-fr-8tD" id="qhm-zm-Zko"/>
<outlet property="title" destination="I8S-E1-SNm" id="nwB-my-Suf"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="290" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="I8S-E1-SNm">
<rect key="frame" x="50" y="0.0" width="240" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<state key="normal" title="Button">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IxN-fr-8tD">
<rect key="frame" x="10" y="0.0" width="30" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<point key="canvasLocation" x="-82" y="-265"/>
</view>
</objects>
</document>

Просмотреть файл

@ -15,6 +15,7 @@
#import "NCAPIController.h"
#import "NCChatMessage.h"
#import "NCChatMention.h"
#import "NCChatTitleView.h"
#import "NCMessageTextView.h"
#import "NCRoomsManager.h"
#import "NCRoomController.h"
@ -48,7 +49,6 @@
self = [super initWithTableViewStyle:UITableViewStylePlain];
if (self) {
self.room = room;
self.title = room.displayName;
self.hidesBottomBarWhenPushed = YES;
// Fixes problem with tableView contentSize on iOS 11
self.tableView.estimatedRowHeight = 0;
@ -101,8 +101,6 @@
[self.textInputbar.editorRightButton setTintColor:[UIColor colorWithRed:0.0/255.0 green:122.0/255.0 blue:255.0/255.0 alpha:1.0]];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.tableView registerClass:[ChatMessageTableViewCell class] forCellReuseIdentifier:ChatMessageCellIdentifier];
@ -170,6 +168,32 @@
- (void)configureActionItems
{
NCChatTitleView *titleView = [[NCChatTitleView alloc] init];
titleView.frame = CGRectMake(0, 0, 800, 30);
titleView.autoresizingMask=UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[titleView.title setTitle:_room.displayName forState:UIControlStateNormal];
// Set room image
switch (_room.type) {
case kNCRoomTypeOneToOneCall:
{
// Request user avatar to the server and set it if exist
[titleView.image setImageWithURLRequest:[[NCAPIController sharedInstance] createAvatarRequestForUser:_room.name andSize:96]
placeholderImage:nil success:nil failure:nil];
}
break;
case kNCRoomTypeGroupCall:
[titleView.image setImage:[UIImage imageNamed:@"group-bg"]];
break;
case kNCRoomTypePublicCall:
[titleView.image setImage:[UIImage imageNamed:@"public-bg"]];
break;
default:
break;
}
self.navigationItem.titleView = titleView;
UIBarButtonItem *videoCallButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"videocall-action"]
style:UIBarButtonItemStylePlain
target:self

Просмотреть файл

@ -0,0 +1,13 @@
//
// RoomInfoTableViewController.h
// VideoCalls
//
// Created by Ivan Sein on 02.07.18.
// Copyright © 2018 struktur AG. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RoomInfoTableViewController : UITableViewController
@end

Просмотреть файл

@ -0,0 +1,114 @@
//
// RoomInfoTableViewController.m
// VideoCalls
//
// Created by Ivan Sein on 02.07.18.
// Copyright © 2018 struktur AG. All rights reserved.
//
#import "RoomInfoTableViewController.h"
@interface RoomInfoTableViewController ()
@end
@implementation RoomInfoTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
return 0;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
return 0;
}
/*
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
// Configure the cell...
return cell;
}
*/
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
/*
#pragma mark - Table view delegate
// In a xib-based application, navigation from a table can be handled in -tableView:didSelectRowAtIndexPath:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here, for example:
// Create the next view controller.
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:<#@"Nib name"#> bundle:nil];
// Pass the selected object to the new view controller.
// Push the view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
}
*/
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end

Просмотреть файл

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RoomInfoTableViewController">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableView opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" bouncesZoom="NO" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="NQg-xp-Ubj"/>
<connections>
<outlet property="dataSource" destination="-1" id="Tng-2m-Rnh"/>
<outlet property="delegate" destination="-1" id="9aC-8N-iBw"/>
</connections>
</tableView>
</objects>
</document>