@capacitor-community/camera-preview 2.0.0-beta.0 → 2.1.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.
Files changed (178) hide show
  1. package/CapacitorCommunityCameraPreview.podspec +3 -2
  2. package/LICENSE +21 -0
  3. package/README.md +80 -61
  4. package/android/.gradle/4.10.1/fileChanges/last-build.bin +0 -0
  5. package/android/.gradle/4.10.1/fileHashes/fileHashes.bin +0 -0
  6. package/android/.gradle/4.10.1/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/4.10.1/gc.properties +0 -0
  8. package/android/.gradle/vcs-1/gc.properties +0 -0
  9. package/android/.idea/compiler.xml +6 -0
  10. package/android/.idea/gradle.xml +20 -0
  11. package/android/.idea/jarRepositories.xml +45 -0
  12. package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_0_aar.xml +14 -0
  13. package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_3_aar.xml +14 -0
  14. package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml +9 -0
  15. package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_2_0.xml +9 -0
  16. package/android/.idea/libraries/Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml +11 -0
  17. package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml +14 -0
  18. package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_3_0_aar.xml +14 -0
  19. package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml +11 -0
  20. package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_3_0_aar.xml +11 -0
  21. package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +9 -0
  22. package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +11 -0
  23. package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +9 -0
  24. package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml +14 -0
  25. package/android/.idea/libraries/Gradle__androidx_core_core_1_3_2_aar.xml +14 -0
  26. package/android/.idea/libraries/Gradle__androidx_core_core_1_5_0_aar.xml +14 -0
  27. package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +11 -0
  28. package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +11 -0
  29. package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +14 -0
  30. package/android/.idea/libraries/Gradle__androidx_exifinterface_exifinterface_1_3_2_aar.xml +14 -0
  31. package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_0_aar.xml +14 -0
  32. package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_4_aar.xml +14 -0
  33. package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +11 -0
  34. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_0.xml +9 -0
  35. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_1.xml +9 -0
  36. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +11 -0
  37. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_0_aar.xml +11 -0
  38. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_1_aar.xml +11 -0
  39. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_0_aar.xml +11 -0
  40. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_1_aar.xml +11 -0
  41. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_0_aar.xml +11 -0
  42. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_1_aar.xml +11 -0
  43. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_0_aar.xml +11 -0
  44. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_1_aar.xml +11 -0
  45. package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +11 -0
  46. package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_1_0_aar.xml +11 -0
  47. package/android/.idea/libraries/Gradle__androidx_test_core_1_3_0_aar.xml +11 -0
  48. package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_1_0_alpha3_aar.xml +11 -0
  49. package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_3_0_aar.xml +11 -0
  50. package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_1_0_alpha3_aar.xml +11 -0
  51. package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_3_0_aar.xml +11 -0
  52. package/android/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_2_aar.xml +11 -0
  53. package/android/.idea/libraries/Gradle__androidx_test_monitor_1_1_0_alpha3_aar.xml +11 -0
  54. package/android/.idea/libraries/Gradle__androidx_test_monitor_1_3_0_aar.xml +11 -0
  55. package/android/.idea/libraries/Gradle__androidx_test_runner_1_1_0_alpha3_aar.xml +11 -0
  56. package/android/.idea/libraries/Gradle__androidx_test_runner_1_3_0_aar.xml +11 -0
  57. package/android/.idea/libraries/Gradle__androidx_tracing_tracing_1_0_0_aar.xml +11 -0
  58. package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +11 -0
  59. package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +11 -0
  60. package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +11 -0
  61. package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_1_aar.xml +11 -0
  62. package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +11 -0
  63. package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1.xml +9 -0
  64. package/android/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1.xml +9 -0
  65. package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +9 -0
  66. package/android/.idea/libraries/Gradle__junit_junit_4_12.xml +9 -0
  67. package/android/.idea/libraries/Gradle__junit_junit_4_13_1.xml +9 -0
  68. package/android/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_10_18.xml +9 -0
  69. package/android/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_10_18.xml +9 -0
  70. package/android/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0.xml +9 -0
  71. package/android/.idea/libraries/Gradle__org_apache_cordova_framework_7_0_0_aar.xml +11 -0
  72. package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +9 -0
  73. package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3.xml +9 -0
  74. package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3.xml +9 -0
  75. package/android/.idea/libraries/Gradle__org_json_json_20140107.xml +9 -0
  76. package/android/.idea/libraries/Gradle__org_mockito_mockito_core_3_6_28.xml +9 -0
  77. package/android/.idea/libraries/Gradle__org_mockito_mockito_inline_3_6_28.xml +9 -0
  78. package/android/.idea/libraries/Gradle__org_objenesis_objenesis_3_1.xml +9 -0
  79. package/android/.idea/misc.xml +9 -0
  80. package/android/.idea/modules/1419750366/android.capacitor-android.iml +92 -0
  81. package/android/.idea/modules/android.iml +87 -0
  82. package/android/.idea/modules.xml +9 -0
  83. package/android/.idea/vcs.xml +6 -0
  84. package/android/build.gradle +4 -4
  85. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +128 -70
  86. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +163 -118
  87. package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomTextureView.java +31 -0
  88. package/android/src/main/java/com/ahm/capacitor/camera/preview/Preview.java +96 -19
  89. package/dist/esm/definitions.d.ts +18 -5
  90. package/dist/esm/definitions.js +1 -0
  91. package/dist/esm/index.d.ts +3 -1
  92. package/dist/esm/index.js +5 -1
  93. package/dist/esm/index.js.map +1 -1
  94. package/dist/esm/web.d.ts +8 -1
  95. package/dist/esm/web.js +95 -77
  96. package/dist/esm/web.js.map +1 -1
  97. package/ios/Plugin/CameraController.swift +237 -48
  98. package/ios/Plugin/Plugin.m +3 -0
  99. package/ios/Plugin/Plugin.swift +130 -46
  100. package/ios/Plugin.xcodeproj/project.pbxproj +2 -6
  101. package/ios/Podfile +2 -2
  102. package/ios/Podfile.lock +4 -4
  103. package/package.json +7 -6
  104. package/android/local.properties +0 -8
  105. package/ios/Plugin.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  106. package/ios/Plugin.xcodeproj/xcuserdata/nielsvanharen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  107. package/ios/Plugin.xcworkspace/xcuserdata/ahernandez.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  108. package/ios/Plugin.xcworkspace/xcuserdata/arielhernandezmusa.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  109. package/ios/Plugin.xcworkspace/xcuserdata/nielsvanharen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  110. package/ios/Pods/CapacitorCordova/LICENSE +0 -23
  111. package/ios/Pods/CapacitorCordova/README.md +0 -39
  112. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/CapacitorCordova.h +0 -21
  113. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.h +0 -8
  114. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.m +0 -5
  115. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDV.h +0 -28
  116. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVAvailability.h +0 -109
  117. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegate.h +0 -51
  118. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.h +0 -39
  119. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m +0 -154
  120. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.h +0 -31
  121. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.m +0 -81
  122. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.h +0 -52
  123. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.m +0 -116
  124. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.h +0 -81
  125. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.m +0 -154
  126. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.h +0 -25
  127. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.m +0 -77
  128. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.h +0 -82
  129. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.m +0 -216
  130. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVScreenOrientationDelegate.h +0 -33
  131. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.h +0 -41
  132. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.m +0 -399
  133. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.h +0 -27
  134. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.m +0 -74
  135. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.h +0 -27
  136. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.m +0 -156
  137. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.h +0 -30
  138. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.m +0 -34
  139. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.h +0 -35
  140. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.m +0 -63
  141. package/ios/Pods/Local Podspecs/Capacitor.podspec.json +0 -31
  142. package/ios/Pods/Manifest.lock +0 -23
  143. package/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -1296
  144. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/Capacitor.xcscheme +0 -60
  145. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/CapacitorCordova.xcscheme +0 -58
  146. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/Pods-Plugin.xcscheme +0 -58
  147. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/Pods-PluginTests.xcscheme +0 -58
  148. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/xcschememanagement.plist +0 -39
  149. package/ios/Pods/Target Support Files/Capacitor/Capacitor-Info.plist +0 -26
  150. package/ios/Pods/Target Support Files/Capacitor/Capacitor-dummy.m +0 -5
  151. package/ios/Pods/Target Support Files/Capacitor/Capacitor-prefix.pch +0 -12
  152. package/ios/Pods/Target Support Files/Capacitor/Capacitor.debug.xcconfig +0 -13
  153. package/ios/Pods/Target Support Files/Capacitor/Capacitor.modulemap +0 -7
  154. package/ios/Pods/Target Support Files/Capacitor/Capacitor.release.xcconfig +0 -13
  155. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-Info.plist +0 -26
  156. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-dummy.m +0 -5
  157. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-prefix.pch +0 -12
  158. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-umbrella.h +0 -32
  159. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.debug.xcconfig +0 -12
  160. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.modulemap +0 -6
  161. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.release.xcconfig +0 -12
  162. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-Info.plist +0 -26
  163. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.markdown +0 -57
  164. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.plist +0 -95
  165. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-dummy.m +0 -5
  166. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-umbrella.h +0 -16
  167. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig +0 -13
  168. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.modulemap +0 -6
  169. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig +0 -13
  170. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-Info.plist +0 -26
  171. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.markdown +0 -57
  172. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.plist +0 -95
  173. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-dummy.m +0 -5
  174. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh +0 -187
  175. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-umbrella.h +0 -16
  176. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig +0 -14
  177. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.modulemap +0 -6
  178. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig +0 -14
