@capacitor-community/camera-preview 2.0.0-beta.0 → 2.0.0-beta.2

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 (95) hide show
  1. package/CapacitorCommunityCameraPreview.podspec +3 -2
  2. package/LICENSE +21 -0
  3. package/README.md +46 -57
  4. package/android/build.gradle +4 -4
  5. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +127 -118
  6. package/dist/esm/definitions.d.ts +9 -5
  7. package/dist/esm/definitions.js +1 -0
  8. package/dist/esm/index.d.ts +3 -1
  9. package/dist/esm/index.js +5 -1
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/web.d.ts +7 -1
  12. package/dist/esm/web.js +89 -77
  13. package/dist/esm/web.js.map +1 -1
  14. package/ios/Plugin/CameraController.swift +155 -48
  15. package/ios/Plugin/Plugin.m +3 -0
  16. package/ios/Plugin/Plugin.swift +125 -46
  17. package/ios/Plugin.xcodeproj/project.pbxproj +2 -6
  18. package/ios/Podfile +2 -2
  19. package/ios/Podfile.lock +4 -4
  20. package/package.json +7 -6
  21. package/android/local.properties +0 -8
  22. package/ios/Plugin.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  23. package/ios/Plugin.xcodeproj/xcuserdata/nielsvanharen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  24. package/ios/Plugin.xcworkspace/xcuserdata/ahernandez.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  25. package/ios/Plugin.xcworkspace/xcuserdata/arielhernandezmusa.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  26. package/ios/Plugin.xcworkspace/xcuserdata/nielsvanharen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  27. package/ios/Pods/CapacitorCordova/LICENSE +0 -23
  28. package/ios/Pods/CapacitorCordova/README.md +0 -39
  29. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/CapacitorCordova.h +0 -21
  30. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.h +0 -8
  31. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.m +0 -5
  32. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDV.h +0 -28
  33. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVAvailability.h +0 -109
  34. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegate.h +0 -51
  35. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.h +0 -39
  36. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m +0 -154
  37. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.h +0 -31
  38. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.m +0 -81
  39. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.h +0 -52
  40. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.m +0 -116
  41. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.h +0 -81
  42. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.m +0 -154
  43. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.h +0 -25
  44. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.m +0 -77
  45. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.h +0 -82
  46. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.m +0 -216
  47. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVScreenOrientationDelegate.h +0 -33
  48. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.h +0 -41
  49. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.m +0 -399
  50. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.h +0 -27
  51. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.m +0 -74
  52. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.h +0 -27
  53. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.m +0 -156
  54. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.h +0 -30
  55. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.m +0 -34
  56. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.h +0 -35
  57. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.m +0 -63
  58. package/ios/Pods/Local Podspecs/Capacitor.podspec.json +0 -31
  59. package/ios/Pods/Manifest.lock +0 -23
  60. package/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -1296
  61. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/Capacitor.xcscheme +0 -60
  62. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/CapacitorCordova.xcscheme +0 -58
  63. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/Pods-Plugin.xcscheme +0 -58
  64. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/Pods-PluginTests.xcscheme +0 -58
  65. package/ios/Pods/Pods.xcodeproj/xcuserdata/ahernandez.xcuserdatad/xcschemes/xcschememanagement.plist +0 -39
  66. package/ios/Pods/Target Support Files/Capacitor/Capacitor-Info.plist +0 -26
  67. package/ios/Pods/Target Support Files/Capacitor/Capacitor-dummy.m +0 -5
  68. package/ios/Pods/Target Support Files/Capacitor/Capacitor-prefix.pch +0 -12
  69. package/ios/Pods/Target Support Files/Capacitor/Capacitor.debug.xcconfig +0 -13
  70. package/ios/Pods/Target Support Files/Capacitor/Capacitor.modulemap +0 -7
  71. package/ios/Pods/Target Support Files/Capacitor/Capacitor.release.xcconfig +0 -13
  72. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-Info.plist +0 -26
  73. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-dummy.m +0 -5
  74. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-prefix.pch +0 -12
  75. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-umbrella.h +0 -32
  76. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.debug.xcconfig +0 -12
  77. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.modulemap +0 -6
  78. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.release.xcconfig +0 -12
  79. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-Info.plist +0 -26
  80. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.markdown +0 -57
  81. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.plist +0 -95
  82. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-dummy.m +0 -5
  83. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-umbrella.h +0 -16
  84. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig +0 -13
  85. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.modulemap +0 -6
  86. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig +0 -13
  87. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-Info.plist +0 -26
  88. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.markdown +0 -57
  89. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.plist +0 -95
  90. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-dummy.m +0 -5
  91. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh +0 -187
  92. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-umbrella.h +0 -16
  93. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig +0 -14
  94. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.modulemap +0 -6
  95. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig +0 -14
