Skip to content

Commit

Permalink
Multiple improvements
Browse files Browse the repository at this point in the history
Improved Apple HIG complyance, improved menu user experience, updated README as change to Availability.h is no longer required
  • Loading branch information
jvanakker authored and jvanakker committed Jan 10, 2019
1 parent 9b036eb commit 761cd02
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 44 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -64,3 +64,4 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
_Project/Availability.h
8 changes: 5 additions & 3 deletions _Project/Browser.xcodeproj/project.pbxproj
Expand Up @@ -126,7 +126,7 @@
TargetAttributes = {
B002B8611BAE420500C744AF = {
CreatedOnToolsVersion = 7.1;
DevelopmentTeam = NKQ4HJ66PX;
DevelopmentTeam = R2HYQQ4QDF;
};
};
};
Expand Down Expand Up @@ -309,12 +309,13 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = R2HYQQ4QDF;
EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES;
ENABLE_ON_DEMAND_RESOURCES = NO;
FRAMEWORK_SEARCH_PATHS = "";
INFOPLIST_FILE = Browser/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.Moballo.tvbrowser;
PRODUCT_BUNDLE_IDENTIFIER = com.jva.tvbrowser;
PRODUCT_NAME = "$(TARGET_NAME)";
SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = NO;
TVOS_DEPLOYMENT_TARGET = 9.0;
Expand All @@ -329,12 +330,13 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
DEVELOPMENT_TEAM = R2HYQQ4QDF;
EMBED_ASSET_PACKS_IN_PRODUCT_BUNDLE = YES;
ENABLE_ON_DEMAND_RESOURCES = NO;
FRAMEWORK_SEARCH_PATHS = "";
INFOPLIST_FILE = Browser/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.Moballo.tvbrowser;
PRODUCT_BUNDLE_IDENTIFIER = com.jva.tvbrowser;
PRODUCT_NAME = "$(TARGET_NAME)";
SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = NO;
TVOS_DEPLOYMENT_TARGET = 9.0;
Expand Down
Expand Up @@ -2,4 +2,70 @@
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Browser/ViewController.m"
timestampString = "568814451.7186739"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1000"
endingLineNumber = "1000"
landmarkName = "-pressesEnded:withEvent:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Browser/ViewController.m"
timestampString = "568814451.719069"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "966"
endingLineNumber = "966"
landmarkName = "-pressesEnded:withEvent:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Browser/ViewController.m"
timestampString = "568814451.719353"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "158"
endingLineNumber = "158"
landmarkName = "-viewDidLoad"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Browser/ViewController.m"
timestampString = "568814451.719623"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "872"
endingLineNumber = "872"
landmarkName = "-toggleMode"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
3 changes: 1 addition & 2 deletions _Project/Browser/AppDelegate.h
Expand Up @@ -3,8 +3,7 @@
// Browser
//
// Created by Steven Troughton-Smith on 20/09/2015.
// Improved by Jip van Akker on 14/10/2015
// Copyright © 2015 High Caffeine Content. All rights reserved.
// Improved by Jip van Akker on 14/10/2015 through 10/01/2019
//

#import <UIKit/UIKit.h>
Expand Down
3 changes: 1 addition & 2 deletions _Project/Browser/AppDelegate.m
Expand Up @@ -3,8 +3,7 @@
// Browser
//
// Created by Steven Troughton-Smith on 20/09/2015.
// Improved by Jip van Akker on 14/10/2015
// Copyright © 2015 High Caffeine Content. All rights reserved.
// Improved by Jip van Akker on 14/10/2015 through 10/01/2019
//

#import "AppDelegate.h"
Expand Down
2 changes: 1 addition & 1 deletion _Project/Browser/Info.plist
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0</string>
<string>4.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
3 changes: 1 addition & 2 deletions _Project/Browser/ViewController.h
Expand Up @@ -3,8 +3,7 @@
// Browser
//
// Created by Steven Troughton-Smith on 20/09/2015.
// Improved by Jip van Akker on 14/10/2015
// Copyright © 2015 High Caffeine Content. All rights reserved.
// Improved by Jip van Akker on 14/10/2015 through 10/01/2019
//

