@capacitor-community/camera-preview 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -13
- package/android/.gradle/8.0.2/checksums/checksums.lock +0 -0
- package/android/.gradle/{4.10.1/fileHashes/fileHashes.bin → 8.0.2/checksums/md5-checksums.bin} +0 -0
- package/android/.gradle/8.0.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.0.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.0.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/8.0.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.0.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.0.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.0.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/8.0.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/build.gradle +10 -8
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -2
- package/android/gradle.properties +1 -1
- package/android/gradlew +14 -4
- package/android/gradlew.bat +34 -32
- package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +3 -3
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +5 -7
- package/dist/esm/definitions.d.ts +4 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +3 -3
- package/dist/esm/web.js +14 -10
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +155 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +158 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/CameraController.swift +1 -1
- package/ios/Plugin/Plugin.swift +5 -5
- package/ios/Podfile +7 -4
- package/ios/Podfile.lock +9 -10
- package/ios/Pods/CapacitorCordova/LICENSE +23 -0
- package/ios/Pods/CapacitorCordova/README.md +39 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/CapacitorCordova.h +21 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.h +8 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.m +5 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDV.h +28 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVAvailability.h +109 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegate.h +51 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.h +39 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m +154 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.h +31 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.m +81 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.h +52 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.m +116 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.h +81 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.m +154 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.h +25 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.m +77 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.h +82 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.m +216 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVScreenOrientationDelegate.h +33 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.h +41 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.m +399 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.h +27 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.m +74 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.h +27 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.m +156 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.h +30 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.m +34 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.h +35 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.m +63 -0
- package/ios/Pods/Local Podspecs/Capacitor.podspec.json +34 -0
- package/ios/Pods/Local Podspecs/CapacitorCordova.podspec.json +26 -0
- package/ios/Pods/Manifest.lock +22 -0
- package/ios/Pods/Pods.xcodeproj/project.pbxproj +1374 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/Capacitor.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/CapacitorCordova.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/Pods-Plugin.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/Pods-PluginTests.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor-prefix.pch +12 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor.debug.xcconfig +15 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor.modulemap +8 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor.release.xcconfig +15 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-Info.plist +26 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-dummy.m +5 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-prefix.pch +12 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-umbrella.h +32 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.debug.xcconfig +12 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.modulemap +6 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.release.xcconfig +12 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.markdown +53 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.plist +91 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-umbrella.h +16 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig +14 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.modulemap +6 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig +14 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.markdown +53 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.plist +91 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh +188 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-umbrella.h +16 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig +15 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.modulemap +6 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig +15 -0
- package/package.json +19 -9
- package/android/.gradle/4.10.1/fileHashes/fileHashes.lock +0 -0
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -20
- package/android/.idea/jarRepositories.xml +0 -45
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_3_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_2_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_3_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_core_core_1_3_2_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_core_core_1_5_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_exifinterface_exifinterface_1_3_2_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_4_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_1.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_core_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_2_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_monitor_1_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_monitor_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_runner_1_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_runner_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_tracing_tracing_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1.xml +0 -9
- package/android/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1.xml +0 -9
- package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +0 -9
- package/android/.idea/libraries/Gradle__junit_junit_4_12.xml +0 -9
- package/android/.idea/libraries/Gradle__junit_junit_4_13_1.xml +0 -9
- package/android/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_10_18.xml +0 -9
- package/android/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_10_18.xml +0 -9
- package/android/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0.xml +0 -9
- package/android/.idea/libraries/Gradle__org_apache_cordova_framework_7_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +0 -9
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3.xml +0 -9
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3.xml +0 -9
- package/android/.idea/libraries/Gradle__org_json_json_20140107.xml +0 -9
- package/android/.idea/libraries/Gradle__org_mockito_mockito_core_3_6_28.xml +0 -9
- package/android/.idea/libraries/Gradle__org_mockito_mockito_inline_3_6_28.xml +0 -9
- package/android/.idea/libraries/Gradle__org_objenesis_objenesis_3_1.xml +0 -9
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules/1419750366/android.capacitor-android.iml +0 -92
- package/android/.idea/modules/android.iml +0 -87
- package/android/.idea/modules.xml +0 -9
- package/android/.idea/vcs.xml +0 -6
- /package/android/.gradle/{4.10.1 → 8.0.2/dependencies-accessors}/gc.properties +0 -0
- /package/android/.gradle/{4.10.1 → 8.0.2}/fileChanges/last-build.bin +0 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#define __CORDOVA_IOS__
|
|
21
|
+
|
|
22
|
+
#define __CORDOVA_0_9_6 906
|
|
23
|
+
#define __CORDOVA_1_0_0 10000
|
|
24
|
+
#define __CORDOVA_1_1_0 10100
|
|
25
|
+
#define __CORDOVA_1_2_0 10200
|
|
26
|
+
#define __CORDOVA_1_3_0 10300
|
|
27
|
+
#define __CORDOVA_1_4_0 10400
|
|
28
|
+
#define __CORDOVA_1_4_1 10401
|
|
29
|
+
#define __CORDOVA_1_5_0 10500
|
|
30
|
+
#define __CORDOVA_1_6_0 10600
|
|
31
|
+
#define __CORDOVA_1_6_1 10601
|
|
32
|
+
#define __CORDOVA_1_7_0 10700
|
|
33
|
+
#define __CORDOVA_1_8_0 10800
|
|
34
|
+
#define __CORDOVA_1_8_1 10801
|
|
35
|
+
#define __CORDOVA_1_9_0 10900
|
|
36
|
+
#define __CORDOVA_2_0_0 20000
|
|
37
|
+
#define __CORDOVA_2_1_0 20100
|
|
38
|
+
#define __CORDOVA_2_2_0 20200
|
|
39
|
+
#define __CORDOVA_2_3_0 20300
|
|
40
|
+
#define __CORDOVA_2_4_0 20400
|
|
41
|
+
#define __CORDOVA_2_5_0 20500
|
|
42
|
+
#define __CORDOVA_2_6_0 20600
|
|
43
|
+
#define __CORDOVA_2_7_0 20700
|
|
44
|
+
#define __CORDOVA_2_8_0 20800
|
|
45
|
+
#define __CORDOVA_2_9_0 20900
|
|
46
|
+
#define __CORDOVA_3_0_0 30000
|
|
47
|
+
#define __CORDOVA_3_1_0 30100
|
|
48
|
+
#define __CORDOVA_3_2_0 30200
|
|
49
|
+
#define __CORDOVA_3_3_0 30300
|
|
50
|
+
#define __CORDOVA_3_4_0 30400
|
|
51
|
+
#define __CORDOVA_3_4_1 30401
|
|
52
|
+
#define __CORDOVA_3_5_0 30500
|
|
53
|
+
#define __CORDOVA_3_6_0 30600
|
|
54
|
+
#define __CORDOVA_3_7_0 30700
|
|
55
|
+
#define __CORDOVA_3_8_0 30800
|
|
56
|
+
#define __CORDOVA_3_9_0 30900
|
|
57
|
+
#define __CORDOVA_3_9_1 30901
|
|
58
|
+
#define __CORDOVA_3_9_2 30902
|
|
59
|
+
#define __CORDOVA_4_0_0 40000
|
|
60
|
+
#define __CORDOVA_4_0_1 40001
|
|
61
|
+
#define __CORDOVA_4_1_0 40100
|
|
62
|
+
#define __CORDOVA_4_1_1 40101
|
|
63
|
+
#define __CORDOVA_4_2_0 40200
|
|
64
|
+
#define __CORDOVA_4_2_1 40201
|
|
65
|
+
#define __CORDOVA_4_3_0 40300
|
|
66
|
+
#define __CORDOVA_4_3_1 40301
|
|
67
|
+
#define __CORDOVA_4_4_0 40400
|
|
68
|
+
#define __CORDOVA_4_5_0 40500
|
|
69
|
+
#define __CORDOVA_4_5_1 40501
|
|
70
|
+
#define __CORDOVA_4_5_2 40502
|
|
71
|
+
#define __CORDOVA_4_5_4 40504
|
|
72
|
+
/* coho:next-version,insert-before */
|
|
73
|
+
#define __CORDOVA_NA 99999 /* not available */
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
#if CORDOVA_VERSION_MIN_REQUIRED >= __CORDOVA_4_0_0
|
|
77
|
+
// do something when its at least 4.0.0
|
|
78
|
+
#else
|
|
79
|
+
// do something else (non 4.0.0)
|
|
80
|
+
#endif
|
|
81
|
+
*/
|
|
82
|
+
#ifndef CORDOVA_VERSION_MIN_REQUIRED
|
|
83
|
+
/* coho:next-version-min-required,replace-after */
|
|
84
|
+
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_4_5_4
|
|
85
|
+
#endif
|
|
86
|
+
|
|
87
|
+
/*
|
|
88
|
+
Returns YES if it is at least version specified as NSString(X)
|
|
89
|
+
Usage:
|
|
90
|
+
if (IsAtLeastiOSVersion(@"5.1")) {
|
|
91
|
+
// do something for iOS 5.1 or greater
|
|
92
|
+
}
|
|
93
|
+
*/
|
|
94
|
+
#define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending)
|
|
95
|
+
|
|
96
|
+
/* Return the string version of the decimal version */
|
|
97
|
+
#define CDV_VERSION [NSString stringWithFormat:@"%d.%d.%d", \
|
|
98
|
+
(CORDOVA_VERSION_MIN_REQUIRED / 10000), \
|
|
99
|
+
(CORDOVA_VERSION_MIN_REQUIRED % 10000) / 100, \
|
|
100
|
+
(CORDOVA_VERSION_MIN_REQUIRED % 10000) % 100]
|
|
101
|
+
|
|
102
|
+
// Enable this to log all exec() calls.
|
|
103
|
+
#define CDV_ENABLE_EXEC_LOGGING 0
|
|
104
|
+
#if CDV_ENABLE_EXEC_LOGGING
|
|
105
|
+
#define CDV_EXEC_LOG NSLog
|
|
106
|
+
#else
|
|
107
|
+
#define CDV_EXEC_LOG(...) do { \
|
|
108
|
+
} while (NO)
|
|
109
|
+
#endif
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import "CDVInvokedUrlCommand.h"
|
|
21
|
+
|
|
22
|
+
@class CDVPlugin;
|
|
23
|
+
@class CDVPluginResult;
|
|
24
|
+
|
|
25
|
+
typedef NSURL* (^ UrlTransformerBlock)(NSURL*);
|
|
26
|
+
|
|
27
|
+
@protocol CDVCommandDelegate <NSObject>
|
|
28
|
+
|
|
29
|
+
@property (nonatomic, readonly) NSDictionary* settings;
|
|
30
|
+
@property (nonatomic, copy) UrlTransformerBlock urlTransformer;
|
|
31
|
+
|
|
32
|
+
- (NSString*)pathForResource:(NSString*)resourcepath;
|
|
33
|
+
- (id)getCommandInstance:(NSString*)pluginName;
|
|
34
|
+
|
|
35
|
+
// Sends a plugin result to the JS. This is thread-safe.
|
|
36
|
+
- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId;
|
|
37
|
+
// Evaluates the given JS. This is thread-safe.
|
|
38
|
+
- (void)evalJs:(NSString*)js;
|
|
39
|
+
// Can be used to evaluate JS right away instead of scheduling it on the run-loop.
|
|
40
|
+
// This is required for dispatch resign and pause events, but should not be used
|
|
41
|
+
// without reason. Without the run-loop delay, alerts used in JS callbacks may result
|
|
42
|
+
// in dead-lock. This method must be called from the UI thread.
|
|
43
|
+
- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop;
|
|
44
|
+
// Run the javascript
|
|
45
|
+
- (void)evalJsHelper2:(NSString*)js;
|
|
46
|
+
// Runs the given block on a background thread using a shared thread-pool.
|
|
47
|
+
- (void)runInBackground:(void (^)())block;
|
|
48
|
+
// Returns the User-Agent of the associated UIWebView.
|
|
49
|
+
- (NSString*)userAgent;
|
|
50
|
+
|
|
51
|
+
@end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <UIKit/UIKit.h>
|
|
21
|
+
#import "CDVCommandDelegate.h"
|
|
22
|
+
#import <WebKit/WebKit.h>
|
|
23
|
+
#import "CDVPluginManager.h"
|
|
24
|
+
|
|
25
|
+
@class CDVViewController;
|
|
26
|
+
@class CDVCommandQueue;
|
|
27
|
+
|
|
28
|
+
@interface CDVCommandDelegateImpl : NSObject <CDVCommandDelegate>{
|
|
29
|
+
@private
|
|
30
|
+
__weak WKWebView* _webView;
|
|
31
|
+
__weak CDVPluginManager* _manager;
|
|
32
|
+
NSRegularExpression* _callbackIdPattern;
|
|
33
|
+
@protected
|
|
34
|
+
__weak CDVCommandQueue* _commandQueue;
|
|
35
|
+
BOOL _delayResponses;
|
|
36
|
+
}
|
|
37
|
+
- (id)initWithWebView:(WKWebView*)webView pluginManager:(CDVPluginManager *)manager;
|
|
38
|
+
- (void)flushCommandQueueWithDelayedJs;
|
|
39
|
+
@end
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import "CDVCommandDelegateImpl.h"
|
|
21
|
+
#import "CDVPluginResult.h"
|
|
22
|
+
#import <WebKit/WebKit.h>
|
|
23
|
+
|
|
24
|
+
@implementation CDVCommandDelegateImpl
|
|
25
|
+
|
|
26
|
+
@synthesize urlTransformer;
|
|
27
|
+
|
|
28
|
+
- (id)initWithWebView:(WKWebView*)webView pluginManager:(CDVPluginManager *)manager
|
|
29
|
+
{
|
|
30
|
+
self = [super init];
|
|
31
|
+
if (self != nil) {
|
|
32
|
+
_webView = webView;
|
|
33
|
+
_manager = manager;
|
|
34
|
+
NSError* err = nil;
|
|
35
|
+
_callbackIdPattern = [NSRegularExpression regularExpressionWithPattern:@"[^A-Za-z0-9._-]" options:0 error:&err];
|
|
36
|
+
if (err != nil) {
|
|
37
|
+
// Couldn't initialize Regex
|
|
38
|
+
NSLog(@"Error: Couldn't initialize regex");
|
|
39
|
+
_callbackIdPattern = nil;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return self;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (NSString*)pathForResource:(NSString*)resourcepath
|
|
46
|
+
{
|
|
47
|
+
NSBundle* mainBundle = [NSBundle mainBundle];
|
|
48
|
+
NSMutableArray* directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
|
|
49
|
+
NSString* filename = [directoryParts lastObject];
|
|
50
|
+
|
|
51
|
+
[directoryParts removeLastObject];
|
|
52
|
+
|
|
53
|
+
NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"];
|
|
54
|
+
NSString* baseFolder = @"public";
|
|
55
|
+
NSString* directoryStr = baseFolder;
|
|
56
|
+
|
|
57
|
+
if ([directoryPartsJoined length] > 0) {
|
|
58
|
+
directoryStr = [NSString stringWithFormat:@"%@/%@", baseFolder, [directoryParts componentsJoinedByString:@"/"]];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)flushCommandQueueWithDelayedJs
|
|
65
|
+
{
|
|
66
|
+
_delayResponses = YES;
|
|
67
|
+
_delayResponses = NO;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (void)evalJsHelper2:(NSString*)js
|
|
71
|
+
{
|
|
72
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
73
|
+
[_webView evaluateJavaScript:js completionHandler:^(id obj, NSError* error) {
|
|
74
|
+
// TODO: obj can be something other than string
|
|
75
|
+
if ([obj isKindOfClass:[NSString class]]) {
|
|
76
|
+
NSString* commandsJSON = (NSString*)obj;
|
|
77
|
+
if ([commandsJSON length] > 0) {
|
|
78
|
+
NSLog(@"Exec: Retrieved new exec messages by chaining.");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}];
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
- (BOOL)isValidCallbackId:(NSString*)callbackId
|
|
86
|
+
{
|
|
87
|
+
if ((callbackId == nil) || (_callbackIdPattern == nil)) {
|
|
88
|
+
return NO;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Disallow if too long or if any invalid characters were found.
|
|
92
|
+
if (([callbackId length] > 100) || [_callbackIdPattern firstMatchInString:callbackId options:0 range:NSMakeRange(0, [callbackId length])]) {
|
|
93
|
+
return NO;
|
|
94
|
+
}
|
|
95
|
+
return YES;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId
|
|
99
|
+
{
|
|
100
|
+
// This occurs when there is are no win/fail callbacks for the call.
|
|
101
|
+
if ([@"INVALID" isEqualToString:callbackId]) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// This occurs when the callback id is malformed.
|
|
105
|
+
if (![self isValidCallbackId:callbackId]) {
|
|
106
|
+
NSLog(@"Invalid callback id received by sendPluginResult");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
int status = [result.status intValue];
|
|
110
|
+
BOOL keepCallback = [result.keepCallback boolValue];
|
|
111
|
+
NSString* argumentsAsJSON = [result argumentsAsJSON];
|
|
112
|
+
BOOL debug = NO;
|
|
113
|
+
|
|
114
|
+
#ifdef DEBUG
|
|
115
|
+
debug = YES;
|
|
116
|
+
#endif
|
|
117
|
+
|
|
118
|
+
NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d, %d)", callbackId, status, argumentsAsJSON, keepCallback, debug];
|
|
119
|
+
|
|
120
|
+
[self evalJsHelper2:js];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
- (void)evalJs:(NSString*)js
|
|
124
|
+
{
|
|
125
|
+
[self evalJs:js scheduledOnRunLoop:YES];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop
|
|
129
|
+
{
|
|
130
|
+
js = [NSString stringWithFormat:@"try{cordova.require('cordova/exec').nativeEvalAndFetch(function(){%@})}catch(e){console.log('exception nativeEvalAndFetch : '+e);};", js];
|
|
131
|
+
[self evalJsHelper2:js];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
- (id)getCommandInstance:(NSString*)pluginName
|
|
135
|
+
{
|
|
136
|
+
return [_manager getCommandInstance:pluginName];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
- (void)runInBackground:(void (^)())block
|
|
140
|
+
{
|
|
141
|
+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
- (NSString*)userAgent
|
|
145
|
+
{
|
|
146
|
+
return nil;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
- (NSDictionary*)settings
|
|
150
|
+
{
|
|
151
|
+
return _manager.settings;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
#import <Foundation/Foundation.h>
|
|
20
|
+
|
|
21
|
+
@interface CDVConfigParser : NSObject <NSXMLParserDelegate>
|
|
22
|
+
{
|
|
23
|
+
NSString* featureName;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@property (nonatomic, readonly, strong) NSMutableDictionary* pluginsDict;
|
|
27
|
+
@property (nonatomic, readonly, strong) NSMutableDictionary* settings;
|
|
28
|
+
@property (nonatomic, readonly, strong) NSMutableArray* startupPluginNames;
|
|
29
|
+
@property (nonatomic, readonly, strong) NSString* startPage;
|
|
30
|
+
|
|
31
|
+
@end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import "CDVConfigParser.h"
|
|
21
|
+
|
|
22
|
+
@interface CDVConfigParser ()
|
|
23
|
+
|
|
24
|
+
@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginsDict;
|
|
25
|
+
@property (nonatomic, readwrite, strong) NSMutableDictionary* settings;
|
|
26
|
+
@property (nonatomic, readwrite, strong) NSMutableArray* startupPluginNames;
|
|
27
|
+
@property (nonatomic, readwrite, strong) NSString* startPage;
|
|
28
|
+
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
@implementation CDVConfigParser
|
|
32
|
+
|
|
33
|
+
@synthesize pluginsDict, settings, startPage, startupPluginNames;
|
|
34
|
+
|
|
35
|
+
- (id)init
|
|
36
|
+
{
|
|
37
|
+
self = [super init];
|
|
38
|
+
if (self != nil) {
|
|
39
|
+
self.pluginsDict = [[NSMutableDictionary alloc] initWithCapacity:30];
|
|
40
|
+
self.settings = [[NSMutableDictionary alloc] initWithCapacity:30];
|
|
41
|
+
self.startupPluginNames = [[NSMutableArray alloc] initWithCapacity:8];
|
|
42
|
+
featureName = nil;
|
|
43
|
+
}
|
|
44
|
+
return self;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (void)parser:(NSXMLParser*)parser didStartElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName attributes:(NSDictionary*)attributeDict
|
|
48
|
+
{
|
|
49
|
+
if ([elementName isEqualToString:@"preference"]) {
|
|
50
|
+
settings[[attributeDict[@"name"] lowercaseString]] = attributeDict[@"value"];
|
|
51
|
+
} else if ([elementName isEqualToString:@"feature"]) { // store feature name to use with correct parameter set
|
|
52
|
+
featureName = [attributeDict[@"name"] lowercaseString];
|
|
53
|
+
} else if ((featureName != nil) && [elementName isEqualToString:@"param"]) {
|
|
54
|
+
NSString* paramName = [attributeDict[@"name"] lowercaseString];
|
|
55
|
+
id value = attributeDict[@"value"];
|
|
56
|
+
if ([paramName isEqualToString:@"ios-package"]) {
|
|
57
|
+
pluginsDict[featureName] = value;
|
|
58
|
+
}
|
|
59
|
+
BOOL paramIsOnload = ([paramName isEqualToString:@"onload"] && [@"true" isEqualToString : value]);
|
|
60
|
+
BOOL attribIsOnload = [@"true" isEqualToString :[attributeDict[@"onload"] lowercaseString]];
|
|
61
|
+
if (paramIsOnload || attribIsOnload) {
|
|
62
|
+
[self.startupPluginNames addObject:featureName];
|
|
63
|
+
}
|
|
64
|
+
} else if ([elementName isEqualToString:@"content"]) {
|
|
65
|
+
self.startPage = attributeDict[@"src"];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
- (void)parser:(NSXMLParser*)parser didEndElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName
|
|
70
|
+
{
|
|
71
|
+
if ([elementName isEqualToString:@"feature"]) { // no longer handling a feature so release
|
|
72
|
+
featureName = nil;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
- (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError
|
|
77
|
+
{
|
|
78
|
+
NSAssert(NO, @"config.xml parse error line %ld col %ld", (long)[parser lineNumber], (long)[parser columnNumber]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
|
|
22
|
+
@interface CDVInvokedUrlCommand : NSObject {
|
|
23
|
+
NSString* _callbackId;
|
|
24
|
+
NSString* _className;
|
|
25
|
+
NSString* _methodName;
|
|
26
|
+
NSArray* _arguments;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@property (nonatomic, readonly) NSArray* arguments;
|
|
30
|
+
@property (nonatomic, readonly) NSString* callbackId;
|
|
31
|
+
@property (nonatomic, readonly) NSString* className;
|
|
32
|
+
@property (nonatomic, readonly) NSString* methodName;
|
|
33
|
+
|
|
34
|
+
+ (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry;
|
|
35
|
+
|
|
36
|
+
- (id)initWithArguments:(NSArray*)arguments
|
|
37
|
+
callbackId:(NSString*)callbackId
|
|
38
|
+
className:(NSString*)className
|
|
39
|
+
methodName:(NSString*)methodName;
|
|
40
|
+
|
|
41
|
+
- (id)initFromJson:(NSArray*)jsonEntry;
|
|
42
|
+
|
|
43
|
+
// Returns the argument at the given index.
|
|
44
|
+
// If index >= the number of arguments, returns nil.
|
|
45
|
+
// If the argument at the given index is NSNull, returns nil.
|
|
46
|
+
- (id)argumentAtIndex:(NSUInteger)index;
|
|
47
|
+
// Same as above, but returns defaultValue instead of nil.
|
|
48
|
+
- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue;
|
|
49
|
+
// Same as above, but returns defaultValue instead of nil, and if the argument is not of the expected class, returns defaultValue
|
|
50
|
+
- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass;
|
|
51
|
+
|
|
52
|
+
@end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import "CDVInvokedUrlCommand.h"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@implementation CDVInvokedUrlCommand
|
|
24
|
+
|
|
25
|
+
@synthesize arguments = _arguments;
|
|
26
|
+
@synthesize callbackId = _callbackId;
|
|
27
|
+
@synthesize className = _className;
|
|
28
|
+
@synthesize methodName = _methodName;
|
|
29
|
+
|
|
30
|
+
+ (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry
|
|
31
|
+
{
|
|
32
|
+
return [[CDVInvokedUrlCommand alloc] initFromJson:jsonEntry];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
- (id)initFromJson:(NSArray*)jsonEntry
|
|
36
|
+
{
|
|
37
|
+
id tmp = [jsonEntry objectAtIndex:0];
|
|
38
|
+
NSString* callbackId = tmp == [NSNull null] ? nil : tmp;
|
|
39
|
+
NSString* className = [jsonEntry objectAtIndex:1];
|
|
40
|
+
NSString* methodName = [jsonEntry objectAtIndex:2];
|
|
41
|
+
NSMutableArray* arguments = [jsonEntry objectAtIndex:3];
|
|
42
|
+
|
|
43
|
+
return [self initWithArguments:arguments
|
|
44
|
+
callbackId:callbackId
|
|
45
|
+
className:className
|
|
46
|
+
methodName:methodName];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (id)initWithArguments:(NSArray*)arguments
|
|
50
|
+
callbackId:(NSString*)callbackId
|
|
51
|
+
className:(NSString*)className
|
|
52
|
+
methodName:(NSString*)methodName
|
|
53
|
+
{
|
|
54
|
+
self = [super init];
|
|
55
|
+
if (self != nil) {
|
|
56
|
+
_arguments = arguments;
|
|
57
|
+
_callbackId = callbackId;
|
|
58
|
+
_className = className;
|
|
59
|
+
_methodName = methodName;
|
|
60
|
+
}
|
|
61
|
+
[self massageArguments];
|
|
62
|
+
return self;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
- (void)massageArguments
|
|
66
|
+
{
|
|
67
|
+
NSMutableArray* newArgs = nil;
|
|
68
|
+
|
|
69
|
+
for (NSUInteger i = 0, count = [_arguments count]; i < count; ++i) {
|
|
70
|
+
id arg = [_arguments objectAtIndex:i];
|
|
71
|
+
if (![arg isKindOfClass:[NSDictionary class]]) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
NSDictionary* dict = arg;
|
|
75
|
+
NSString* type = [dict objectForKey:@"CDVType"];
|
|
76
|
+
if (!type || ![type isEqualToString:@"ArrayBuffer"]) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
NSString* data = [dict objectForKey:@"data"];
|
|
80
|
+
if (!data) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (newArgs == nil) {
|
|
84
|
+
newArgs = [NSMutableArray arrayWithArray:_arguments];
|
|
85
|
+
_arguments = newArgs;
|
|
86
|
+
}
|
|
87
|
+
[newArgs replaceObjectAtIndex:i withObject:[[NSData alloc] initWithBase64EncodedString:data options:0]];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
- (id)argumentAtIndex:(NSUInteger)index
|
|
92
|
+
{
|
|
93
|
+
return [self argumentAtIndex:index withDefault:nil];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue
|
|
97
|
+
{
|
|
98
|
+
return [self argumentAtIndex:index withDefault:defaultValue andClass:nil];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass
|
|
102
|
+
{
|
|
103
|
+
if (index >= [_arguments count]) {
|
|
104
|
+
return defaultValue;
|
|
105
|
+
}
|
|
106
|
+
id ret = [_arguments objectAtIndex:index];
|
|
107
|
+
if (ret == [NSNull null]) {
|
|
108
|
+
ret = defaultValue;
|
|
109
|
+
}
|
|
110
|
+
if ((aClass != nil) && ![ret isKindOfClass:aClass]) {
|
|
111
|
+
ret = defaultValue;
|
|
112
|
+
}
|
|
113
|
+
return ret;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@end
|