@@ -1,51 +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
- @class CDVPlugin;
23
- @class CDVPluginResult;
24
-
25
- typedef NSURL* (^ UrlTransformerBlock)(NSURL*);
26
-
27
- @protocol CDVCommandDelegate <NSObject>
28
-
29
- @property (nonatomic, readonly) NSDictionary* settings;
30
- @property (nonatomic, copy) UrlTransformerBlock urlTransformer;
31
-
32
- - (NSString*)pathForResource:(NSString*)resourcepath;
33
- - (id)getCommandInstance:(NSString*)pluginName;
34
-
35
- // Sends a plugin result to the JS. This is thread-safe.
36
- - (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId;
37
- // Evaluates the given JS. This is thread-safe.
38
- - (void)evalJs:(NSString*)js;
39
- // Can be used to evaluate JS right away instead of scheduling it on the run-loop.
40
- // This is required for dispatch resign and pause events, but should not be used
41
- // without reason. Without the run-loop delay, alerts used in JS callbacks may result
42
- // in dead-lock. This method must be called from the UI thread.
43
- - (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop;
44
- // Run the javascript
45
- - (void)evalJsHelper2:(NSString*)js;
46
- // Runs the given block on a background thread using a shared thread-pool.
47
- - (void)runInBackground:(void (^)())block;
48
- // Returns the User-Agent of the associated UIWebView.
49
- - (NSString*)userAgent;
50
-
51
- @end
@@ -1,39 +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 <UIKit/UIKit.h>
21
- #import "CDVCommandDelegate.h"
22
- #import <WebKit/WebKit.h>
23
- #import "CDVPluginManager.h"
24
-
25
- @class CDVViewController;
26
- @class CDVCommandQueue;
27
-
28
- @interface CDVCommandDelegateImpl : NSObject <CDVCommandDelegate>{
29
- @private
30
- __weak WKWebView* _webView;
31
- __weak CDVPluginManager* _manager;
32
- NSRegularExpression* _callbackIdPattern;
33
- @protected
34
- __weak CDVCommandQueue* _commandQueue;
35
- BOOL _delayResponses;
36
- }
37
- - (id)initWithWebView:(WKWebView*)webView pluginManager:(CDVPluginManager *)manager;
38
- - (void)flushCommandQueueWithDelayedJs;
39
- @end
@@ -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 "CDVCommandDelegateImpl.h"
21
- #import "CDVPluginResult.h"
22
- #import <WebKit/WebKit.h>
23
-
24
- @implementation CDVCommandDelegateImpl
25
-
26
- @synthesize urlTransformer;
27
-
28
- - (id)initWithWebView:(WKWebView*)webView pluginManager:(CDVPluginManager *)manager
29
- {
30
- self = [super init];
31
- if (self != nil) {
32
- _webView = webView;
33
- _manager = manager;
34
- NSError* err = nil;
35
- _callbackIdPattern = [NSRegularExpression regularExpressionWithPattern:@"[^A-Za-z0-9._-]" options:0 error:&err];
36
- if (err != nil) {
37
- // Couldn't initialize Regex
38
- NSLog(@"Error: Couldn't initialize regex");
39
- _callbackIdPattern = nil;
40
- }
41
- }
42
- return self;
43
- }
44
-
45
- - (NSString*)pathForResource:(NSString*)resourcepath
46
- {
47
- NSBundle* mainBundle = [NSBundle mainBundle];
48
- NSMutableArray* directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
49
- NSString* filename = [directoryParts lastObject];
50
-
51
- [directoryParts removeLastObject];
52
-
53
- NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"];
54
- NSString* baseFolder = @"public";
55
- NSString* directoryStr = baseFolder;
56
-
57
- if ([directoryPartsJoined length] > 0) {
58
- directoryStr = [NSString stringWithFormat:@"%@/%@", baseFolder, [directoryParts componentsJoinedByString:@"/"]];
59
- }
60
-
61
- return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr];
62
- }
63
-
64
- - (void)flushCommandQueueWithDelayedJs
65
- {
66
- _delayResponses = YES;
67
- _delayResponses = NO;
68
- }
69
-
70
- - (void)evalJsHelper2:(NSString*)js
71
- {
72
- dispatch_async(dispatch_get_main_queue(), ^{
73
- [_webView evaluateJavaScript:js completionHandler:^(id obj, NSError* error) {
74
- // TODO: obj can be something other than string
75
- if ([obj isKindOfClass:[NSString class]]) {
76
- NSString* commandsJSON = (NSString*)obj;
77
- if ([commandsJSON length] > 0) {
78
- NSLog(@"Exec: Retrieved new exec messages by chaining.");
79
- }
80
- }
81
- }];
82
- });
83
- }
84
-
85
- - (BOOL)isValidCallbackId:(NSString*)callbackId
86
- {
87
- if ((callbackId == nil) || (_callbackIdPattern == nil)) {
88
- return NO;
89
- }
90
-
91
- // Disallow if too long or if any invalid characters were found.
92
- if (([callbackId length] > 100) || [_callbackIdPattern firstMatchInString:callbackId options:0 range:NSMakeRange(0, [callbackId length])]) {
93
- return NO;
94
- }
95
- return YES;
96
- }
97
-
98
- - (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId
99
- {
100
- // This occurs when there is are no win/fail callbacks for the call.
101
- if ([@"INVALID" isEqualToString:callbackId]) {
102
- return;
103
- }
104
- // This occurs when the callback id is malformed.
105
- if (![self isValidCallbackId:callbackId]) {
106
- NSLog(@"Invalid callback id received by sendPluginResult");
107
- return;
108
- }
109
- int status = [result.status intValue];
110
- BOOL keepCallback = [result.keepCallback boolValue];
111
- NSString* argumentsAsJSON = [result argumentsAsJSON];
112
- BOOL debug = NO;
113
-
114
- #ifdef DEBUG
115
- debug = YES;
116
- #endif
117
-
118
- NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d, %d)", callbackId, status, argumentsAsJSON, keepCallback, debug];
119
-
120
- [self evalJsHelper2:js];
121
- }
122
-
123
- - (void)evalJs:(NSString*)js
124
- {
125
- [self evalJs:js scheduledOnRunLoop:YES];
126
- }
127
-
128
- - (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop
129
- {
130
- js = [NSString stringWithFormat:@"try{cordova.require('cordova/exec').nativeEvalAndFetch(function(){%@})}catch(e){console.log('exception nativeEvalAndFetch : '+e);};", js];
131
- [self evalJsHelper2:js];
132
- }
133
-
134
- - (id)getCommandInstance:(NSString*)pluginName
135
- {
136
- return [_manager getCommandInstance:pluginName];
137
- }
138
-
139
- - (void)runInBackground:(void (^)())block
140
- {
141
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);
142
- }
143
-
144
- - (NSString*)userAgent
145
- {
146
- return nil;
147
- }
148
-
149
- - (NSDictionary*)settings
150
- {
151
- return _manager.settings;
152
- }
153
-
154
- @end
@@ -1,31 +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
- #import <Foundation/Foundation.h>
20
-
21
- @interface CDVConfigParser : NSObject <NSXMLParserDelegate>
22
- {
23
- NSString* featureName;
24
- }
25
-
26
- @property (nonatomic, readonly, strong) NSMutableDictionary* pluginsDict;
27
- @property (nonatomic, readonly, strong) NSMutableDictionary* settings;
28
- @property (nonatomic, readonly, strong) NSMutableArray* startupPluginNames;
29
- @property (nonatomic, readonly, strong) NSString* startPage;
30
-
31
- @end
@@ -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