Drew 7 vuotta sitten
vanhempi
commit
9a9ae3402d

+ 1 - 1
config.xml

@@ -65,9 +65,9 @@
     </plugin>
     <plugin name="cordova-plugin-navigationbar" spec="/Users/xiongzhu/Projects/Cordova/Milk/node_modules/cordova-plugin-navigationbar" />
     <plugin name="cordova-plugin-remote-injection" spec="^0.5.2" />
-    <plugin name="cordova-plugin-handheld" spec="../handheld" />
     <plugin name="cordova-plugin-device" spec="^2.0.2" />
     <plugin name="cordova-plugin-app-version" spec="^0.1.9" />
+    <plugin name="cordova-plugin-handheld" spec="../handheld" />
     <engine name="ios" spec="^4.5.4" />
     <engine name="android" spec="^6.3.0" />
 </widget>

+ 2 - 2
package.json

@@ -40,9 +40,9 @@
             },
             "cordova-plugin-navigationbar": {},
             "cordova-plugin-remote-injection": {},
-            "cordova-plugin-handheld": {},
             "cordova-plugin-device": {},
-            "cordova-plugin-app-version": {}
+            "cordova-plugin-app-version": {},
+            "cordova-plugin-handheld": {}
         },
         "platforms": [
             "ios",

+ 8 - 8
platforms/android/AndroidManifest.xml

@@ -12,26 +12,26 @@
         <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
             <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
         </provider>
-        <activity android:name="com.izouma.handheld.ScanActivity" />
         <meta-data android:name="PGYER_APPID" android:value="d0f09be14a67a2082bdf777eb0b2a8c2" />
         <meta-data android:name="TencentMapSDK" android:value="PPQBZ-HCQLO-MMNWE-SHIDE-Y42BH-D3F76" />
         <service android:enabled="true" android:exported="false" android:name="cn.x1ongzhu.tencentBgLocation.LocationService" />
+        <activity android:name="com.izouma.handheld.ScanActivity" />
     </application>
     <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26" />
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
     <uses-feature android:name="android.hardware.camera" />
     <uses-feature android:name="android.hardware.camera.autofocus" />
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-permission android:name="android.permission.FLASHLIGHT" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.WAKE_LOCK" />
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.WRITE_SETTINGS" />
     <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
-    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
-    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
 </manifest>

+ 45 - 45
platforms/android/android.json

@@ -20,10 +20,6 @@
               "xml": "<feature name=\"Device\"><param name=\"android-package\" value=\"org.apache.cordova.device.Device\" /></feature>",
               "count": 1
             },
-            {
-              "xml": "<feature name=\"Handheld\"><param name=\"android-package\" value=\"com.izouma.handheld.Handheld\" /><param name=\"onload\" value=\"true\" /></feature>",
-              "count": 1
-            },
             {
               "xml": "<feature name=\"navigationbar\"><param name=\"android-package\" value=\"cn.x1ongzhu.navigationbar.navigationbar\" /></feature>",
               "count": 1
@@ -47,6 +43,10 @@
             {
               "xml": "<feature name=\"Toast\"><param name=\"android-package\" value=\"nl.xservices.plugins.Toast\" /></feature>",
               "count": 1
+            },
+            {
+              "xml": "<feature name=\"Handheld\"><param name=\"android-package\" value=\"com.izouma.handheld.Handheld\" /><param name=\"onload\" value=\"true\" /></feature>",
+              "count": 1
             }
           ]
         }
@@ -59,67 +59,67 @@
               "count": 4
             },
             {
-              "xml": "<uses-feature android:name=\"android.hardware.camera\" />",
-              "count": 1
+              "xml": "<uses-permission android:name=\"android.permission.INTERNET\" />",
+              "count": 3
             },
             {
-              "xml": "<uses-feature android:name=\"android.hardware.camera.autofocus\" />",
-              "count": 1
+              "xml": "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />",
+              "count": 3
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.CAMERA\" />",
-              "count": 1
+              "xml": "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />",
+              "count": 2
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.FLASHLIGHT\" />",
-              "count": 1
+              "xml": "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />",
+              "count": 2
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.INTERNET\" />",
-              "count": 3
+              "xml": "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
+              "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />",
-              "count": 3
+              "xml": "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
+              "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.WAKE_LOCK\" />",
+              "xml": "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\" />",
               "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />",
+              "xml": "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\" />",
               "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\" />",
+              "xml": "<uses-feature android:name=\"android.hardware.camera\" />",
               "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS\" />",
+              "xml": "<uses-feature android:name=\"android.hardware.camera.autofocus\" />",
               "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />",
-              "count": 2
+              "xml": "<uses-permission android:name=\"android.permission.CAMERA\" />",
+              "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />",
-              "count": 2
+              "xml": "<uses-permission android:name=\"android.permission.FLASHLIGHT\" />",
+              "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />",
+              "xml": "<uses-permission android:name=\"android.permission.WAKE_LOCK\" />",
               "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />",
+              "xml": "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />",
               "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\" />",
+              "xml": "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\" />",
               "count": 1
             },
             {
-              "xml": "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\" />",
+              "xml": "<uses-permission android:name=\"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS\" />",
               "count": 1
             }
           ],
