forked from mirrors/linphone-iphone
add wait view when creating a chat room
This commit is contained in:
parent
92fc3b68d9
commit
ff5177d32f
6 changed files with 43 additions and 7 deletions
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
<outlet property="selectedButtonImage" destination="ibu-Ra-oZO" id="jvl-ay-cfh"/>
|
||||
<outlet property="tableController" destination="4" id="18"/>
|
||||
<outlet property="view" destination="5" id="14"/>
|
||||
<outlet property="waitView" destination="CwL-Gm-5EH" id="Zte-9n-SFk"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
|
|
@ -144,6 +145,18 @@
|
|||
<outlet property="delegate" destination="4" id="MJr-oP-Hib"/>
|
||||
</connections>
|
||||
</searchBar>
|
||||
<view hidden="YES" tag="8" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="CwL-Gm-5EH" userLabel="waitView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="559"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<activityIndicatorView opaque="NO" tag="9" contentMode="scaleToFill" fixedFrame="YES" animating="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="YYS-fL-sfZ" userLabel="activityIndicatorView">
|
||||
<rect key="frame" x="179" y="267" width="20" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
</activityIndicatorView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<gestureRecognizers/>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -19,13 +19,12 @@
|
|||
@property(strong, nonatomic) IBOutlet ChatConversationCreateTableView *tableController;
|
||||
@property(strong, nonatomic) IBOutlet ChatConversationCreateCollectionViewController *collectionController;
|
||||
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UIIconButton *backButton;
|
||||
@property (weak, nonatomic) IBOutlet UIIconButton *nextButton;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIIconButton *allButton;
|
||||
@property (weak, nonatomic) IBOutlet UIIconButton *linphoneButton;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *selectedButtonImage;
|
||||
@property (weak, nonatomic) IBOutlet UIView *waitView;
|
||||
|
||||
@property(nonatomic) Boolean isForEditing;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
_waitView.hidden = YES;
|
||||
if(_tableController.contactsGroup.count == 0) {
|
||||
if (!_isForEditing)
|
||||
_nextButton.enabled = FALSE;
|
||||
|
|
@ -76,12 +77,14 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
#pragma mark - Chat room functions
|
||||
|
||||
void create_chat_room_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState newState) {
|
||||
ChatConversationCreateView *view = (__bridge ChatConversationCreateView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr));
|
||||
switch (newState) {
|
||||
case LinphoneChatRoomStateCreated:
|
||||
LOGI(@"Chat room [%p] created on server.", cr);
|
||||
[(__bridge ChatConversationCreateView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr)) onChatRoomCreated:cr];
|
||||
[view onChatRoomCreated:cr];
|
||||
break;
|
||||
case LinphoneChatRoomStateCreationFailed:
|
||||
view.waitView.hidden = YES;
|
||||
LOGE(@"Chat room [%p] could not be created on server.", cr);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -91,11 +94,13 @@ void create_chat_room_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState
|
|||
|
||||
- (void)onChatRoomCreated:(LinphoneChatRoom *)cr {
|
||||
ChatConversationView *view = VIEW(ChatConversationView);
|
||||
_waitView.hidden = YES;
|
||||
view.chatRoom = cr;
|
||||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
|
||||
}
|
||||
|
||||
- (void)createChatRoom {
|
||||
_waitView.hidden = NO;
|
||||
LinphoneChatRoom *room = linphone_core_create_client_group_chat_room(LC, "dummy subject");
|
||||
NSString *addr = _tableController.contactsDict.allKeys[0];
|
||||
LinphoneAddress *linphoneAddress = linphone_address_new(addr.UTF8String);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
@property (weak, nonatomic) IBOutlet UIIconButton *addButton;
|
||||
@property (weak, nonatomic) IBOutlet UITextField *nameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UITableView *tableView;
|
||||
@property (weak, nonatomic) IBOutlet UIView *waitView;
|
||||
|
||||
- (IBAction)onNextClick:(id)sender;
|
||||
- (IBAction)onBackClick:(id)sender;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
_waitView.hidden = YES;
|
||||
_nameLabel.text = _room && linphone_chat_room_get_subject(_room)
|
||||
? [NSString stringWithUTF8String:linphone_chat_room_get_subject(_room)]
|
||||
: @"";
|
||||
|
|
@ -90,6 +91,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
#pragma mark - next functions
|
||||
|
||||
- (void)onCreate {
|
||||
_waitView.hidden = NO;
|
||||
LinphoneChatRoom *room = linphone_core_create_client_group_chat_room(LC, _nameLabel.text.UTF8String);
|
||||
if(!room) {
|
||||
return;
|
||||
|
|
@ -282,23 +284,26 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
#pragma mark - chat room callbacks
|
||||
|
||||
- (void)goToChatRoom:(LinphoneChatRoom *)cr {
|
||||
_waitView.hidden = YES;
|
||||
ChatConversationView *view = VIEW(ChatConversationView);
|
||||
view.chatRoom = cr;
|
||||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
|
||||
}
|
||||
|
||||
void chat_room_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState newState) {
|
||||
ChatConversationInfoView *view = (__bridge ChatConversationInfoView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr));
|
||||
switch (newState) {
|
||||
case LinphoneChatRoomStateCreated:
|
||||
LOGI(@"Chat room [%p] created on server.", cr);
|
||||
[(__bridge ChatConversationInfoView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr)) goToChatRoom:cr];
|
||||
[view goToChatRoom:cr];
|
||||
break;
|
||||
case LinphoneChatRoomStateCreationFailed:
|
||||
view.waitView.hidden = YES;
|
||||
LOGE(@"Chat room [%p] could not be created on server.", cr);
|
||||
break;
|
||||
case LinphoneChatRoomStateTerminated:
|
||||
LOGI(@"Chat room [%p] has been terminated.", cr);
|
||||
[(__bridge ChatConversationInfoView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_callbacks(cr)) goToChatRoom:cr];
|
||||
[view goToChatRoom:cr];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
<outlet property="quitButton" destination="Hnm-7C-dBQ" id="Kp1-Aw-FQq"/>
|
||||
<outlet property="tableView" destination="pMq-Gv-0uu" id="ELS-RQ-olX"/>
|
||||
<outlet property="view" destination="zgv-a8-72k" id="1Cq-i3-h2W"/>
|
||||
<outlet property="waitView" destination="gCU-N8-PWM" id="KUB-ax-ALp"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
|
|
@ -147,6 +148,18 @@
|
|||
<action selector="onQuitClick:" destination="-1" eventType="touchUpInside" id="TT0-hW-JMh"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view hidden="YES" tag="8" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gCU-N8-PWM" userLabel="waitView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="559"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<activityIndicatorView opaque="NO" tag="9" contentMode="scaleToFill" fixedFrame="YES" animating="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="QeU-kh-Ycy" userLabel="activityIndicatorView">
|
||||
<rect key="frame" x="179" y="268" width="20" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
</activityIndicatorView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<gestureRecognizers/>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue