Commits

Anonymous committed 4e0749e

About and first-launch screens.

Comments (0)

Files changed (7)

Camerang.xcodeproj/project.pbxproj

 		86D7D0DB173AF96300E2A2D1 /* Default-Portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 86D7D0D9173AF96200E2A2D1 /* Default-Portrait.png */; };
 		86D7D0DC173AF96300E2A2D1 /* Default-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 86D7D0DA173AF96300E2A2D1 /* Default-Landscape.png */; };
 		86D7D0DF173AFBFD00E2A2D1 /* UILabel+WBExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 86D7D0DE173AFBFD00E2A2D1 /* UILabel+WBExtensions.m */; };
+		86D7D0E2173AFD1300E2A2D1 /* BBUInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 86D7D0E1173AFD1300E2A2D1 /* BBUInfoViewController.m */; };
+		86D7D0E4173AFF1100E2A2D1 /* about.html in Resources */ = {isa = PBXBuildFile; fileRef = 86D7D0E3173AFF1100E2A2D1 /* about.html */; };
+		86D7D0E6173B062900E2A2D1 /* first-launch.html in Resources */ = {isa = PBXBuildFile; fileRef = 86D7D0E5173B062900E2A2D1 /* first-launch.html */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
 		86D7D0DA173AF96300E2A2D1 /* Default-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape.png"; sourceTree = "<group>"; };
 		86D7D0DD173AFBFD00E2A2D1 /* UILabel+WBExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UILabel+WBExtensions.h"; path = "vendor/NoticeView/NoticeView/WBNoticeView/UILabel+WBExtensions.h"; sourceTree = "<group>"; };
 		86D7D0DE173AFBFD00E2A2D1 /* UILabel+WBExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UILabel+WBExtensions.m"; path = "vendor/NoticeView/NoticeView/WBNoticeView/UILabel+WBExtensions.m"; sourceTree = "<group>"; };
+		86D7D0E0173AFD1300E2A2D1 /* BBUInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BBUInfoViewController.h; sourceTree = "<group>"; };
+		86D7D0E1173AFD1300E2A2D1 /* BBUInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BBUInfoViewController.m; sourceTree = "<group>"; };
+		86D7D0E3173AFF1100E2A2D1 /* about.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = about.html; sourceTree = "<group>"; };
+		86D7D0E5173B062900E2A2D1 /* first-launch.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "first-launch.html"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
 				866E7F961739876C005B09E9 /* BBUAppDelegate.m */,
 				866E7FBB17398B9F005B09E9 /* BBUCameraViewController.h */,
 				866E7FBC17398B9F005B09E9 /* BBUCameraViewController.m */,
+				86D7D0E0173AFD1300E2A2D1 /* BBUInfoViewController.h */,
+				86D7D0E1173AFD1300E2A2D1 /* BBUInfoViewController.m */,
 			);
 			path = Classes;
 			sourceTree = "<group>";
 		866E7FA3173987E7005B09E9 /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				86D7D0E3173AFF1100E2A2D1 /* about.html */,
 				866E7F981739876C005B09E9 /* Default.png */,
 				866E7F9A1739876C005B09E9 /* Default@2x.png */,
 				866E7F9C1739876C005B09E9 /* Default-568h@2x.png */,
 				86D7D0D6173AF8F900E2A2D1 /* Default-Landscape@2x.png */,
 				86D7D0D9173AF96200E2A2D1 /* Default-Portrait.png */,
 				86D7D0D5173AF8F900E2A2D1 /* Default-Portrait@2x.png */,
+				86D7D0E5173B062900E2A2D1 /* first-launch.html */,
 				86D7D0C5173AF6B200E2A2D1 /* Icon-72.png */,
 				86D7D0C6173AF6B200E2A2D1 /* Icon-72@2x.png */,
 				86D7D0C7173AF6B200E2A2D1 /* Icon-Small-50.png */,
 				86D7D0D8173AF8F900E2A2D1 /* Default-Landscape@2x.png in Resources */,
 				86D7D0DB173AF96300E2A2D1 /* Default-Portrait.png in Resources */,
 				86D7D0DC173AF96300E2A2D1 /* Default-Landscape.png in Resources */,
+				86D7D0E4173AFF1100E2A2D1 /* about.html in Resources */,
+				86D7D0E6173B062900E2A2D1 /* first-launch.html in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 				86D7D0C11739AA3300E2A2D1 /* WBErrorNoticeView.m in Sources */,
 				86D7D0C41739AA4700E2A2D1 /* WBRedGradientView.m in Sources */,
 				86D7D0DF173AFBFD00E2A2D1 /* UILabel+WBExtensions.m in Sources */,
