You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2013/03/07 02:13:59 UTC
[4/6] Got NetworkConnection and Device plugins working.
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaMac/Classes/Utils.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/Utils.h b/CordovaMac/CordovaMac/Classes/Utils.h
deleted file mode 100644
index 9895454..0000000
--- a/CordovaMac/CordovaMac/Classes/Utils.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- 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.
- */
-
-#import <Foundation/Foundation.h>
-
-#define DEG_EPS 0.001
-#define fequal(a,b) (fabs((a) - (b)) < DEG_EPS)
-#define fequalzero(a) (fabs(a) < DEG_EPS)
-
-@class LoadingView;
-
-@interface Utils : NSObject {
-}
-
-- (float) titleBarHeight:(NSWindow*)aWindow;
-- (NSString*) pathForResource:(NSString*)resourcepath;
-
-
-+ (Utils*) sharedInstance;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaMac/Classes/Utils.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/Utils.m b/CordovaMac/CordovaMac/Classes/Utils.m
deleted file mode 100644
index b557014..0000000
--- a/CordovaMac/CordovaMac/Classes/Utils.m
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- 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.
- */
-
-#import "Utils.h"
-
-static Utils* sharedInstance = nil;
-
-@implementation Utils
-
-- (float) titleBarHeight:(NSWindow*)aWindow
-{
- NSRect frame = [aWindow frame];
- NSRect contentRect = [NSWindow contentRectForFrameRect: frame
- styleMask: NSTitledWindowMask];
-
- return (frame.size.height - contentRect.size.height);
-}
-
-- (NSString*) pathForResource:(NSString*)resourcepath
-{
- NSBundle * mainBundle = [NSBundle mainBundle];
- NSMutableArray *directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
- NSString *filename = [directoryParts lastObject];
- [directoryParts removeLastObject];
-
- NSString *directoryStr = [NSString stringWithFormat:@"%@/%@", kCDVStartFolder, [directoryParts componentsJoinedByString:@"/"]];
- return [mainBundle pathForResource:filename
- ofType:@""
- inDirectory:directoryStr];
-}
-
-#pragma mark -
-#pragma mark Singleton methods
-
-+ (Utils*) sharedInstance
-{
- @synchronized(self)
- {
- if (sharedInstance == nil){
- sharedInstance = [[Utils alloc] init];
- }
- }
- return sharedInstance;
-}
-
-+ (id) allocWithZone:(NSZone *)zone {
- @synchronized(self) {
- if (sharedInstance == nil) {
- sharedInstance = [super allocWithZone:zone];
- return sharedInstance; // assignment and return on first allocation
- }
- }
- return nil; // on subsequent allocation attempts return nil
-}
-
-- (id) copyWithZone:(NSZone *)zone
-{
- return self;
-}
-
-//- (id) retain {
-// return self;
-//}
-//
-//- (unsigned long) retainCount {
-// return UINT_MAX; // denotes an object that cannot be released
-//}
-//
-//- (oneway void) release {
-// //do nothing
-//}
-//
-//- (id) autorelease {
-// return self;
-//}
-
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaMac/Classes/WebViewDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/WebViewDelegate.h b/CordovaMac/CordovaMac/Classes/WebViewDelegate.h
deleted file mode 100644
index 458cd29..0000000
--- a/CordovaMac/CordovaMac/Classes/WebViewDelegate.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- 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.
- */
-
-#import <Cocoa/Cocoa.h>
-#import <WebKit/WebKit.h>
-
-@class CDVSound;
-@class CDVNotification;
-@class CDVConsole;
-@class CDVBridge;
-
-@interface WebViewDelegate : NSObject {
-}
-
-@property (nonatomic, strong) CDVSound* sound;
-@property (nonatomic, strong) CDVNotification* notification;
-@property (nonatomic, strong) CDVConsole* console;
-@property (nonatomic, strong) CDVBridge* bridge;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaMac/Classes/WebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/WebViewDelegate.m b/CordovaMac/CordovaMac/Classes/WebViewDelegate.m
deleted file mode 100644
index f0dbd98..0000000
--- a/CordovaMac/CordovaMac/Classes/WebViewDelegate.m
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- 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.
- */
-
-
-#import "WebViewDelegate.h"
-#import "CDVConsole.h"
-#import "CDVBridge.h"
-
-@implementation WebViewDelegate
-
-@synthesize sound, notification, console;
-
-- (void) webView:(WebView*)webView windowScriptObjectAvailable:(WebScriptObject*)windowScriptObject
-{
- if (self.console == nil) {
- self.console = [CDVConsole new];
- }
- [windowScriptObject setValue:self.console forKey:@"console"];
-
- if (self.bridge == nil) {
- self.bridge = [[CDVBridge alloc] initWithWebView:webView];
- }
- [windowScriptObject setValue:self.bridge forKey:@"cordovabridge"];
-}
-
-- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
-{
- id win = [sender windowScriptObject];
- NSString* nativeReady = @"try{cordova.require('cordova/channel').onNativeReady.fire();}catch(e){window._nativeReady = true;}";
- [win evaluateWebScript:nativeReady];
-}
-
-/* This logs all errors from Javascript, nifty */
-- (void) webView:(WebView*)webView addMessageToConsole:(NSDictionary*)message
-{
- if (![message isKindOfClass:[NSDictionary class]]) {
- return;
- }
-
- NSLog(@"JavaScript error: %@:%@: %@",
- [[message objectForKey:@"sourceURL"] lastPathComponent], // could be nil
- [message objectForKey:@"lineNumber"],
- [message objectForKey:@"message"]);
-}
-
-#pragma mark WebScripting protocol
-
-/* checks whether a selector is acceptable to be called from JavaScript */
-+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
-{
- return YES;
-}
-
-// right now exclude all properties (eg keys)
-+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
-{
- return YES;
-}
-
-#pragma mark WebPolicyDelegate
-
-- (void)webView:(WebView *)sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener
-{
- NSString* url = [[request URL] description];
- NSLog(@"navigating to %@", url);
-
- [listener use];
-}
-
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaMac/CordovaMac-Info.plist
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/CordovaMac-Info.plist b/CordovaMac/CordovaMac/CordovaMac-Info.plist
index c8f540f..d025b0b 100644
--- a/CordovaMac/CordovaMac/CordovaMac-Info.plist
+++ b/CordovaMac/CordovaMac/CordovaMac-Info.plist
@@ -27,7 +27,7 @@
<key>NSHumanReadableCopyright</key>
<string>Apache License, Version 2.0</string>
<key>NSMainNibFile</key>
- <string>MainMenu</string>
+ <string>MainViewController</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/CordovaMac-Prefix.pch b/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
index 94d708c..c4c1d52 100644
--- a/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
+++ b/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
@@ -22,6 +22,5 @@
#import <Cocoa/Cocoa.h>
#import "Constants.h"
-#import "Utils.h"
#endif