Skip to content

Commit

Permalink
Conditional onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed May 14, 2013
1 parent 4d1fd25 commit 662bb8d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Binary file added Media/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Media/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions OpenWatch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
D909C2D71742B11D005930A7 /* NSString+FontAwesome.m in Sources */ = {isa = PBXBuildFile; fileRef = D909C2D11742B11D005930A7 /* NSString+FontAwesome.m */; };
D909C2D81742B11D005930A7 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D909C2D31742B11D005930A7 /* FontAwesome.ttf */; };
D909C2D91742B11D005930A7 /* UIColor+BButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D909C2D51742B11D005930A7 /* UIColor+BButton.m */; };
D909C2DD1742BB55005930A7 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D909C2DB1742BB55005930A7 /* [email protected] */; };
D909C2DE1742BB55005930A7 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D909C2DC1742BB55005930A7 /* [email protected] */; };
D91AC0011733003100823179 /* OWDashboardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D91AC0001733003100823179 /* OWDashboardViewController.m */; };
D91AC0341733021800823179 /* 66-microphone.png in Resources */ = {isa = PBXBuildFile; fileRef = D91AC02C1733021800823179 /* 66-microphone.png */; };
D91AC0351733021800823179 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D91AC02D1733021800823179 /* [email protected] */; };
Expand Down Expand Up @@ -64,7 +66,6 @@
D930851F166426A9008C5D4C /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D930851E166426A9008C5D4C /* MapKit.framework */; };
D93936BF174199140070E164 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D93936BE174199140070E164 /* libxml2.dylib */; };
D93936C11741991A0070E164 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D93936C01741991A0070E164 /* ImageIO.framework */; };
D93936C81741A5620070E164 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D93936C41741A5620070E164 /* [email protected] */; };
D93936C91741A5620070E164 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D93936C51741A5620070E164 /* [email protected] */; };
D93936CA1741A5620070E164 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D93936C61741A5620070E164 /* [email protected] */; };
D93936CB1741A5620070E164 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = D93936C71741A5620070E164 /* [email protected] */; };
Expand Down Expand Up @@ -344,6 +345,8 @@
D909C2D31742B11D005930A7 /* FontAwesome.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome.ttf; sourceTree = "<group>"; };
D909C2D41742B11D005930A7 /* UIColor+BButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+BButton.h"; sourceTree = "<group>"; };
D909C2D51742B11D005930A7 /* UIColor+BButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+BButton.m"; sourceTree = "<group>"; };
D909C2DB1742BB55005930A7 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D909C2DC1742BB55005930A7 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D91ABFFF1733003100823179 /* OWDashboardViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWDashboardViewController.h; sourceTree = "<group>"; };
D91AC0001733003100823179 /* OWDashboardViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWDashboardViewController.m; sourceTree = "<group>"; };
D91AC02C1733021800823179 /* 66-microphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "66-microphone.png"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -392,7 +395,6 @@
D930851E166426A9008C5D4C /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; };
D93936BE174199140070E164 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
D93936C01741991A0070E164 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
D93936C41741A5620070E164 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D93936C51741A5620070E164 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D93936C61741A5620070E164 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
D93936C71741A5620070E164 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1415,7 +1417,8 @@
D9DFADF716547DE7003C515C /* Media */ = {
isa = PBXGroup;
children = (
D93936C41741A5620070E164 /* [email protected] */,
D909C2DB1742BB55005930A7 /* [email protected] */,
D909C2DC1742BB55005930A7 /* [email protected] */,
D93936C51741A5620070E164 /* [email protected] */,
D93936C61741A5620070E164 /* [email protected] */,
D93936C71741A5620070E164 /* [email protected] */,
Expand Down Expand Up @@ -1836,11 +1839,12 @@
D9E42C4D1741778B00CA524F /* [email protected] in Resources */,
D9E42C4E1741778B00CA524F /* Safari@2x~ipad.png in Resources */,
D9E42C4F1741778B00CA524F /* Safari~ipad.png in Resources */,
D93936C81741A5620070E164 /* [email protected] in Resources */,
D93936C91741A5620070E164 /* [email protected] in Resources */,
D93936CA1741A5620070E164 /* [email protected] in Resources */,
D93936CB1741A5620070E164 /* [email protected] in Resources */,
D909C2D81742B11D005930A7 /* FontAwesome.ttf in Resources */,
D909C2DD1742BB55005930A7 /* [email protected] in Resources */,
D909C2DE1742BB55005930A7 /* [email protected] in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
1 change: 1 addition & 0 deletions OpenWatch/OWOnboardingView.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
@property (nonatomic) NSUInteger displayIndex;
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) NSArray *images;
@property (nonatomic, strong) NSArray *imageViews;
@property (nonatomic, strong) UIButton *continueButton;
@property (nonatomic, strong) UISwitch *agentSwitch;

Expand Down
12 changes: 9 additions & 3 deletions OpenWatch/OWOnboardingView.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#import "BButton.h"

@implementation OWOnboardingView
@synthesize scrollView, images, displayIndex, continueButton, agentSwitch;
@synthesize scrollView, images, displayIndex, continueButton, agentSwitch, imageViews;

- (id) initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
Expand All @@ -23,7 +23,7 @@ - (id) initWithFrame:(CGRect)frame {

[self addSubview:scrollView];

self.images = @[[UIImage imageNamed:@"onboarding_1.png"], [UIImage imageNamed:@"onboarding_2.png"], [UIImage imageNamed:@"onboarding_3.png"], [UIImage imageNamed:@"onboarding_4.png"]];
self.images = @[[UIImage imageNamed:@"onboarding_1.png"], [UIImage imageNamed:@"onboarding_2.png"], [UIImage imageNamed:@"onboarding_3.png"], [UIImage imageNamed:@"onboarding_4b.png"]];

self.continueButton = [[BButton alloc] initWithFrame:CGRectZero type:BButtonTypeSuccess];
[continueButton setTitle:@"Continue →" forState:UIControlStateNormal];
Expand All @@ -38,15 +38,20 @@ - (id) initWithFrame:(CGRect)frame {
}

- (void) toggleSecretAgentMode:(id)sender {
UIImageView *lastImageView = [imageViews lastObject];
if (self.agentSwitch.on) {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
lastImageView.image = [UIImage imageNamed:@"onboarding_4a.png"];
} else {
lastImageView.image = [UIImage imageNamed:@"onboarding_4b.png"];
}
}

- (void) setImages:(NSArray *)newImages {
images = newImages;
int i = 0;
NSMutableArray *newImageViews = [NSMutableArray arrayWithCapacity:images.count];
for (UIImage *image in images) {
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.backgroundColor = [OWUtilities stoneBackgroundPattern];
Expand All @@ -61,9 +66,10 @@ - (void) setImages:(NSArray *)newImages {
[agentSwitch addTarget:self action:@selector(toggleSecretAgentMode:) forControlEvents:UIControlEventValueChanged];
[imageView addSubview:agentSwitch];
}

[newImageViews addObject:imageView];
i++;
}
self.imageViews = newImageViews;
self.scrollView.contentSize = CGSizeMake(self.frame.size.width * i, self.frame.size.height);
}

Expand Down

0 comments on commit 662bb8d

Please sign in to comment.