diff --git a/VideoCalls/Images.xcassets/lobby-placeholder.imageset/Contents.json b/VideoCalls/Images.xcassets/lobby-placeholder.imageset/Contents.json new file mode 100644 index 000000000..3d399b5db --- /dev/null +++ b/VideoCalls/Images.xcassets/lobby-placeholder.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "lobby-placeholder.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "lobby-placeholder@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "lobby-placeholder@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/VideoCalls/Images.xcassets/lobby-placeholder.imageset/lobby-placeholder.png b/VideoCalls/Images.xcassets/lobby-placeholder.imageset/lobby-placeholder.png new file mode 100644 index 000000000..0a1408385 Binary files /dev/null and b/VideoCalls/Images.xcassets/lobby-placeholder.imageset/lobby-placeholder.png differ diff --git a/VideoCalls/Images.xcassets/lobby-placeholder.imageset/lobby-placeholder@2x.png b/VideoCalls/Images.xcassets/lobby-placeholder.imageset/lobby-placeholder@2x.png new file mode 100644 index 000000000..043364ec6 Binary files /dev/null and b/VideoCalls/Images.xcassets/lobby-placeholder.imageset/lobby-placeholder@2x.png differ diff --git a/VideoCalls/Images.xcassets/lobby-placeholder.imageset/lobby-placeholder@3x.png b/VideoCalls/Images.xcassets/lobby-placeholder.imageset/lobby-placeholder@3x.png new file mode 100644 index 000000000..c0c658152 Binary files /dev/null and b/VideoCalls/Images.xcassets/lobby-placeholder.imageset/lobby-placeholder@3x.png differ diff --git a/VideoCalls/Images.xcassets/lobby.imageset/Contents.json b/VideoCalls/Images.xcassets/lobby.imageset/Contents.json new file mode 100644 index 000000000..dbb5d597c --- /dev/null +++ b/VideoCalls/Images.xcassets/lobby.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "lobby.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "lobby@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "lobby@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/VideoCalls/Images.xcassets/lobby.imageset/lobby.png b/VideoCalls/Images.xcassets/lobby.imageset/lobby.png new file mode 100644 index 000000000..0a4b99c6b Binary files /dev/null and b/VideoCalls/Images.xcassets/lobby.imageset/lobby.png differ diff --git a/VideoCalls/Images.xcassets/lobby.imageset/lobby@2x.png b/VideoCalls/Images.xcassets/lobby.imageset/lobby@2x.png new file mode 100644 index 000000000..f29534659 Binary files /dev/null and b/VideoCalls/Images.xcassets/lobby.imageset/lobby@2x.png differ diff --git a/VideoCalls/Images.xcassets/lobby.imageset/lobby@3x.png b/VideoCalls/Images.xcassets/lobby.imageset/lobby@3x.png new file mode 100644 index 000000000..4c3448546 Binary files /dev/null and b/VideoCalls/Images.xcassets/lobby.imageset/lobby@3x.png differ diff --git a/VideoCalls/Images.xcassets/timer.imageset/Contents.json b/VideoCalls/Images.xcassets/timer.imageset/Contents.json new file mode 100644 index 000000000..883f4452a --- /dev/null +++ b/VideoCalls/Images.xcassets/timer.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "timer.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "timer@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "timer@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/VideoCalls/Images.xcassets/timer.imageset/timer.png b/VideoCalls/Images.xcassets/timer.imageset/timer.png new file mode 100644 index 000000000..2aede7ed1 Binary files /dev/null and b/VideoCalls/Images.xcassets/timer.imageset/timer.png differ diff --git a/VideoCalls/Images.xcassets/timer.imageset/timer@2x.png b/VideoCalls/Images.xcassets/timer.imageset/timer@2x.png new file mode 100644 index 000000000..9058b008b Binary files /dev/null and b/VideoCalls/Images.xcassets/timer.imageset/timer@2x.png differ diff --git a/VideoCalls/Images.xcassets/timer.imageset/timer@3x.png b/VideoCalls/Images.xcassets/timer.imageset/timer@3x.png new file mode 100644 index 000000000..ed8f021c4 Binary files /dev/null and b/VideoCalls/Images.xcassets/timer.imageset/timer@3x.png differ diff --git a/VideoCalls/NCAPIController.h b/VideoCalls/NCAPIController.h index 2ebe4f133..c8ad7878a 100644 --- a/VideoCalls/NCAPIController.h +++ b/VideoCalls/NCAPIController.h @@ -30,6 +30,7 @@ typedef void (^ExitRoomCompletionBlock)(NSError *error); typedef void (^FavoriteRoomCompletionBlock)(NSError *error); typedef void (^NotificationLevelCompletionBlock)(NSError *error); typedef void (^ReadOnlyCompletionBlock)(NSError *error); +typedef void (^SetLobbyStateCompletionBlock)(NSError *error); typedef void (^GetParticipantsFromRoomCompletionBlock)(NSMutableArray *participants, NSError *error); typedef void (^LeaveRoomCompletionBlock)(NSInteger errorCode, NSError *error); @@ -94,6 +95,7 @@ typedef void (^UnsubscribeToPushProxyCompletionBlock)(NSError *error); - (NSURLSessionDataTask *)removeRoomFromFavorites:(NSString *)token withCompletionBlock:(FavoriteRoomCompletionBlock)block; - (NSURLSessionDataTask *)setNotificationLevel:(NCRoomNotificationLevel)level forRoom:(NSString *)token withCompletionBlock:(NotificationLevelCompletionBlock)block; - (NSURLSessionDataTask *)setReadOnlyState:(NCRoomReadOnlyState)state forRoom:(NSString *)token withCompletionBlock:(ReadOnlyCompletionBlock)block; +- (NSURLSessionDataTask *)setLobbyState:(NCRoomLobbyState)state withTimer:(NSString *)timer forRoom:(NSString *)token withCompletionBlock:(SetLobbyStateCompletionBlock)block; // Participants Controller - (NSURLSessionDataTask *)getParticipantsFromRoom:(NSString *)token withCompletionBlock:(GetParticipantsFromRoomCompletionBlock)block; diff --git a/VideoCalls/NCAPIController.m b/VideoCalls/NCAPIController.m index dfeab279f..2bd0c2be6 100644 --- a/VideoCalls/NCAPIController.m +++ b/VideoCalls/NCAPIController.m @@ -497,6 +497,28 @@ - (NSURLSessionDataTask *)setReadOnlyState:(NCRoomReadOnlyState)state forRoom:(N return task; } +- (NSURLSessionDataTask *)setLobbyState:(NCRoomLobbyState)state withTimer:(NSString *)timer forRoom:(NSString *)token withCompletionBlock:(SetLobbyStateCompletionBlock)block +{ + NSString *URLString = [self getRequestURLForSpreedEndpoint:[NSString stringWithFormat:@"room/%@/webinary/lobby", token]]; + NSMutableDictionary *parameters = [NSMutableDictionary new]; + [parameters setObject:@(state) forKey:@"state"]; + if (timer) { + [parameters setObject:timer forKey:@"timer"]; + } + + NSURLSessionDataTask *task = [[NCAPISessionManager sharedInstance] PUT:URLString parameters:parameters success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + if (block) { + block(nil); + } + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + if (block) { + block(error); + } + }]; + + return task; +} + #pragma mark - Participants Controller - (NSURLSessionDataTask *)getParticipantsFromRoom:(NSString *)token withCompletionBlock:(GetParticipantsFromRoomCompletionBlock)block diff --git a/VideoCalls/NCChatViewController.m b/VideoCalls/NCChatViewController.m index 5b3463b9b..caed5b634 100644 --- a/VideoCalls/NCChatViewController.m +++ b/VideoCalls/NCChatViewController.m @@ -51,6 +51,7 @@ @interface NCChatViewController () @property (nonatomic, strong) UIButton *unreadMessageButton; @property (nonatomic, strong) UIBarButtonItem *videoCallButton; @property (nonatomic, strong) UIBarButtonItem *voiceCallButton; +@property (nonatomic, strong) NSTimer *lobbyCheckTimer; @end @@ -80,6 +81,7 @@ - (instancetype)initForRoom:(NCRoom *)room [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveChatHistory:) name:NCRoomControllerDidReceiveChatHistoryNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveChatMessages:) name:NCRoomControllerDidReceiveChatMessagesNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didSendChatMessage:) name:NCRoomControllerDidSendChatMessageNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveChatBlocked:) name:NCRoomControllerDidReceiveChatBlockedNotification object:nil]; } return self; @@ -96,6 +98,11 @@ - (void)viewDidLoad { [super viewDidLoad]; + self.titleView = [[NCChatTitleView alloc] init]; + self.titleView.frame = CGRectMake(0, 0, 800, 30); + self.titleView.autoresizingMask=UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; + [self.titleView.title addTarget:self action:@selector(titleButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; + self.navigationItem.titleView = _titleView; [self setTitleView]; [self configureActionItems]; @@ -197,6 +204,7 @@ - (void)viewDidDisappear:(BOOL)animated // Leave chat when the view controller has been removed from its parent view. if (self.isMovingFromParentViewController) { + [_lobbyCheckTimer invalidate]; [[NCRoomsManager sharedInstance] leaveChatInRoom:_room.token]; } } @@ -205,11 +213,7 @@ - (void)viewDidDisappear:(BOOL)animated - (void)setTitleView { - _titleView = [[NCChatTitleView alloc] init]; - _titleView.frame = CGRectMake(0, 0, 800, 30); - _titleView.autoresizingMask=UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; [_titleView.title setTitle:_room.displayName forState:UIControlStateNormal]; - [_titleView.title addTarget:self action:@selector(titleButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; // Set room image switch (_room.type) { @@ -239,8 +243,6 @@ - (void)setTitleView } else if ([_room.objectType isEqualToString:NCRoomObjectTypeSharePassword]) { [_titleView.image setImage:[UIImage imageNamed:@"password-bg"]]; } - - self.navigationItem.titleView = _titleView; } - (void)configureActionItems @@ -269,13 +271,53 @@ - (void)checkRoomControlsAvailability [_voiceCallButton setEnabled:YES]; } - if (_room.readOnlyState == NCRoomReadOnlyStateReadOnly) { + if (_room.readOnlyState == NCRoomReadOnlyStateReadOnly || [self shouldPresentLobbyView]) { // Hide text input self.textInputbarHidden = YES; // Disable call buttons [_videoCallButton setEnabled:NO]; [_voiceCallButton setEnabled:NO]; + } else if ([self isTextInputbarHidden]) { + // Show text input if it was hidden in a previous state + [self setTextInputbarHidden:NO animated:YES]; + } +} + +- (void)checkLobbyState +{ + if ([self shouldPresentLobbyView]) { + [_chatBackgroundView.placeholderText setText:@"You are currently waiting in the lobby."]; + [_chatBackgroundView.placeholderImage setImage:[UIImage imageNamed:@"lobby-placeholder"]]; + NSDate *date = [NCUtils dateFromDateAtomFormat:_room.lobbyTimer]; + if (date) { + NSString *meetingStart = [NCUtils readableDateFromDate:date]; + NSString *placeHolderText = [NSString stringWithFormat:@"You are currently waiting in the lobby.\nThis meeting is scheduled for\n%@", meetingStart]; + [_chatBackgroundView.placeholderText setText:placeHolderText]; + [_chatBackgroundView.placeholderImage setImage:[UIImage imageNamed:@"lobby-placeholder"]]; + } + [_chatBackgroundView.placeholderView setHidden:NO]; + [_chatBackgroundView.loadingView stopAnimating]; + [_chatBackgroundView.loadingView setHidden:YES]; + // Clear current chat since chat history will be retrieve when lobby is disabled + _messages = [[NSMutableDictionary alloc] init]; + _dateSections = [[NSMutableArray alloc] init]; + _hasReceiveInitialHistory = NO; + [self hideNewMessagesView]; + [self.tableView reloadData]; + } else { + [_chatBackgroundView.placeholderText setText:@"No messages yet, start the conversation!"]; + [_chatBackgroundView.placeholderImage setImage:[UIImage imageNamed:@"chat-placeholder"]]; + [_chatBackgroundView.placeholderView setHidden:YES]; + [_chatBackgroundView.loadingView startAnimating]; + [_chatBackgroundView.loadingView setHidden:NO]; + // Stop checking lobby flag + [_lobbyCheckTimer invalidate]; + // Retrieve initial chat history + if (!_hasReceiveInitialHistory) { + [_roomController getInitialChatHistory]; + } } + [self checkRoomControlsAvailability]; } #pragma mark - Utils @@ -419,6 +461,7 @@ - (void)didUpdateRoom:(NSNotification *)notification _room = room; [self setTitleView]; + [self checkLobbyState]; } - (void)didJoinRoom:(NSNotification *)notification @@ -545,6 +588,38 @@ - (void)didSendChatMessage:(NSNotification *)notification } } +- (void)didReceiveChatBlocked:(NSNotification *)notification +{ + NSString *room = [notification.userInfo objectForKey:@"room"]; + if (![room isEqualToString:_room.token]) { + return; + } + + [self startObservingRoomLobbyFlag]; +} + +#pragma mark - Lobby functions + +- (void)startObservingRoomLobbyFlag +{ + [self updateRoomInformation]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [_lobbyCheckTimer invalidate]; + _lobbyCheckTimer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(updateRoomInformation) userInfo:nil repeats:YES]; + }); +} + +- (void)updateRoomInformation +{ + [[NCRoomsManager sharedInstance] updateRoom:_room.token]; +} + +- (BOOL)shouldPresentLobbyView +{ + return _room.lobbyState == NCRoomLobbyStateModeratorsOnly && !_room.canModerate; +} + #pragma mark - Chat functions - (NSDate *)getKeyForDate:(NSDate *)date inDictionary:(NSDictionary *)dictionary @@ -657,7 +732,7 @@ - (BOOL)shouldGroupMessage:(NCChatMessage *)newMessage withMessage:(NCChatMessag - (BOOL)shouldRetireveHistory { - return _hasReceiveInitialHistory && !_retrievingHistory && [_roomController hasHistory]; + return _hasReceiveInitialHistory && !_retrievingHistory && [_roomController hasHistory] && _dateSections.count > 0; } - (void)showLoadingHistoryView @@ -747,6 +822,12 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView return 1; } + if ([tableView isEqual:self.tableView] && _dateSections.count > 0) { + self.tableView.backgroundView = nil; + } else { + self.tableView.backgroundView = _chatBackgroundView; + } + return _dateSections.count; } @@ -759,10 +840,6 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger NSDate *date = [_dateSections objectAtIndex:section]; NSMutableArray *messages = [_messages objectForKey:date]; - if ([tableView isEqual:self.tableView] && messages.count > 0) { - self.tableView.backgroundView = nil; - } - return messages.count; } diff --git a/VideoCalls/NCRoom.h b/VideoCalls/NCRoom.h index 8dcff586e..60cde1481 100644 --- a/VideoCalls/NCRoom.h +++ b/VideoCalls/NCRoom.h @@ -30,6 +30,11 @@ typedef enum NCRoomReadOnlyState { NCRoomReadOnlyStateReadOnly } NCRoomReadOnlyState; +typedef enum NCRoomLobbyState { + NCRoomLobbyStateAllParticipants = 0, + NCRoomLobbyStateModeratorsOnly +} NCRoomLobbyState; + extern NSString * const NCRoomObjectTypeFile; extern NSString * const NCRoomObjectTypeSharePassword; @@ -56,6 +61,8 @@ extern NSString * const NCRoomObjectTypeSharePassword; @property (nonatomic, copy) NSString *objectType; @property (nonatomic, copy) NSString *objectId; @property (nonatomic, assign) NCRoomReadOnlyState readOnlyState; +@property (nonatomic, assign) NCRoomLobbyState lobbyState; +@property (nonatomic, copy) NSString *lobbyTimer; + (instancetype)roomWithDictionary:(NSDictionary *)roomDict; diff --git a/VideoCalls/NCRoom.m b/VideoCalls/NCRoom.m index 760c0450a..94d57e0f1 100644 --- a/VideoCalls/NCRoom.m +++ b/VideoCalls/NCRoom.m @@ -41,6 +41,8 @@ + (instancetype)roomWithDictionary:(NSDictionary *)roomDict room.objectType = [roomDict objectForKey:@"objectType"]; room.objectId = [roomDict objectForKey:@"objectId"]; room.readOnlyState = (NCRoomReadOnlyState)[[roomDict objectForKey:@"readOnly"] integerValue]; + room.lobbyState = (NCRoomLobbyState)[[roomDict objectForKey:@"lobbyState"] integerValue]; + room.lobbyTimer = [roomDict objectForKey:@"lobbyTimer"]; id name = [roomDict objectForKey:@"name"]; if ([name isKindOfClass:[NSString class]]) { diff --git a/VideoCalls/NCRoomController.h b/VideoCalls/NCRoomController.h index 1c028b941..766d2fdad 100644 --- a/VideoCalls/NCRoomController.h +++ b/VideoCalls/NCRoomController.h @@ -14,6 +14,7 @@ extern NSString * const NCRoomControllerDidReceiveInitialChatHistoryNotification extern NSString * const NCRoomControllerDidReceiveChatHistoryNotification; extern NSString * const NCRoomControllerDidReceiveChatMessagesNotification; extern NSString * const NCRoomControllerDidSendChatMessageNotification; +extern NSString * const NCRoomControllerDidReceiveChatBlockedNotification; @interface NCRoomController : NSObject diff --git a/VideoCalls/NCRoomController.m b/VideoCalls/NCRoomController.m index 16c892fd4..3b5a3fd9f 100644 --- a/VideoCalls/NCRoomController.m +++ b/VideoCalls/NCRoomController.m @@ -15,6 +15,7 @@ NSString * const NCRoomControllerDidReceiveChatHistoryNotification = @"NCRoomControllerDidReceiveChatHistoryNotification"; NSString * const NCRoomControllerDidReceiveChatMessagesNotification = @"NCRoomControllerDidReceiveChatMessagesNotification"; NSString * const NCRoomControllerDidSendChatMessageNotification = @"NCRoomControllerDidSendChatMessageNotification"; +NSString * const NCRoomControllerDidReceiveChatBlockedNotification = @"NCRoomControllerDidReceiveChatBlockedNotification"; @interface NCRoomController () @@ -71,7 +72,7 @@ - (void)stopPingRoom - (void)getInitialChatHistory { - _pullMessagesTask = [[NCAPIController sharedInstance] receiveChatMessagesOfRoom:_roomToken fromLastMessageId:_oldestMessageId history:YES withCompletionBlock:^(NSMutableArray *messages, NSInteger lastKnownMessage, NSError *error, NSInteger statusCode) { + _pullMessagesTask = [[NCAPIController sharedInstance] receiveChatMessagesOfRoom:_roomToken fromLastMessageId:-1 history:YES withCompletionBlock:^(NSMutableArray *messages, NSInteger lastKnownMessage, NSError *error, NSInteger statusCode) { if (_stopChatMessagesPoll) { return; } @@ -79,6 +80,10 @@ - (void)getInitialChatHistory NSMutableDictionary *userInfo = [NSMutableDictionary new]; if (error) { + if ([self isChatBeingBlocked:statusCode]) { + [self notifyChatIsBlocked]; + return; + } [userInfo setObject:error forKey:@"error"]; NSLog(@"Could not get initial chat history. Error: %@", error.description); } @@ -91,7 +96,9 @@ - (void)getInitialChatHistory [[NSNotificationCenter defaultCenter] postNotificationName:NCRoomControllerDidReceiveInitialChatHistoryNotification object:self userInfo:userInfo]; - [self startReceivingChatMessages]; + if (!error) { + [self startReceivingChatMessages]; + } }]; } @@ -105,6 +112,10 @@ - (void)getChatHistoryFromMessagesId:(NSInteger)messageId NSMutableDictionary *userInfo = [NSMutableDictionary new]; if (error) { + if ([self isChatBeingBlocked:statusCode]) { + [self notifyChatIsBlocked]; + return; + } [userInfo setObject:error forKey:@"error"]; if (statusCode != 304) { NSLog(@"Could not get chat history. Error: %@", error.description); @@ -137,6 +148,10 @@ - (void)startReceivingChatMessages NSMutableDictionary *userInfo = [NSMutableDictionary new]; if (error) { + if ([self isChatBeingBlocked:statusCode]) { + [self notifyChatIsBlocked]; + return; + } [userInfo setObject:error forKey:@"error"]; if (statusCode != 304) { NSLog(@"Could not get new chat messages. Error: %@", error.description); @@ -149,7 +164,9 @@ - (void)startReceivingChatMessages [[NSNotificationCenter defaultCenter] postNotificationName:NCRoomControllerDidReceiveChatMessagesNotification object:self userInfo:userInfo]; - [self startReceivingChatMessages]; + if (error.code != -999) { + [self startReceivingChatMessages]; + } }]; } @@ -174,6 +191,23 @@ - (void)sendChatMessage:(NSString *)message }]; } +- (BOOL)isChatBeingBlocked:(NSInteger)statusCode +{ + if (statusCode == 412) { + return YES; + } + return NO; +} + +- (void)notifyChatIsBlocked +{ + NSMutableDictionary *userInfo = [NSMutableDictionary new]; + [userInfo setObject:_roomToken forKey:@"room"]; + [[NSNotificationCenter defaultCenter] postNotificationName:NCRoomControllerDidReceiveChatBlockedNotification + object:self + userInfo:userInfo]; +} + - (void)stopRoomController { [self stopPingRoom]; diff --git a/VideoCalls/NCSettingsController.h b/VideoCalls/NCSettingsController.h index 79f734dad..93b2626c4 100644 --- a/VideoCalls/NCSettingsController.h +++ b/VideoCalls/NCSettingsController.h @@ -36,6 +36,7 @@ extern NSString * const kCapabilitySystemMessages; extern NSString * const kCapabilityMentionFlag; extern NSString * const kCapabilityNotificationLevels; extern NSString * const kCapabilityLockedOneToOneRooms; +extern NSString * const kCapabilityWebinaryLobby; extern NSInteger const kDefaultChatMaxLength; diff --git a/VideoCalls/NCSettingsController.m b/VideoCalls/NCSettingsController.m index 2b0e98297..43141d524 100644 --- a/VideoCalls/NCSettingsController.m +++ b/VideoCalls/NCSettingsController.m @@ -51,6 +51,7 @@ @implementation NCSettingsController NSString * const kCapabilityMentionFlag = @"mention-flag"; NSString * const kCapabilityNotificationLevels = @"notification-levels"; NSString * const kCapabilityLockedOneToOneRooms = @"locked-one-to-one-rooms"; +NSString * const kCapabilityWebinaryLobby = @"webinary-lobby"; NSInteger const kDefaultChatMaxLength = 1000; diff --git a/VideoCalls/NCUtils.h b/VideoCalls/NCUtils.h index 82aee09fe..c952fb6ee 100644 --- a/VideoCalls/NCUtils.h +++ b/VideoCalls/NCUtils.h @@ -14,9 +14,15 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *)previewImageForFileExtension:(NSString *)fileExtension; + (NSString *)previewImageForFileMIMEType:(NSString *)fileMIMEType; + + (BOOL)isNextcloudAppInstalled; + (void)openFileInNextcloudApp:(NSString *)path withFileLink:(NSString *)link; +// https://www.php.net/manual/en/class.datetimeinterface.php#datetime.constants.atom ++ (NSDate *)dateFromDateAtomFormat:(NSString *)dateAtomFormatString; ++ (NSString *)dateAtomFormatFromDate:(NSDate *)date; ++ (NSString *)readableDateFromDate:(NSDate *)date; + @end NS_ASSUME_NONNULL_END diff --git a/VideoCalls/NCUtils.m b/VideoCalls/NCUtils.m index 832f5b4cd..048a71daa 100644 --- a/VideoCalls/NCUtils.m +++ b/VideoCalls/NCUtils.m @@ -73,4 +73,29 @@ + (void)openFileInNextcloudApp:(NSString *)path withFileLink:(NSString *)link [[UIApplication sharedApplication] openURL:nextcloudURL options:@{} completionHandler:nil]; } ++ (NSDate *)dateFromDateAtomFormat:(NSString *)dateAtomFormatString +{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]]; + [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"]; + + return [dateFormatter dateFromString:dateAtomFormatString]; +} ++ (NSString *)dateAtomFormatFromDate:(NSDate *)date +{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]]; + [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"]; + + return [dateFormatter stringFromDate:date]; +} ++ (NSString *)readableDateFromDate:(NSDate *)date +{ + NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateStyle:NSDateFormatterMediumStyle]; + [dateFormatter setTimeStyle:NSDateFormatterShortStyle]; + + return [dateFormatter stringFromDate:date]; +} + @end diff --git a/VideoCalls/PlaceholderView.xib b/VideoCalls/PlaceholderView.xib index 103eabaf8..ecf3234db 100644 --- a/VideoCalls/PlaceholderView.xib +++ b/VideoCalls/PlaceholderView.xib @@ -1,11 +1,11 @@ - + - + @@ -35,8 +35,8 @@ -