+				86D7D0E2173AFD1300E2A2D1 /* BBUInfoViewController.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Classes/BBUCameraViewController.m

 #import <AssetsLibrary/AssetsLibrary.h>
 
 #import "BBUCameraViewController.h"
+#import "BBUInfoViewController.h"
 #import "BOMTalk.h"
 #import "RRCameraCaptureSession.h"
 #import "WBErrorNoticeView.h"
 #import "WBSuccessNoticeView.h"
 
-static const NSUInteger kSendImage = 101;
+static NSString* const kFirstLaunch = @"kFirstLaunch";
+static const NSUInteger kSendImage  = 101;
 
 @interface BBUCameraViewController () <RRCameraCaptureSessionDelegate>
 
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC), dispatch_get_main_queue(), block);
 }
 
+-(void)swiped {
+    BBUInfoViewController* infoVC = [[BBUInfoViewController alloc] initWithResource:@"about" ofType:@"html"];
+    [self presentViewController:infoVC animated:YES completion:NULL];
+}
+
 -(BOMTalk *)talker {
     return [BOMTalk sharedTalk];
 }
                                }];
 }
 
+-(void)viewDidAppear:(BOOL)animated {
+    NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
+    if (![defaults boolForKey:kFirstLaunch]) {
+        BBUInfoViewController* infoVC = [[BBUInfoViewController alloc] initWithResource:@"first-launch" ofType:@"html"];
+        [self presentViewController:infoVC animated:YES completion:NULL];
+        [defaults setBool:YES forKey:kFirstLaunch];
+    }
+}
+
 -(void)viewDidLoad {
     self.imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
     self.imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
     self.imageView.userInteractionEnabled = YES;
     [self.view addSubview:self.imageView];
     
+    UISwipeGestureRecognizer* swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swiped)];
+    swipeRecognizer.direction = UISwipeGestureRecognizerDirectionUp;
+    [self.imageView addGestureRecognizer:swipeRecognizer];
+    
     UITapGestureRecognizer* tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped)];
     [self.imageView addGestureRecognizer:tapRecognizer];
 }

Classes/BBUInfoViewController.h

+//
+//  BBUInfoViewController.h
+//  Camerang
+//
+//  Created by Boris Bügling on 08.05.13.
+//  Copyright (c) 2013 Boris Bügling. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface BBUInfoViewController : UIViewController
+
+-(id)initWithResource:(NSString*)resourceName ofType:(NSString*)type;
+
+@end

Classes/BBUInfoViewController.m

+//
+//  BBUInfoViewController.m
+//  Camerang
+//
+//  Created by Boris Bügling on 08.05.13.
+//  Copyright (c) 2013 Boris Bügling. All rights reserved.
+//
+
+#import "BBUInfoViewController.h"
+
+@interface BBUInfoViewController ()
+
+@property (nonatomic, strong) NSString* path;
+
+@end
+
+#pragma mark -
+
+@implementation BBUInfoViewController
+
+-(id)initWithResource:(NSString*)resourceName ofType:(NSString*)type {
+    self = [super init];
+    if (self) {
+        self.path = [[NSBundle mainBundle] pathForResource:resourceName ofType:type];
+    }
+    return self;
+}
+
+-(void)loadView {
+    self.view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
+    self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
+    self.view.backgroundColor = [UIColor colorWithRed:238.0/255.0 green:128.0/255.0 blue:38.0/255.0 alpha:1.0];
+}
+
+-(void)tapped {
+    [self.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
+}
+
+-(void)viewDidLoad {
+    UIWebView* webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
+    webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    webView.backgroundColor = [UIColor clearColor];
+    webView.opaque = NO;
+    [webView loadHTMLString:[NSString stringWithContentsOfFile:self.path encoding:NSUTF8StringEncoding error:nil]
+                    baseURL:[[NSBundle mainBundle] bundleURL]];
+    [self.view addSubview:webView];
+    
+    for (UIView* subview in webView.scrollView.subviews) {
+        if ([NSStringFromClass([subview class]) isEqualToString:@"UIWebBrowserView"]) {
+            UITapGestureRecognizer* tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
+                                                                                            action:@selector(tapped)];
+            tapRecognizer.numberOfTapsRequired = 2;
+            [subview addGestureRecognizer:tapRecognizer];
+        }
+    }
+}
+
+@end

Resources/about.html

+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title>About Camerang</title>
+    <style>
+        * {
+            font-family: "Avenir-Heavy";
+        }
+    </style>
+</head>
+<body>
+<h1>About Camerang</h1>
+    
+<h2>Stole the basic idea from a UIKonf 2013 hackday project by @hannesoid and @kaalita.</h2>
+    
+<h3>Camerang uses open source code from the following projects:</h3>
+
+<p><b>BOMTalk</b> by Oliver Michalak - oliver@werk01.de - @omichde</p>
+    
+<p><b>WBNoticeView</b> Copyright (c) 2012 Webbo, L.L.C. All rights reserved.</p>
+    
+<p><b>RailRoad</b> Copyright (c) 2013 UEA. All rights reserved.</p>
+
+<h3>Camerang uses artwork by Luke Firth, from The Noun Project</h3>
+    
+</body>
+</html>

Resources/first-launch.html

+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title>About Camerang</title>
+    <style>
+        * {
+            font-family: "Avenir-Heavy";
+        }
+    </style>
+</head>
+<body>
+<h1>Thank you for downloading Camerang</h1>
+
+<p>Remote control your device's camera from another device.</p>
+    
+<ul>
+    <li>First launch the app on the device that should be the camera.</li>
+    <li>Then launch the app on the device that should be the remote control.</li>
+    <li>Tap on any device to save the picture to camera roll.</li>
+    <li>Swipe up for some additional information.</li>
+</ul>
+    
+<h2>Dismiss by double tapping.</h2>
+</body>
+</html>
-* Acknowledgements
-* About screen
 * Tap to switch between front/back on host
-* First launch screen
-* iPad support
 * Mac app
-* App icon
-* Launch images
-