Skip to content

Commit

Permalink
Merge branch 'release/1.1_36'
Browse files Browse the repository at this point in the history
  • Loading branch information
duemunk committed Nov 9, 2014
2 parents e4b0f7b + 2e9d90e commit b3e51b3
Show file tree
Hide file tree
Showing 21 changed files with 857 additions and 72 deletions.
6 changes: 6 additions & 0 deletions BeMyEyes.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
4E8E21F519E8C03C00316AD8 /* IntroVideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8E21F219E8C03C00316AD8 /* IntroVideoViewController.swift */; };
4E8E21F619E8C03C00316AD8 /* OnboardingVideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8E21F319E8C03C00316AD8 /* OnboardingVideoViewController.swift */; };
4E8E21F719E8C03C00316AD8 /* VideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8E21F419E8C03C00316AD8 /* VideoViewController.swift */; };
4EB3A9A41A0E6D4F0044D4B9 /* BMEOpenTokVideoCapture.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EB3A9A31A0E6D4F0044D4B9 /* BMEOpenTokVideoCapture.m */; };
4EB46C4419F080FE008405B8 /* BMEAccessLocalization.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4EB46C4619F080FE008405B8 /* BMEAccessLocalization.strings */; };
4EB6A1E219E5725F00C72A02 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB6A1E119E5725F00C72A02 /* Button.swift */; };
4EB6AD1219E1F47A00141615 /* BMETaskTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EB6AD1119E1F47A00141615 /* BMETaskTableViewCell.m */; };
Expand Down Expand Up @@ -200,6 +201,8 @@
4E8E21F219E8C03C00316AD8 /* IntroVideoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroVideoViewController.swift; sourceTree = "<group>"; };
4E8E21F319E8C03C00316AD8 /* OnboardingVideoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingVideoViewController.swift; sourceTree = "<group>"; };
4E8E21F419E8C03C00316AD8 /* VideoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoViewController.swift; sourceTree = "<group>"; };
4EB3A9A21A0E6D4F0044D4B9 /* BMEOpenTokVideoCapture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BMEOpenTokVideoCapture.h; sourceTree = "<group>"; };
4EB3A9A31A0E6D4F0044D4B9 /* BMEOpenTokVideoCapture.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BMEOpenTokVideoCapture.m; sourceTree = "<group>"; };
4EB46C4519F080FE008405B8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/BMEAccessLocalization.strings; sourceTree = "<group>"; };
4EB46C4719F08102008405B8 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/BMEAccessLocalization.strings; sourceTree = "<group>"; };
4EB6A1E119E5725F00C72A02 /* Button.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -670,6 +673,8 @@
4E6544861A0136F700B71C1C /* BMEScrollViewTextFieldHelper.h */,
4E6544871A0136F700B71C1C /* BMEScrollViewTextFieldHelper.m */,
4E6AE89D1A01927F0019247A /* FacebookHelper.swift */,
4EB3A9A21A0E6D4F0044D4B9 /* BMEOpenTokVideoCapture.h */,
4EB3A9A31A0E6D4F0044D4B9 /* BMEOpenTokVideoCapture.m */,
);
path = Library;
sourceTree = "<group>";
Expand Down Expand Up @@ -998,6 +1003,7 @@
4E3ACE1819FFEF4F002548C8 /* PostCallViewController.swift in Sources */,
72DA826818D45B52001F3312 /* BMEHelperMainViewController.m in Sources */,
7236E04A18B8DD8E00F622AA /* BMESignUpViewController.m in Sources */,
4EB3A9A41A0E6D4F0044D4B9 /* BMEOpenTokVideoCapture.m in Sources */,
7296569918CC8C3E00E1A9EE /* BMEMainViewController.m in Sources */,
4EB6AD1719E1F48C00141615 /* GradientView.swift in Sources */,
72A7676C19029F34003121C4 /* NSDate+BMESnoozeRelativeDate.m in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions BeMyEyes/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="NHr-Jb-n4i">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="pPv-pk-tQL">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
Expand Down Expand Up @@ -349,7 +349,7 @@
<!--Top Navigation Controller-->
<scene sceneID="eg8-GG-mp5">
<objects>
<navigationController definesPresentationContext="YES" navigationBarHidden="YES" id="NHr-Jb-n4i" customClass="BMETopNavigationController" sceneMemberID="viewController">
<navigationController storyboardIdentifier="FrontPageNavigation" definesPresentationContext="YES" navigationBarHidden="YES" id="NHr-Jb-n4i" customClass="BMETopNavigationController" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Pvb-fY-Etg">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
Expand Down
10 changes: 9 additions & 1 deletion BeMyEyes/BeMyEyes-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>35</string>
<string>36</string>
<key>FacebookAppID</key>
<string>771890076161460</string>
<key>FacebookDisplayName</key>
Expand All @@ -39,6 +39,7 @@
<true/>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
Expand All @@ -57,6 +58,13 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
Expand Down
6 changes: 3 additions & 3 deletions BeMyEyes/Source/Application/BMEAccessControlHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

@interface BMEAccessControlHandler : NSObject

+ (void)requireNotificationsEnabled:(void(^)(BOOL isEnabled))completion;
+ (void)hasNotificationsEnabled:(void(^)(BOOL isEnabled))completion;
+ (void)requireNotificationsEnabled:(void(^)(BOOL isEnabled, BOOL validToken))completion;
+ (void)hasNotificationsEnabled:(void(^)(BOOL isEnabled, BOOL validToken))completion;
+ (void)requireMicrophoneEnabled:(void(^)(BOOL isEnabled))completion;
+ (void)hasMicrophoneEnabled:(void(^)(BOOL isEnabled))completion;
+ (void)requireCameraEnabled:(void(^)(BOOL isEnabled))completion;
+ (void)hasVideoEnabled:(void(^)(BOOL isEnabled))completion;

+ (void)enabledForRole:(BMERole)role completion:(void(^)(BOOL isEnabled))completion;
+ (void)enabledForRole:(BMERole)role completion:(void(^)(BOOL isEnabled, BOOL validToken))completion;

@end
31 changes: 15 additions & 16 deletions BeMyEyes/Source/Application/BMEAccessControlHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@interface BMEAccessControlHandler() <UIAlertViewDelegate>

@property (strong, nonatomic) void (^notificationsCompletion)(BOOL);
@property (strong, nonatomic) void (^notificationsCompletion)(BOOL isEnabled, BOOL validToken);

@end

Expand Down Expand Up @@ -50,13 +50,13 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
{
if ([keyPath isEqualToString:NSStringFromSelector(@selector(deviceToken))] &&
object == [GVUserDefaults standardUserDefaults]) {
[BMEAccessControlHandler hasNotificationsEnabled:^(BOOL isEnabled) {
[BMEAccessControlHandler hasNotificationsEnabled:^(BOOL isEnabled, BOOL validToken) {
if (!isEnabled) {
[BMEAccessControlHandler showNotificationsAlert];
}
if (self.notificationsCompletion) {
self.notificationsCompletion(isEnabled);
self.notificationsCompletion = nil;
self.notificationsCompletion(isEnabled, validToken);
_notificationsCompletion = nil;
}
}];
return;
Expand All @@ -68,10 +68,10 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
#pragma mark -
#pragma mark Public Methods

+ (void)enabledForRole:(BMERole)role completion:(void (^)(BOOL))completion
+ (void)enabledForRole:(BMERole)role completion:(void (^)(BOOL isEnabled, BOOL validToken))completion
{
#if TARGET_IPHONE_SIMULATOR
completion(YES);
completion(YES, YES);
return;
#endif

Expand All @@ -81,30 +81,30 @@ + (void)enabledForRole:(BMERole)role completion:(void (^)(BOOL))completion
// Ask for microphone + video
[self hasMicrophoneEnabled:^(BOOL isEnabled) {
if (!isEnabled) {
completion(NO);
completion(NO, YES);
return;
}
[self hasVideoEnabled:^(BOOL isEnabled) {
completion(isEnabled);
completion(isEnabled, YES);
}];
}];
}
break;
case BMERoleHelper:
{
// Ask for notifications + microphone + video
[self hasNotificationsEnabled:^(BOOL isEnabled) {
[self hasNotificationsEnabled:^(BOOL isEnabled, BOOL validToken) {
if (!isEnabled) {
completion(NO);
completion(NO, validToken);
return;
}
[self hasMicrophoneEnabled:^(BOOL isEnabled) {
if (!isEnabled) {
completion(NO);
completion(NO, validToken);
return;
}
[self hasVideoEnabled:^(BOOL isEnabled) {
completion(isEnabled);
completion(isEnabled, validToken);
}];
}];
}];
Expand All @@ -119,13 +119,13 @@ + (void)enabledForRole:(BMERole)role completion:(void (^)(BOOL))completion

// Remote notifications

+ (void)requireNotificationsEnabled:(void(^)(BOOL isEnabled))completion {
+ (void)requireNotificationsEnabled:(void(^)(BOOL isEnabled, BOOL validToken))completion {
// Store completion block
[self sharedInstance].notificationsCompletion = completion;
[self registerForRemoteNotifications];
}

+ (void)hasNotificationsEnabled:(void(^)(BOOL isEnabled))completion {
+ (void)hasNotificationsEnabled:(void(^)(BOOL isUserEnabled, BOOL validToken))completion {
// System – require badge and alert
BOOL isUserEnabled = NO;
if ([[UIApplication sharedApplication] respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) {
Expand All @@ -149,8 +149,7 @@ + (void)hasNotificationsEnabled:(void(^)(BOOL isEnabled))completion {
BOOL isTemporary = [deviceToken rangeOfString:@"bmetemp"].location == 0; // [GVUserDefaults standardUserDefaults].isTemporaryDeviceToken might not have been set yet
BOOL hasValidToken = hasNotificationsToken && !isTemporary;
// Combined
BOOL isEnabled = hasValidToken && isUserEnabled;
completion(isEnabled);
completion(isUserEnabled, hasValidToken);
}


Expand Down
32 changes: 20 additions & 12 deletions BeMyEyes/Source/Application/BMEAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

[NewRelicAgent startWithApplicationToken:@"AA9b45f5411736426b5fac31cce185b50d173d99ea"];
[self configureRESTClient];
dispatch_async(dispatch_get_main_queue(), ^{
[self checkIfLoggedIn];
});
[self checkIfLoggedIn];

if (self.isLaunchedWithShortID) {
[self performSelector:@selector(didAnswerCallWithShortId:) withObject:shortIdInLaunchOptions afterDelay:0.0f];
Expand Down Expand Up @@ -269,6 +267,7 @@ - (void)checkIfLoggedIn {
}
}];
} else {
[self showFrontPage];
NSLog(@"Device token: %@", [GVUserDefaults standardUserDefaults].deviceToken);
NSLog(@"Is valid: %@", [BMEClient sharedClient].isTokenValid ? @"YES" : @"NO");
}
Expand Down Expand Up @@ -405,25 +404,34 @@ - (void)didLogIn:(NSNotification *)notification {


- (void)showFrontPage {
BMETopNavigationController *initialViewController;
if ([self.window.rootViewController isKindOfClass:[BMETopNavigationController class]]) {
initialViewController = (BMETopNavigationController *)self.window.rootViewController;
if ([self.window.rootViewController.restorationIdentifier isEqualToString:BMEFrontPageNavigationControllerIdentifier]) {
BMETopNavigationController *initialViewController = (BMETopNavigationController *)self.window.rootViewController;
if (initialViewController.presentedViewController) {
[initialViewController dismissViewControllerAnimated:YES completion:nil];
}
[initialViewController popToRootViewControllerAnimated:YES];
} else {
initialViewController = (BMETopNavigationController *)[self.window.rootViewController.storyboard instantiateInitialViewController];
self.window.rootViewController = initialViewController;
return;
}
[self setTopViewController:[self.storyboard instantiateViewControllerWithIdentifier:BMEFrontPageNavigationControllerIdentifier]];
}

- (void)showLoggedInMainView {
if ([self.window.rootViewController.presentedViewController.restorationIdentifier isEqualToString:BMEMainNavigationControllerIdentifier]) {
if ([self.window.rootViewController.restorationIdentifier isEqualToString:BMEMainNavigationControllerIdentifier]) {
return;
}
UIViewController *mainController = [self.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:BMEMainNavigationControllerIdentifier];
[self.window.rootViewController presentViewController:mainController animated:YES completion:nil];
[self setTopViewController:[self.storyboard instantiateViewControllerWithIdentifier:BMEMainNavigationControllerIdentifier]];
}

- (void)setTopViewController:(UIViewController *)viewController {
for (UIView *view in self.window.subviews) { // Clear out, since presentedViewController might not be removed when settings window.rootViewController
[view removeFromSuperview];
}
self.window.rootViewController = viewController;
}

- (UIStoryboard *)storyboard {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
return storyboard;
}

@end
12 changes: 6 additions & 6 deletions BeMyEyes/Source/Controllers/BMEAccessViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ - (void)dealloc

- (void)checkAccess
{
[BMEAccessControlHandler enabledForRole:self.role completion:^(BOOL isEnabled) {
if (isEnabled) {
[BMEAccessControlHandler enabledForRole:self.role completion:^(BOOL isEnabled, BOOL validToken) {
if (isEnabled && validToken) {
[self dismissViewControllerAnimated:YES completion:nil];
return;
}

if (_accessNotificationsView) {
[BMEAccessControlHandler hasNotificationsEnabled:^(BOOL isEnabled) {
[BMEAccessControlHandler hasNotificationsEnabled:^(BOOL isEnabled, BOOL validToken) {
_accessNotificationsView.selected = isEnabled;
}];
}
Expand All @@ -87,7 +87,7 @@ - (void)checkAccess
}
if (_accessCameraView) {
[BMEAccessControlHandler hasVideoEnabled:^(BOOL isEnabled) {
self.accessCameraView.selected = isEnabled;
_accessCameraView.selected = isEnabled;
}];
}
}];
Expand Down Expand Up @@ -196,8 +196,8 @@ - (void)touchUpInsideNotificationsView
if (self.accessNotificationsView.selected) {
return;
}
[BMEAccessControlHandler requireNotificationsEnabled:^(BOOL isEnabled) {
self.accessNotificationsView.selected = isEnabled;
[BMEAccessControlHandler requireNotificationsEnabled:^(BOOL isUserEnabled, BOOL validToken) {
self.accessNotificationsView.selected = isUserEnabled;
[self checkAccess];
}];
}
Expand Down
7 changes: 2 additions & 5 deletions BeMyEyes/Source/Controllers/BMEBaseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ - (BOOL)shouldAutorotate {
}

- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
BOOL isIpad = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad;
return isIpad ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskPortrait;
}

- (UIStatusBarStyle)preferredStatusBarStyle
Expand Down
2 changes: 2 additions & 0 deletions BeMyEyes/Source/Controllers/BMECallViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#import "BMERequest.h"
#import "BMESpeaker.h"
#import "BMECallAudioPlayer.h"
#import "BMEOpenTokVideoCapture.h"

static NSString *BMECallPostSegue = @"PostCall";

Expand Down Expand Up @@ -222,6 +223,7 @@ - (void)publish {
self.publisher.cameraPosition = AVCaptureDevicePositionBack;
self.publisher.publishAudio = YES;
self.publisher.publishVideo = [self isUserBlind];
self.publisher.videoCapture = [BMEOpenTokVideoCapture new];

OTError *error = nil;
[self.session publish:self.publisher error:&error];
Expand Down
7 changes: 4 additions & 3 deletions BeMyEyes/Source/Controllers/BMEHelperMainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ - (void)viewDidLoad {

[MKLocalization registerForLocalization:self];

self.tableView.estimatedRowHeight = self.tableView.rowHeight;
self.tableView.rowHeight = UITableViewAutomaticDimension;

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
self.tableView.estimatedRowHeight = self.tableView.rowHeight;
self.tableView.rowHeight = UITableViewAutomaticDimension;
}

self.pointsHelpedPersonsLabel.colors =
self.pointsTotalLabel.colors = @{ @(0.0f) : [UIColor lightTextColor],
Expand Down

0 comments on commit b3e51b3

Please sign in to comment.