mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-16 06:28:27 +02:00
Join public room
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
F01628BA19E29A270071C473 /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F01628B919E29A270071C473 /* LoginViewController.m */; };
|
||||
F01628C119E29C660071C473 /* default-profile.png in Resources */ = {isa = PBXBuildFile; fileRef = F01628BC19E29C660071C473 /* default-profile.png */; };
|
||||
F01628C319E29C660071C473 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = F01628BE19E29C660071C473 /* logo.png */; };
|
||||
F024098219E7D177006E741B /* tab_recents@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F024098119E7D177006E741B /* tab_recents@2x.png */; };
|
||||
F05B955919DEDCD9008761B0 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F05B955219DEDCD9008761B0 /* HomeViewController.m */; };
|
||||
F05B955A19DEDCD9008761B0 /* RecentsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F05B955419DEDCD9008761B0 /* RecentsViewController.m */; };
|
||||
F05B955B19DEDCD9008761B0 /* RoomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F05B955619DEDCD9008761B0 /* RoomViewController.m */; };
|
||||
@@ -46,6 +47,7 @@
|
||||
F01628B919E29A270071C473 /* LoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewController.m; sourceTree = "<group>"; };
|
||||
F01628BC19E29C660071C473 /* default-profile.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "default-profile.png"; sourceTree = "<group>"; };
|
||||
F01628BE19E29C660071C473 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = "<group>"; };
|
||||
F024098119E7D177006E741B /* tab_recents@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tab_recents@2x.png"; sourceTree = "<group>"; };
|
||||
F05B955119DEDCD9008761B0 /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = "<group>"; };
|
||||
F05B955219DEDCD9008761B0 /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = "<group>"; };
|
||||
F05B955319DEDCD9008761B0 /* RecentsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecentsViewController.h; sourceTree = "<group>"; };
|
||||
@@ -113,6 +115,7 @@
|
||||
F01628B519E298710071C473 /* Assets */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F024098119E7D177006E741B /* tab_recents@2x.png */,
|
||||
F0CEA5B019E6898800E47915 /* tab_home.ico */,
|
||||
F0CEA5AD19E6895E00E47915 /* tab_recents.png */,
|
||||
F01628BC19E29C660071C473 /* default-profile.png */,
|
||||
@@ -278,6 +281,7 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F024098219E7D177006E741B /* tab_recents@2x.png in Resources */,
|
||||
F07A80E419DD9DE700B621A1 /* Main.storyboard in Resources */,
|
||||
F07A80E919DD9DE700B621A1 /* LaunchScreen.xib in Resources */,
|
||||
F0CEA5AF19E6895E00E47915 /* tab_recents.png in Resources */,
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
|
||||
#import "MasterTabBarController.h"
|
||||
|
||||
#define TABBAR_HOME_INDEX 0
|
||||
#define TABBAR_RECENTS_INDEX 1
|
||||
#define TABBAR_SETTINGS_INDEX 2
|
||||
#define TABBAR_COUNT 3
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
BIN
syMessaging/syMessaging/Assets/tab_recents@2x.png
Normal file
BIN
syMessaging/syMessaging/Assets/tab_recents@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -62,10 +62,48 @@
|
||||
<scene sceneID="3rt-8o-eGh">
|
||||
<objects>
|
||||
<tableViewController title="Home" id="ldZ-75-BUU" customClass="HomeViewController" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="LbI-fz-LaI">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="50" sectionHeaderHeight="30" sectionFooterHeight="22" id="LbI-fz-LaI">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<view key="tableHeaderView" contentMode="scaleToFill" id="vtK-sz-hd2" userLabel="TableHeaderView">
|
||||
<rect key="frame" x="0.0" y="64" width="600" height="90"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Room alias" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="b5x-lU-scr">
|
||||
<rect key="frame" x="8" y="30" width="461" height="30"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fIu-Mb-2Ad">
|
||||
<rect key="frame" x="512" y="52" width="53" height="33"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<state key="normal" title="Create">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
</button>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="DFg-sq-K9p">
|
||||
<rect key="frame" x="479" y="10" width="113" height="29"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="113" id="Rxh-Zw-vxF"/>
|
||||
</constraints>
|
||||
<segments>
|
||||
<segment title="Public"/>
|
||||
<segment title="Private"/>
|
||||
</segments>
|
||||
</segmentedControl>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="DFg-sq-K9p" firstAttribute="top" secondItem="vtK-sz-hd2" secondAttribute="top" constant="10" id="0B7-Rc-qbd"/>
|
||||
<constraint firstAttribute="trailing" secondItem="fIu-Mb-2Ad" secondAttribute="trailing" constant="35" id="ZeB-7G-AHj"/>
|
||||
<constraint firstItem="DFg-sq-K9p" firstAttribute="leading" secondItem="b5x-lU-scr" secondAttribute="trailing" constant="10" id="fpt-fP-KK4"/>
|
||||
<constraint firstAttribute="centerY" secondItem="b5x-lU-scr" secondAttribute="centerY" id="i6J-DF-oGV"/>
|
||||
<constraint firstAttribute="trailing" secondItem="DFg-sq-K9p" secondAttribute="trailing" constant="8" id="lHF-iX-NXM"/>
|
||||
<constraint firstItem="b5x-lU-scr" firstAttribute="leading" secondItem="vtK-sz-hd2" secondAttribute="leading" constant="8" id="yqk-6l-hdw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="fIu-Mb-2Ad" secondAttribute="bottom" constant="5" id="zE1-pl-eIQ" userLabel="Vertical Space - (8) - TableHeaderView - Create"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="PublicRoomCell" textLabel="UoS-rO-98c" style="IBUITableViewCellStyleDefault" id="Y5I-fR-nF2">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
@@ -88,7 +126,7 @@
|
||||
<outlet property="delegate" destination="ldZ-75-BUU" id="o5I-o3-IXu"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Public Rooms" id="vwK-UA-vG8"/>
|
||||
<navigationItem key="navigationItem" title="Home" id="vwK-UA-vG8"/>
|
||||
<connections>
|
||||
<outlet property="publicRoomsTable" destination="LbI-fz-LaI" id="WcR-YT-Ojc"/>
|
||||
</connections>
|
||||
@@ -417,32 +455,32 @@
|
||||
<scene sceneID="smW-Zh-WAh">
|
||||
<objects>
|
||||
<tableViewController title="Recents" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="RecentsViewController" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="r7i-6Z-zg0">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="70" sectionHeaderHeight="22" sectionFooterHeight="22" id="r7i-6Z-zg0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="RecentsCell" rowHeight="70" id="WCw-Qf-5nD" customClass="RecentsTableViewCell">
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="RecentsCell" id="WCw-Qf-5nD" customClass="RecentsTableViewCell">
|
||||
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WCw-Qf-5nD" id="37f-cq-3Eg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RoomTitle" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="15" translatesAutoresizingMaskIntoConstraints="NO" id="YTM-8H-EpC">
|
||||
<rect key="frame" x="8" y="9" width="86" height="23"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="RoomTitle" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="15" translatesAutoresizingMaskIntoConstraints="NO" id="YTM-8H-EpC">
|
||||
<rect key="frame" x="8" y="8" width="504" height="23"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="19"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LastEventDescription" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="14" translatesAutoresizingMaskIntoConstraints="NO" id="5g8-vg-2EB">
|
||||
<rect key="frame" x="8" y="40" width="164" height="21"/>
|
||||
<rect key="frame" x="8" y="39" width="584" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Oct 12 18:15" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eKl-0r-wFc">
|
||||
<rect key="frame" x="514" y="8" width="80" height="21"/>
|
||||
<rect key="frame" x="520" y="8" width="72" height="15"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addPublicRoom:)];
|
||||
self.navigationItem.rightBarButtonItem = addButton;
|
||||
// UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addPublicRoom:)];
|
||||
// self.navigationItem.rightBarButtonItem = addButton;
|
||||
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
_publicRooms = nil;
|
||||
@@ -66,6 +66,17 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
|
||||
if (_publicRooms) {
|
||||
NSString *homeserver = [[MatrixHandler sharedHandler] homeServerURL];
|
||||
if (homeserver.length) {
|
||||
return [NSString stringWithFormat:@"Public Rooms (at %@)", homeserver];
|
||||
}
|
||||
return @"Public Rooms";
|
||||
}
|
||||
return @"No Public Rooms";
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UITableViewCell *cell = [_publicRoomsTable dequeueReusableCellWithIdentifier:@"PublicRoomCell" forIndexPath:indexPath];
|
||||
|
||||
@@ -75,6 +86,24 @@
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - Table view delegate
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
// Join the selected room
|
||||
MXPublicRoom *publicRoom = [_publicRooms objectAtIndex:indexPath.row];
|
||||
[[[MatrixHandler sharedHandler] mxSession] join:publicRoom.room_id success:^{
|
||||
// Show joined room
|
||||
[[AppDelegate theDelegate].masterTabBarController showRoomDetails:publicRoom.room_id];
|
||||
} failure:^(NSError *error) {
|
||||
NSLog(@"Failed to join public room (%@) failed: %@", publicRoom.displayname, error);
|
||||
//Alert user
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
}];
|
||||
|
||||
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - Internals
|
||||
|
||||
- (void)refreshPublicRooms
|
||||
|
||||
@@ -16,9 +16,16 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#define TABBAR_HOME_INDEX 0
|
||||
#define TABBAR_RECENTS_INDEX 1
|
||||
#define TABBAR_SETTINGS_INDEX 2
|
||||
#define TABBAR_COUNT 3
|
||||
|
||||
@interface MasterTabBarController : UITabBarController
|
||||
|
||||
- (void)showLoginScreen;
|
||||
|
||||
- (void)showRoomDetails:(NSString*)roomId;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -46,4 +46,10 @@
|
||||
[self performSegueWithIdentifier:@"showLogin" sender:self];
|
||||
}
|
||||
|
||||
- (void)showRoomDetails:(NSString*)roomId {
|
||||
// Switch on recent
|
||||
[self setSelectedIndex:TABBAR_RECENTS_INDEX];
|
||||
//TODO
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
@interface MatrixHandler : NSObject
|
||||
|
||||
@property (strong, nonatomic) MXHomeServer *homeServer;
|
||||
@property (strong, nonatomic) MXSession *mxSession;
|
||||
@property (strong, nonatomic) MXData *mxData;
|
||||
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ static MatrixHandler *sharedHandler = nil;
|
||||
|
||||
@interface MatrixHandler ()
|
||||
|
||||
@property (strong, nonatomic) MXSession *mxSession;
|
||||
|
||||
@property (nonatomic,readwrite) BOOL isInitialSyncDone;
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user