Skip to content

Commit

Permalink
Merge branch 'release/1.2_44'
Browse files Browse the repository at this point in the history
  • Loading branch information
duemunk committed Dec 17, 2014
2 parents 26fa350 + 50e1f14 commit 688d397
Show file tree
Hide file tree
Showing 52 changed files with 27,661 additions and 11,152 deletions.
6 changes: 3 additions & 3 deletions BeMyEyes.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -808,15 +808,16 @@
7262301918BA3B49006F388C /* Localizable */ = {
isa = PBXGroup;
children = (
4EB46C4619F080FE008405B8 /* BMEAccessLocalization.strings */,
72DA826F18D46C6A001F3312 /* BMEAppDelegateLocalizationTable.strings */,
4E6544741A00279000B71C1C /* PostCallLocalizationTable.strings */,
72856DEA19AF66A20027AFF5 /* BMEBlindIntroLocalizationTable.strings */,
72DA826C18D4699F001F3312 /* BMEBlindMainLocalizationTable.strings */,
72B1493818DF686600E9A8A9 /* BMECallLocalizationTable.strings */,
727E13EA194B3189002EDA7E /* BMEForgotPasswordLocalizationTable.strings */,
72856DDE19AF608B0027AFF5 /* BMEFrontPageLocalizationTable.strings */,
72856DE719AF66920027AFF5 /* BMEHelperIntroLocalizationTable.strings */,
72A7676D1902A5C4003121C4 /* BMEHelperMainLocalizationTable.strings */,
4E6544841A010BEC00B71C1C /* BMEInterfaceLocalizationTable.strings */,
72414AF8196AAD5C00A2C5F4 /* BMELanguagesLocalizationTable.strings */,
72E65F9F18BA7A4E002FB2E0 /* BMELoginLocalizationTable.strings */,
72414AFB196AB16A00A2C5F4 /* BMEMainLocalizationTable.strings */,
Expand All @@ -830,9 +831,8 @@
72A767701902A5F4003121C4 /* BMESnoozeRelativeDateLocalizationTable.strings */,
72856DF019AF75420027AFF5 /* BMETermsLocalizationTable.strings */,
72B3C4C61987E22100A56D49 /* BMEVideoLocalizationTable.strings */,
4EB46C4619F080FE008405B8 /* BMEAccessLocalization.strings */,
72DA827518D4716A001F3312 /* Localizable.strings */,
4E6544841A010BEC00B71C1C /* BMEInterfaceLocalizationTable.strings */,
4E6544741A00279000B71C1C /* PostCallLocalizationTable.strings */,
);
name = Localizable;
sourceTree = "<group>";
Expand Down
289 changes: 236 additions & 53 deletions BeMyEyes/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions BeMyEyes/BeMyEyes-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<string>1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>43</string>
<string>44</string>
<key>FacebookAppID</key>
<string>771890076161460</string>
<key>FacebookDisplayName</key>
Expand Down
1 change: 1 addition & 0 deletions BeMyEyes/Source/Application/InAppTestBadge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import UIKit
label.font = UIFont.boldSystemFontOfSize(12)
label.textColor = .whiteColor()
label.textAlignment = .Center
label.isAccessibilityElement = false
return label
}()

Expand Down
53 changes: 45 additions & 8 deletions BeMyEyes/Source/Controllers/BMEBlindMainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@

#import "BMEBlindMainViewController.h"
#import "BMEAppDelegate.h"
#import "BMECallViewController.h"
#import "BMEPointLabel.h"
#import "BMECommunityStats.h"

#define BMEBlindMainCallSegue @"Call"

@interface BMEBlindMainViewController ()
@property (weak, nonatomic) IBOutlet UIButton *connectToCommunityButton;
@property (weak, nonatomic) IBOutlet UIView *communityStatsView;
@property (weak, nonatomic) IBOutlet UILabel *communityStatsLabel;
@property (weak, nonatomic) IBOutlet BMEPointLabel *pointsCommunitySightedLabel;
@property (weak, nonatomic) IBOutlet BMEPointLabel *pointsCommunityBlindLabel;
@property (weak, nonatomic) IBOutlet BMEPointLabel *pointsCommunityHelpedLabel;
@property (weak, nonatomic) IBOutlet UILabel *descriptionCommunitySightedLabel;
@property (weak, nonatomic) IBOutlet UILabel *descriptionCommunityBlindLabel;
@property (weak, nonatomic) IBOutlet UILabel *descriptionCommunityHelpedLabel;
@end

