Skip to content

Commit efddbe4

Browse files
committed
Split ProfileViewController's Bridge dependence into category
1 parent 4249216 commit efddbe4

File tree

6 files changed

+324
-271
lines changed

6 files changed

+324
-271
lines changed

APCAppCore/APCAppCore.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@
322322
CFFDEDFA1A95734000B25581 /* APCSetupTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = CFFDEDC01A95734000B25581 /* APCSetupTableViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
323323
CFFDEDFB1A95734000B25581 /* APCSetupTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CFFDEDC11A95734000B25581 /* APCSetupTableViewCell.m */; };
324324
CFFDEDFC1A95734000B25581 /* APCSetupTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = CFFDEDC21A95734000B25581 /* APCSetupTableViewCell.xib */; };
325+
EE2258261AF90F52007FA51E /* APCProfileViewController+Bridge.h in Headers */ = {isa = PBXBuildFile; fileRef = EE2258241AF90F52007FA51E /* APCProfileViewController+Bridge.h */; };
326+
EE2258271AF90F52007FA51E /* APCProfileViewController+Bridge.m in Sources */ = {isa = PBXBuildFile; fileRef = EE2258251AF90F52007FA51E /* APCProfileViewController+Bridge.m */; };
325327
F50738C01A682E12004CF100 /* APCDateRange.h in Headers */ = {isa = PBXBuildFile; fileRef = F50738BE1A682E12004CF100 /* APCDateRange.h */; settings = {ATTRIBUTES = (Public, ); }; };
326328
F50738C11A682E12004CF100 /* APCDateRange.m in Sources */ = {isa = PBXBuildFile; fileRef = F50738BF1A682E12004CF100 /* APCDateRange.m */; };
327329
F5306CCD1A8BE7F600732E60 /* ORKQuestionResult+APCHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = F5306CCB1A8BE7F600732E60 /* ORKQuestionResult+APCHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1005,6 +1007,8 @@
10051007
CFFDEDC01A95734000B25581 /* APCSetupTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APCSetupTableViewCell.h; sourceTree = "<group>"; };
10061008
CFFDEDC11A95734000B25581 /* APCSetupTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APCSetupTableViewCell.m; sourceTree = "<group>"; };
10071009
CFFDEDC21A95734000B25581 /* APCSetupTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = APCSetupTableViewCell.xib; sourceTree = "<group>"; };
1010+
EE2258241AF90F52007FA51E /* APCProfileViewController+Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "APCProfileViewController+Bridge.h"; sourceTree = "<group>"; };
1011+
EE2258251AF90F52007FA51E /* APCProfileViewController+Bridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "APCProfileViewController+Bridge.m"; sourceTree = "<group>"; };
10081012
F50738BE1A682E12004CF100 /* APCDateRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APCDateRange.h; sourceTree = "<group>"; };
10091013
F50738BF1A682E12004CF100 /* APCDateRange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APCDateRange.m; sourceTree = "<group>"; };
10101014
F5179B2919D09128001DCCB7 /* APCAppCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = APCAppCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -2670,6 +2674,8 @@
26702674
F5F1298B1A2F78490015982C /* APCProfile.storyboard */,
26712675
F5F1298C1A2F78490015982C /* APCProfileViewController.h */,
26722676
F5F1298D1A2F78490015982C /* APCProfileViewController.m */,
2677+
EE2258241AF90F52007FA51E /* APCProfileViewController+Bridge.h */,
2678+
EE2258251AF90F52007FA51E /* APCProfileViewController+Bridge.m */,
26732679
F5F1298E1A2F78490015982C /* APCSettingsViewController.h */,
26742680
F5F1298F1A2F78490015982C /* APCSettingsViewController.m */,
26752681
F5F129901A2F78490015982C /* APCWithdrawCompleteViewController.h */,
@@ -3000,6 +3006,7 @@
30003006
F5F12A731A2F78490015982C /* APCConfirmationView.h in Headers */,
30013007
F5B947FC1A73272C0034C522 /* APCPermissionsManager.h in Headers */,
30023008
F5F12ACA1A2F78490015982C /* APCProfileViewController.h in Headers */,
3009+
EE2258261AF90F52007FA51E /* APCProfileViewController+Bridge.h in Headers */,
30033010
F5B947E71A73272C0034C522 /* APCSegmentedButton.h in Headers */,
30043011
F5B947C71A73272C0034C522 /* NSObject+Helper.h in Headers */,
30053012
747307101A96E1DE0071D863 /* APCCMS.h in Headers */,
@@ -3530,6 +3537,7 @@
35303537
369E27F41A96B7A200D35DFA /* APCMedicationLozenge.m in Sources */,
35313538
7BF54F981AA158E50081C935 /* APCHorizontalBottomThinLineView.m in Sources */,
35323539
369E27FB1A96B7A200D35DFA /* APCMedicationUltraSimpleSelfInflator.m in Sources */,
3540+
EE2258271AF90F52007FA51E /* APCProfileViewController+Bridge.m in Sources */,
35333541
F5F12ABB1A2F78490015982C /* APCActivitiesViewController.m in Sources */,
35343542
5BB10C141A91F970002D2DD2 /* APCWebViewController.m in Sources */,
35353543
F5B948011A73272C0034C522 /* APCDayOfMonthSelector.m in Sources */,

