Permalink
Browse files

Initial Commit

  • Loading branch information...
0 parents commit ff18f280c7e59cf75979a4b3f7a58b23825bb711 @kristianmandrup committed Jun 10, 2012
Showing with 1,385 additions and 0 deletions.
  1. +547 −0 friendlyrent.xcodeproj/project.pbxproj
  2. +50 −0 friendlyrent/Classes/AppDelegate.h
  3. +140 −0 friendlyrent/Classes/AppDelegate.m
  4. +36 −0 friendlyrent/Classes/MainViewController.h
  5. +140 −0 friendlyrent/Classes/MainViewController.m
  6. +138 −0 friendlyrent/Classes/MainViewController.xib
  7. +59 −0 friendlyrent/Cordova.plist
  8. +20 −0 friendlyrent/Plugins/README
  9. BIN friendlyrent/Resources/Capture.bundle/controls_bg.png
  10. BIN friendlyrent/Resources/Capture.bundle/controls_bg@2x.png
  11. BIN friendlyrent/Resources/Capture.bundle/controls_bg@2x~ipad.png
  12. BIN friendlyrent/Resources/Capture.bundle/controls_bg~ipad.png
  13. BIN friendlyrent/Resources/Capture.bundle/microphone.png
  14. BIN friendlyrent/Resources/Capture.bundle/microphone@2x.png
  15. BIN friendlyrent/Resources/Capture.bundle/microphone@2x~ipad.png
  16. BIN friendlyrent/Resources/Capture.bundle/microphone~ipad.png
  17. BIN friendlyrent/Resources/Capture.bundle/record_button.png
  18. BIN friendlyrent/Resources/Capture.bundle/record_button@2x.png
  19. BIN friendlyrent/Resources/Capture.bundle/record_button@2x~ipad.png
  20. BIN friendlyrent/Resources/Capture.bundle/record_button~ipad.png
  21. BIN friendlyrent/Resources/Capture.bundle/recording_bg.png
  22. BIN friendlyrent/Resources/Capture.bundle/recording_bg@2x.png
  23. BIN friendlyrent/Resources/Capture.bundle/recording_bg@2x~ipad.png
  24. BIN friendlyrent/Resources/Capture.bundle/recording_bg~ipad.png
  25. BIN friendlyrent/Resources/Capture.bundle/stop_button.png
  26. BIN friendlyrent/Resources/Capture.bundle/stop_button@2x.png
  27. BIN friendlyrent/Resources/Capture.bundle/stop_button@2x~ipad.png
  28. BIN friendlyrent/Resources/Capture.bundle/stop_button~ipad.png
  29. +26 −0 friendlyrent/Resources/de.lproj/Localizable.strings
  30. +25 −0 friendlyrent/Resources/en.lproj/Localizable.strings
  31. +25 −0 friendlyrent/Resources/es.lproj/Localizable.strings
  32. BIN friendlyrent/Resources/icons/icon-72.png
  33. BIN friendlyrent/Resources/icons/icon.png
  34. BIN friendlyrent/Resources/icons/icon@2x.png
  35. +26 −0 friendlyrent/Resources/se.lproj/Localizable.strings
  36. BIN friendlyrent/Resources/splash/Default@2x~iphone.png
  37. BIN friendlyrent/Resources/splash/Default~iphone.png
  38. +2 −0 friendlyrent/en.lproj/InfoPlist.strings
  39. +78 −0 friendlyrent/friendlyrent-Info.plist
  40. +7 −0 friendlyrent/friendlyrent-Prefix.pch
  41. +35 −0 friendlyrent/main.m
  42. +31 −0 friendlyrent/verify.sh