@implementation BMEBlindMainViewController
Expand All @@ -27,24 +36,52 @@ - (void)viewDidLoad {
[MKLocalization registerForLocalization:self];

self.connectToCommunityButton.titleLabel.textAlignment = NSTextAlignmentCenter;

self.pointsCommunitySightedLabel.colors =
self.pointsCommunityBlindLabel.colors =
self.pointsCommunityHelpedLabel.colors = @{ @(0.0f) : [UIColor lightTextColor],
@(1.0f) : [UIColor whiteColor] };

[[BMEClient sharedClient] loadCommunityStatsPointsCompletion:^(BMECommunityStats *stats, NSError *error) {
if (error) {
NSLog(@"Could not load point for days: %@", error);
}
[self updateToCommunityStats:stats];
self.communityStatsView.isAccessibilityElement = YES;
}];
}

- (void)shouldLocalize {
[self.connectToCommunityButton setTitle:MKLocalizedFromTable(BME_BLIND_MAIN_CONNECT_TO_COMMUNITY, BMEBlindMainLocalizationTable) forState:UIControlStateNormal];

self.communityStatsLabel.text = MKLocalizedFromTable(BME_HELPER_MAIN_COMMUNITY_NETWORK_DESCRIPTION, BMEHelperMainLocalizationTable);
self.descriptionCommunitySightedLabel.text = MKLocalizedFromTable(BME_HELPER_MAIN_COMMUNITY_NETWORK_SIGHTED, BMEHelperMainLocalizationTable);
self.descriptionCommunityBlindLabel.text = MKLocalizedFromTable(BME_HELPER_MAIN_COMMUNITY_NETWORK_BLIND, BMEHelperMainLocalizationTable);
self.descriptionCommunityHelpedLabel.text = MKLocalizedFromTable(BME_HELPER_MAIN_COMMUNITY_NETWORK_HELPED, BMEHelperMainLocalizationTable);

[self updateToCommunityStats:nil];
}


#pragma mark -
#pragma mark Private Methods

- (IBAction)connectToCommunityButtonPressed:(id)sender {
[[NSNotificationCenter defaultCenter] postNotificationName:BMEInitiateCallIfPossibleNotification object:self];
}


#pragma mark - Stats

- (void)updateToCommunityStats:(BMECommunityStats *)stats
{
if (stats) {
[self.pointsCommunityBlindLabel setPoint:stats.blind.integerValue animated:YES];
[self.pointsCommunitySightedLabel setPoint:stats.sighted.integerValue animated:YES];
[self.pointsCommunityHelpedLabel setPoint:stats.helped.integerValue animated:NO];
}

BMECallViewController *callController = [self.storyboard instantiateViewControllerWithIdentifier:BMECallControllerIdentifier];
callController.callMode = BMECallModeCreate;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:callController];
navigationController.navigationBarHidden = YES;

[self presentViewController:navigationController animated:YES completion:nil];
self.communityStatsView.accessibilityLabel = [NSString stringWithFormat:@"%@. %@ %@. %@ %@. %@ %@.", self.communityStatsLabel.text, self.pointsCommunitySightedLabel.finalText, self.descriptionCommunitySightedLabel.text, self.pointsCommunityBlindLabel.finalText, self.descriptionCommunityBlindLabel.text, self.pointsCommunityHelpedLabel.finalText, self.descriptionCommunityHelpedLabel.text];
}

@end
17 changes: 17 additions & 0 deletions BeMyEyes/Source/Controllers/BMECallViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@ - (void)shouldLocalize {
self.disconnectButton.title = MKLocalizedFromTable(BME_CALL_DISCONNECT, BMECallLocalizationTable);
}

- (BOOL)accessibilityPerformMagicTap {
if (self.disconnecting) {
return NO;
}
[self disconnect];
return YES;
}

- (BOOL)accessibilityPerformEscape {
if (self.disconnecting) {
return NO;
}
[self disconnect];
return YES;
}


#pragma mark -
#pragma mark Private Methods

Expand Down
2 changes: 2 additions & 0 deletions BeMyEyes/Source/Controllers/BMEForgotPasswordViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@

@interface BMEForgotPasswordViewController : BMEBaseViewController <MKLocalizable>