@@ -1,81 +0,0 @@
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
@@ -1,52 +0,0 @@
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
@@ -1,116 +0,0 @@
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
@@ -1,81 +0,0 @@
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
- #import <UIKit/UIKit.h>
22
- #import "CDVPluginResult.h"
23
- #import "CDVCommandDelegate.h"
24
- #import "CDVAvailability.h"
25
- #import <WebKit/WebKit.h>
26
-
27
- @interface UIView (org_apache_cordova_UIView_Extension)
28
-
29
- @property (nonatomic, weak) UIScrollView* scrollView;
30
-
31
- @end
32
-
33
- extern NSString* const CDVPageDidLoadNotification;
34
- extern NSString* const CDVPluginHandleOpenURLNotification;
35
- extern NSString* const CDVPluginHandleOpenURLWithAppSourceAndAnnotationNotification;
36
- extern NSString* const CDVPluginResetNotification;
37
- extern NSString* const CDVViewWillAppearNotification;
38
- extern NSString* const CDVViewDidAppearNotification;
39
- extern NSString* const CDVViewWillDisappearNotification;
40
- extern NSString* const CDVViewDidDisappearNotification;
41
- extern NSString* const CDVViewWillLayoutSubviewsNotification;
42
- extern NSString* const CDVViewDidLayoutSubviewsNotification;
43
- extern NSString* const CDVViewWillTransitionToSizeNotification;
44
-
45
- /*
46
- * The local and remote push notification functionality has been removed from the core in cordova-ios 4.x,
47
- * but these constants have unfortunately have not been removed, but will be removed in 5.x.
48
- *
49
- * To have the same functionality as 3.x, use a third-party plugin or the experimental
50
- * https://github.com/apache/cordova-plugins/tree/master/notification-rebroadcast
51
- */
52
-
53
-
54
- @interface CDVPlugin : NSObject {}
55
-
56
- @property (nonatomic, weak) UIView* webView;
57
- @property (nonatomic, weak) WKWebView * webViewEngine;
58
- @property (nonatomic, strong) NSString * className;
59
-
60
- @property (nonatomic, weak) UIViewController* viewController;
61
- @property (nonatomic, weak) id <CDVCommandDelegate> commandDelegate;
62
-
63
- - (void)pluginInitialize;
64
-
65
- - (void)handleOpenURL:(NSNotification*)notification;
66
- - (void)onAppTerminate;
67
- - (void)onMemoryWarning;
68
- - (void)onReset;
69
- - (void)dispose;
70
-
71
- /*
72
- // see initWithWebView implementation
73
- - (void) onPause {}
74
- - (void) onResume {}
75
- - (void) onOrientationWillChange {}
76
- - (void) onOrientationDidChange {}
77
- */
78
-
79
- - (id)appDelegate;
80
-
81
- @end
@@ -1,154 +0,0 @@
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 "CDVPlugin.h"
21
- #include <objc/message.h>
22
-
23
- @implementation UIView (org_apache_cordova_UIView_Extension)
24
-
25
- @dynamic scrollView;
26
-
27
- - (UIScrollView*)scrollView
28
- {
29
- SEL scrollViewSelector = NSSelectorFromString(@"scrollView");
30
-
31
- if ([self respondsToSelector:scrollViewSelector]) {
32
- return ((id (*)(id, SEL))objc_msgSend)(self, scrollViewSelector);
33
- }
34
-
35
- return nil;
36
- }
37
-
38
- @end
39
-
40
- NSString* const CDVPageDidLoadNotification = @"CDVPageDidLoadNotification";
41
- NSString* const CDVPluginHandleOpenURLNotification = @"CDVPluginHandleOpenURLNotification";
42
- NSString* const CDVPluginHandleOpenURLWithAppSourceAndAnnotationNotification = @"CDVPluginHandleOpenURLWithAppSourceAndAnnotationNotification";
43
- NSString* const CDVPluginResetNotification = @"CDVPluginResetNotification";
44
- NSString* const CDVLocalNotification = @"CDVLocalNotification";
45
- NSString* const CDVRemoteNotification = @"CDVRemoteNotification";
46
- NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError";
47
- NSString* const CDVViewWillAppearNotification = @"CDVViewWillAppearNotification";
48
- NSString* const CDVViewDidAppearNotification = @"CDVViewDidAppearNotification";
49
- NSString* const CDVViewWillDisappearNotification = @"CDVViewWillDisappearNotification";
50
- NSString* const CDVViewDidDisappearNotification = @"CDVViewDidDisappearNotification";
51
- NSString* const CDVViewWillLayoutSubviewsNotification = @"CDVViewWillLayoutSubviewsNotification";
52
- NSString* const CDVViewDidLayoutSubviewsNotification = @"CDVViewDidLayoutSubviewsNotification";
53
- NSString* const CDVViewWillTransitionToSizeNotification = @"CDVViewWillTransitionToSizeNotification";
54
-
55
- @interface CDVPlugin ()
56
-
57
- @property (readwrite, assign) BOOL hasPendingOperation;
58
-
59
- @end
60
-
61
- @implementation CDVPlugin
62
- @synthesize webViewEngine, viewController, commandDelegate, hasPendingOperation, webView;
63
-
64
- // Do not override these methods. Use pluginInitialize instead.
65
- - (instancetype)initWithWebViewEngine:(WKWebView *)theWebViewEngine
66
- {
67
- self = [super init];
68
- if (self) {
69
- self.webViewEngine = theWebViewEngine;
70
- }
71
- return self;
72
- }
73
-
74
- - (void)pluginInitialize
75
- {
76
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppTerminate) name:UIApplicationWillTerminateNotification object:nil];
77
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
78
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:CDVPluginHandleOpenURLNotification object:nil];
79
- // You can listen to more app notifications, see:
80
- // http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006728-CH3-DontLinkElementID_4
81
-
82
- // NOTE: if you want to use these, make sure you uncomment the corresponding notification handler
83
-
84
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
85
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil];
86
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
87
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationDidChange) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
88
-
89
- // Added in 2.5.0
90
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification object:self.webView];
91
- //Added in 4.3.0
92
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillAppear:) name:CDVViewWillAppearNotification object:nil];
93
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewDidAppear:) name:CDVViewDidAppearNotification object:nil];
94
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillDisappear:) name:CDVViewWillDisappearNotification object:nil];
95
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewDidDisappear:) name:CDVViewDidDisappearNotification object:nil];
96
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillLayoutSubviews:) name:CDVViewWillLayoutSubviewsNotification object:nil];
97
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewDidLayoutSubviews:) name:CDVViewDidLayoutSubviewsNotification object:nil];
98
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillTransitionToSize:) name:CDVViewWillTransitionToSizeNotification object:nil];
99
- }
100
-
101
- - (void)dispose
102
- {
103
- viewController = nil;
104
- commandDelegate = nil;
105
- }
106
-
107
- /*
108
- // NOTE: for onPause and onResume, calls into JavaScript must not call or trigger any blocking UI, like alerts
109
- - (void) onPause {}
110
- - (void) onResume {}
111
- - (void) onOrientationWillChange {}
112
- - (void) onOrientationDidChange {}
113
- */
114
-
115
- /* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */
116
- - (void)handleOpenURL:(NSNotification*)notification
117
- {
118
- // override to handle urls sent to your app
119
- // register your url schemes in your App-Info.plist
120
-
121
- NSURL* url = [notification object];
122
-
123
- if ([url isKindOfClass:[NSURL class]]) {
124
- /* Do your thing! */
125
- }
126
- }
127
-
128
- /* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */
129
- - (void)onAppTerminate
130
- {
131
- // override this if you need to do any cleanup on app exit
132
- }
133
-
134
- - (void)onMemoryWarning
135
- {
136
- // override to remove caches, etc
137
- }
138
-
139
- - (void)onReset
140
- {
141
- // Override to cancel any long-running requests when the WebView navigates or refreshes.
142
- }
143
-
144
- - (void)dealloc
145
- {
146
- [[NSNotificationCenter defaultCenter] removeObserver:self]; // this will remove all notifications unless added using addObserverForName:object:queue:usingBlock:
147
- }
148
-
149
- - (id)appDelegate
150
- {
151
- return [[UIApplication sharedApplication] delegate];
152
- }
153
-
154
- @end
@@ -1,25 +0,0 @@
1
- //
2
- // CDVPluginManager.h
3
- // CapacitorCordova
4
- //
5
- // Created by Julio Cesar Sanchez Hernandez on 26/2/18.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
- #import "CDVPlugin.h"
10
- #import "CDVConfigParser.h"
11
- #import "CDVCommandDelegate.h"
12
-
13
- @interface CDVPluginManager : NSObject
14
-
15
- @property (nonatomic, strong) NSMutableDictionary * pluginsMap;
16
- @property (nonatomic, strong) NSMutableDictionary * pluginObjects;
17
- @property (nonatomic, strong) NSMutableDictionary * settings;
18
- @property (nonatomic, strong) UIViewController * viewController;
19
- @property (nonatomic, strong) WKWebView * webView;
20
- @property (nonatomic, strong) id <CDVCommandDelegate> commandDelegate;
21
-
22
- - (id)initWithParser:(CDVConfigParser*)parser viewController:(UIViewController*)viewController webView:(WKWebView *)webview;
23
- - (CDVPlugin *)getCommandInstance:(NSString*)pluginName;
24
-
25
- @end
@@ -1,77 +0,0 @@
1
- #import "CDVPluginManager.h"
2
- #import "CDVPlugin.h"
3
- #import "CDVCommandDelegateImpl.h"
4
-
5
- @implementation CDVPluginManager
6
-
7
- - (id)initWithParser:(CDVConfigParser*)parser viewController:(UIViewController*)viewController webView:(WKWebView *)webview
8
- {
9
- self = [super init];
10
- if (self != nil) {
11
- _pluginsMap = parser.pluginsDict;
12
- _settings = parser.settings;
13
- _viewController = viewController;
14
- _webView = webview;
15
- _pluginObjects = [[NSMutableDictionary alloc] init];
16
- _commandDelegate = [[CDVCommandDelegateImpl alloc] initWithWebView:_webView pluginManager:self];
17
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidEnterBackground:)
18
- name:UIApplicationDidEnterBackgroundNotification object:nil];
19
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillEnterForeground:)
20
- name:UIApplicationWillEnterForegroundNotification object:nil];
21
- }
22
- return self;
23
- }
24
-
25
- /**
26
- Returns an instance of a CordovaCommand object, based on its name. If one exists already, it is returned.
27
- */
28
- - (CDVPlugin *)getCommandInstance:(NSString*)pluginName
29
- {
30
- NSString* className = [self.pluginsMap objectForKey:[pluginName lowercaseString]];
31
-
32
- if (className == nil) {
33
- return nil;
34
- }
35
-
36
- id obj = [self.pluginObjects objectForKey:className];
37
- if (!obj) {
38
- obj = [[NSClassFromString(className)alloc] init];
39
- if (!obj) {
40
- NSString* fullClassName = [NSString stringWithFormat:@"%@.%@",
41
- NSBundle.mainBundle.infoDictionary[@"CFBundleExecutable"],
42
- className];
43
- obj = [[NSClassFromString(fullClassName)alloc] init];
44
- }
45
-
46
- if (obj != nil) {
47
- [self registerPlugin:obj withClassName:className];
48
- } else {
49
- NSLog(@"CDVPlugin class %@ (pluginName: %@) does not exist.", className, pluginName);
50
- }
51
- }
52
- [obj setClassName:className];
53
-
54
- return obj;
55
- }
56
-
57
-
58
- - (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className
59
- {
60
- [self.pluginObjects setObject:plugin forKey:className];
61
- plugin.viewController = self.viewController;
62
- plugin.webView = self.webView;
63
- plugin.commandDelegate = self.commandDelegate;
64
- [plugin pluginInitialize];
65
- }
66
-
67
- - (void)onAppDidEnterBackground:(NSNotification*)notification
68
- {
69
- [self.commandDelegate evalJsHelper2:@"window.Capacitor.triggerEvent('pause', 'document');"];
70
- }
71
-
72
- - (void)onAppWillEnterForeground:(NSNotification*)notification
73
- {
74
- [self.commandDelegate evalJsHelper2:@"window.Capacitor.triggerEvent('resume', 'document');"];
75
- }
76
-
77
- @end
@@ -1,82 +0,0 @@
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
- typedef NS_ENUM(NSUInteger, CDVCommandStatus) {
23
- CDVCommandStatus_NO_RESULT NS_SWIFT_NAME(noResult) = 0,
24
- CDVCommandStatus_OK NS_SWIFT_NAME(ok),
25
- CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION NS_SWIFT_NAME(classNotFoundException),
26
- CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION NS_SWIFT_NAME(illegalAccessException),
27
- CDVCommandStatus_INSTANTIATION_EXCEPTION NS_SWIFT_NAME(instantiationException),
28
- CDVCommandStatus_MALFORMED_URL_EXCEPTION NS_SWIFT_NAME(malformedUrlException),
29
- CDVCommandStatus_IO_EXCEPTION NS_SWIFT_NAME(ioException),
30
- CDVCommandStatus_INVALID_ACTION NS_SWIFT_NAME(invalidAction),
31
- CDVCommandStatus_JSON_EXCEPTION NS_SWIFT_NAME(jsonException),
32
- CDVCommandStatus_ERROR NS_SWIFT_NAME(error)
33
- };
34
-
35
- // This exists to preserve compatibility with early Swift plugins, who are
36
- // using CDVCommandStatus as ObjC-style constants rather than as Swift enum
37
- // values.
38
- // This declares extern'ed constants (implemented in CDVPluginResult.m)
39
- #define SWIFT_ENUM_COMPAT_HACK(enumVal) extern const CDVCommandStatus SWIFT_##enumVal NS_SWIFT_NAME(enumVal)
40
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_NO_RESULT);
41
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_OK);
42
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION);
43
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION);
44
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_INSTANTIATION_EXCEPTION);
45
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_MALFORMED_URL_EXCEPTION);
46
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_IO_EXCEPTION);
47
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_INVALID_ACTION);
48
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_JSON_EXCEPTION);
49
- SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_ERROR);
50
- #undef SWIFT_ENUM_COMPAT_HACK
51
-
52
- @interface CDVPluginResult : NSObject {}
53
-
54
- @property (nonatomic, strong, readonly) NSNumber* status;
55
- @property (nonatomic, strong, readonly) id message;
56
- @property (nonatomic, strong) NSNumber* keepCallback;
57
- // This property can be used to scope the lifetime of another object. For example,
58
- // Use it to store the associated NSData when `message` is created using initWithBytesNoCopy.
59
- @property (nonatomic, strong) id associatedObject;
60
-
61
- - (CDVPluginResult*)init;
62
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal;
63
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage;
64
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage;
65
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage;
66
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSInteger:(NSInteger)theMessage;
67
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSUInteger:(NSUInteger)theMessage;
68
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage;
69
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage;
70
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage;
71
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage;
72
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages;
73
- + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode;
74
-
75
- + (void)setVerbose:(BOOL)verbose;
76
- + (BOOL)isVerbose;
77
-
78
- - (void)setKeepCallbackAsBool:(BOOL)bKeepCallback;
79
-
80
- - (NSString*)argumentsAsJSON;
81
-
82
- @end