@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
package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.h
ADDED
|
@@ -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 <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
|
package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.m
ADDED
|
@@ -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 "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
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
|
@@ -0,0 +1,216 @@
|
|
|
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 "CDVPluginResult.h"
|
|
21
|
+
|
|
22
|
+
// This exists to preserve compatibility with early Swift plugins, who are
|
|
23
|
+
// using CDVCommandStatus as ObjC-style constants rather than as Swift enum
|
|
24
|
+
// values.
|
|
25
|
+
// These constants alias the enum values back to their previous names.
|
|
26
|
+
#define SWIFT_ENUM_COMPAT_HACK(enumVal) const CDVCommandStatus SWIFT_##enumVal NS_SWIFT_NAME(enumVal) = enumVal
|
|
27
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_NO_RESULT);
|
|
28
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_OK);
|
|
29
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION);
|
|
30
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION);
|
|
31
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_INSTANTIATION_EXCEPTION);
|
|
32
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_MALFORMED_URL_EXCEPTION);
|
|
33
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_IO_EXCEPTION);
|
|
34
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_INVALID_ACTION);
|
|
35
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_JSON_EXCEPTION);
|
|
36
|
+
SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_ERROR);
|
|
37
|
+
#undef SWIFT_ENUM_COMPAT_HACK
|
|
38
|
+
|
|
39
|
+
@interface CDVPluginResult ()
|
|
40
|
+
|
|
41
|
+
- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage;
|
|
42
|
+
|
|
43
|
+
@end
|
|
44
|
+
|
|
45
|
+
@implementation CDVPluginResult
|
|
46
|
+
@synthesize status, message, keepCallback, associatedObject;
|
|
47
|
+
|
|
48
|
+
static NSArray* org_apache_cordova_CommandStatusMsgs;
|
|
49
|
+
|
|
50
|
+
id messageFromArrayBuffer(NSData* data)
|
|
51
|
+
{
|
|
52
|
+
return @{
|
|
53
|
+
@"CDVType" : @"ArrayBuffer",
|
|
54
|
+
@"data" :[data base64EncodedStringWithOptions:0]
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
id massageMessage(id message)
|
|
59
|
+
{
|
|
60
|
+
if ([message isKindOfClass:[NSData class]]) {
|
|
61
|
+
return messageFromArrayBuffer(message);
|
|
62
|
+
}
|
|
63
|
+
return message;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
id messageFromMultipart(NSArray* theMessages)
|
|
67
|
+
{
|
|
68
|
+
NSMutableArray* messages = [NSMutableArray arrayWithArray:theMessages];
|
|
69
|
+
|
|
70
|
+
for (NSUInteger i = 0; i < messages.count; ++i) {
|
|
71
|
+
[messages replaceObjectAtIndex:i withObject:massageMessage([messages objectAtIndex:i])];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return @{
|
|
75
|
+
@"CDVType" : @"MultiPart",
|
|
76
|
+
@"messages" : messages
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
+ (void)initialize
|
|
81
|
+
{
|
|
82
|
+
org_apache_cordova_CommandStatusMsgs = [[NSArray alloc] initWithObjects:@"No result",
|
|
83
|
+
@"OK",
|
|
84
|
+
@"Class not found",
|
|
85
|
+
@"Illegal access",
|
|
86
|
+
@"Instantiation error",
|
|
87
|
+
@"Malformed url",
|
|
88
|
+
@"IO error",
|
|
89
|
+
@"Invalid action",
|
|
90
|
+
@"JSON error",
|
|
91
|
+
@"Error",
|
|
92
|
+
nil];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
- (CDVPluginResult*)init
|
|
96
|
+
{
|
|
97
|
+
return [self initWithStatus:CDVCommandStatus_NO_RESULT message:nil];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage
|
|
101
|
+
{
|
|
102
|
+
self = [super init];
|
|
103
|
+
if (self) {
|
|
104
|
+
status = [NSNumber numberWithInt:statusOrdinal];
|
|
105
|
+
message = theMessage;
|
|
106
|
+
keepCallback = [NSNumber numberWithBool:NO];
|
|
107
|
+
}
|
|
108
|
+
return self;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal
|
|
112
|
+
{
|
|
113
|
+
return [[self alloc] initWithStatus:statusOrdinal message:nil];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage
|
|
117
|
+
{
|
|
118
|
+
return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage
|
|
122
|
+
{
|
|
123
|
+
return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage
|
|
127
|
+
{
|
|
128
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithInt:theMessage]];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSInteger:(NSInteger)theMessage
|
|
132
|
+
{
|
|
133
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithInteger:theMessage]];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSUInteger:(NSUInteger)theMessage
|
|
137
|
+
{
|
|
138
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithUnsignedInteger:theMessage]];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage
|
|
142
|
+
{
|
|
143
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithDouble:theMessage]];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage
|
|
147
|
+
{
|
|
148
|
+
return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithBool:theMessage]];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage
|
|
152
|
+
{
|
|
153
|
+
return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage
|
|
157
|
+
{
|
|
158
|
+
return [[self alloc] initWithStatus:statusOrdinal message:messageFromArrayBuffer(theMessage)];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages
|
|
162
|
+
{
|
|
163
|
+
return [[self alloc] initWithStatus:statusOrdinal message:messageFromMultipart(theMessages)];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode
|
|
167
|
+
{
|
|
168
|
+
NSDictionary* errDict = @{@"code" :[NSNumber numberWithInt:errorCode]};
|
|
169
|
+
|
|
170
|
+
return [[self alloc] initWithStatus:statusOrdinal message:errDict];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
- (void)setKeepCallbackAsBool:(BOOL)bKeepCallback
|
|
174
|
+
{
|
|
175
|
+
[self setKeepCallback:[NSNumber numberWithBool:bKeepCallback]];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
- (NSString*)argumentsAsJSON
|
|
179
|
+
{
|
|
180
|
+
id arguments = (self.message == nil ? [NSNull null] : self.message);
|
|
181
|
+
NSArray* argumentsWrappedInArray = [NSArray arrayWithObject:arguments];
|
|
182
|
+
|
|
183
|
+
NSString* argumentsJSON = [self JSONStringFromArray:argumentsWrappedInArray];
|
|
184
|
+
|
|
185
|
+
argumentsJSON = [argumentsJSON substringWithRange:NSMakeRange(1, [argumentsJSON length] - 2)];
|
|
186
|
+
|
|
187
|
+
return argumentsJSON;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
static BOOL gIsVerbose = NO;
|
|
191
|
+
+ (void)setVerbose:(BOOL)verbose
|
|
192
|
+
{
|
|
193
|
+
gIsVerbose = verbose;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
+ (BOOL)isVerbose
|
|
197
|
+
{
|
|
198
|
+
return gIsVerbose;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
- (NSString*)JSONStringFromArray:(NSArray *) array
|
|
202
|
+
{
|
|
203
|
+
NSError* error = nil;
|
|
204
|
+
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:array
|
|
205
|
+
options:0
|
|
206
|
+
error:&error];
|
|
207
|
+
|
|
208
|
+
if (error != nil) {
|
|
209
|
+
NSLog(@"NSArray JSONString error: %@", [error localizedDescription]);
|
|
210
|
+
return nil;
|
|
211
|
+
} else {
|
|
212
|
+
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@end
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
@protocol CDVScreenOrientationDelegate <NSObject>
|
|
23
|
+
|
|
24
|
+
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
|
|
25
|
+
- (NSUInteger)supportedInterfaceOrientations;
|
|
26
|
+
#else
|
|
27
|
+
- (UIInterfaceOrientationMask)supportedInterfaceOrientations;
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
|
|
31
|
+
- (BOOL)shouldAutorotate;
|
|
32
|
+
|
|
33
|
+
@end
|