cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject git commit: [CB-3970] Make notification.beep cross platform in js
Date Tue, 25 Jun 2013 20:57:01 GMT
Updated Branches:
  refs/heads/master 8e08233df -> 5db12530f


[CB-3970] Make notification.beep cross platform in js


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/commit/5db12530
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/tree/5db12530
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/diff/5db12530

Branch: refs/heads/master
Commit: 5db12530ffd70f1154a3ff918c7f5c45524462ec
Parents: 8e08233
Author: Shazron Abdullah <shazron@apache.org>
Authored: Tue Jun 25 13:56:54 2013 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Tue Jun 25 13:56:54 2013 -0700

----------------------------------------------------------------------
 plugin.xml                              |   8 ++------
 src/ios/CDVNotification.bundle/beep.wav | Bin 0 -> 8114 bytes
 src/ios/CDVNotification.h               |   1 +
 src/ios/CDVNotification.m               |   9 +++++++++
 www/ios/notification.js                 |  28 ---------------------------
 5 files changed, 12 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/5db12530/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 0e2f9e9..31248d5 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -40,12 +40,8 @@ id="org.apache.cordova.core.Notification" version="0.1.0">
         </config-file>
         <header-file src="src/ios/CDVNotification.h" />
 	    <source-file src="src/ios/CDVNotification.m" />
-	    
-	    <!-- ios specific notification apis -->
-        <js-module src="www/ios/notification.js" name="notification_ios">
-            <merges target="navigator.notification" />
-        </js-module>
-        
+	    <resource-file src="src/ios/CDVNotification.bundle" />
+	            
     </platform>
 
     <!-- wp7 -->

http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/5db12530/src/ios/CDVNotification.bundle/beep.wav
----------------------------------------------------------------------
diff --git a/src/ios/CDVNotification.bundle/beep.wav b/src/ios/CDVNotification.bundle/beep.wav
new file mode 100644
index 0000000..05f5997
Binary files /dev/null and b/src/ios/CDVNotification.bundle/beep.wav differ

http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/5db12530/src/ios/CDVNotification.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVNotification.h b/src/ios/CDVNotification.h
index 18887cf..109ff53 100644
--- a/src/ios/CDVNotification.h
+++ b/src/ios/CDVNotification.h
@@ -28,6 +28,7 @@
 - (void)confirm:(CDVInvokedUrlCommand*)command;
 - (void)prompt:(CDVInvokedUrlCommand*)command;
 - (void)vibrate:(CDVInvokedUrlCommand*)command;
+- (void)beep:(CDVInvokedUrlCommand*)command;
 
 @end
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/5db12530/src/ios/CDVNotification.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVNotification.m b/src/ios/CDVNotification.m
index b34953f..0f83304 100644
--- a/src/ios/CDVNotification.m
+++ b/src/ios/CDVNotification.m
@@ -121,6 +121,15 @@
     AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
 }
 
+- (void)beep:(CDVInvokedUrlCommand*)command
+{
+    SystemSoundID completeSound;
+    NSURL *audioPath = [[NSBundle mainBundle] URLForResource:@"CDVNotification.bundle/beep"
withExtension:@"wav"];
+    AudioServicesCreateSystemSoundID((CFURLRef)audioPath, &completeSound);
+    AudioServicesPlaySystemSound (completeSound);
+}
+
+
 @end
 
 @implementation CDVAlertView

http://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration/blob/5db12530/www/ios/notification.js
----------------------------------------------------------------------
diff --git a/www/ios/notification.js b/www/ios/notification.js
deleted file mode 100644
index 98b317c..0000000
--- a/www/ios/notification.js
+++ /dev/null
@@ -1,28 +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.
- *
-*/
-
-var Media = require('cordova/plugin/Media');
-
-module.exports = {
-    beep:function(count) {
-        (new Media('beep.wav')).play();
-    }
-};


Mime
View raw message