@@ -130,10 +130,6 @@
             }
           ],
           "/manifest/application": [
-            {
-              "xml": "<activity android:name=\"com.izouma.handheld.ScanActivity\" />",
-              "count": 1
-            },
             {
               "xml": "<meta-data android:name=\"PGYER_APPID\" android:value=\"d0f09be14a67a2082bdf777eb0b2a8c2\" />",
               "count": 1
@@ -145,6 +141,10 @@
             {
               "xml": "<service android:enabled=\"true\" android:exported=\"false\" android:name=\"cn.x1ongzhu.tencentBgLocation.LocationService\" />",
               "count": 1
+            },
+            {
+              "xml": "<activity android:name=\"com.izouma.handheld.ScanActivity\" />",
+              "count": 1
             }
           ]
         }
@@ -171,9 +171,6 @@
     "cordova-plugin-device": {
       "PACKAGE_NAME": "com.izouma.milk"
     },
-    "cordova-plugin-handheld": {
-      "PACKAGE_NAME": "com.izouma.milk"
-    },
     "cordova-plugin-navigationbar": {
       "PACKAGE_NAME": "com.izouma.milk"
     },
@@ -199,6 +196,9 @@
     },
     "cordova-plugin-x-toast": {
       "PACKAGE_NAME": "com.izouma.milk"
+    },
+    "cordova-plugin-handheld": {
+      "PACKAGE_NAME": "com.izouma.milk"
     }
   },
   "dependent_plugins": {},
@@ -251,14 +251,6 @@
         "device"
       ]
     },
-    {
-      "id": "cordova-plugin-handheld.Handheld",
-      "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
-      "pluginId": "cordova-plugin-handheld",
-      "clobbers": [
-        "Handheld"
-      ]
-    },
     {
       "id": "cordova-plugin-navigationbar.navigationbar",
       "file": "plugins/cordova-plugin-navigationbar/www/navigationbar.js",
@@ -303,13 +295,20 @@
       "id": "cordova-plugin-x-toast.tests",
       "file": "plugins/cordova-plugin-x-toast/test/tests.js",
       "pluginId": "cordova-plugin-x-toast"
+    },
+    {
+      "id": "cordova-plugin-handheld.Handheld",
+      "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
+      "pluginId": "cordova-plugin-handheld",
+      "clobbers": [
+        "Handheld"
+      ]
     }
   ],
   "plugin_metadata": {
     "cordova-plugin-app-version": "0.1.9",
     "cordova-plugin-camera": "4.0.2",
     "cordova-plugin-device": "2.0.2",
-    "cordova-plugin-handheld": "1.0.0",
     "cordova-plugin-navigationbar": "1.0.0",
     "cordova-plugin-pgyer": "1.0.0",
     "cordova-plugin-remote-injection": "0.5.2",
@@ -317,6 +316,7 @@
     "cordova-plugin-tencent-bg-location": "1.0.0",
     "cordova-plugin-whitelist": "1.3.3",
     "cordova-plugin-wkwebview-engine": "1.1.4",
-    "cordova-plugin-x-toast": "2.6.0"
+    "cordova-plugin-x-toast": "2.6.0",
+    "cordova-plugin-handheld": "1.0.0"
   }
 }

+ 10 - 10
platforms/android/assets/www/cordova_plugins.js

@@ -48,14 +48,6 @@ module.exports = [
       "device"
     ]
   },
-  {
-    "id": "cordova-plugin-handheld.Handheld",
-    "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
-    "pluginId": "cordova-plugin-handheld",
-    "clobbers": [
-      "Handheld"
-    ]
-  },
   {
     "id": "cordova-plugin-navigationbar.navigationbar",
     "file": "plugins/cordova-plugin-navigationbar/www/navigationbar.js",
@@ -100,6 +92,14 @@ module.exports = [
     "id": "cordova-plugin-x-toast.tests",
     "file": "plugins/cordova-plugin-x-toast/test/tests.js",
     "pluginId": "cordova-plugin-x-toast"
+  },
+  {
+    "id": "cordova-plugin-handheld.Handheld",
+    "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
+    "pluginId": "cordova-plugin-handheld",
+    "clobbers": [
+      "Handheld"
+    ]
   }
 ];
 module.exports.metadata = 
@@ -108,7 +108,6 @@ module.exports.metadata =
   "cordova-plugin-app-version": "0.1.9",
   "cordova-plugin-camera": "4.0.2",
   "cordova-plugin-device": "2.0.2",
-  "cordova-plugin-handheld": "1.0.0",
   "cordova-plugin-navigationbar": "1.0.0",
   "cordova-plugin-pgyer": "1.0.0",
   "cordova-plugin-remote-injection": "0.5.2",
@@ -116,7 +115,8 @@ module.exports.metadata =
   "cordova-plugin-tencent-bg-location": "1.0.0",
   "cordova-plugin-whitelist": "1.3.3",
   "cordova-plugin-wkwebview-engine": "1.1.4",
-  "cordova-plugin-x-toast": "2.6.0"
+  "cordova-plugin-x-toast": "2.6.0",
+  "cordova-plugin-handheld": "1.0.0"
 };
 // BOTTOM OF METADATA
 });

+ 1 - 1
platforms/android/build.gradle