- (void)prepopulateWithEmail:(NSString *)email;

@end
21 changes: 20 additions & 1 deletion BeMyEyes/Source/Controllers/BMEForgotPasswordViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ @interface BMEForgotPasswordViewController ()
@property (weak, nonatomic) IBOutlet UITextField *emailTextField;
@property (weak, nonatomic) IBOutlet Button *sendPasswordButton;
@property (strong, nonatomic) BMEScrollViewTextFieldHelper *scrollViewHelper;
@property (strong, nonatomic) NSString *prepopulatingEmail;
@end

@implementation BMEForgotPasswordViewController
Expand All @@ -33,6 +34,7 @@ - (void)viewDidLoad {
[MKLocalization registerForLocalization:self];

self.scrollViewHelper = [[BMEScrollViewTextFieldHelper alloc] initWithScrollview:self.scrollView inViewController:self];
self.emailTextField.text = self.prepopulatingEmail;
}

- (void)shouldLocalize {
Expand All @@ -55,6 +57,20 @@ - (UIStatusBarAnimation)preferredStatusBarUpdateAnimation
return self.scrollViewHelper.preferredStatusBarUpdateAnimation;
}

- (BOOL)accessibilityPerformEscape {
[self.navigationController popViewControllerAnimated:NO];
return YES;
}


#pragma mark - Public Methods

- (void)prepopulateWithEmail:(NSString *)email {
self.prepopulatingEmail = email;
self.emailTextField.text = self.prepopulatingEmail;
}


#pragma mark -
#pragma mark Private Methods

