diff --git a/.gitignore b/.gitignore index 7479815..f5e0fbd 100755 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ fastlane/report.xml fastlane/Preview.html fastlane/screenshots fastlane/test_output +_Project/Availability.h diff --git a/_Project/Browser.xcodeproj/project.pbxproj b/_Project/Browser.xcodeproj/project.pbxproj index acbed03..fe79cde 100644 --- a/_Project/Browser.xcodeproj/project.pbxproj +++ b/_Project/Browser.xcodeproj/project.pbxproj @@ -126,7 +126,7 @@ TargetAttributes = { B002B8611BAE420500C744AF = { CreatedOnToolsVersion = 7.1; - DevelopmentTeam = NKQ4HJ66PX; + DevelopmentTeam = R2HYQQ4QDF; }; }; }; @@ -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; @@ -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; diff --git a/_Project/Browser.xcodeproj/xcuserdata/jipvanakker.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/_Project/Browser.xcodeproj/xcuserdata/jipvanakker.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index fe2b454..f959cff 100644 --- a/_Project/Browser.xcodeproj/xcuserdata/jipvanakker.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/_Project/Browser.xcodeproj/xcuserdata/jipvanakker.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -2,4 +2,70 @@ + + + + + + + + + + + + + + + + + + diff --git a/_Project/Browser/AppDelegate.h b/_Project/Browser/AppDelegate.h index 47f9d6a..b07de4f 100644 --- a/_Project/Browser/AppDelegate.h +++ b/_Project/Browser/AppDelegate.h @@ -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 diff --git a/_Project/Browser/AppDelegate.m b/_Project/Browser/AppDelegate.m index a456cfc..ad331a8 100644 --- a/_Project/Browser/AppDelegate.m +++ b/_Project/Browser/AppDelegate.m @@ -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" diff --git a/_Project/Browser/Info.plist b/_Project/Browser/Info.plist index 4f6a289..70fb4e3 100644 --- a/_Project/Browser/Info.plist +++ b/_Project/Browser/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.0 + 4.0 CFBundleSignature ???? CFBundleVersion diff --git a/_Project/Browser/ViewController.h b/_Project/Browser/ViewController.h index f7e054d..3b0d4f3 100644 --- a/_Project/Browser/ViewController.h +++ b/_Project/Browser/ViewController.h @@ -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 diff --git a/_Project/Browser/ViewController.m b/_Project/Browser/ViewController.m index 65d50c4..cf20471 100644 --- a/_Project/Browser/ViewController.m +++ b/_Project/Browser/ViewController.m @@ -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" @@ -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)]; @@ -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 @@ -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"; @@ -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:@"."]) { @@ -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:@"+"]; @@ -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 @@ -708,14 +729,35 @@ -(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: @""]) { @@ -723,16 +765,22 @@ -(void)requestURLorSearchInput [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; @@ -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 @@ -911,6 +962,7 @@ - (void)alertTextFieldShouldReturn:(UITextField *)sender -(void)pressesEnded:(NSSet *)presses withEvent:(UIPressesEvent *)event { + if (presses.anyObject.type == UIPressTypeMenu) { UIAlertController *alertController = (UIAlertController *)self.presentedViewController; @@ -918,12 +970,18 @@ -(void)pressesEnded:(NSSet *)presses withEvent:(UIPressesEvent *)even { [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) diff --git a/_Project/Browser/main.m b/_Project/Browser/main.m index 96a95c1..99f79ab 100644 --- a/_Project/Browser/main.m +++ b/_Project/Browser/main.m @@ -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 diff --git a/_Project/README.mdown b/_Project/README.mdown index ee56d52..b877c40 100644 --- a/_Project/README.mdown +++ b/_Project/README.mdown @@ -3,28 +3,15 @@ tvOS Browser Web browser for tvOS using private API (aka UIWebView). -To build successfully, you'll need to change 2 lines in Availability.h starting around line 280: -``` -Availability.h for the AppleTV: '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/Availability.h' -Availability.h for the AppleTV Simulator: '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/Availability.h' -``` -Change: -``` -#define __TVOS_UNAVAILABLE __OS_AVAILABILITY(tvos,unavailable) -#define __TVOS_PROHIBITED __OS_AVAILABILITY(tvos,unavailable) -``` -To: -``` -#define __TVOS_UNAVAILABLE_NOTQUITE __OS_AVAILABILITY(tvos,unavailable) -#define __TVOS_PROHIBITED_NOTQUITE __OS_AVAILABILITY(tvos,unavailable) -``` -Do this for Availability.h for both simulator and device if you want to run it on the real hardware. +Update: Changing Availability.h to build successfully is NOT needed anymore from now on. +The private UIWebView is now initialized using NSClassFromString(@"UIWebView"), which is a cleaner solution than changing your local Availability.h for both Device and Simulator builds. + + How to Use tvOSBrowser ============= - Double press on the center of the touch area of the Apple TV Remote to switch between cursor & scroll mode. - Press the touch area while in cursor mode to click. -- Menu will navigate back (like a back button). -- Pressing the Play/Pause button will let you input URLs, search Google, and reload the page. -- Double tapping the Play/Pause button or Menu button displays a menu with Favorites, History, set/open homepage, change user agent, clear cache, and clear cookies. +- Single tap the Play/Pause button to: input URLs, search Google, reload the page, or navigate back. +- Double tap the Play/Pause button to: display a menu with Favorites, History, set/open homepage, change user agent, clear cache, and clear cookies.