@@ -255,9 +255,9 @@ dependencies {
     debugCompile(project(path: "CordovaLib", configuration: "debug"))
     releaseCompile(project(path: "CordovaLib", configuration: "release"))
     compile "com.android.support:support-v4:24.1.1+"
-    compile "com.google.code.gson:gson:2.8.2"
     compile "com.yanzhenjie:permission:1.1.2"
     compile "com.squareup.retrofit2:retrofit:2.3.0"
+    compile "com.google.code.gson:gson:2.8.2"
     compile "com.squareup.retrofit2:converter-gson:2.3.0"
     // SUB-PROJECT DEPENDENCIES END
 }

+ 2 - 0
platforms/android/cordova-plugin-handheld/milk-handheld.gradle

@@ -7,4 +7,6 @@ repositories {
 dependencies {
     compile(name:'bga-qrcode-core', ext:'aar')
     compile(name:'bga-qrcode-zxing', ext:'aar')
+    compile "com.android.support:support-v4:24.1.1+"
+    compile "com.google.code.gson:gson:2.8.2"
 }

+ 10 - 10
platforms/android/platform_www/cordova_plugins.js

@@ -48,14 +48,6 @@ module.exports = [
       "device"
     ]
   },
-  {
-    "id": "cordova-plugin-handheld.Handheld",
-    "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
-    "pluginId": "cordova-plugin-handheld",
-    "clobbers": [
-      "Handheld"
-    ]
-  },
   {
     "id": "cordova-plugin-navigationbar.navigationbar",
     "file": "plugins/cordova-plugin-navigationbar/www/navigationbar.js",
@@ -100,6 +92,14 @@ module.exports = [
     "id": "cordova-plugin-x-toast.tests",
     "file": "plugins/cordova-plugin-x-toast/test/tests.js",
     "pluginId": "cordova-plugin-x-toast"
+  },
+  {
+    "id": "cordova-plugin-handheld.Handheld",
+    "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
+    "pluginId": "cordova-plugin-handheld",
+    "clobbers": [
+      "Handheld"
+    ]
   }
 ];
 module.exports.metadata = 
@@ -108,7 +108,6 @@ module.exports.metadata =
   "cordova-plugin-app-version": "0.1.9",
   "cordova-plugin-camera": "4.0.2",
   "cordova-plugin-device": "2.0.2",
-  "cordova-plugin-handheld": "1.0.0",
   "cordova-plugin-navigationbar": "1.0.0",
   "cordova-plugin-pgyer": "1.0.0",
   "cordova-plugin-remote-injection": "0.5.2",
@@ -116,7 +115,8 @@ module.exports.metadata =
   "cordova-plugin-tencent-bg-location": "1.0.0",
   "cordova-plugin-whitelist": "1.3.3",
   "cordova-plugin-wkwebview-engine": "1.1.4",
-  "cordova-plugin-x-toast": "2.6.0"
+  "cordova-plugin-x-toast": "2.6.0",
+  "cordova-plugin-handheld": "1.0.0"
 };
 // BOTTOM OF METADATA
 });

+ 5 - 6
platforms/android/project.properties

@@ -13,9 +13,8 @@
 target=android-26
 android.library.reference.1=CordovaLib
 cordova.system.library.1=com.android.support:support-v4:24.1.1+
-cordova.gradle.include.1=cordova-plugin-handheld/milk-handheld.gradle
-cordova.system.library.2=com.google.code.gson:gson:2.8.2
-cordova.system.library.3=com.yanzhenjie:permission:1.1.2
-cordova.system.library.4=com.squareup.retrofit2:retrofit:2.3.0
-cordova.system.library.5=com.google.code.gson:gson:2.8.2
-cordova.system.library.6=com.squareup.retrofit2:converter-gson:2.3.0
+cordova.system.library.2=com.yanzhenjie:permission:1.1.2
+cordova.system.library.3=com.squareup.retrofit2:retrofit:2.3.0
+cordova.system.library.4=com.google.code.gson:gson:2.8.2
+cordova.system.library.5=com.squareup.retrofit2:converter-gson:2.3.0
+cordova.gradle.include.1=cordova-plugin-handheld/milk-handheld.gradle

+ 4 - 4
platforms/android/res/xml/config.xml

@@ -9,10 +9,6 @@
     <feature name="Device">
         <param name="android-package" value="org.apache.cordova.device.Device" />
     </feature>
-    <feature name="Handheld">
-        <param name="android-package" value="com.izouma.handheld.Handheld" />
-        <param name="onload" value="true" />
-    </feature>
     <feature name="navigationbar">
         <param name="android-package" value="cn.x1ongzhu.navigationbar.navigationbar" />
     </feature>
@@ -34,6 +30,10 @@
     <feature name="Toast">
         <param name="android-package" value="nl.xservices.plugins.Toast" />
     </feature>
+    <feature name="Handheld">
+        <param name="android-package" value="com.izouma.handheld.Handheld" />
+        <param name="onload" value="true" />
+    </feature>
     <feature name="RemoteInjection">
         <param name="android-package" value="com.truckmovers.cordova.RemoteInjectionPlugin" />
         <param name="onload" value="true" />

+ 53 - 0
platforms/android/src/com/izouma/handheld/Handheld.java

