You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2016/06/07 10:18:23 UTC

cordova-paramedic git commit: Add plugin to allow geolocation on iOS

Repository: cordova-paramedic
Updated Branches:
  refs/heads/master 83c1961d3 -> 18da15fb7


Add plugin to allow geolocation on iOS


Project: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/commit/18da15fb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/tree/18da15fb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-paramedic/diff/18da15fb

Branch: refs/heads/master
Commit: 18da15fb70908c5ae27d309676c49b4cfc856a7e
Parents: 83c1961
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Tue Jun 7 12:31:42 2016 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Tue Jun 7 13:16:48 2016 +0300

----------------------------------------------------------------------
 ios-geolocation-permissions-plugin/plugin.xml   | 42 ++++++++++++++++++++
 .../src/ios/CDVAllowLocation.m                  | 36 +++++++++++++++++
 lib/paramedic.js                                |  3 ++
 3 files changed, 81 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/18da15fb/ios-geolocation-permissions-plugin/plugin.xml
----------------------------------------------------------------------
diff --git a/ios-geolocation-permissions-plugin/plugin.xml b/ios-geolocation-permissions-plugin/plugin.xml
new file mode 100644
index 0000000..4f1dade
--- /dev/null
+++ b/ios-geolocation-permissions-plugin/plugin.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
+        id="ios-geolocation-permissions-plugin"
+        version="0.0.1">
+
+    <name>Geolocation permissions</name>
+    <description>Plugin to allow geolocation on iOS simulator w/out presenting OS dialog</description>
+    <license>Apache 2.0</license>
+
+    <platform name="ios">
+        <config-file target="config.xml" parent="/*">
+            <feature name="AllowGeolocation">
+                <param name="ios-package" value="CDVAllowLocation"/>
+                <param name="onload" value="true" />
+            </feature>
+        </config-file>
+
+        <source-file src="src/ios/CDVAllowLocation.m" />
+        <framework src="CoreLocation.framework" />
+
+    </platform>
+
+</plugin>

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/18da15fb/ios-geolocation-permissions-plugin/src/ios/CDVAllowLocation.m
----------------------------------------------------------------------
diff --git a/ios-geolocation-permissions-plugin/src/ios/CDVAllowLocation.m b/ios-geolocation-permissions-plugin/src/ios/CDVAllowLocation.m
new file mode 100644
index 0000000..0545f1f
--- /dev/null
+++ b/ios-geolocation-permissions-plugin/src/ios/CDVAllowLocation.m
@@ -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.
+ */
+
+#import <Cordova/CDVPlugin.h>
+#import <CoreLocation/CoreLocation.h>
+
+@interface CLLocationManager()
++ (void)setAuthorizationStatus:(BOOL)status forBundleIdentifier:(NSString *)bundleIdentifier;
+@end
+
+@interface CDVAllowLocation : CDVPlugin <CLLocationManagerDelegate>{
+}
+@end
+
+@implementation CDVAllowLocation
+- (void)pluginInitialize
+{
+    [CLLocationManager setAuthorizationStatus:YES forBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]];
+}
+@end

http://git-wip-us.apache.org/repos/asf/cordova-paramedic/blob/18da15fb/lib/paramedic.js
----------------------------------------------------------------------
diff --git a/lib/paramedic.js b/lib/paramedic.js
index 11a4783..7cd5818 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -125,6 +125,9 @@ ParamedicRunner.prototype.installPlugins = function () {
     if (this.config.getPlatformId() === 'windows') {
         additionalPlugins.push(path.join(__dirname, '../debug-mode-plugin'));
     }
+    if (this.config.getPlatformId() === 'ios') {
+        additionalPlugins.push(path.join(__dirname, '../ios-geolocation-permissions-plugin'));
+    }
 
     this.pluginsManager.installPlugins(additionalPlugins);
 };


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org