#import <UIKit/UIKit.h>
Expand Down
84 changes: 71 additions & 13 deletions _Project/Browser/ViewController.m
Expand Up @@ -3,8 +3,7 @@
// Browser
//
// Created by Steven Troughton-Smith on 20/09/2015.
// Improved by Jip van Akker on 14/10/2015
// Copyright © 2015 High Caffeine Content. All rights reserved.
// Improved by Jip van Akker on 14/10/2015 through 10/01/2019
//

#import "ViewController.h"
Expand Down Expand Up @@ -163,7 +162,9 @@ -(void)viewDidLoad {

playPauseOrMenuDoubleTapRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleDoubleTapMenuOrPlayPause:)];
playPauseOrMenuDoubleTapRecognizer.numberOfTapsRequired = 2;
playPauseOrMenuDoubleTapRecognizer.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause], [NSNumber numberWithInteger:UIPressTypeMenu]];
//playPauseOrMenuDoubleTapRecognizer.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause], [NSNumber numberWithInteger:UIPressTypeMenu]];
playPauseOrMenuDoubleTapRecognizer.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause]];

[self.view addGestureRecognizer:playPauseOrMenuDoubleTapRecognizer];

cursorView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 64, 64)];
Expand Down Expand Up @@ -197,7 +198,7 @@ -(void)viewDidLoad {
-(void)handleDoubleTapMenuOrPlayPause:(UITapGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateEnded) {
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:@"Menu"
alertControllerWithTitle:@"Advanced Menu"
message:@""
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *loadHomePageAction = [UIAlertAction
Expand Down Expand Up @@ -622,12 +623,20 @@ -(void)handleTouchSurfaceDoubleTap:(UITapGestureRecognizer *)sender {
}
-(void)requestURLorSearchInput
{

UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:@"Quick Menu"
message:@""
preferredStyle:UIAlertControllerStyleAlert];



UIAlertController *alertController2 = [UIAlertController
alertControllerWithTitle:@"Enter URL or Search Terms"
message:@""
preferredStyle:UIAlertControllerStyleAlert];

[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField)
[alertController2 addTextFieldWithConfigurationHandler:^(UITextField *textField)
{
textField.keyboardType = UIKeyboardTypeURL;
textField.placeholder = @"Enter URL or Search Terms";
Expand All @@ -640,12 +649,14 @@ -(void)requestURLorSearchInput

}];



UIAlertAction *goAction = [UIAlertAction
actionWithTitle:@"Go To Website"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
UITextField *urltextfield = alertController.textFields[0];
UITextField *urltextfield = alertController2.textFields[0];
NSString *toMod = urltextfield.text;
/*
if ([toMod containsString:@" "] || ![temporaryURL containsString:@"."]) {
Expand Down Expand Up @@ -678,12 +689,13 @@ -(void)requestURLorSearchInput
//}

}];

UIAlertAction *searchAction = [UIAlertAction
actionWithTitle:@"Search Google"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
UITextField *urltextfield = alertController.textFields[0];
UITextField *urltextfield = alertController2.textFields[0];
NSString *toMod = urltextfield.text;
toMod = [toMod stringByReplacingOccurrencesOfString:@" " withString:@"+"];
toMod = [toMod stringByReplacingOccurrencesOfString:@"." withString:@"+"];
Expand All @@ -699,6 +711,15 @@ -(void)requestURLorSearchInput
}
}];

UIAlertAction *backAction = [UIAlertAction
actionWithTitle:@"Navigate Back"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
[self.webview goBack];
}];


UIAlertAction *reloadAction = [UIAlertAction
actionWithTitle:@"Reload Page"
style:UIAlertActionStyleDefault
Expand All @@ -708,31 +729,58 @@ -(void)requestURLorSearchInput
[self.webview reload];
}];

UIAlertAction *inputAction = [UIAlertAction
actionWithTitle:@"Input URL or Search with Google"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{

[alertController2 addAction:searchAction];
[alertController2 addAction:goAction];

[self presentViewController:alertController2 animated:YES completion:nil];


}];

UIAlertAction *cancelAction = [UIAlertAction
actionWithTitle:@"Cancel"
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action)
{
}];
[alertController addAction:searchAction];
[alertController addAction:goAction];




if([self.webview canGoBack])
[alertController addAction:backAction];

[alertController addAction:inputAction];

NSURLRequest *request = [self.webview request];
if (request != nil) {
if (![request.URL.absoluteString isEqual: @""]) {
[alertController addAction:reloadAction];
[alertController addAction:cancelAction];
}
}

[self presentViewController:alertController animated:YES completion:nil];


if (request == nil) {
UITextField *loginTextField = alertController.textFields[0];
UITextField *loginTextField = alertController2.textFields[0];
[loginTextField becomeFirstResponder];
}
else if (![request.URL.absoluteString isEqual: @""]) {
UITextField *loginTextField = alertController.textFields[0];
UITextField *loginTextField = alertController2.textFields[0];
[loginTextField becomeFirstResponder];
}




}
- (BOOL)webView:(id)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(NSInteger)navigationType {
requestURL = request.URL.absoluteString;
Expand Down Expand Up @@ -824,13 +872,16 @@ -(void)toggleMode
scrollView.scrollEnabled = YES;
[self.webview setUserInteractionEnabled:YES];
cursorView.hidden = YES;


}
}
- (void)showHintsAlert
{
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:@"Usage Guide"
message:@"Double press the touch area to switch between cursor & scroll mode.\nPress the touch area while in cursor mode to click.\nPress the Menu button to navigate back.\nPress the Play/Pause button for a URL bar.\nDouble tap the Play/Pause button or Menu button for more options."
//message:@"Double press the touch area to switch between cursor & scroll mode.\nPress the touch area while in cursor mode to click.\nPress the Menu button to navigate back.\nPress the Play/Pause button for a URL bar.\nDouble tap the Play/Pause button or Menu button for more options."
message:@"Double press the touch area to switch between cursor & scroll mode.\nPress the touch area while in cursor mode to click.\nSingle tap the Play/Pause button to: Navigate Back, enter URL or Reload Page.\nDouble tap the Play/Pause to show the Advanced Menu with more options."
preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *hideForeverAction = [UIAlertAction
Expand Down Expand Up @@ -911,19 +962,26 @@ - (void)alertTextFieldShouldReturn:(UITextField *)sender
-(void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
{


if (presses.anyObject.type == UIPressTypeMenu)
{
UIAlertController *alertController = (UIAlertController *)self.presentedViewController;
if (alertController)
{
[self.presentedViewController dismissViewControllerAnimated:true completion:nil];
}
else
{
//UIControl().sendAction(#selector(NSURLSessionTask.suspend), to: UIApplication.sharedApplication(), forEvent: nil);
exit(EXIT_SUCCESS);
}
/*
else if ([self.webview canGoBack]) {
[self.webview goBack];
}
else {
[self requestURLorSearchInput];
}
}*/

}
else if (presses.anyObject.type == UIPressTypeUpArrow)
Expand Down
3 changes: 1 addition & 2 deletions _Project/Browser/main.m
Expand Up @@ -3,8 +3,7 @@
// Browser
//
// Created by Steven Troughton-Smith on 20/09/2015.
// Improved by Jip van Akker on 14/10/2015
// Copyright © 2015 High Caffeine Content. All rights reserved.
// Improved by Jip van Akker on 14/10/2015 through 10/01/2019
//

#import <UIKit/UIKit.h>
Expand Down

0 comments on commit 761cd02

Please sign in to comment.