@@ -1,6 +1,13 @@
 package com.izouma.handheld;
 
+import android.Manifest;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Build;
+import android.support.v4.app.ActivityCompat;
 
 import com.google.gson.Gson;
 import com.izouma.handheld.device.Device;
@@ -22,6 +29,7 @@ import java.util.List;
  */
 public class Handheld extends CordovaPlugin {
     private Device device;
+    private CallbackContext callbackContext;
 
     @Override
     public void initialize(CordovaInterface cordova, CordovaWebView webView) {
@@ -79,6 +87,7 @@ public class Handheld extends CordovaPlugin {
     }
 
     private void scanCode(final CallbackContext callbackContext) {
+        this.callbackContext = callbackContext;
         device.scanCode(new Device.ScanCodeListener() {
             @Override
             public void onScanResult(String result) {
@@ -133,4 +142,48 @@ public class Handheld extends CordovaPlugin {
         super.onActivityResult(requestCode, resultCode, intent);
         device.onActivityResult(requestCode, resultCode, intent);
     }
+
+    @Override
+    public void requestPermissions(int requestCode) {
+        super.requestPermissions(requestCode);
+        cordova.requestPermissions(this, requestCode, new String[]{Manifest.permission.CAMERA});
+    }
+
+    @Override
+    public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException {
+        super.onRequestPermissionResult(requestCode, permissions, grantResults);
+        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+            device.scanCode(new Device.ScanCodeListener() {
+                @Override
+                public void onScanResult(String result) {
+                    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result);
+                    pluginResult.setKeepCallback(false);
+                    callbackContext.sendPluginResult(pluginResult);
+                }
+            });
+        } else {
+            new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT)
+                    .setTitle("提示")
+                    .setMessage("需要相机权限")
+                    .setPositiveButton("打开设置", new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialog, int which) {
+                            dialog.dismiss();
+                            Intent localIntent = new Intent();
+                            localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                            localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
+                            localIntent.setData(Uri.fromParts("package", cordova.getActivity().getPackageName(), null));
+                            cordova.getActivity().startActivity(localIntent);
+                        }
+                    })
+                    .setNegativeButton("取消", new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialog, int which) {
+                            dialog.dismiss();
+                        }
+                    })
+                    .create()
+                    .show();
+        }
+    }
 }

+ 11 - 3
platforms/android/src/com/izouma/handheld/device/DeviceCommon.java

@@ -1,7 +1,11 @@
 package com.izouma.handheld.device;
 
+import android.Manifest;
 import android.app.Activity;
 import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
 import android.text.TextUtils;
 
 import com.izouma.handheld.ScanActivity;
@@ -27,9 +31,13 @@ public class DeviceCommon extends Device {
 
     @Override
     public void scanCode(ScanCodeListener listener) {
-        this.listener = listener;
-        Intent intent = new Intent(cordovaPlugin.cordova.getActivity(), ScanActivity.class);
-        cordovaPlugin.cordova.startActivityForResult(cordovaPlugin, intent, 1);
+        if (ContextCompat.checkSelfPermission(cordovaPlugin.cordova.getActivity(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
+            cordovaPlugin.requestPermissions(0);
+        } else {
+            this.listener = listener;
+            Intent intent = new Intent(cordovaPlugin.cordova.getActivity(), ScanActivity.class);
+            cordovaPlugin.cordova.startActivityForResult(cordovaPlugin, intent, 1);
+        }
     }
 
     @Override

+ 16 - 16
platforms/ios/ios.json

@@ -77,15 +77,15 @@
               "count": 1
             },
             {
-              "xml": "<feature name=\"Handheld\"><param name=\"ios-package\" value=\"Handheld\" /><param name=\"onload\" value=\"true\" /></feature>",
+              "xml": "<feature name=\"Device\"><param name=\"ios-package\" value=\"CDVDevice\" /></feature>",
               "count": 1
             },
             {
-              "xml": "<feature name=\"Device\"><param name=\"ios-package\" value=\"CDVDevice\" /></feature>",
+              "xml": "<feature name=\"AppVersion\"><param name=\"ios-package\" value=\"AppVersion\" /></feature>",
               "count": 1
             },
             {
-              "xml": "<feature name=\"AppVersion\"><param name=\"ios-package\" value=\"AppVersion\" /></feature>",
+              "xml": "<feature name=\"Handheld\"><param name=\"ios-package\" value=\"Handheld\" /><param name=\"onload\" value=\"true\" /></feature>",
               "count": 1
             }
           ]
@@ -123,14 +123,14 @@
     "cordova-plugin-x-toast": {
       "PACKAGE_NAME": "com.brightdairy.milk"
     },
-    "cordova-plugin-handheld": {
-      "PACKAGE_NAME": "com.brightdairy.milk"
-    },
     "cordova-plugin-device": {
       "PACKAGE_NAME": "com.brightdairy.milk"
     },
     "cordova-plugin-app-version": {
       "PACKAGE_NAME": "com.brightdairy.milk"
+    },
+    "cordova-plugin-handheld": {
+      "PACKAGE_NAME": "com.brightdairy.milk"
     }
   },
   "dependent_plugins": {},
