Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

Add iPhone support. #10

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Classes/FileSourceController.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ - (void)addUIElements

self.navigationItem.leftBarButtonItem =[[UIBarButtonItem alloc]initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(backButtonAction)];

self.previewViewController = (FilePreviewViewController *)[[self.splitViewController.viewControllers lastObject] topViewController];

if (DEVICE_IS_IPAD) {
self.previewViewController = (FilePreviewViewController *)[[self.splitViewController.viewControllers lastObject] topViewController];
} else {
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
self.previewViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"FilePreviewViewController_iPhone"];
}
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshControl;
Expand Down Expand Up @@ -607,6 +611,9 @@ - (void) objectSelectedAtIndex:(NSInteger) index withThumbnail:(UIImage *) thumb
, nil]];
});

if (!DEVICE_IS_IPAD) {
[FPMBProgressHUD showHUDAddedTo:self.view animated:YES];
}
[[self previewViewController] showSpinner];
[self downloadAndUpdatePreview:obj];

Expand Down Expand Up @@ -645,6 +652,10 @@ - (void) downloadAndUpdatePreview: (NSDictionary*) obj {

[selectedFile writeData:data];

if (!DEVICE_IS_IPAD) {
[FPMBProgressHUD hideHUDForView:self.view animated:NO];
[self.navigationController pushViewController:self.previewViewController animated:YES];
}
[[self previewViewController] previewFile:selectedFile];
}
failure:^(FPAFHTTPRequestOperation *operation, NSError *error) {
Expand Down
8 changes: 7 additions & 1 deletion Classes/FileSourceListController.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ - (id)initWithStyle:(UITableViewStyle)style
- (void)viewDidLoad
{
[super viewDidLoad];
self.previewViewController = (FilePreviewViewController *)[[self.splitViewController.viewControllers lastObject] topViewController];
//self.previewViewController = (FilePreviewViewController *)[[self.splitViewController.viewControllers lastObject] topViewController];
if (DEVICE_IS_IPAD) {
self.previewViewController = (FilePreviewViewController *)[[self.splitViewController.viewControllers lastObject] topViewController];
} else {
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
self.previewViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"FilePreviewViewController_iPhone"];
}
self.previewViewController.master = (id)self;
[UIBarButtonItem configureFlatButtonsWithColor:[UIColor peterRiverColor]
highlightedColor:[UIColor belizeHoleColor]
Expand Down
90 changes: 90 additions & 0 deletions Classes/MainStoryboard_iPhone.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4510" systemVersion="12F37" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vjC-cW-MDg">
<dependencies>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
</dependencies>
<scenes>
<!--File Source List Controller - Root View Controller-->
<scene sceneID="xcO-DA-Ro5">
<objects>
<tableViewController id="Ckv-Ss-qmP" customClass="FileSourceListController" sceneMemberID="viewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="BqW-Fi-PsB">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="4rw-Kd-tCd">
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4rw-Kd-tCd" id="4wL-vO-5ft">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
</tableView>
<navigationItem key="navigationItem" title="Root View Controller" id="Iau-11-thT"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iTT-oA-ENi" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1428" y="54"/>
</scene>
<!--File Preview View Controller-->
<scene sceneID="X5D-sN-Nfd">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="DzK-s5-l8z" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController storyboardIdentifier="FilePreviewViewController_iPhone" useStoryboardIdentifierAsRestorationIdentifier="YES" id="Dqf-MI-4fK" customClass="FilePreviewViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Y25-At-y2d"/>
<viewControllerLayoutGuide type="bottom" id="aIs-JQ-AOt"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="cpo-q3-tZ3">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3NF-Fx-VAb">
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</webView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="3NF-Fx-VAb" secondAttribute="trailing" id="Xpw-JX-ct2"/>
<constraint firstAttribute="bottom" secondItem="3NF-Fx-VAb" secondAttribute="bottom" id="lgh-Mh-aIh"/>
<constraint firstItem="3NF-Fx-VAb" firstAttribute="leading" secondItem="cpo-q3-tZ3" secondAttribute="leading" id="uR3-cM-KGg"/>
<constraint firstItem="3NF-Fx-VAb" firstAttribute="top" secondItem="Y25-At-y2d" secondAttribute="bottom" id="vRQ-Xj-48s"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="vbV-sQ-46e"/>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
<connections>
<outlet property="webView" destination="3NF-Fx-VAb" id="Ya7-wF-KEZ"/>
</connections>
</viewController>
</objects>
<point key="canvasLocation" x="-885" y="54"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="ik5-Ks-lyw">
<objects>
<navigationController definesPresentationContext="YES" id="vjC-cW-MDg" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="H7h-yS-RVe">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="Ckv-Ss-qmP" kind="relationship" relationship="rootViewController" id="rIT-Ou-DMf"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="MRF-iL-imc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1962" y="54"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
12 changes: 8 additions & 4 deletions Classes/PairingReceiveViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
return self;
}

#define labelFrame (DEVICE_IS_IPAD ? CGRectMake(0, 30, 540, 30) : CGRectMake(0, 30, 320, 30))
#define filenameFrame (DEVICE_IS_IPAD ? CGRectMake((540-400)/2, 130, 400, 30) : CGRectMake(0, 130, 320, 30))
#define mimetypeFrame (DEVICE_IS_IPAD ? CGRectMake((540-400)/2, 150, 400, 30) : CGRectMake(0, 150, 320, 30))
#define txFrame (DEVICE_IS_IPAD ? CGRectMake((540-350)/2, 80, 350, 30) : CGRectMake(0, 80, 320, 30))
- (void)viewDidLoad
{
[super viewDidLoad];
Expand All @@ -45,22 +49,22 @@ - (void)viewDidLoad

[self.view setBackgroundColor:[UIColor whiteColor]];

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 540, 30)];
UILabel *label = [[UILabel alloc] initWithFrame:labelFrame];
label.text = [NSString stringWithFormat:@"Enter the Pairing Code:"];
label.font = [UIFont fontWithName:LIGHTFONT size:16];