Oops, something went wrong.
@@ -0,0 +1,50 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+//
+// AppDelegate.h
+// friendlyrent
+//
+// Created by Kristian Mandrup on 6/10/12.
+// Copyright __MyCompanyName__ 2012. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#ifdef CORDOVA_FRAMEWORK
+ #import <Cordova/CDVViewController.h>
+#else
+ #import "CDVViewController.h"
+#endif
+
+
+@interface AppDelegate : NSObject < UIApplicationDelegate > {
+
+}
+
+// invoke string is passed to your app on launch, this is only valid if you
+// edit friendlyrent-Info.plist to add a protocol
+// a simple tutorial can be found here :
+// http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
+
+@property (nonatomic, retain) IBOutlet UIWindow* window;
+@property (nonatomic, retain) IBOutlet CDVViewController* viewController;
+
+@end
+
@@ -0,0 +1,140 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+//
+// AppDelegate.m
+// friendlyrent
+//
+// Created by Kristian Mandrup on 6/10/12.
+// Copyright __MyCompanyName__ 2012. All rights reserved.
+//
+
+#import "AppDelegate.h"
+#import "MainViewController.h"
+
+#ifdef CORDOVA_FRAMEWORK
+ #import <Cordova/CDVPlugin.h>
+ #import <Cordova/CDVURLProtocol.h>
+#else
+ #import "CDVPlugin.h"
+ #import "CDVURLProtocol.h"
+#endif
+
+
+@implementation AppDelegate
+
+@synthesize window, viewController;
+
+- (id) init
+{
+ /** If you need to do any extra app-specific initialization, you can do it here
+ * -jm
+ **/
+ NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
+ [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
+
+ [CDVURLProtocol registerURLProtocol];
+
+ return [super init];
+}
+
+#pragma UIApplicationDelegate implementation
+
+/**
+ * This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up)
+ */
+- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
+{
+ NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
+ NSString* invokeString = nil;
+
+ if (url && [url isKindOfClass:[NSURL class]]) {
+ invokeString = [url absoluteString];
+ NSLog(@"friendlyrent launchOptions = %@", url);
+ }
+
+ CGRect screenBounds = [[UIScreen mainScreen] bounds];
+ self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
+ self.window.autoresizesSubviews = YES;
+
+ CGRect viewBounds = [[UIScreen mainScreen] applicationFrame];
+
+ self.viewController = [[[MainViewController alloc] init] autorelease];
+ self.viewController.useSplashScreen = YES;
+ self.viewController.wwwFolderName = @"www";
+ self.viewController.startPage = @"index.html";
+ self.viewController.invokeString = invokeString;
+ self.viewController.view.frame = viewBounds;
+
+ // check whether the current orientation is supported: if it is, keep it, rather than forcing a rotation
+ BOOL forceStartupRotation = YES;
+ UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation];
+
+ if (UIDeviceOrientationUnknown == curDevOrientation) {
+ // UIDevice isn't firing orientation notifications yet… go look at the status bar
+ curDevOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
+ }
+
+ if (UIDeviceOrientationIsValidInterfaceOrientation(curDevOrientation)) {
+ for (NSNumber *orient in self.viewController.supportedOrientations) {
+ if ([orient intValue] == curDevOrientation) {
+ forceStartupRotation = NO;
+ break;
+ }
+ }
+ }
+
+ if (forceStartupRotation) {
+ NSLog(@"supportedOrientations: %@", self.viewController.supportedOrientations);
+ // The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait)
+ UIInterfaceOrientation newOrient = [[self.viewController.supportedOrientations objectAtIndex:0] intValue];
+ NSLog(@"AppDelegate forcing status bar to: %d from: %d", newOrient, curDevOrientation);
+ [[UIApplication sharedApplication] setStatusBarOrientation:newOrient];
+ }
+
+ [self.window addSubview:self.viewController.view];
+ [self.window makeKeyAndVisible];
+
+ return YES;
+}
+
+// this happens while we are running ( in the background, or from within our own app )
+// only valid if friendlyrent-Info.plist specifies a protocol to handle
+- (BOOL) application:(UIApplication*)application handleOpenURL:(NSURL*)url
+{
+ if (!url) {
+ return NO;
+ }
+
+ // calls into javascript global function 'handleOpenURL'
+ NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", url];
+ [self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
+
+ // all plugins will get the notification, and their handlers will be called
+ [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
+
+ return YES;
+}
+
+- (void) dealloc
+{
+ [super dealloc];
+}
+
+@end
@@ -0,0 +1,36 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+//
+// MainViewController.h
+// friendlyrent
+//
+// Created by Kristian Mandrup on 6/10/12.
+// Copyright __MyCompanyName__ 2012. All rights reserved.
+//
+
+#ifdef CORDOVA_FRAMEWORK
+ #import <Cordova/CDVViewController.h>
+#else
+ #import "CDVViewController.h"
+#endif
+
+@interface MainViewController : CDVViewController
+
+@end
@@ -0,0 +1,140 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+//
+// MainViewController.h
+// friendlyrent
+//
+// Created by Kristian Mandrup on 6/10/12.
+// Copyright __MyCompanyName__ 2012. All rights reserved.
+//
+
+#import "MainViewController.h"
+
+@implementation MainViewController
+
+- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (void) didReceiveMemoryWarning
+{
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+#pragma mark - View lifecycle
+
+- (void) viewDidLoad
+{
+ [super viewDidLoad];
+ // Do any additional setup after loading the view from its nib.
+}
+
+- (void) viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ // Return YES for supported orientations
+ return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
+}
+
+/* Comment out the block below to over-ride */
+/*
+- (CDVCordovaView*) newCordovaViewWithFrame:(CGRect)bounds
+{
+ return[super newCordovaViewWithFrame:bounds];
+}
+*/
+
+/* Comment out the block below to over-ride */
+/*
+#pragma CDVCommandDelegate implementation
+
+- (id) getCommandInstance:(NSString*)className
+{
+ return [super getCommandInstance:className];
+}
+
+- (BOOL) execute:(CDVInvokedUrlCommand*)command
+{
+ return [super execute:command];
+}
+
+- (NSString*) pathForResource:(NSString*)resourcepath;
+{
+ return [super pathForResource:resourcepath];
+}
+
+- (void) registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className
+{
+ return [super registerPlugin:plugin withClassName:className];
+}
+*/
+
+#pragma UIWebDelegate implementation
+
+- (void) webViewDidFinishLoad:(UIWebView*) theWebView
+{
+ // only valid if ___PROJECTNAME__-Info.plist specifies a protocol to handle
+ if (self.invokeString)
+ {
+ // this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready
+ NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString];
+ [theWebView stringByEvaluatingJavaScriptFromString:jsString];
+ }
+
+ // Black base color for background matches the native apps
+ theWebView.backgroundColor = [UIColor blackColor];
+
+ return [super webViewDidFinishLoad:theWebView];
+}
+
+/* Comment out the block below to over-ride */
+/*
+
+- (void) webViewDidStartLoad:(UIWebView*)theWebView
+{
+ return [super webViewDidStartLoad:theWebView];
+}
+
+- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
+{
+ return [super webView:theWebView didFailLoadWithError:error];
+}
+
+- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
+{
+ return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
+}
+*/
+
+@end
Oops, something went wrong.

0 comments on commit ff18f28

Please sign in to comment.