APCAppCore/APCAppCore/UI/TabBarControllers/Profile/APCProfile.storyboard

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="u6G-bF-12V">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="u6G-bF-12V">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
55
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
66
</dependencies>
77
<scenes>
@@ -257,15 +257,15 @@
257257
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="XjR-k1-ssh" id="R7Y-lH-nIr">
258258
<autoresizingMask key="autoresizingMask"/>
259259
<subviews>
260-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AuT-nK-R7J">
260+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AuT-nK-R7J">
261261
<rect key="frame" x="20" y="23" width="185" height="21"/>
262262
<constraints>
263263
<constraint firstAttribute="height" constant="21" id="UCw-3X-AVs"/>
264264
</constraints>
265265
<fontDescription key="fontDescription" type="system" pointSize="16"/>
266266
<nil key="highlightedColor"/>
267267
</label>
268-
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Hhu-Za-IMS">
268+
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Hhu-Za-IMS">
269269
<rect key="frame" x="257" y="17" width="51" height="31"/>
270270
<constraints>
271271
<constraint firstAttribute="height" constant="31" id="Ae4-Zm-QqF"/>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// APCProfileViewController+Bridge.h
3+
// APCAppCore
4+
//
5+
// Copyright (c) 2015 Boston Children's Hospital, Inc. All rights reserved.
6+
//
7+
// Redistribution and use in source and binary forms, with or without modification,
8+
// are permitted provided that the following conditions are met:
9+
//
10+
// 1. Redistributions of source code must retain the above copyright notice, this
11+
// list of conditions and the following disclaimer.
12+
//
13+
// 2. Redistributions in binary form must reproduce the above copyright notice,
14+
// this list of conditions and the following disclaimer in the documentation and/or
15+
// other materials provided with the distribution.
16+
//
17+
// 3. Neither the name of the copyright holder(s) nor the names of any contributors
18+
// may be used to endorse or promote products derived from this software without
19+
// specific prior written permission. No license is granted to the trademarks of
20+
// the copyright holders even if such marks are included in this software.
21+
//
22+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
26+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
//
33+
34+
#import <APCAppCore/APCAppCore.h>
35+
36+
@interface APCProfileViewController (Bridge)
37+
38+
- (void)logOut;
39+
40+
@end
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// APCProfileViewController+Bridge.m
3+
// APCAppCore
4+
//
5+
// Copyright (c) 2015 Boston Children's Hospital, Inc. All rights reserved.
6+
//
7+
// Redistribution and use in source and binary forms, with or without modification,
8+
// are permitted provided that the following conditions are met:
9+
//
10+
// 1. Redistributions of source code must retain the above copyright notice, this
11+
// list of conditions and the following disclaimer.
12+
//
13+
// 2. Redistributions in binary form must reproduce the above copyright notice,
14+
// this list of conditions and the following disclaimer in the documentation and/or
15+
// other materials provided with the distribution.
16+
//
17+
// 3. Neither the name of the copyright holder(s) nor the names of any contributors
18+
// may be used to endorse or promote products derived from this software without
19+
// specific prior written permission. No license is granted to the trademarks of
20+
// the copyright holders even if such marks are included in this software.
21+
//
22+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
26+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
//
33+
34+
#import "APCProfileViewController+Bridge.h"
35+
#import "APCSpinnerViewController.h"
36+
#import "APCUser+Bridge.h"
37+
#import "APCLog.h"
38+
39+
#import "UIAlertController+Helper.h"
40+
41+
42+
@implementation APCProfileViewController (Bridge)
43+
44+
- (void)logOut
45+
{
46+
APCSpinnerViewController *spinnerController = [[APCSpinnerViewController alloc] init];
47+
[self presentViewController:spinnerController animated:YES completion:nil];
48+
49+
typeof(self) __weak weakSelf = self;
50+
51+
[self.user signOutOnCompletion:^(NSError *error) {
52+
if (error) {
53+
APCLogError2 (error);
54+
[spinnerController dismissViewControllerAnimated:NO completion:^{
55+
UIAlertController *alert = [UIAlertController simpleAlertWithTitle:NSLocalizedString(@"Sign Out", @"") message:error.message];
56+
[weakSelf presentViewController:alert animated:YES completion:nil];
57+
}];
58+
}
59+
else {
60+
[spinnerController dismissViewControllerAnimated:NO completion:^{
61+
[[NSNotificationCenter defaultCenter] postNotificationName:APCUserLogOutNotification object:self];
62+
}];
63+
}
64+
}];
65+
}
66+
67+
@end

APCAppCore/APCAppCore/UI/TabBarControllers/Profile/APCProfileViewController.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
//
3333

34-
#import <UIKit/UIKit.h>
3534
#import "APCUserInfoViewController.h"
3635

3736

0 commit comments

Comments
 (0)