label.textAlignment = NSTextAlignmentCenter;
[self.view addSubview:label];

UILabel *filename = [[UILabel alloc] initWithFrame:CGRectMake((540-400)/2, 130, 400, 30)];
UILabel *filename = [[UILabel alloc] initWithFrame:filenameFrame];
filename.text = @"";
filename.textAlignment = NSTextAlignmentCenter;
filename.lineBreakMode = NSLineBreakByTruncatingMiddle;
filename.font = [UIFont fontWithName:FONT size:16];
[self.view addSubview:filename];
self.filename = filename;

UILabel *mimetype = [[UILabel alloc] initWithFrame:CGRectMake((540-400)/2, 150, 400, 30)];
UILabel *mimetype = [[UILabel alloc] initWithFrame:mimetypeFrame];
mimetype.textAlignment = NSTextAlignmentCenter;
mimetype.text = @"";
mimetype.font = [UIFont fontWithName:LIGHTFONT size:14];
Expand All @@ -74,7 +78,7 @@ - (void)viewDidLoad
label.textAlignment = NSTextAlignmentCenter;
[self.view addSubview:label];

UITextField *tx = [[UITextField alloc] initWithFrame:CGRectMake((540-350)/2, 80, 350, 30)];
UITextField *tx = [[UITextField alloc] initWithFrame:txFrame];
[tx setBorderStyle:UITextBorderStyleRoundedRect];
[tx setFont:[UIFont fontWithName:@"Courier" size:16]];
tx.autocapitalizationType = UITextAutocapitalizationTypeNone;
Expand Down
15 changes: 10 additions & 5 deletions Classes/PairingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
return self;
}

#define imageVFrame (DEVICE_IS_IPAD ? (CGRectMake((540-imageV.frame.size.width)/2, 50, imageV.frame.size.width, imageV.frame.size.height)) : (CGRectMake(10, 5, imageV.frame.size.width, imageV.frame.size.height)))
#define subheaderFrame (DEVICE_IS_IPAD ? CGRectMake(0, 200, 540, 90) : CGRectMake(0, 170, 320, 90))
#define labelFrame (DEVICE_IS_IPAD ? CGRectMake(0, 350, 540, 30) : CGRectMake(0, 280, 320, 30))
#define pairingTextfieldFrame (DEVICE_IS_IPAD ? CGRectMake((540-250)/2, 385, 250, 30) : CGRectMake(40, 335, 250, 30))
#define copylabelFrame (DEVICE_IS_IPAD ? CGRectMake(0, 410, 540, 30) : CGRectMake(0, 350, 320, 30))
- (void)viewDidLoad
{
[super viewDidLoad];
Expand All @@ -45,10 +50,10 @@ - (void)viewDidLoad
[self.view setBackgroundColor:[UIColor whiteColor]];

UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pair.png"]];
imageV.frame = CGRectMake((540-imageV.frame.size.width)/2, 50, imageV.frame.size.width, imageV.frame.size.height);
imageV.frame = imageVFrame;
[self.view addSubview:imageV];

UILabel *subheader = [[UILabel alloc] initWithFrame:CGRectMake(0, 200, 540, 90)];
UILabel *subheader = [[UILabel alloc] initWithFrame:subheaderFrame];
subheader.textAlignment = NSTextAlignmentCenter;
subheader.text = @"You can easily share files with other ThatCloud users.\n A secure pairing code has been generated below \nand can be retrieved on another device with ThatCloud.";
subheader.lineBreakMode = NSLineBreakByWordWrapping;
Expand All @@ -57,22 +62,22 @@ - (void)viewDidLoad
[self.view addSubview:subheader];


UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 350, 540, 30)];
UILabel *label = [[UILabel alloc] initWithFrame:labelFrame];
label.textAlignment = NSTextAlignmentCenter;
label.text = @"Pairing Code";
label.font = [UIFont fontWithName:FONT size:22];
[self.view addSubview:label];


UITextField *pairing = [[UITextField alloc] initWithFrame:CGRectMake((540-250)/2, 385, 250, 30)];
UITextField *pairing = [[UITextField alloc] initWithFrame:pairingTextfieldFrame];
[pairing setText:self.fphandle];
pairing.delegate = self;
pairing.textAlignment = NSTextAlignmentCenter;
pairing.enabled = NO;
pairing.font = [UIFont fontWithName:@"Courier" size:18];
[self.view addSubview:pairing];

UILabel *copylabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 410, 540, 30)];
UILabel *copylabel = [[UILabel alloc] initWithFrame:copylabelFrame];
copylabel.textAlignment = NSTextAlignmentCenter;
copylabel.text = @"(Copied to your clipboard)";
copylabel.font = [UIFont fontWithName:FONT size:14];
Expand Down
2 changes: 1 addition & 1 deletion Classes/ThatCloudAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

if ([INKWelcomeViewController shouldRunWelcomeFlow]) {
INKWelcomeViewController * welcomeViewController;
welcomeViewController = [[INKWelcomeViewController alloc] initWithNibName:@"INKWelcomeViewController" bundle:nil];
welcomeViewController = [[INKWelcomeViewController alloc] initWithNibName:DEVICE_SPECIFIC_NIB2( INKWelcomeViewController) bundle:nil];

welcomeViewController.nextViewController = self.window.rootViewController;
[self.window setRootViewController:welcomeViewController];
Expand Down
Loading