├── AUTHORS ├── SafariLauncher ├── en.lproj │ └── InfoPlist.strings ├── Default.png ├── Default@2x.png ├── Default-568h@2x.png ├── SafariLauncher.h ├── AppDelegate.h ├── SafariLauncher-Prefix.pch ├── main.m ├── ViewController.h ├── Preferences.h ├── SafariLauncher.m ├── SafariLauncher-Info.plist ├── ViewController.m ├── Preferences.m └── AppDelegate.m ├── Settings.bundle ├── en.lproj │ └── Root.strings └── Root.plist ├── README.md ├── LICENSE ├── .gitignore └── SafariLauncher.xcodeproj ├── xcshareddata └── xcschemes │ └── SafariLauncher.xcscheme └── project.pbxproj /AUTHORS: -------------------------------------------------------------------------------- 1 | Authors ordered by first contribution 2 | 3 | Budhaditya Das 4 | -------------------------------------------------------------------------------- /SafariLauncher/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | 4 | -------------------------------------------------------------------------------- /SafariLauncher/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budhash/SafariLauncher/HEAD/SafariLauncher/Default.png -------------------------------------------------------------------------------- /SafariLauncher/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budhash/SafariLauncher/HEAD/SafariLauncher/Default@2x.png -------------------------------------------------------------------------------- /SafariLauncher/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budhash/SafariLauncher/HEAD/SafariLauncher/Default-568h@2x.png -------------------------------------------------------------------------------- /Settings.bundle/en.lproj/Root.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/budhash/SafariLauncher/HEAD/Settings.bundle/en.lproj/Root.strings -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SafariLauncher 2 | 3 | A simple IOS application that automatically launches Mobile Safari after a certain delay. This application is intended to be used with appium for running Web Tests on real IOS devices 4 | -------------------------------------------------------------------------------- /SafariLauncher/SafariLauncher.h: -------------------------------------------------------------------------------- 1 | // 2 | // SafariLauncher.h 3 | // SafariLauncher 4 | // 5 | // Created by Budhaditya Das on 6/5/13. 6 | // Copyright (c) 2013 Bytearc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SafariLauncher : NSObject 12 | + (void)launch:(NSString *)url withDelay:(NSUInteger)delay; 13 | @end 14 | -------------------------------------------------------------------------------- /SafariLauncher/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SafariLauncher 4 | // 5 | // Created by Budhaditya Das on 6/5/13. 6 | // Copyright (c) 2013 Bytearc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SafariLauncher/SafariLauncher-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SafariLauncher' target in the 'SafariLauncher' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif -------------------------------------------------------------------------------- /SafariLauncher/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SafariLauncher 4 | // 5 | // Created by Budhaditya Das on 6/5/13. 6 | // Copyright (c) 2013 Bytearc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SafariLauncher/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SafariLauncher 4 | // 5 | // Created by Budhaditya Das on 6/5/13. 6 | // Copyright (c) 2013 Bytearc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController{ 12 | UILabel *titleLabel; 13 | UILabel *infoLabel; 14 | } 15 | 16 | @property (nonatomic, strong) NSTimer *delayTimer; 17 | //@property (nonatomic, retain) IBOutlet UILabel *infoLabel; 18 | 19 | @end -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Budhaditya Das 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /SafariLauncher/Preferences.h: -------------------------------------------------------------------------------- 1 | // 2 | // Preferences.h 3 | // SafariLauncher 4 | // 5 | // Created by Budhaditya Das on 6/10/13. 6 | // Copyright (c) 2013 Bytearc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Preferences: NSObject { 12 | 13 | NSString *launchUrl_; 14 | NSUInteger startDelay_; 15 | NSUInteger nonStartDelay_; 16 | } 17 | 18 | @property (readonly, nonatomic) NSString *launchUrl; 19 | @property (readonly, nonatomic) NSUInteger startDelay; 20 | @property (readonly, nonatomic) NSUInteger nonStartDelay; 21 | 22 | // Singleton 23 | + (Preferences *)sharedInstance; 24 | + (NSURL *) getDefaultUrl; 25 | @end 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target.xcconfig 2 | 3 | # git ignore template from: http://cocoaheads.tumblr.com/post/1350304132/gitignore-template-for-xcode3-4 4 | 5 | # Mac OS X Finder 6 | .DS_Store 7 | 8 | # XCode (and ancestors) per-user config (very noisy, and not relevant) 9 | *.mode1 10 | *.mode1v3 11 | *.mode2v3 12 | *.perspective 13 | *.perspectivev3 14 | *.pbxuser 15 | 16 | # Xcode 4 17 | xcuserdata/ 18 | project.xcworkspace/ 19 | 20 | # build products 21 | build/ 22 | *.[oa] 23 | 24 | # Other source repository archive directories (protects when importing) 25 | .hg 26 | .svn 27 | CVS 28 | 29 | # automatic backup files 30 | *~.nib 31 | *.swp 32 | *~ 33 | *(Autosaved).rtfd/ 34 | Backup[ ]of[ ]*.pages/ 35 | Backup[ ]of[ ]*.key/ 36 | Backup[ ]of[ ]*.numbers/ 37 | 38 | _* 39 | -------------------------------------------------------------------------------- /SafariLauncher/SafariLauncher.m: -------------------------------------------------------------------------------- 1 | // 2 | // SafariLauncher.m 3 | // SafariLauncher 4 | // 5 | // Created by Budhaditya Das on 6/5/13. 6 | // Copyright (c) 2013 Bytearc. All rights reserved. 7 | // 8 | 9 | #import "SafariLauncher.h" 10 | #import "Preferences.h" 11 | 12 | @implementation SafariLauncher 13 | 14 | + (void)launch:(NSString *)url withDelay:(NSUInteger)delay{ 15 | Preferences *preferences = [Preferences sharedInstance]; 16 | 17 | NSLog(@"Waiting for %lu seconds", (unsigned long)delay); 18 | [NSThread sleepForTimeInterval:delay]; 19 | 20 | NSURL *launchUrl = [NSURL URLWithString: url]; 21 | 22 | if(launchUrl == nil || (![[launchUrl scheme] isEqualToString:@"http"] && ![[launchUrl scheme] isEqualToString:@"https"])) { 23 | NSLog(@"Invalid URL [%@] specified. Trying settings URL", url); 24 | 25 | launchUrl = [NSURL URLWithString: preferences.launchUrl]; 26 | 27 | if(launchUrl == nil || (![[launchUrl scheme] isEqualToString:@"http"] && ![[launchUrl scheme] isEqualToString:@"https"])) { 28 | NSLog(@"Invalid settings URL [%@]. Launching default URL", preferences.launchUrl); 29 | launchUrl = [Preferences getDefaultUrl]; 30 | } 31 | } 32 | NSLog(@"Launching URL - %@", launchUrl); 33 | [[UIApplication sharedApplication] openURL:launchUrl]; 34 | 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Settings.bundle/Root.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | Title 9 | Configurations 10 | Type 11 | PSGroupSpecifier 12 | 13 | 14 | AutocapitalizationType 15 | None 16 | AutocorrectionType 17 | No 18 | DefaultValue 19 | http://www.apple.com 20 | IsSecure 21 | 22 | Key 23 | preference_launchUrl 24 | KeyboardType 25 | URL 26 | Title 27 | URL 28 | Type 29 | PSTextFieldSpecifier 30 | 31 | 32 | Type 33 | PSSliderSpecifier 34 | Key 35 | preference_startDelay 36 | DefaultValue 37 | 2 38 | MinimumValue 39 | 0 40 | MaximumValue 41 | 30 42 | 43 | 44 | StringsTable 45 | Root 46 | 47 | 48 | -------------------------------------------------------------------------------- /SafariLauncher/SafariLauncher-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | ${BUNDLE_ID} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleURLTypes 24 | 25 | 26 | CFBundleURLName 27 | com.bytearc.SafariLauncher 28 | CFBundleURLSchemes 29 | 30 | sl 31 | 32 | 33 | 34 | CFBundleVersion 35 | 1.0 36 | LSRequiresIPhoneOS 37 | 38 | UIRequiredDeviceCapabilities 39 | 40 | armv7 41 | 42 | UISupportedInterfaceOrientations 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UISupportedInterfaceOrientations~ipad 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationPortraitUpsideDown 52 | UIInterfaceOrientationLandscapeLeft 53 | UIInterfaceOrientationLandscapeRight 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /SafariLauncher.xcodeproj/xcshareddata/xcschemes/SafariLauncher.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /SafariLauncher/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SafariLauncher 4 | // 5 | // Created by Budhaditya Das on 6/5/13. 6 | // Copyright (c) 2013 Bytearc. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "Preferences.h" 11 | #import "SafariLauncher.h" 12 | #import "ViewController.h" 13 | #import "QuartzCore/QuartzCore.h" 14 | 15 | @interface ViewController () 16 | 17 | @end 18 | 19 | @implementation ViewController 20 | @synthesize delayTimer; 21 | 22 | int secondsLeft; 23 | 24 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 25 | { 26 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 27 | if (self) { 28 | // Custom initialization 29 | } 30 | return self; 31 | } 32 | 33 | - (void)viewDidLoad 34 | { 35 | [super viewDidLoad]; 36 | // Do any additional setup after loading the view. 37 | int fontSize = self.view.bounds.size.height/25; 38 | 39 | NSLog(@" height - %02f : width - %02f", self.view.bounds.size.height, self.view.bounds.size.width); 40 | titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.view.bounds.size.width/4.0f, 41 | self.view.bounds.size.height/2.0f, 42 | self.view.bounds.size.width/2.0f, 43 | 50)]; 44 | titleLabel.text = @"Safari Launcher"; 45 | titleLabel.textColor = [UIColor blueColor]; 46 | titleLabel.font = [UIFont fontWithName:@"Verdana" size:fontSize]; 47 | 48 | infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 49 | self.view.bounds.size.height-50.0f, 50 | self.view.bounds.size.width, 51 | 50)]; 52 | infoLabel.text = @"Status:"; 53 | infoLabel.layer.borderColor = [UIColor blackColor].CGColor; 54 | infoLabel.layer.borderWidth = 3.0; 55 | 56 | [self.view addSubview:titleLabel]; 57 | [self.view addSubview:infoLabel]; 58 | 59 | Preferences *preferences = [Preferences sharedInstance]; 60 | secondsLeft = preferences.startDelay; 61 | self.delayTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(delayCountdown) userInfo:nil repeats:YES]; 62 | } 63 | 64 | - (void)viewDidUnload 65 | { 66 | [super viewDidUnload]; 67 | // Release any retained subviews of the main view. 68 | titleLabel = nil; 69 | infoLabel = nil; 70 | } 71 | 72 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 73 | { 74 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 75 | } 76 | 77 | -(void) delayCountdown { 78 | secondsLeft--; 79 | infoLabel.text = [NSString stringWithFormat:@" Pausing %02d seconds before launch", secondsLeft]; 80 | 81 | NSLog(@"delay: %d", secondsLeft); 82 | if (secondsLeft <= 0) { 83 | [self.delayTimer invalidate]; 84 | self.delayTimer = nil; 85 | [self launchSafari]; 86 | } 87 | } 88 | 89 | -(void) launchSafari{ 90 | Preferences *preferences = [Preferences sharedInstance]; 91 | NSArray * args = [[NSProcessInfo processInfo] arguments]; 92 | NSString *urlArg = preferences.launchUrl; 93 | if([args count] > 1) { 94 | urlArg = [args objectAtIndex: 1]; 95 | } 96 | infoLabel.text = [NSString stringWithFormat:@" Launching: %@", urlArg]; 97 | [SafariLauncher launch:urlArg withDelay:preferences.nonStartDelay]; 98 | } 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /SafariLauncher/Preferences.m: -------------------------------------------------------------------------------- 1 | // 2 | // Preferences.m 3 | // SafariLauncher 4 | // 5 | // Created by Budhaditya Das on 6/10/13. 6 | // Copyright (c) 2013 Bytearc. All rights reserved. 7 | // 8 | 9 | #import "Preferences.h" 10 | 11 | static NSString * const PREF_LAUNCH_URL = @"preference_launchUrl"; 12 | static NSString * const PREF_START_DELAY = @"preference_startDelay"; 13 | static NSString * const DEFAULT_URL = @"http://www.google.com"; 14 | static NSUInteger const NON_START_DELAY = 0; 15 | 16 | @implementation Preferences 17 | 18 | @synthesize launchUrl = launchUrl_; 19 | @synthesize startDelay = startDelay_; 20 | @synthesize nonStartDelay = nonStartDelay_; 21 | 22 | /* 23 | static Preferences *singleton = nil; 24 | + (Preferences*) sharedInstance { 25 | if (singleton == nil) { 26 | singleton = [[Preferences alloc] init]; 27 | } 28 | return singleton; 29 | } 30 | */ 31 | + (Preferences *)sharedInstance 32 | { 33 | // Static local predicate must be initialized to 0 34 | static Preferences *sharedInstance = nil; 35 | static dispatch_once_t onceToken = 0; 36 | dispatch_once(&onceToken, ^{ 37 | sharedInstance = [[Preferences alloc] init]; 38 | }); 39 | return sharedInstance; 40 | } 41 | 42 | + (void) initPreferences { 43 | NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; 44 | id launchUrl = [userDefaults objectForKey:PREF_LAUNCH_URL]; 45 | id startDelay = [userDefaults objectForKey:PREF_START_DELAY]; 46 | 47 | if (launchUrl == nil || startDelay == nil) { 48 | NSLog(@"App setting not found. Initializing app settings to default values."); 49 | 50 | NSString* bundlePath = [[NSBundle mainBundle] bundlePath]; 51 | NSString* settingsPath = [bundlePath stringByAppendingPathComponent: 52 | @"Settings.bundle"]; 53 | NSString* rootPlist = [settingsPath stringByAppendingPathComponent: 54 | @"Root.plist"]; 55 | 56 | NSDictionary* settings = [NSDictionary dictionaryWithContentsOfFile: 57 | rootPlist]; 58 | NSArray* preferences = [settings objectForKey:@"PreferenceSpecifiers"]; 59 | 60 | NSMutableDictionary* defaultPrefs = 61 | [NSMutableDictionary dictionaryWithCapacity:[preferences count]]; 62 | for (NSDictionary* item in preferences) { 63 | id key = [item objectForKey:@"Key"]; 64 | if (key != nil) { 65 | [defaultPrefs setObject:[item objectForKey:@"DefaultValue"] 66 | forKey:key]; 67 | } 68 | } 69 | 70 | [[NSUserDefaults standardUserDefaults] registerDefaults:defaultPrefs]; 71 | [[NSUserDefaults standardUserDefaults] synchronize]; 72 | } else { 73 | NSLog(@"App settings already initialized"); 74 | } 75 | } 76 | 77 | 78 | - (id)init { 79 | [Preferences initPreferences]; 80 | 81 | // Fetching paramters from [NSUserDefaults standardUserDefaults]. 82 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 83 | 84 | launchUrl_ = [defaults stringForKey:PREF_LAUNCH_URL]; 85 | if (!launchUrl_) { 86 | launchUrl_ = [[Preferences getDefaultUrl] absoluteString]; 87 | [defaults setObject:launchUrl_ forKey:PREF_LAUNCH_URL]; 88 | } 89 | 90 | startDelay_ = [defaults integerForKey:PREF_START_DELAY]; 91 | if (!startDelay_) { 92 | startDelay_ = 20; 93 | [defaults setObject:@"0" forKey:PREF_START_DELAY]; 94 | } 95 | 96 | nonStartDelay_ = NON_START_DELAY; 97 | 98 | [defaults synchronize]; 99 | return self; 100 | } 101 | 102 | + (NSURL *) getDefaultUrl{ 103 | return [NSURL URLWithString:DEFAULT_URL]; 104 | } 105 | @end 106 | 107 | -------------------------------------------------------------------------------- /SafariLauncher/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SafariLauncher 4 | // 5 | // Created by Budhaditya Das on 6/5/13. 6 | // Copyright (c) 2013 Bytearc. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "Preferences.h" 11 | #import "SafariLauncher.h" 12 | #import "ViewController.h" 13 | 14 | static BOOL foregroungCheckFlag = false; 15 | 16 | @implementation AppDelegate 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 21 | // Override point for customization after application launch. 22 | self.window.backgroundColor = [UIColor whiteColor]; 23 | 24 | [self.window makeKeyAndVisible]; 25 | ViewController *mainView = [[ViewController alloc] init]; 26 | //[self.window addSubview:mainView.view]; 27 | 28 | [self.window setRootViewController:mainView]; 29 | 30 | [self.window makeKeyAndVisible]; 31 | return YES; 32 | } 33 | 34 | - (void)applicationWillResignActive:(UIApplication *)application 35 | { 36 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 37 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 38 | } 39 | 40 | - (void)applicationDidEnterBackground:(UIApplication *)application 41 | { 42 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 43 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 44 | } 45 | 46 | - (void)applicationWillEnterForeground:(UIApplication *)application 47 | { 48 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 49 | foregroungCheckFlag = true; 50 | } 51 | 52 | - (void)applicationDidBecomeActive:(UIApplication *)application 53 | { 54 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 55 | if(foregroungCheckFlag){ 56 | Preferences *preferences = [Preferences sharedInstance]; 57 | [SafariLauncher launch:preferences.launchUrl withDelay:preferences.nonStartDelay]; 58 | } 59 | } 60 | 61 | - (void)applicationWillTerminate:(UIApplication *)application 62 | { 63 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 64 | } 65 | 66 | - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url 67 | { 68 | foregroungCheckFlag = false; 69 | Preferences *preferences = [Preferences sharedInstance]; 70 | if (!url) { 71 | [SafariLauncher launch:preferences.launchUrl withDelay:preferences.nonStartDelay]; 72 | }else{ 73 | 74 | NSString *launchUrl = [[url absoluteString] substringFromIndex:5]; 75 | if([launchUrl hasPrefix:@"http//"]){ 76 | launchUrl = [launchUrl stringByReplacingOccurrencesOfString:@"http//" 77 | withString:@"http://"]; 78 | }else if([launchUrl hasPrefix:@"https//"]){ 79 | launchUrl = [launchUrl stringByReplacingOccurrencesOfString:@"https//" 80 | withString:@"https://"]; 81 | } 82 | 83 | [SafariLauncher launch:launchUrl withDelay:preferences.nonStartDelay]; 84 | } 85 | return YES; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /SafariLauncher.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0CF376B3175F268800CF1F65 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF376B2175F268800CF1F65 /* UIKit.framework */; }; 11 | 0CF376B5175F268800CF1F65 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF376B4175F268800CF1F65 /* Foundation.framework */; }; 12 | 0CF376B7175F268800CF1F65 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF376B6175F268800CF1F65 /* CoreGraphics.framework */; }; 13 | 0CF376BD175F268800CF1F65 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0CF376BB175F268800CF1F65 /* InfoPlist.strings */; }; 14 | 0CF376BF175F268800CF1F65 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF376BE175F268800CF1F65 /* main.m */; }; 15 | 0CF376C3175F268800CF1F65 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF376C2175F268800CF1F65 /* AppDelegate.m */; }; 16 | 0CF376C5175F268800CF1F65 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 0CF376C4175F268800CF1F65 /* Default.png */; }; 17 | 0CF376C7175F268800CF1F65 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0CF376C6175F268800CF1F65 /* Default@2x.png */; }; 18 | 0CF376C9175F268800CF1F65 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0CF376C8175F268800CF1F65 /* Default-568h@2x.png */; }; 19 | 0CF376D4175F2E9500CF1F65 /* AUTHORS in Resources */ = {isa = PBXBuildFile; fileRef = 0CF376D1175F2E9500CF1F65 /* AUTHORS */; }; 20 | 0CF376D5175F2E9500CF1F65 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 0CF376D2175F2E9500CF1F65 /* LICENSE */; }; 21 | 0CF376D6175F2E9500CF1F65 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 0CF376D3175F2E9500CF1F65 /* README.md */; }; 22 | B70E4318176F8962003E5E3B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B70E4317176F8962003E5E3B /* ViewController.m */; }; 23 | B7E340CE17614DDB00F99A2B /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B7E340CD17614DDB00F99A2B /* Settings.bundle */; }; 24 | B7E340D2176669B900F99A2B /* Preferences.m in Sources */ = {isa = PBXBuildFile; fileRef = B7E340D1176669B800F99A2B /* Preferences.m */; }; 25 | B7E340D51766708B00F99A2B /* SafariLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = B7E340D41766708B00F99A2B /* SafariLauncher.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 0CF376AF175F268800CF1F65 /* SafariLauncher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SafariLauncher.app; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 0CF376B2175F268800CF1F65 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 31 | 0CF376B4175F268800CF1F65 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 32 | 0CF376B6175F268800CF1F65 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 33 | 0CF376BA175F268800CF1F65 /* SafariLauncher-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SafariLauncher-Info.plist"; sourceTree = ""; }; 34 | 0CF376BC175F268800CF1F65 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 35 | 0CF376BE175F268800CF1F65 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | 0CF376C0175F268800CF1F65 /* SafariLauncher-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SafariLauncher-Prefix.pch"; sourceTree = ""; }; 37 | 0CF376C1175F268800CF1F65 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 38 | 0CF376C2175F268800CF1F65 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 39 | 0CF376C4175F268800CF1F65 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 40 | 0CF376C6175F268800CF1F65 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 41 | 0CF376C8175F268800CF1F65 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 42 | 0CF376D1175F2E9500CF1F65 /* AUTHORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AUTHORS; sourceTree = ""; }; 43 | 0CF376D2175F2E9500CF1F65 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 44 | 0CF376D3175F2E9500CF1F65 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = ""; }; 45 | B70E4316176F8962003E5E3B /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 46 | B70E4317176F8962003E5E3B /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 47 | B7E340CD17614DDB00F99A2B /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; 48 | B7E340D0176669B800F99A2B /* Preferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Preferences.h; sourceTree = ""; }; 49 | B7E340D1176669B800F99A2B /* Preferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Preferences.m; sourceTree = ""; }; 50 | B7E340D31766708B00F99A2B /* SafariLauncher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SafariLauncher.h; sourceTree = ""; }; 51 | B7E340D41766708B00F99A2B /* SafariLauncher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SafariLauncher.m; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 0CF376AC175F268800CF1F65 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | 0CF376B3175F268800CF1F65 /* UIKit.framework in Frameworks */, 60 | 0CF376B5175F268800CF1F65 /* Foundation.framework in Frameworks */, 61 | 0CF376B7175F268800CF1F65 /* CoreGraphics.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 0CF376A6175F268800CF1F65 = { 69 | isa = PBXGroup; 70 | children = ( 71 | 0CF376D1175F2E9500CF1F65 /* AUTHORS */, 72 | 0CF376D2175F2E9500CF1F65 /* LICENSE */, 73 | 0CF376D3175F2E9500CF1F65 /* README.md */, 74 | B7E340CD17614DDB00F99A2B /* Settings.bundle */, 75 | 0CF376B8175F268800CF1F65 /* SafariLauncher */, 76 | 0CF376B1175F268800CF1F65 /* Frameworks */, 77 | 0CF376B0175F268800CF1F65 /* Products */, 78 | ); 79 | sourceTree = ""; 80 | }; 81 | 0CF376B0175F268800CF1F65 /* Products */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 0CF376AF175F268800CF1F65 /* SafariLauncher.app */, 85 | ); 86 | name = Products; 87 | sourceTree = ""; 88 | }; 89 | 0CF376B1175F268800CF1F65 /* Frameworks */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 0CF376B2175F268800CF1F65 /* UIKit.framework */, 93 | 0CF376B4175F268800CF1F65 /* Foundation.framework */, 94 | 0CF376B6175F268800CF1F65 /* CoreGraphics.framework */, 95 | ); 96 | name = Frameworks; 97 | sourceTree = ""; 98 | }; 99 | 0CF376B8175F268800CF1F65 /* SafariLauncher */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | B7E340D0176669B800F99A2B /* Preferences.h */, 103 | B7E340D1176669B800F99A2B /* Preferences.m */, 104 | B7E340D31766708B00F99A2B /* SafariLauncher.h */, 105 | B7E340D41766708B00F99A2B /* SafariLauncher.m */, 106 | 0CF376C1175F268800CF1F65 /* AppDelegate.h */, 107 | 0CF376C2175F268800CF1F65 /* AppDelegate.m */, 108 | B70E4316176F8962003E5E3B /* ViewController.h */, 109 | B70E4317176F8962003E5E3B /* ViewController.m */, 110 | 0CF376B9175F268800CF1F65 /* Supporting Files */, 111 | ); 112 | path = SafariLauncher; 113 | sourceTree = ""; 114 | }; 115 | 0CF376B9175F268800CF1F65 /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 0CF376BA175F268800CF1F65 /* SafariLauncher-Info.plist */, 119 | 0CF376BB175F268800CF1F65 /* InfoPlist.strings */, 120 | 0CF376BE175F268800CF1F65 /* main.m */, 121 | 0CF376C0175F268800CF1F65 /* SafariLauncher-Prefix.pch */, 122 | 0CF376C4175F268800CF1F65 /* Default.png */, 123 | 0CF376C6175F268800CF1F65 /* Default@2x.png */, 124 | 0CF376C8175F268800CF1F65 /* Default-568h@2x.png */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | 0CF376AE175F268800CF1F65 /* SafariLauncher */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = 0CF376CC175F268800CF1F65 /* Build configuration list for PBXNativeTarget "SafariLauncher" */; 135 | buildPhases = ( 136 | 0CF376AB175F268800CF1F65 /* Sources */, 137 | 0CF376AC175F268800CF1F65 /* Frameworks */, 138 | 0CF376AD175F268800CF1F65 /* Resources */, 139 | ); 140 | buildRules = ( 141 | ); 142 | dependencies = ( 143 | ); 144 | name = SafariLauncher; 145 | productName = SafariLauncher; 146 | productReference = 0CF376AF175F268800CF1F65 /* SafariLauncher.app */; 147 | productType = "com.apple.product-type.application"; 148 | }; 149 | /* End PBXNativeTarget section */ 150 | 151 | /* Begin PBXProject section */ 152 | 0CF376A7175F268800CF1F65 /* Project object */ = { 153 | isa = PBXProject; 154 | attributes = { 155 | LastUpgradeCheck = 0460; 156 | ORGANIZATIONNAME = Bytearc; 157 | }; 158 | buildConfigurationList = 0CF376AA175F268800CF1F65 /* Build configuration list for PBXProject "SafariLauncher" */; 159 | compatibilityVersion = "Xcode 3.2"; 160 | developmentRegion = English; 161 | hasScannedForEncodings = 0; 162 | knownRegions = ( 163 | en, 164 | ); 165 | mainGroup = 0CF376A6175F268800CF1F65; 166 | productRefGroup = 0CF376B0175F268800CF1F65 /* Products */; 167 | projectDirPath = ""; 168 | projectRoot = ""; 169 | targets = ( 170 | 0CF376AE175F268800CF1F65 /* SafariLauncher */, 171 | ); 172 | }; 173 | /* End PBXProject section */ 174 | 175 | /* Begin PBXResourcesBuildPhase section */ 176 | 0CF376AD175F268800CF1F65 /* Resources */ = { 177 | isa = PBXResourcesBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | 0CF376BD175F268800CF1F65 /* InfoPlist.strings in Resources */, 181 | 0CF376C5175F268800CF1F65 /* Default.png in Resources */, 182 | 0CF376C7175F268800CF1F65 /* Default@2x.png in Resources */, 183 | 0CF376C9175F268800CF1F65 /* Default-568h@2x.png in Resources */, 184 | 0CF376D4175F2E9500CF1F65 /* AUTHORS in Resources */, 185 | 0CF376D5175F2E9500CF1F65 /* LICENSE in Resources */, 186 | 0CF376D6175F2E9500CF1F65 /* README.md in Resources */, 187 | B7E340CE17614DDB00F99A2B /* Settings.bundle in Resources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXResourcesBuildPhase section */ 192 | 193 | /* Begin PBXSourcesBuildPhase section */ 194 | 0CF376AB175F268800CF1F65 /* Sources */ = { 195 | isa = PBXSourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | 0CF376BF175F268800CF1F65 /* main.m in Sources */, 199 | 0CF376C3175F268800CF1F65 /* AppDelegate.m in Sources */, 200 | B7E340D2176669B900F99A2B /* Preferences.m in Sources */, 201 | B7E340D51766708B00F99A2B /* SafariLauncher.m in Sources */, 202 | B70E4318176F8962003E5E3B /* ViewController.m in Sources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | /* End PBXSourcesBuildPhase section */ 207 | 208 | /* Begin PBXVariantGroup section */ 209 | 0CF376BB175F268800CF1F65 /* InfoPlist.strings */ = { 210 | isa = PBXVariantGroup; 211 | children = ( 212 | 0CF376BC175F268800CF1F65 /* en */, 213 | ); 214 | name = InfoPlist.strings; 215 | sourceTree = ""; 216 | }; 217 | /* End PBXVariantGroup section */ 218 | 219 | /* Begin XCBuildConfiguration section */ 220 | 0CF376CA175F268800CF1F65 /* Debug */ = { 221 | isa = XCBuildConfiguration; 222 | buildSettings = { 223 | ALWAYS_SEARCH_USER_PATHS = NO; 224 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 225 | CLANG_CXX_LIBRARY = "libc++"; 226 | CLANG_ENABLE_OBJC_ARC = YES; 227 | CLANG_WARN_CONSTANT_CONVERSION = YES; 228 | CLANG_WARN_EMPTY_BODY = YES; 229 | CLANG_WARN_ENUM_CONVERSION = YES; 230 | CLANG_WARN_INT_CONVERSION = YES; 231 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 232 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 233 | COPY_PHASE_STRIP = NO; 234 | GCC_C_LANGUAGE_STANDARD = gnu99; 235 | GCC_DYNAMIC_NO_PIC = NO; 236 | GCC_OPTIMIZATION_LEVEL = 0; 237 | GCC_PREPROCESSOR_DEFINITIONS = ( 238 | "DEBUG=1", 239 | "$(inherited)", 240 | ); 241 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 242 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 243 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 244 | GCC_WARN_UNUSED_VARIABLE = YES; 245 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 246 | ONLY_ACTIVE_ARCH = YES; 247 | SDKROOT = iphoneos; 248 | TARGETED_DEVICE_FAMILY = "1,2"; 249 | }; 250 | name = Debug; 251 | }; 252 | 0CF376CB175F268800CF1F65 /* Release */ = { 253 | isa = XCBuildConfiguration; 254 | buildSettings = { 255 | ALWAYS_SEARCH_USER_PATHS = NO; 256 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 257 | CLANG_CXX_LIBRARY = "libc++"; 258 | CLANG_ENABLE_OBJC_ARC = YES; 259 | CLANG_WARN_CONSTANT_CONVERSION = YES; 260 | CLANG_WARN_EMPTY_BODY = YES; 261 | CLANG_WARN_ENUM_CONVERSION = YES; 262 | CLANG_WARN_INT_CONVERSION = YES; 263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 264 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 265 | COPY_PHASE_STRIP = YES; 266 | GCC_C_LANGUAGE_STANDARD = gnu99; 267 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 268 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 269 | GCC_WARN_UNUSED_VARIABLE = YES; 270 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 271 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 272 | SDKROOT = iphoneos; 273 | TARGETED_DEVICE_FAMILY = "1,2"; 274 | VALIDATE_PRODUCT = YES; 275 | }; 276 | name = Release; 277 | }; 278 | 0CF376CD175F268800CF1F65 /* Debug */ = { 279 | isa = XCBuildConfiguration; 280 | buildSettings = { 281 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "${IDENTITY_NAME}"; 282 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 283 | GCC_PREFIX_HEADER = "SafariLauncher/SafariLauncher-Prefix.pch"; 284 | INFOPLIST_FILE = "SafariLauncher/SafariLauncher-Info.plist"; 285 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 286 | PRODUCT_NAME = "$(TARGET_NAME)"; 287 | "PROVISIONING_PROFILE[sdk=*]" = "${IDENTITY_CODE}"; 288 | WRAPPER_EXTENSION = app; 289 | }; 290 | name = Debug; 291 | }; 292 | 0CF376CE175F268800CF1F65 /* Release */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "${IDENTITY_NAME}"; 296 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 297 | GCC_PREFIX_HEADER = "SafariLauncher/SafariLauncher-Prefix.pch"; 298 | INFOPLIST_FILE = "SafariLauncher/SafariLauncher-Info.plist"; 299 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 300 | PRODUCT_NAME = "$(TARGET_NAME)"; 301 | "PROVISIONING_PROFILE[sdk=*]" = "${IDENTITY_CODE}"; 302 | WRAPPER_EXTENSION = app; 303 | }; 304 | name = Release; 305 | }; 306 | /* End XCBuildConfiguration section */ 307 | 308 | /* Begin XCConfigurationList section */ 309 | 0CF376AA175F268800CF1F65 /* Build configuration list for PBXProject "SafariLauncher" */ = { 310 | isa = XCConfigurationList; 311 | buildConfigurations = ( 312 | 0CF376CA175F268800CF1F65 /* Debug */, 313 | 0CF376CB175F268800CF1F65 /* Release */, 314 | ); 315 | defaultConfigurationIsVisible = 0; 316 | defaultConfigurationName = Release; 317 | }; 318 | 0CF376CC175F268800CF1F65 /* Build configuration list for PBXNativeTarget "SafariLauncher" */ = { 319 | isa = XCConfigurationList; 320 | buildConfigurations = ( 321 | 0CF376CD175F268800CF1F65 /* Debug */, 322 | 0CF376CE175F268800CF1F65 /* Release */, 323 | ); 324 | defaultConfigurationIsVisible = 0; 325 | defaultConfigurationName = Release; 326 | }; 327 | /* End XCConfigurationList section */ 328 | }; 329 | rootObject = 0CF376A7175F268800CF1F65 /* Project object */; 330 | } 331 | --------------------------------------------------------------------------------