@@ -228,14 +228,6 @@
       "file": "plugins/cordova-plugin-x-toast/test/tests.js",
       "pluginId": "cordova-plugin-x-toast"
     },
-    {
-      "id": "cordova-plugin-handheld.Handheld",
-      "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
-      "pluginId": "cordova-plugin-handheld",
-      "clobbers": [
-        "Handheld"
-      ]
-    },
     {
       "id": "cordova-plugin-device.device",
       "file": "plugins/cordova-plugin-device/www/device.js",
@@ -251,6 +243,14 @@
       "clobbers": [
         "cordova.getAppVersion"
       ]
+    },
+    {
+      "id": "cordova-plugin-handheld.Handheld",
+      "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
+      "pluginId": "cordova-plugin-handheld",
+      "clobbers": [
+        "Handheld"
+      ]
     }
   ],
   "plugin_metadata": {
@@ -263,8 +263,8 @@
     "cordova-plugin-whitelist": "1.3.3",
     "cordova-plugin-wkwebview-engine": "1.1.4",
     "cordova-plugin-x-toast": "2.6.0",
-    "cordova-plugin-handheld": "1.0.0",
     "cordova-plugin-device": "2.0.2",
-    "cordova-plugin-app-version": "0.1.9"
+    "cordova-plugin-app-version": "0.1.9",
+    "cordova-plugin-handheld": "1.0.0"
   }
 }

+ 10 - 10
platforms/ios/platform_www/cordova_plugins.js

@@ -93,14 +93,6 @@ module.exports = [
     "file": "plugins/cordova-plugin-x-toast/test/tests.js",
     "pluginId": "cordova-plugin-x-toast"
   },
-  {
-    "id": "cordova-plugin-handheld.Handheld",
-    "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
-    "pluginId": "cordova-plugin-handheld",
-    "clobbers": [
-      "Handheld"
-    ]
-  },
   {
     "id": "cordova-plugin-device.device",
     "file": "plugins/cordova-plugin-device/www/device.js",
@@ -116,6 +108,14 @@ module.exports = [
     "clobbers": [
       "cordova.getAppVersion"
     ]
+  },
+  {
+    "id": "cordova-plugin-handheld.Handheld",
+    "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
+    "pluginId": "cordova-plugin-handheld",
+    "clobbers": [
+      "Handheld"
+    ]
   }
 ];
 module.exports.metadata = 
@@ -130,9 +130,9 @@ module.exports.metadata =
   "cordova-plugin-whitelist": "1.3.3",
   "cordova-plugin-wkwebview-engine": "1.1.4",
   "cordova-plugin-x-toast": "2.6.0",
-  "cordova-plugin-handheld": "1.0.0",
   "cordova-plugin-device": "2.0.2",
-  "cordova-plugin-app-version": "0.1.9"
+  "cordova-plugin-app-version": "0.1.9",
+  "cordova-plugin-handheld": "1.0.0"
 };
 // BOTTOM OF METADATA
 });

+ 10 - 10
platforms/ios/platform_www/plugins/cordova-plugin-handheld/www/Handheld.js

@@ -93,14 +93,6 @@ module.exports = [
     "file": "plugins/cordova-plugin-x-toast/test/tests.js",
     "pluginId": "cordova-plugin-x-toast"
   },
-  {
-    "id": "cordova-plugin-handheld.Handheld",
-    "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
-    "pluginId": "cordova-plugin-handheld",
-    "clobbers": [
-      "Handheld"
-    ]
-  },
   {
     "id": "cordova-plugin-device.device",
     "file": "plugins/cordova-plugin-device/www/device.js",
@@ -116,6 +108,14 @@ module.exports = [
     "clobbers": [
       "cordova.getAppVersion"
     ]
+  },
+  {
+    "id": "cordova-plugin-handheld.Handheld",
+    "file": "plugins/cordova-plugin-handheld/www/Handheld.js",
+    "pluginId": "cordova-plugin-handheld",
+    "clobbers": [
+      "Handheld"
+    ]
   }
 ];
 module.exports.metadata = 
@@ -130,9 +130,9 @@ module.exports.metadata =
   "cordova-plugin-whitelist": "1.3.3",
   "cordova-plugin-wkwebview-engine": "1.1.4",
   "cordova-plugin-x-toast": "2.6.0",
-  "cordova-plugin-handheld": "1.0.0",
   "cordova-plugin-device": "2.0.2",
-  "cordova-plugin-app-version": "0.1.9"
+  "cordova-plugin-app-version": "0.1.9",
+  "cordova-plugin-handheld": "1.0.0"
 };
 // BOTTOM OF METADATA
 });

+ 16 - 16
platforms/ios/www/plugins/cordova-plugin-handheld/www/Handheld.js

@@ -43,12 +43,12 @@
 		EF6C40D56F214AB190847A6D /* Toast+UIView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD24EF4088B1481D85024623 /* Toast+UIView.m */; };
 		F1EF0B62FB5B4D2A985F3E73 /* Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = C9E9E44345F14457B218BA0F /* Toast.m */; };
 		AB915EE1DE79498BBD0BBDD3 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E58A419A5382479A9268FE52 /* QuartzCore.framework */; };