Expand Down Expand Up @@ -96,7 +112,10 @@ - (void)sendNewPasswordToEmail:(NSString *)email {
[[BMEClient sharedClient] sendNewPasswordToEmail:email completion:^(BOOL success, NSError *error) {
[progressOverlayView hide:YES];

if (error && [error code] != BMEClientErrorUserNotFound && [error code] != BMEClientErrorNotPermitted) {
BOOL hasError = error != nil;
BOOL userNotFound = error.code == BMEClientErrorUserNotFound;
BOOL notPermitted = [error code] != BMEClientErrorNotPermitted;
if (hasError && !userNotFound && !notPermitted) {
NSString *title = MKLocalizedFromTable(BME_FORGOT_PASSWORD_ALERT_SEND_NEW_PASSWORD_REQUEST_FAILED_TITLE, BMEForgotPasswordLocalizationTable);
NSString *message = MKLocalizedFromTable(BME_FORGOT_PASSWORD_ALERT_SEND_NEW_PASSWORD_REQUEST_FAILED_MESSAGE, BMEForgotPasswordLocalizationTable);
NSString *cancelButton = MKLocalizedFromTable(BME_FORGOT_PASSWORD_ALERT_SEND_NEW_PASSWORD_REQUEST_FAILED_CANCEL, BMEForgotPasswordLocalizationTable);
Expand Down
5 changes: 5 additions & 0 deletions BeMyEyes/Source/Controllers/BMEIntroViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@

@implementation BMEIntroViewController

- (BOOL)accessibilityPerformEscape {
[self.navigationController popViewControllerAnimated:NO];
return YES;
}

@end
14 changes: 13 additions & 1 deletion BeMyEyes/Source/Controllers/BMELoginViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#import "BMEUser.h"
#import "BMEScrollViewTextFieldHelper.h"
#import "BeMyEyes-Swift.h"
#import "BMEForgotPasswordViewController.h"

@interface BMELoginViewController () <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
Expand Down Expand Up @@ -67,6 +68,18 @@ - (UIStatusBarAnimation)preferredStatusBarUpdateAnimation
return self.scrollViewHelper.preferredStatusBarUpdateAnimation;
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.destinationViewController isKindOfClass:[BMEForgotPasswordViewController class]]) {
BMEForgotPasswordViewController *viewController = (BMEForgotPasswordViewController *)segue.destinationViewController;
[viewController prepopulateWithEmail:self.emailTextField.text];
}
}

- (BOOL)accessibilityPerformEscape {
[self.navigationController popViewControllerAnimated:NO];
return YES;
}

#pragma mark -
#pragma mark Private Methods

Expand All @@ -80,7 +93,6 @@ - (IBAction)loginButtonPressed:(id)sender {

- (void)performLoginUsingFacebook:(BOOL)useFacebook {
[self dismissKeyboard];
[self showLoggingInOverlay];

if (useFacebook) {
[self performLoginWithFacebook];
Expand Down
49 changes: 44 additions & 5 deletions BeMyEyes/Source/Controllers/BMEMainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "BMEUser.h"
#import "BMEAccessControlHandler.h"
#import "BMEAccessViewController.h"
#import "BMECallViewController.h"

#define BMEMainKnownLanguagesSegue @"KnownLanguages"
static NSString *const BMEAccessViewSegue = @"AccessView";
Expand Down Expand Up @@ -48,6 +49,7 @@ - (void)viewDidLoad {
selector:@selector(handleAppBecameActive)
name:UIApplicationDidBecomeActiveNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initiateCall) name:BMEInitiateCallIfPossibleNotification object:nil];

[[BMEClient sharedClient] verifyTokenAuthOnServerWithCompletion:^(BOOL valid) {
if (!valid) { // Force user to log out
Expand All @@ -69,17 +71,17 @@ - (void)viewDidLoad {
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];

[self check];
[self checkAccess];
[self askForMoreLanguagesIfNecessary];
}

- (void)handleAppBecameActive
{
[self check];
[self checkAccess];
}

- (void)check
- (void)checkAccess
{
[self askForMoreLanguagesIfNecessary];
if ([BMEClient sharedClient].currentUser.role == BMERoleHelper) {
[BMEAccessControlHandler hasNotificationsEnabled:^(BOOL isUserEnabled, BOOL validToken) {
if (isUserEnabled) {
Expand Down Expand Up @@ -150,7 +152,7 @@ - (void)displayMainControllerWithIdentifier:(NSString *)identifier {
}

- (void)askForMoreLanguagesIfNecessary {
if ([GVUserDefaults standardUserDefaults].peopleHelped >= BMEPeopleHelpedBeforeAskingForMoreLanguages &&
if ([BMEClient sharedClient].currentUser.peopleHelped.integerValue >= BMEPeopleHelpedBeforeAskingForMoreLanguages &&
![GVUserDefaults standardUserDefaults].hasAskedForMoreLanguages) {
NSString *title, *message, *cancelButton, *confirmButton;
if ([[BMEClient sharedClient].currentUser isHelper]) {
Expand Down Expand Up @@ -196,4 +198,41 @@ - (void)askForAccessIfNecessary
}];
}



#pragma mark - Call

- (BOOL)inCall {
return [self.navigationController.visibleViewController isKindOfClass:[BMECallViewController class]];
}

- (BOOL)ableToCall {
BOOL inCall = [self inCall];
return !inCall; // Not in call
}

- (BOOL)accessibilityPerformMagicTap {
if ([self inCall]) {
// Do nothing
} else if([self ableToCall]) {
return [self initiateCall];
}
return NO;
}

- (BOOL)initiateCall {
if (![BMEClient sharedClient].currentUser.isBlind) {
return NO;
}

BMECallViewController *callController = [self.storyboard instantiateViewControllerWithIdentifier:BMECallControllerIdentifier];
callController.callMode = BMECallModeCreate;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:callController];
navigationController.navigationBarHidden = YES;

[self presentViewController:navigationController animated:YES completion:nil];
return YES;
}

@end
5 changes: 5 additions & 0 deletions BeMyEyes/Source/Controllers/BMEPrivacyPolicyViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ - (void)shouldLocalize {
[self.backButton setTitle:MKLocalizedFromTable(BME_PRIVACY_POLICY_BACK, BMEPrivacyPolicyLocalizationTable) forState:UIControlStateNormal];
}

- (BOOL)accessibilityPerformEscape {
[self.navigationController popViewControllerAnimated:NO];
return YES;
}

@end
5 changes: 0 additions & 5 deletions BeMyEyes/Source/Controllers/BMEReportAbuseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ - (void)viewDidLoad {
[super viewDidLoad];

[MKLocalization registerForLocalization:self];

if ([[BMEClient sharedClient].currentUser isHelper]) {
NSUInteger peopleHelped = [GVUserDefaults standardUserDefaults].peopleHelped;
[GVUserDefaults standardUserDefaults].peopleHelped = peopleHelped + 1;
}
}

- (void)dealloc {
Expand Down

0 comments on commit 688d397

Please sign in to comment.