Add activity indicator while joining room.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2018-05-28 12:15:19 +02:00
Родитель 5d573e529c
Коммит 7ee16abbef
3 изменённых файлов: 18 добавлений и 2 удалений

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

@ -10,4 +10,7 @@
@interface ChatPlaceholderView : UIView
@property (weak, nonatomic) IBOutlet UIView *placeholderView;
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *loadingView;
@end

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

@ -12,6 +12,8 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ChatPlaceholderView">
<connections>
<outlet property="contentView" destination="iN0-l3-epB" id="OnQ-or-tGk"/>
<outlet property="loadingView" destination="FB3-Ig-rQB" id="gOr-Ol-aYj"/>
<outlet property="placeholderView" destination="Vla-vD-TGa" id="56h-KR-IJ3"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
@ -37,6 +39,10 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="FB3-Ig-rQB">
<rect key="frame" x="177" y="324" 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="custom" customColorSpace="sRGB"/>
<point key="canvasLocation" x="29.5" y="-163.5"/>

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

@ -26,6 +26,7 @@
@interface NCChatViewController ()
@property (nonatomic, strong) NCRoom *room;
@property (nonatomic, strong) ChatPlaceholderView *chatBackgroundView;
@property (nonatomic, strong) NSMutableDictionary *messages;
@property (nonatomic, strong) NSMutableArray *dateSections;
@property (nonatomic, strong) NSMutableArray *mentions;
@ -98,8 +99,10 @@
[self.autoCompletionView registerClass:[ChatMessageTableViewCell class] forCellReuseIdentifier:AutoCompletionCellIdentifier];
[self registerPrefixesForAutoCompletion:@[@"@"]];
ChatPlaceholderView *placeholder = [[ChatPlaceholderView alloc] init];
self.tableView.backgroundView = placeholder;
_chatBackgroundView = [[ChatPlaceholderView alloc] init];
[_chatBackgroundView.placeholderView setHidden:YES];
[_chatBackgroundView.loadingView startAnimating];
self.tableView.backgroundView = _chatBackgroundView;
}
- (void)viewWillAppear:(BOOL)animated
@ -210,6 +213,10 @@
}
[roomController startReceivingChatMessages];
[_chatBackgroundView.loadingView stopAnimating];
[_chatBackgroundView.loadingView setHidden:YES];
[_chatBackgroundView.placeholderView setHidden:NO];
}
- (void)didReceiveChatMessages:(NSNotification *)notification