OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 self.view = mainView; | 25 self.view = mainView; |
26 } | 26 } |
27 | 27 |
28 - (void)applicationWillResignActive:(UIApplication *)application { | 28 - (void)applicationWillResignActive:(UIApplication *)application { |
29 // Terminate any calls when we aren't active. | 29 // Terminate any calls when we aren't active. |
30 [self dismissViewControllerAnimated:NO completion:nil]; | 30 [self dismissViewControllerAnimated:NO completion:nil]; |
31 } | 31 } |
32 | 32 |
33 #pragma mark - ARDMainViewDelegate | 33 #pragma mark - ARDMainViewDelegate |
34 | 34 |
35 - (void)mainView:(ARDMainView *)mainView didInputRoom:(NSString *)room { | 35 - (void)mainView:(ARDMainView *)mainView |
| 36 didInputRoom:(NSString *)room |
| 37 isLoopback:(BOOL)isLoopback |
| 38 isAudioOnly:(BOOL)isAudioOnly { |
36 if (!room.length) { | 39 if (!room.length) { |
37 return; | 40 return; |
38 } | 41 } |
39 // Trim whitespaces. | 42 // Trim whitespaces. |
40 NSCharacterSet *whitespaceSet = [NSCharacterSet whitespaceCharacterSet]; | 43 NSCharacterSet *whitespaceSet = [NSCharacterSet whitespaceCharacterSet]; |
41 NSString *trimmedRoom = [room stringByTrimmingCharactersInSet:whitespaceSet]; | 44 NSString *trimmedRoom = [room stringByTrimmingCharactersInSet:whitespaceSet]; |
42 | 45 |
43 // Check that room name is valid. | 46 // Check that room name is valid. |
44 NSError *error = nil; | 47 NSError *error = nil; |
45 NSRegularExpressionOptions options = NSRegularExpressionCaseInsensitive; | 48 NSRegularExpressionOptions options = NSRegularExpressionCaseInsensitive; |
(...skipping 10 matching lines...) Expand all Loading... |
56 options:0 | 59 options:0 |
57 range:NSMakeRange(0, trimmedRoom.length)]; | 60 range:NSMakeRange(0, trimmedRoom.length)]; |
58 if (matchRange.location == NSNotFound || | 61 if (matchRange.location == NSNotFound || |
59 matchRange.length != trimmedRoom.length) { | 62 matchRange.length != trimmedRoom.length) { |
60 [self showAlertWithMessage:@"Invalid room name."]; | 63 [self showAlertWithMessage:@"Invalid room name."]; |
61 return; | 64 return; |
62 } | 65 } |
63 | 66 |
64 // Kick off the video call. | 67 // Kick off the video call. |
65 ARDVideoCallViewController *videoCallViewController = | 68 ARDVideoCallViewController *videoCallViewController = |
66 [[ARDVideoCallViewController alloc] initForRoom:trimmedRoom]; | 69 [[ARDVideoCallViewController alloc] initForRoom:trimmedRoom |
| 70 isLoopback:isLoopback |
| 71 isAudioOnly:isAudioOnly]; |
67 videoCallViewController.modalTransitionStyle = | 72 videoCallViewController.modalTransitionStyle = |
68 UIModalTransitionStyleCrossDissolve; | 73 UIModalTransitionStyleCrossDissolve; |
69 [self presentViewController:videoCallViewController | 74 [self presentViewController:videoCallViewController |
70 animated:YES | 75 animated:YES |
71 completion:nil]; | 76 completion:nil]; |
72 } | 77 } |
73 | 78 |
74 #pragma mark - Private | 79 #pragma mark - Private |
75 | 80 |
76 - (void)showAlertWithMessage:(NSString*)message { | 81 - (void)showAlertWithMessage:(NSString*)message { |
77 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil | 82 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil |
78 message:message | 83 message:message |
79 delegate:nil | 84 delegate:nil |
80 cancelButtonTitle:@"OK" | 85 cancelButtonTitle:@"OK" |
81 otherButtonTitles:nil]; | 86 otherButtonTitles:nil]; |
82 [alertView show]; | 87 [alertView show]; |
83 } | 88 } |
84 | 89 |
85 @end | 90 @end |
OLD | NEW |