-		F9023DAE5B8A4FF69BB34B9A /* Handheld.m in Sources */ = {isa = PBXBuildFile; fileRef = D109DC20B94F48EBBC201A0D /* Handheld.m */; };
-		7DE6683967294D41A96A1125 /* ScanViewController.h in Resources */ = {isa = PBXBuildFile; fileRef = B348E6F89301427EA89FC391 /* ScanViewController.h */; };
-		F868D1F5556F4C098B54B3AA /* ScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DFAC7D7CCC9C42B0A538E5A2 /* ScanViewController.m */; };
-		AB0E3EFDCFA94F528E9C17C6 /* qrCodeScanner.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1A76CBBFB0A240A796A89205 /* qrCodeScanner.bundle */; };
 		5ED5B21EE31F40BB84641F39 /* CDVDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B2A757CF83440FC81ACA2A2 /* CDVDevice.m */; };
 		C3CF3B7BB1F84277B397C92C /* AppVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = 91BF7C9AB28C4E7F955DEE7C /* AppVersion.m */; };
+		9B86BF4591924C35A7C0CC48 /* Handheld.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C31D949C2246B6A67D7BDA /* Handheld.m */; };
+		0BBCA02089A1446FAEFE8078 /* ScanViewController.h in Resources */ = {isa = PBXBuildFile; fileRef = E6234DC405244CD9884988FE /* ScanViewController.h */; };
+		3302FCCC183A44FC96506106 /* ScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F3B720DE5EAD488A8D3BD35C /* ScanViewController.m */; };
+		ADBE6385855D419E81A1060B /* qrCodeScanner.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B12E24957BD544F2B39A7F5B /* qrCodeScanner.bundle */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -131,14 +131,14 @@
 		6CE5CD06755441ABAA1FC73C /* Toast+UIView.h */ = {isa = PBXFileReference; name = "Toast+UIView.h"; path = "cordova-plugin-x-toast/Toast+UIView.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
 		25293D9110BF458CA0612FC8 /* Toast.h */ = {isa = PBXFileReference; name = "Toast.h"; path = "cordova-plugin-x-toast/Toast.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
 		E58A419A5382479A9268FE52 /* QuartzCore.framework */ = {isa = PBXFileReference; name = "QuartzCore.framework"; path = "System/Library/Frameworks/QuartzCore.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; };
-		D109DC20B94F48EBBC201A0D /* Handheld.m */ = {isa = PBXFileReference; name = "Handheld.m"; path = "cordova-plugin-handheld/Handheld.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; };
-		B348E6F89301427EA89FC391 /* ScanViewController.h */ = {isa = PBXFileReference; name = "ScanViewController.h"; path = "cordova-plugin-handheld/ScanViewController.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
-		DFAC7D7CCC9C42B0A538E5A2 /* ScanViewController.m */ = {isa = PBXFileReference; name = "ScanViewController.m"; path = "cordova-plugin-handheld/ScanViewController.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; };
-		1A76CBBFB0A240A796A89205 /* qrCodeScanner.bundle */ = {isa = PBXFileReference; name = "qrCodeScanner.bundle"; path = "qrCodeScanner.bundle"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.plug-in; explicitFileType = undefined; includeInIndex = 0; };
 		8B2A757CF83440FC81ACA2A2 /* CDVDevice.m */ = {isa = PBXFileReference; name = "CDVDevice.m"; path = "cordova-plugin-device/CDVDevice.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; };
 		B6BD39A66E474D3A86476C60 /* CDVDevice.h */ = {isa = PBXFileReference; name = "CDVDevice.h"; path = "cordova-plugin-device/CDVDevice.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
 		91BF7C9AB28C4E7F955DEE7C /* AppVersion.m */ = {isa = PBXFileReference; name = "AppVersion.m"; path = "cordova-plugin-app-version/AppVersion.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; };
 		9440D188147F4424B45E2FD7 /* AppVersion.h */ = {isa = PBXFileReference; name = "AppVersion.h"; path = "cordova-plugin-app-version/AppVersion.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
+		97C31D949C2246B6A67D7BDA /* Handheld.m */ = {isa = PBXFileReference; name = "Handheld.m"; path = "cordova-plugin-handheld/Handheld.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; };
+		E6234DC405244CD9884988FE /* ScanViewController.h */ = {isa = PBXFileReference; name = "ScanViewController.h"; path = "cordova-plugin-handheld/ScanViewController.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
+		F3B720DE5EAD488A8D3BD35C /* ScanViewController.m */ = {isa = PBXFileReference; name = "ScanViewController.m"; path = "cordova-plugin-handheld/ScanViewController.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; };
+		B12E24957BD544F2B39A7F5B /* qrCodeScanner.bundle */ = {isa = PBXFileReference; name = "qrCodeScanner.bundle"; path = "qrCodeScanner.bundle"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.plug-in; explicitFileType = undefined; includeInIndex = 0; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -220,7 +220,7 @@
 				8D1107310486CEB800E47090 /* 奶源追溯-Info.plist */,
 				6AFF5BF81D6E424B00AB3073 /* CDVLaunchScreen.storyboard */,
 				1D3E0A1B6463441BBA2331E9 /* Navigationbar.bundle */,
-				1A76CBBFB0A240A796A89205 /* qrCodeScanner.bundle */,
+				B12E24957BD544F2B39A7F5B /* qrCodeScanner.bundle */,
 			);
 			name = Resources;
 			path = "奶源追溯/Resources";
@@ -295,13 +295,13 @@
 				C9E9E44345F14457B218BA0F /* Toast.m */,
 				6CE5CD06755441ABAA1FC73C /* Toast+UIView.h */,
 				25293D9110BF458CA0612FC8 /* Toast.h */,
-				D109DC20B94F48EBBC201A0D /* Handheld.m */,
-				B348E6F89301427EA89FC391 /* ScanViewController.h */,
-				DFAC7D7CCC9C42B0A538E5A2 /* ScanViewController.m */,
 				8B2A757CF83440FC81ACA2A2 /* CDVDevice.m */,
 				B6BD39A66E474D3A86476C60 /* CDVDevice.h */,
 				91BF7C9AB28C4E7F955DEE7C /* AppVersion.m */,
 				9440D188147F4424B45E2FD7 /* AppVersion.h */,
+				97C31D949C2246B6A67D7BDA /* Handheld.m */,
+				E6234DC405244CD9884988FE /* ScanViewController.h */,
+				F3B720DE5EAD488A8D3BD35C /* ScanViewController.m */,
 			);
 			name = Plugins;
 			path = "奶源追溯/Plugins";
@@ -384,7 +384,7 @@
 				0207DA581B56EA530066E2B4 /* Images.xcassets in Resources */,
 				6AFF5BF91D6E424B00AB3073 /* CDVLaunchScreen.storyboard in Resources */,
 				2000CCF4DBC541D19F4B163A /* Navigationbar.bundle in Resources */,
-				AB0E3EFDCFA94F528E9C17C6 /* qrCodeScanner.bundle in Resources */,
+				ADBE6385855D419E81A1060B /* qrCodeScanner.bundle in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -432,11 +432,11 @@
 				82108B1E6A2B460E9ADE5994 /* CDVWKProcessPoolFactory.m in Sources */,
 				EF6C40D56F214AB190847A6D /* Toast+UIView.m in Sources */,
 				F1EF0B62FB5B4D2A985F3E73 /* Toast.m in Sources */,
-				F9023DAE5B8A4FF69BB34B9A /* Handheld.m in Sources */,
-				7DE6683967294D41A96A1125 /* ScanViewController.h in Resources */,
-				F868D1F5556F4C098B54B3AA /* ScanViewController.m in Sources */,
 				5ED5B21EE31F40BB84641F39 /* CDVDevice.m in Sources */,
 				C3CF3B7BB1F84277B397C92C /* AppVersion.m in Sources */,
+				9B86BF4591924C35A7C0CC48 /* Handheld.m in Sources */,
+				0BBCA02089A1446FAEFE8078 /* ScanViewController.h in Resources */,
+				3302FCCC183A44FC96506106 /* ScanViewController.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

+ 4 - 4
platforms/ios/奶源追溯/config.xml

@@ -43,10 +43,6 @@
     <feature name="Toast">
         <param name="ios-package" value="Toast" />
     </feature>
-    <feature name="Handheld">
-        <param name="ios-package" value="Handheld" />
-        <param name="onload" value="true" />
-    </feature>
     <feature name="Device">
         <param name="ios-package" value="CDVDevice" />
     </feature>
@@ -109,4 +105,8 @@
     <preference name="forceUpdate" value="true" />
     <preference name="ShowSplashScreenSpinner" value="false" />
     <preference name="SplashMaintainAspectRatio" value="true" />
+    <feature name="Handheld">
+        <param name="ios-package" value="Handheld" />
+        <param name="onload" value="true" />
+    </feature>
 </widget>

+ 3 - 3
plugins/android.json

@@ -16,9 +16,6 @@
     "cordova-plugin-device": {
       "PACKAGE_NAME": "com.izouma.milk"
     },
-    "cordova-plugin-handheld": {
-      "PACKAGE_NAME": "com.izouma.milk"
-    },
     "cordova-plugin-navigationbar": {
       "PACKAGE_NAME": "com.izouma.milk"
     },
@@ -44,6 +41,9 @@
     },
     "cordova-plugin-x-toast": {
       "PACKAGE_NAME": "com.izouma.milk"
+    },
+    "cordova-plugin-handheld": {
+      "PACKAGE_NAME": "com.izouma.milk"
     }
   },
   "dependent_plugins": {}

+ 0 - 1
plugins/cordova-plugin-handheld/plugin.xml

@@ -75,7 +75,6 @@
         <resource-file src="src/android/libs/bga-qrcode-zxing.aar" target="libs/bga-qrcode-zxing.aar"/>
         <!--  -->
         <framework src="src/android/handheld.gradle" custom="true" type="gradleReference"/>
-        <framework src="com.google.code.gson:gson:2.8.2" />
     </platform>
     <platform name="ios">
         <config-file parent="/*" target="config.xml">

+ 2 - 0
plugins/cordova-plugin-handheld/src/android/handheld.gradle

@@ -7,4 +7,6 @@ repositories {
 dependencies {
     compile(name:'bga-qrcode-core', ext:'aar')
     compile(name:'bga-qrcode-zxing', ext:'aar')
+    compile "com.android.support:support-v4:24.1.1+"
+    compile "com.google.code.gson:gson:2.8.2"
 }

+ 53 - 0
plugins/cordova-plugin-handheld/src/android/handheld/Handheld.java

@@ -1,6 +1,13 @@
 package com.izouma.handheld;
 
+import android.Manifest;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Build;
+import android.support.v4.app.ActivityCompat;
 
 import com.google.gson.Gson;
 import com.izouma.handheld.device.Device;
@@ -22,6 +29,7 @@ import java.util.List;
  */
 public class Handheld extends CordovaPlugin {
     private Device device;
+    private CallbackContext callbackContext;
 
     @Override
     public void initialize(CordovaInterface cordova, CordovaWebView webView) {
@@ -79,6 +87,7 @@ public class Handheld extends CordovaPlugin {
     }
 
     private void scanCode(final CallbackContext callbackContext) {
+        this.callbackContext = callbackContext;
         device.scanCode(new Device.ScanCodeListener() {
             @Override
             public void onScanResult(String result) {
@@ -133,4 +142,48 @@ public class Handheld extends CordovaPlugin {
         super.onActivityResult(requestCode, resultCode, intent);
         device.onActivityResult(requestCode, resultCode, intent);
     }
+
+    @Override
+    public void requestPermissions(int requestCode) {
+        super.requestPermissions(requestCode);
+        cordova.requestPermissions(this, requestCode, new String[]{Manifest.permission.CAMERA});
+    }
+
+    @Override
+    public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) throws JSONException {
+        super.onRequestPermissionResult(requestCode, permissions, grantResults);
+        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+            device.scanCode(new Device.ScanCodeListener() {
+                @Override
+                public void onScanResult(String result) {
+                    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result);
+                    pluginResult.setKeepCallback(false);
+                    callbackContext.sendPluginResult(pluginResult);
+                }
+            });
+        } else {
+            new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT)
+                    .setTitle("提示")
+                    .setMessage("需要相机权限")
+                    .setPositiveButton("打开设置", new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialog, int which) {
+                            dialog.dismiss();
+                            Intent localIntent = new Intent();
+                            localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                            localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
+                            localIntent.setData(Uri.fromParts("package", cordova.getActivity().getPackageName(), null));
+                            cordova.getActivity().startActivity(localIntent);
+                        }
+                    })
+                    .setNegativeButton("取消", new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialog, int which) {
+                            dialog.dismiss();
+                        }
+                    })
+                    .create()
+                    .show();
+        }
+    }
 }

+ 11 - 3
plugins/cordova-plugin-handheld/src/android/handheld/device/DeviceCommon.java

@@ -1,7 +1,11 @@
 package com.izouma.handheld.device;
 
+import android.Manifest;
 import android.app.Activity;
 import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.content.ContextCompat;
 import android.text.TextUtils;
 
 import com.izouma.handheld.ScanActivity;
@@ -27,9 +31,13 @@ public class DeviceCommon extends Device {
 
     @Override
     public void scanCode(ScanCodeListener listener) {
-        this.listener = listener;
-        Intent intent = new Intent(cordovaPlugin.cordova.getActivity(), ScanActivity.class);
-        cordovaPlugin.cordova.startActivityForResult(cordovaPlugin, intent, 1);
+        if (ContextCompat.checkSelfPermission(cordovaPlugin.cordova.getActivity(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
+            cordovaPlugin.requestPermissions(0);
+        } else {
+            this.listener = listener;
+            Intent intent = new Intent(cordovaPlugin.cordova.getActivity(), ScanActivity.class);
+            cordovaPlugin.cordova.startActivityForResult(cordovaPlugin, intent, 1);
+        }
     }
 
     @Override

+ 8 - 8
plugins/fetch.json

@@ -75,14 +75,6 @@
     "is_top_level": true,
     "variables": {}
   },
-  "cordova-plugin-handheld": {
-    "source": {
-      "type": "local",
-      "path": "/Users/xiongzhu/Projects/Cordova/Milk/node_modules/cordova-plugin-handheld"
-    },
-    "is_top_level": true,
-    "variables": {}
-  },
   "cordova-plugin-device": {
     "source": {
       "type": "registry",
@@ -98,5 +90,13 @@
     },
     "is_top_level": true,
     "variables": {}
+  },
+  "cordova-plugin-handheld": {
+    "source": {
+      "type": "local",
+      "path": "/Users/drew/Projects/Cordova/Milk/node_modules/cordova-plugin-handheld"
+    },
+    "is_top_level": true,
+    "variables": {}
   }
 }

+ 3 - 3
plugins/ios.json

@@ -36,14 +36,14 @@
     "cordova-plugin-x-toast": {
       "PACKAGE_NAME": "com.brightdairy.milk"
     },
-    "cordova-plugin-handheld": {
-      "PACKAGE_NAME": "com.brightdairy.milk"
-    },
     "cordova-plugin-device": {
       "PACKAGE_NAME": "com.brightdairy.milk"
     },
     "cordova-plugin-app-version": {
       "PACKAGE_NAME": "com.brightdairy.milk"
+    },
+    "cordova-plugin-handheld": {
+      "PACKAGE_NAME": "com.brightdairy.milk"
     }
   },
   "dependent_plugins": {}