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/06 20:45:06 UTC
[3/3] mac commit: Removed Sound and Notification bindings.
Updated Branches:
refs/heads/plugin-enable b3bdeb8d3 -> 1db66f1d7
Removed Sound and Notification bindings.
Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/1db66f1d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/1db66f1d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/1db66f1d
Branch: refs/heads/plugin-enable
Commit: 1db66f1d7b46b0c49344eeee56f47cdb1fc58c85
Parents: aa6c0bf
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Mar 6 11:44:57 2013 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Mar 6 11:44:57 2013 -0800
----------------------------------------------------------------------
CordovaMac/CordovaMac.xcodeproj/project.pbxproj | 12 ---
CordovaMac/CordovaMac/AppDelegate.m | 2 +-
CordovaMac/CordovaMac/Commands/CDVNotification.h | 29 ------
CordovaMac/CordovaMac/Commands/CDVNotification.m | 78 ----------------
CordovaMac/CordovaMac/Commands/CDVSound.h | 29 ------
CordovaMac/CordovaMac/Commands/CDVSound.m | 79 -----------------
CordovaMac/CordovaMac/Constants.h | 4 +-
CordovaMac/CordovaMac/Utils.m | 2 +-
CordovaMac/CordovaMac/WebViewDelegate.m | 16 ++--
CordovaMac/www/js/index.js | 3 +
10 files changed, 14 insertions(+), 240 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac.xcodeproj/project.pbxproj b/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
index c73f2b1..ae2e1e2 100644
--- a/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
+++ b/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
@@ -7,8 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
- 30513C05154B6DED002B79B6 /* CDVNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 30513C02154B6DED002B79B6 /* CDVNotification.m */; };
- 30513C06154B6DED002B79B6 /* CDVSound.m in Sources */ = {isa = PBXBuildFile; fileRef = 30513C04154B6DED002B79B6 /* CDVSound.m */; };
30513C09154B6F56002B79B6 /* CDVConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = 30513C08154B6F56002B79B6 /* CDVConsole.m */; };
30FC415116E5845A004E6F35 /* CDVBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 30FC415016E5845A004E6F35 /* CDVBridge.m */; };
488B21E7152F6242007056D6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 488B21E6152F6242007056D6 /* AppDelegate.m */; };
@@ -38,10 +36,6 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
- 30513C01154B6DED002B79B6 /* CDVNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVNotification.h; sourceTree = "<group>"; };
- 30513C02154B6DED002B79B6 /* CDVNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVNotification.m; sourceTree = "<group>"; };
- 30513C03154B6DED002B79B6 /* CDVSound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVSound.h; sourceTree = "<group>"; };
- 30513C04154B6DED002B79B6 /* CDVSound.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVSound.m; sourceTree = "<group>"; };
30513C07154B6F56002B79B6 /* CDVConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVConsole.h; sourceTree = "<group>"; };
30513C08154B6F56002B79B6 /* CDVConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVConsole.m; sourceTree = "<group>"; };
30FC414F16E5845A004E6F35 /* CDVBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVBridge.h; sourceTree = "<group>"; };
@@ -139,10 +133,6 @@
7E79274616E7BE63002E20B9 /* CDVDevice.m */,
30513C07154B6F56002B79B6 /* CDVConsole.h */,
30513C08154B6F56002B79B6 /* CDVConsole.m */,
- 30513C01154B6DED002B79B6 /* CDVNotification.h */,
- 30513C02154B6DED002B79B6 /* CDVNotification.m */,
- 30513C03154B6DED002B79B6 /* CDVSound.h */,
- 30513C04154B6DED002B79B6 /* CDVSound.m */,
7E79274916E7BE8C002E20B9 /* CDV.h */,
);
path = Commands;
@@ -304,8 +294,6 @@
48B4353E152E5FE200906A36 /* WebViewDelegate.m in Sources */,
48B43544152E60A300906A36 /* Utils.m in Sources */,
488B21E7152F6242007056D6 /* AppDelegate.m in Sources */,
- 30513C05154B6DED002B79B6 /* CDVNotification.m in Sources */,
- 30513C06154B6DED002B79B6 /* CDVSound.m in Sources */,
30513C09154B6F56002B79B6 /* CDVConsole.m in Sources */,
30FC415116E5845A004E6F35 /* CDVBridge.m in Sources */,
7E79274716E7BE63002E20B9 /* CDVConnection.m in Sources */,
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/CordovaMac/AppDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/AppDelegate.m b/CordovaMac/CordovaMac/AppDelegate.m
index 3ce0fc2..ff7f06f 100644
--- a/CordovaMac/CordovaMac/AppDelegate.m
+++ b/CordovaMac/CordovaMac/AppDelegate.m
@@ -35,7 +35,7 @@
name:NSWindowDidResizeNotification
object:[self window]];
- NSURL* fileUrl = [NSURL fileURLWithPath:[[Utils sharedInstance] pathForResource:kStartPage]];
+ NSURL* fileUrl = [NSURL fileURLWithPath:[[Utils sharedInstance] pathForResource:kCDVStartPage]];
[self.contentView.webView setMainFrameURL:[fileUrl description]];
}
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/CordovaMac/Commands/CDVNotification.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVNotification.h b/CordovaMac/CordovaMac/Commands/CDVNotification.h
deleted file mode 100644
index 7cff59f..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVNotification.h
+++ /dev/null
@@ -1,29 +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>
-
-
-@interface CDVNotification : NSObject {
-
-}
-
-- (void) alert:(NSString*)message withTitle:(NSString*)title;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/CordovaMac/Commands/CDVNotification.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVNotification.m b/CordovaMac/CordovaMac/Commands/CDVNotification.m
deleted file mode 100644
index 1830a13..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVNotification.m
+++ /dev/null
@@ -1,78 +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 "CDVNotification.h"
-#import <AppKit/AppKit.h>
-
-@implementation CDVNotification
-
-
-- (void) alert:(NSString*)message withTitle:(NSString*)title;
-{
- NSAlert* alert = [NSAlert alertWithMessageText:title
- defaultButton:@"OK" alternateButton:nil
- otherButton:nil informativeTextWithFormat:@"%@", message];
- [alert runModal];
-}
-
-#pragma mark WebScripting Protocol
-
-/* checks whether a selector is acceptable to be called from JavaScript */
-+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
-{
- BOOL result = YES;
-
- int i = 0;
- static SEL * acceptableList = NULL;
- SEL currentSelector;
-
- if (acceptableList == NULL && (acceptableList = calloc(256, sizeof(SEL)))) // up to 256 selectors
- {
- acceptableList[i++] = @selector(alert:withTitle:);
- }
-
- i = 0;
- while (result == YES && (currentSelector = acceptableList[i++]))
- {
- //checking for exclusions
- result = !(selector == currentSelector);
- }
-
- return result;
-}
-
-/* helper function so we don't have to have underscores and stuff in js to refer to the right method */
-+ (NSString*) webScriptNameForSelector:(SEL)aSelector
-{
- id result = nil;
-
- if (aSelector == @selector(alert:withTitle:)) {
- result = @"alert";
- }
-
- return result;
-}
-
-// right now exclude all properties (eg keys)
-+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
-{
- return YES;
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/CordovaMac/Commands/CDVSound.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVSound.h b/CordovaMac/CordovaMac/Commands/CDVSound.h
deleted file mode 100644
index a277829..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVSound.h
+++ /dev/null
@@ -1,29 +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>
-
-
-@interface CDVSound : NSObject {
-
-}
-
-- (void) play:(NSString*)file;
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/CordovaMac/Commands/CDVSound.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVSound.m b/CordovaMac/CordovaMac/Commands/CDVSound.m
deleted file mode 100644
index 0782d81..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVSound.m
+++ /dev/null
@@ -1,79 +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 "CDVSound.h"
-
-
-@implementation CDVSound
-
-
-- (void) play:(NSString*)file
-{
- NSURL* fileUrl = [NSURL fileURLWithPath:[[Utils sharedInstance] pathForResource:file]];
- //DebugNSLog(@"Sound file:%@", [fileUrl description]);
-
- NSSound* sound = [[NSSound alloc] initWithContentsOfURL:fileUrl byReference:YES];
- [sound play];
-}
-
-#pragma mark WebScripting Protocol
-
-/* checks whether a selector is acceptable to be called from JavaScript */
-+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
-{
- BOOL result = YES;
-
- int i = 0;
- static SEL * acceptableList = NULL;
- SEL currentSelector;
-
- if (acceptableList == NULL && (acceptableList = calloc(256, sizeof(SEL)))) // up to 256 selectors
- {
- acceptableList[i++] = @selector(play:);
- }
-
- i = 0;
- while (result == YES && (currentSelector = acceptableList[i++]))
- {
- //checking for exclusions
- result = !(selector == currentSelector);
- }
-
- return result;
-}
-
-/* helper function so we don't have to have underscores and stuff in js to refer to the right method */
-+ (NSString*) webScriptNameForSelector:(SEL)aSelector
-{
- id result = nil;
-
- if (aSelector == @selector(play:)) {
- result = @"play";
- }
-
- return result;
-}
-
-// right now exclude all properties (eg keys)
-+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
-{
- return YES;
-}
-
-@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/CordovaMac/Constants.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Constants.h b/CordovaMac/CordovaMac/Constants.h
index cffe4e6..5b7fc2b 100644
--- a/CordovaMac/CordovaMac/Constants.h
+++ b/CordovaMac/CordovaMac/Constants.h
@@ -17,6 +17,6 @@
under the License.
*/
-#define kStartPage @"index.html"
-#define kStartFolder @"www"
+#define kCDVStartPage @"index.html"
+#define kCDVStartFolder @"www"
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/CordovaMac/Utils.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Utils.m b/CordovaMac/CordovaMac/Utils.m
index 09e72eb..b557014 100644
--- a/CordovaMac/CordovaMac/Utils.m
+++ b/CordovaMac/CordovaMac/Utils.m
@@ -39,7 +39,7 @@ static Utils* sharedInstance = nil;
NSString *filename = [directoryParts lastObject];
[directoryParts removeLastObject];
- NSString *directoryStr = [NSString stringWithFormat:@"%@/%@", kStartFolder, [directoryParts componentsJoinedByString:@"/"]];
+ NSString *directoryStr = [NSString stringWithFormat:@"%@/%@", kCDVStartFolder, [directoryParts componentsJoinedByString:@"/"]];
return [mainBundle pathForResource:filename
ofType:@""
inDirectory:directoryStr];
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/CordovaMac/WebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/WebViewDelegate.m b/CordovaMac/CordovaMac/WebViewDelegate.m
index 52934bc..f0dbd98 100644
--- a/CordovaMac/CordovaMac/WebViewDelegate.m
+++ b/CordovaMac/CordovaMac/WebViewDelegate.m
@@ -19,8 +19,6 @@
#import "WebViewDelegate.h"
-#import "CDVSound.h"
-#import "CDVNotification.h"
#import "CDVConsole.h"
#import "CDVBridge.h"
@@ -30,14 +28,14 @@
- (void) webView:(WebView*)webView windowScriptObjectAvailable:(WebScriptObject*)windowScriptObject
{
- if (self.sound == nil) { self.sound = [CDVSound new]; }
- [windowScriptObject setValue:self.sound forKey:@"sound"];
- if (self.console == nil) { self.console = [CDVConsole new]; }
+ if (self.console == nil) {
+ self.console = [CDVConsole new];
+ }
[windowScriptObject setValue:self.console forKey:@"console"];
- if (self.notification == nil) { self.notification = [CDVNotification new]; }
- [windowScriptObject setValue:self.notification forKey:@"notification"];
- [windowScriptObject evaluateWebScript:@"navigator.notification = notification;"];
- if (self.bridge == nil) { self.bridge = [[CDVBridge alloc] initWithWebView:webView]; }
+
+ if (self.bridge == nil) {
+ self.bridge = [[CDVBridge alloc] initWithWebView:webView];
+ }
[windowScriptObject setValue:self.bridge forKey:@"cordovabridge"];
}
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/1db66f1d/CordovaMac/www/js/index.js
----------------------------------------------------------------------
diff --git a/CordovaMac/www/js/index.js b/CordovaMac/www/js/index.js
index 31d9064..0f9d033 100644
--- a/CordovaMac/www/js/index.js
+++ b/CordovaMac/www/js/index.js
@@ -34,6 +34,9 @@ var app = {
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {
app.receivedEvent('deviceready');
+
+ var exec = cordova.require('cordova/exec');
+ exec(null, null, 'MyService', 'MyAction', [1, "two", { 'three': 3, 4: 'four'}]);
},
// Update DOM on a Received Event
receivedEvent: function(id) {