Skip to content

Commit

Permalink
Files v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
steventroughtonsmith committed Jun 12, 2016
0 parents commit 784ebf3
Show file tree
Hide file tree
Showing 51 changed files with 2,168 additions and 0 deletions.
621 changes: 621 additions & 0 deletions Files.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Files.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Files/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// AppDelegate.h
// Files
//
// Created by Steven Troughton-Smith on 11/06/2016.
// Copyright © 2016 High Caffeine Content. All rights reserved.
//

#import <UIKit/UIKit.h>

@class FBColumnViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate, UIAlertViewDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong) FBColumnViewController *columnViewController;


@end

140 changes: 140 additions & 0 deletions Files/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
//
// AppDelegate.m
// Files
//
// Created by Steven Troughton-Smith on 11/06/2016.
// Copyright © 2016 High Caffeine Content. All rights reserved.
//

#import "AppDelegate.h"
#import "FBColumnViewController.h"
#import "FBFilesTableViewController.h"
#import "FBColumnNavigationController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.highcaffeinecontent.Files"];
NSInteger sortingFilter = [defaults integerForKey:@"FBSortingFilter"];

self.window = [[UIWindow alloc] init];

FBFilesTableViewController *tc = [[FBFilesTableViewController alloc] initWithPath:@"/"];

FBColumnNavigationController *cnc = [[FBColumnNavigationController alloc] initWithRootViewController:tc];

FBColumnViewController *columnViewController = [[FBColumnViewController alloc] initWithRootViewController:cnc];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:columnViewController];

UISegmentedControl *filterSegmentedControl = [[UISegmentedControl alloc] initWithItems:@[@"Name", @"Kind"]];
filterSegmentedControl.apportionsSegmentWidthsByContent = NO;
filterSegmentedControl.frame = CGRectMake(0, 0, 240, 32);
filterSegmentedControl.selectedSegmentIndex = sortingFilter;
columnViewController.navigationItem.titleView = filterSegmentedControl;

[filterSegmentedControl addTarget:self action:@selector(filterChanged:) forControlEvents:UIControlEventValueChanged];

columnViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(goToFolder:)];

[self.window makeKeyAndVisible];

self.window.rootViewController = nc;
self.columnViewController = columnViewController;

[self becomeFirstResponder];

return YES;
}

-(void)filterChanged:(UISegmentedControl *)sender
{
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.highcaffeinecontent.Files"];

[defaults setInteger:sender.selectedSegmentIndex forKey:@"FBSortingFilter"];
}

-(void)navigateToPath:(NSString *)path
{
[self.columnViewController popToRootViewController];

__block NSString *composedPath = @"/";

NSArray *components = [path pathComponents];

[components enumerateObjectsUsingBlock:^(NSString * _Nonnull component, NSUInteger idx, BOOL * _Nonnull stop) {
if (idx == 0)
return;

NSString *highlightedComponent = (idx < components.count-1) ? components[idx+1] : nil;

composedPath = [composedPath stringByAppendingPathComponent:component];

FBFilesTableViewController *vc = [[FBFilesTableViewController alloc] initWithPath:composedPath];

FBColumnNavigationController *detailNavController = [[FBColumnNavigationController alloc] initWithRootViewController:vc];
[self.columnViewController pushViewController:detailNavController];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[vc highlightPathComponent:highlightedComponent];
});
}];

}

#pragma mark - Key Commands

-(NSArray <UIKeyCommand *>*)keyCommands
{
return @[
[UIKeyCommand keyCommandWithInput:@"g" modifierFlags:UIKeyModifierShift|UIKeyModifierCommand action:@selector(goToFolder:) discoverabilityTitle:NSLocalizedString(@"Go to Folder…", nil)]
];
}

#pragma mark -

-(void)goToFolder:(id)sender
{

UIAlertController * alert = [UIAlertController
alertControllerWithTitle:NSLocalizedString(@"Go to the folder…", nil)
message:nil
preferredStyle:UIAlertControllerStyleAlert];

[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
}];

UIAlertAction* goAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Go", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
NSString *path = alert.textFields.firstObject.text;

if (path.length > 0)
{
[self navigateToPath:path];
}

[alert dismissViewControllerAnimated:YES completion:nil];

}];
UIAlertAction* cancelAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action)
{
[alert dismissViewControllerAnimated:YES completion:nil];
}];

[alert addAction:cancelAction];
[alert addAction:goAction];

[self.columnViewController presentViewController:alert animated:YES completion:nil];
}

@end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 Files/Assets.xcassets/AppIcon.appiconset/120.png
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 Files/Assets.xcassets/AppIcon.appiconset/152.png
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 Files/Assets.xcassets/AppIcon.appiconset/167.png
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 Files/Assets.xcassets/AppIcon.appiconset/180.png
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 Files/Assets.xcassets/AppIcon.appiconset/29.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 Files/Assets.xcassets/AppIcon.appiconset/58.png
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 Files/Assets.xcassets/AppIcon.appiconset/76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 Files/Assets.xcassets/AppIcon.appiconset/80.png
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 Files/Assets.xcassets/AppIcon.appiconset/87.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions Files/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "58.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "87.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "80.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "120-1.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "120.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "180.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "58-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "80-1.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "120-2.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "152.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "167.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
6 changes: 6 additions & 0 deletions Files/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
23 changes: 23 additions & 0 deletions Files/Assets.xcassets/Document.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "DocumentBase-48.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions Files/Assets.xcassets/Folder.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Folder-50?download.pdf",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
23 changes: 23 additions & 0 deletions Files/Assets.xcassets/Picture.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Image48.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions Files/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" launchScreen="YES" initialViewController="2Yf-Ae-sKQ">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="q8P-EX-n72">
<objects>
<navigationController id="2Yf-Ae-sKQ" sceneMemberID="viewController">
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="qCj-ID-FkT">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="sA2-it-c5h" kind="relationship" relationship="rootViewController" id="WUh-xM-4VQ"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4ev-0m-rlZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-977" y="246"/>
</scene>
<!--View Controller-->
<scene sceneID="3cG-z8-If1">
<objects>
<viewController id="sA2-it-c5h" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="TIE-rt-KWt">
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</view>
<navigationItem key="navigationItem" id="bKt-y9-zWG"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="DWj-gA-XnI" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-977" y="1414"/>
</scene>
</scenes>
</document>
16 changes: 16 additions & 0 deletions Files/FBColumnNavigationController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// FBColumnNavigationController.h
// Files
//
// Created by Steven Troughton-Smith on 11/06/2016.
// Copyright © 2016 High Caffeine Content. All rights reserved.
//

#import <UIKit/UIKit.h>

@class FBColumnViewController;

@interface FBColumnNavigationController : UINavigationController
@property (nonatomic, strong) FBColumnViewController *columnViewController;

@end
Loading

0 comments on commit 784ebf3

Please sign in to comment.