@capacitor-community/camera-preview 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -13
- package/android/.gradle/8.0.2/checksums/checksums.lock +0 -0
- package/android/.gradle/{4.10.1/fileHashes/fileHashes.bin → 8.0.2/checksums/md5-checksums.bin} +0 -0
- package/android/.gradle/8.0.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.0.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.0.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/8.0.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.0.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.0.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.0.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/8.0.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/build.gradle +10 -8
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -2
- package/android/gradle.properties +1 -1
- package/android/gradlew +14 -4
- package/android/gradlew.bat +34 -32
- package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +3 -3
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +5 -7
- package/dist/esm/definitions.d.ts +4 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +3 -3
- package/dist/esm/web.js +14 -10
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +155 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +158 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/CameraController.swift +1 -1
- package/ios/Plugin/Plugin.swift +5 -5
- package/ios/Podfile +7 -4
- package/ios/Podfile.lock +9 -10
- package/ios/Pods/CapacitorCordova/LICENSE +23 -0
- package/ios/Pods/CapacitorCordova/README.md +39 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/CapacitorCordova.h +21 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.h +8 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.m +5 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDV.h +28 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVAvailability.h +109 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegate.h +51 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.h +39 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m +154 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.h +31 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.m +81 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.h +52 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.m +116 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.h +81 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.m +154 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.h +25 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.m +77 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.h +82 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.m +216 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVScreenOrientationDelegate.h +33 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.h +41 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.m +399 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.h +27 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.m +74 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.h +27 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.m +156 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.h +30 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.m +34 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.h +35 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.m +63 -0
- package/ios/Pods/Local Podspecs/Capacitor.podspec.json +34 -0
- package/ios/Pods/Local Podspecs/CapacitorCordova.podspec.json +26 -0
- package/ios/Pods/Manifest.lock +22 -0
- package/ios/Pods/Pods.xcodeproj/project.pbxproj +1374 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/Capacitor.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/CapacitorCordova.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/Pods-Plugin.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/Pods-PluginTests.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor-prefix.pch +12 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor.debug.xcconfig +15 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor.modulemap +8 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor.release.xcconfig +15 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-Info.plist +26 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-dummy.m +5 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-prefix.pch +12 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-umbrella.h +32 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.debug.xcconfig +12 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.modulemap +6 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.release.xcconfig +12 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.markdown +53 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.plist +91 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-umbrella.h +16 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig +14 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.modulemap +6 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig +14 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.markdown +53 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.plist +91 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh +188 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-umbrella.h +16 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig +15 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.modulemap +6 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig +15 -0
- package/package.json +19 -9
- package/android/.gradle/4.10.1/fileHashes/fileHashes.lock +0 -0
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -20
- package/android/.idea/jarRepositories.xml +0 -45
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_3_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_2_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_3_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_core_core_1_3_2_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_core_core_1_5_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_exifinterface_exifinterface_1_3_2_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_4_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_1.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_core_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_2_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_monitor_1_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_monitor_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_runner_1_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_runner_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_tracing_tracing_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1.xml +0 -9
- package/android/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1.xml +0 -9
- package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +0 -9
- package/android/.idea/libraries/Gradle__junit_junit_4_12.xml +0 -9
- package/android/.idea/libraries/Gradle__junit_junit_4_13_1.xml +0 -9
- package/android/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_10_18.xml +0 -9
- package/android/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_10_18.xml +0 -9
- package/android/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0.xml +0 -9
- package/android/.idea/libraries/Gradle__org_apache_cordova_framework_7_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +0 -9
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3.xml +0 -9
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3.xml +0 -9
- package/android/.idea/libraries/Gradle__org_json_json_20140107.xml +0 -9
- package/android/.idea/libraries/Gradle__org_mockito_mockito_core_3_6_28.xml +0 -9
- package/android/.idea/libraries/Gradle__org_mockito_mockito_inline_3_6_28.xml +0 -9
- package/android/.idea/libraries/Gradle__org_objenesis_objenesis_3_1.xml +0 -9
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules/1419750366/android.capacitor-android.iml +0 -92
- package/android/.idea/modules/android.iml +0 -87
- package/android/.idea/modules.xml +0 -9
- package/android/.idea/vcs.xml +0 -6
- /package/android/.gradle/{4.10.1 → 8.0.2/dependencies-accessors}/gc.properties +0 -0
- /package/android/.gradle/{4.10.1 → 8.0.2}/fileChanges/last-build.bin +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
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 "CDVUserAgentUtil.h"
|
|
21
|
+
|
|
22
|
+
#import <UIKit/UIKit.h>
|
|
23
|
+
|
|
24
|
+
// #define VerboseLog NSLog
|
|
25
|
+
#define VerboseLog(...) do {} while (0)
|
|
26
|
+
|
|
27
|
+
static NSString* const kCdvUserAgentKey = @"Cordova-User-Agent";
|
|
28
|
+
static NSString* const kCdvUserAgentVersionKey = @"Cordova-User-Agent-Version";
|
|
29
|
+
|
|
30
|
+
static NSString* gOriginalUserAgent = nil;
|
|
31
|
+
static NSInteger gNextLockToken = 0;
|
|
32
|
+
static NSInteger gCurrentLockToken = 0;
|
|
33
|
+
static NSMutableArray* gPendingSetUserAgentBlocks = nil;
|
|
34
|
+
|
|
35
|
+
#import <WebKit/WebKit.h>
|
|
36
|
+
|
|
37
|
+
@interface WKWebView(SynchronousEvaluateJavaScript)
|
|
38
|
+
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
|
|
39
|
+
@end
|
|
40
|
+
|
|
41
|
+
@implementation WKWebView(SynchronousEvaluateJavaScript)
|
|
42
|
+
|
|
43
|
+
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
|
|
44
|
+
{
|
|
45
|
+
__block NSString *resultString = nil;
|
|
46
|
+
__block BOOL finished = NO;
|
|
47
|
+
|
|
48
|
+
[self evaluateJavaScript:script completionHandler:^(id result, NSError *error) {
|
|
49
|
+
if (error == nil) {
|
|
50
|
+
if (result != nil) {
|
|
51
|
+
resultString = [NSString stringWithFormat:@"%@", result];
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
NSLog(@"evaluateJavaScript error : %@", error.localizedDescription);
|
|
55
|
+
}
|
|
56
|
+
finished = YES;
|
|
57
|
+
}];
|
|
58
|
+
|
|
59
|
+
while (!finished) {
|
|
60
|
+
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return resultString;
|
|
64
|
+
}
|
|
65
|
+
@end
|
|
66
|
+
|
|
67
|
+
@implementation CDVUserAgentUtil
|
|
68
|
+
|
|
69
|
+
+ (NSString*)originalUserAgent
|
|
70
|
+
{
|
|
71
|
+
if (gOriginalUserAgent == nil) {
|
|
72
|
+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppLocaleDidChange:)
|
|
73
|
+
name:NSCurrentLocaleDidChangeNotification object:nil];
|
|
74
|
+
|
|
75
|
+
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
|
|
76
|
+
NSString* systemVersion = [[UIDevice currentDevice] systemVersion];
|
|
77
|
+
NSString* localeStr = [[NSLocale currentLocale] localeIdentifier];
|
|
78
|
+
// Record the model since simulator can change it without re-install (CB-5420).
|
|
79
|
+
NSString* model = [UIDevice currentDevice].model;
|
|
80
|
+
// Record the version of the app so that we can bust the cache when it changes (CB-10078)
|
|
81
|
+
NSString* appVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"];
|
|
82
|
+
NSString* systemAndLocale = [NSString stringWithFormat:@"%@ %@ %@ %@", appVersion, model, systemVersion, localeStr];
|
|
83
|
+
|
|
84
|
+
NSString* cordovaUserAgentVersion = [userDefaults stringForKey:kCdvUserAgentVersionKey];
|
|
85
|
+
gOriginalUserAgent = [userDefaults stringForKey:kCdvUserAgentKey];
|
|
86
|
+
BOOL cachedValueIsOld = ![systemAndLocale isEqualToString:cordovaUserAgentVersion];
|
|
87
|
+
|
|
88
|
+
if ((gOriginalUserAgent == nil) || cachedValueIsOld) {
|
|
89
|
+
WKWebView* sampleWebView = [[WKWebView alloc] initWithFrame:CGRectZero];
|
|
90
|
+
gOriginalUserAgent = [sampleWebView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
|
|
91
|
+
|
|
92
|
+
[userDefaults setObject:gOriginalUserAgent forKey:kCdvUserAgentKey];
|
|
93
|
+
[userDefaults setObject:systemAndLocale forKey:kCdvUserAgentVersionKey];
|
|
94
|
+
|
|
95
|
+
[userDefaults synchronize];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return gOriginalUserAgent;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
+ (void)onAppLocaleDidChange:(NSNotification*)notification
|
|
102
|
+
{
|
|
103
|
+
// TODO: We should figure out how to update the user-agent of existing UIWebViews when this happens.
|
|
104
|
+
// Maybe use the PDF bug (noted in setUserAgent:).
|
|
105
|
+
gOriginalUserAgent = nil;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
+ (void)acquireLock:(void (^)(NSInteger lockToken))block
|
|
109
|
+
{
|
|
110
|
+
if (gCurrentLockToken == 0) {
|
|
111
|
+
gCurrentLockToken = ++gNextLockToken;
|
|
112
|
+
VerboseLog(@"Gave lock %d", gCurrentLockToken);
|
|
113
|
+
block(gCurrentLockToken);
|
|
114
|
+
} else {
|
|
115
|
+
if (gPendingSetUserAgentBlocks == nil) {
|
|
116
|
+
gPendingSetUserAgentBlocks = [[NSMutableArray alloc] initWithCapacity:4];
|
|
117
|
+
}
|
|
118
|
+
VerboseLog(@"Waiting for lock");
|
|
119
|
+
[gPendingSetUserAgentBlocks addObject:block];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
+ (void)releaseLock:(NSInteger*)lockToken
|
|
124
|
+
{
|
|
125
|
+
if (lockToken == nil || *lockToken == 0) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
NSAssert(gCurrentLockToken == *lockToken, @"Got token %ld, expected %ld", (long)*lockToken, (long)gCurrentLockToken);
|
|
129
|
+
|
|
130
|
+
VerboseLog(@"Released lock %d", *lockToken);
|
|
131
|
+
if ([gPendingSetUserAgentBlocks count] > 0) {
|
|
132
|
+
void (^block)(NSInteger lockToken) = [gPendingSetUserAgentBlocks objectAtIndex:0];
|
|
133
|
+
[gPendingSetUserAgentBlocks removeObjectAtIndex:0];
|
|
134
|
+
gCurrentLockToken = ++gNextLockToken;
|
|
135
|
+
NSLog(@"Gave lock %ld", (long)gCurrentLockToken);
|
|
136
|
+
block(gCurrentLockToken);
|
|
137
|
+
} else {
|
|
138
|
+
gCurrentLockToken = 0;
|
|
139
|
+
}
|
|
140
|
+
*lockToken = 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
+ (void)setUserAgent:(NSString*)value lockToken:(NSInteger)lockToken
|
|
144
|
+
{
|
|
145
|
+
NSAssert(gCurrentLockToken == lockToken, @"Got token %ld, expected %ld", (long)lockToken, (long)gCurrentLockToken);
|
|
146
|
+
VerboseLog(@"User-Agent set to: %@", value);
|
|
147
|
+
|
|
148
|
+
// Setting the UserAgent must occur before a UIWebView is instantiated.
|
|
149
|
+
// It is read per instantiation, so it does not affect previously created views.
|
|
150
|
+
// Except! When a PDF is loaded, all currently active UIWebViews reload their
|
|
151
|
+
// User-Agent from the NSUserDefaults some time after the DidFinishLoad of the PDF bah!
|
|
152
|
+
NSDictionary* dict = [[NSDictionary alloc] initWithObjectsAndKeys:value, @"UserAgent", nil];
|
|
153
|
+
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@end
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
|
|
22
|
+
@interface CDVViewController : UIViewController
|
|
23
|
+
|
|
24
|
+
@property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects;
|
|
25
|
+
@property (nonatomic, readonly, strong) NSMutableDictionary* settings;
|
|
26
|
+
@property (nonatomic, readonly, weak) UIView* webView;
|
|
27
|
+
|
|
28
|
+
- (id) getCommandInstance:(NSString*)className;
|
|
29
|
+
|
|
30
|
+
@end
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
|
|
21
|
+
#import "CDVViewController.h"
|
|
22
|
+
|
|
23
|
+
@interface CDVViewController () {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginObjects;
|
|
29
|
+
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
@implementation CDVViewController
|
|
33
|
+
|
|
34
|
+
@end
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
|
|
23
|
+
@interface NSDictionary (CordovaPreferences)
|
|
24
|
+
|
|
25
|
+
- (id)cordovaSettingForKey:(NSString*)key;
|
|
26
|
+
- (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue;
|
|
27
|
+
- (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue;
|
|
28
|
+
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
@interface NSMutableDictionary (CordovaPreferences)
|
|
32
|
+
|
|
33
|
+
- (void)setCordovaSetting:(id)value forKey:(NSString*)key;
|
|
34
|
+
|
|
35
|
+
@end
|
|
@@ -0,0 +1,63 @@
|
|
|
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 "NSDictionary+CordovaPreferences.h"
|
|
21
|
+
#import <Foundation/Foundation.h>
|
|
22
|
+
|
|
23
|
+
@implementation NSDictionary (CordovaPreferences)
|
|
24
|
+
|
|
25
|
+
- (id)cordovaSettingForKey:(NSString*)key
|
|
26
|
+
{
|
|
27
|
+
return [self objectForKey:[key lowercaseString]];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue
|
|
31
|
+
{
|
|
32
|
+
BOOL value = defaultValue;
|
|
33
|
+
id prefObj = [self cordovaSettingForKey:key];
|
|
34
|
+
|
|
35
|
+
if (prefObj != nil) {
|
|
36
|
+
value = [(NSNumber*)prefObj boolValue];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue
|
|
43
|
+
{
|
|
44
|
+
CGFloat value = defaultValue;
|
|
45
|
+
id prefObj = [self cordovaSettingForKey:key];
|
|
46
|
+
|
|
47
|
+
if (prefObj != nil) {
|
|
48
|
+
value = [prefObj floatValue];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@end
|
|
55
|
+
|
|
56
|
+
@implementation NSMutableDictionary (CordovaPreferences)
|
|
57
|
+
|
|
58
|
+
- (void)setCordovaSetting:(id)value forKey:(NSString*)key
|
|
59
|
+
{
|
|
60
|
+
[self setObject:value forKey:[key lowercaseString]];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Capacitor",
|
|
3
|
+
"version": "5.0.3",
|
|
4
|
+
"summary": "Capacitor for iOS",
|
|
5
|
+
"social_media_url": "https://twitter.com/capacitorjs",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://capacitorjs.com/",
|
|
8
|
+
"platforms": {
|
|
9
|
+
"ios": "13.0"
|
|
10
|
+
},
|
|
11
|
+
"authors": {
|
|
12
|
+
"Ionic Team": "hi@ionicframework.com"
|
|
13
|
+
},
|
|
14
|
+
"source": {
|
|
15
|
+
"git": "https://github.com/ionic-team/capacitor.git",
|
|
16
|
+
"tag": "5.0.3"
|
|
17
|
+
},
|
|
18
|
+
"source_files": [
|
|
19
|
+
"Capacitor/Capacitor/*.{swift,h,m}",
|
|
20
|
+
"Capacitor/Capacitor/Plugins/*.{swift,h,m}",
|
|
21
|
+
"Capacitor/Capacitor/Plugins/**/*.{swift,h,m}"
|
|
22
|
+
],
|
|
23
|
+
"module_map": "Capacitor/Capacitor/Capacitor.modulemap",
|
|
24
|
+
"resources": [
|
|
25
|
+
"Capacitor/Capacitor/assets/native-bridge.js"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"CapacitorCordova": [
|
|
29
|
+
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"swift_versions": "5.1",
|
|
33
|
+
"swift_version": "5.1"
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "CapacitorCordova",
|
|
3
|
+
"module_name": "Cordova",
|
|
4
|
+
"version": "5.0.3",
|
|
5
|
+
"summary": "Capacitor Cordova Compatibility Layer",
|
|
6
|
+
"homepage": "https://capacitorjs.com",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"authors": {
|
|
9
|
+
"Ionic Team": "hi@ionicframework.com"
|
|
10
|
+
},
|
|
11
|
+
"source": {
|
|
12
|
+
"git": "https://github.com/ionic-team/capacitor",
|
|
13
|
+
"tag": "5.0.3"
|
|
14
|
+
},
|
|
15
|
+
"platforms": {
|
|
16
|
+
"ios": "13.0"
|
|
17
|
+
},
|
|
18
|
+
"source_files": "CapacitorCordova/CapacitorCordova/**/*.{h,m}",
|
|
19
|
+
"public_header_files": [
|
|
20
|
+
"CapacitorCordova/CapacitorCordova/Classes/Public/*.h",
|
|
21
|
+
"CapacitorCordova/CapacitorCordova/CapacitorCordova.h"
|
|
22
|
+
],
|
|
23
|
+
"module_map": "CapacitorCordova/CapacitorCordova/CapacitorCordova.modulemap",
|
|
24
|
+
"requires_arc": true,
|
|
25
|
+
"frameworks": "WebKit"
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
PODS:
|
|
2
|
+
- Capacitor (5.0.3):
|
|
3
|
+
- CapacitorCordova
|
|
4
|
+
- CapacitorCordova (5.0.3)
|
|
5
|
+
|
|
6
|
+
DEPENDENCIES:
|
|
7
|
+
- "Capacitor (from `../node_modules/@capacitor/ios`)"
|
|
8
|
+
- "CapacitorCordova (from `../node_modules/@capacitor/ios`)"
|
|
9
|
+
|
|
10
|
+
EXTERNAL SOURCES:
|
|
11
|
+
Capacitor:
|
|
12
|
+
:path: "../node_modules/@capacitor/ios"
|
|
13
|
+
CapacitorCordova:
|
|
14
|
+
:path: "../node_modules/@capacitor/ios"
|
|
15
|
+
|
|
16
|
+
SPEC CHECKSUMS:
|
|
17
|
+
Capacitor: 304a960e431f9e6f78556554ca71c41c1b2b9680
|
|
18
|
+
CapacitorCordova: def732a63679698df6fb392bbe6d269a0b61e937
|
|
19
|
+
|
|
20
|
+
PODFILE CHECKSUM: 14e8b2400457751b865e1c327e7cfa1c6fa67da6
|
|
21
|
+
|
|
22
|
+
COCOAPODS: 1.11.3
|