cordova-plugin-inappbrowser-patch 6.0.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +2 -2
- package/README.md +51 -24
- package/RELEASENOTES.md +4 -4
- package/eslint.config.js +45 -0
- package/licence_checker.yml +19 -0
- package/package.json +12 -7
- package/plugin.xml +20 -19
- package/src/android/InAppBrowser.java +20 -18
- package/src/android/InAppBrowserDialog.java +18 -17
- package/src/android/InAppChromeClient.java +18 -17
- package/src/browser/InAppBrowserProxy.js +24 -26
- package/src/ios/CDVInAppBrowserNavigationController.h +16 -20
- package/src/ios/CDVInAppBrowserNavigationController.m +23 -50
- package/src/ios/CDVInAppBrowserOptions.h +27 -27
- package/src/ios/CDVInAppBrowserOptions.m +25 -25
- package/src/ios/CDVWKInAppBrowser.h +56 -49
- package/src/ios/CDVWKInAppBrowser.m +492 -567
- package/src/ios/CDVWKInAppBrowserUIDelegate.h +20 -20
- package/src/ios/CDVWKInAppBrowserUIDelegate.m +43 -43
- package/types/index.d.ts +7 -5
- package/www/inappbrowser.js +18 -20
|
@@ -1,63 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
19
|
|
|
20
20
|
#import "CDVInAppBrowserNavigationController.h"
|
|
21
21
|
|
|
22
22
|
@implementation CDVInAppBrowserNavigationController : UINavigationController
|
|
23
23
|
|
|
24
|
-
- (void)
|
|
25
|
-
if ( self.presentedViewController) {
|
|
26
|
-
[super dismissViewControllerAnimated:flag completion:completion];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
- (void) viewDidLoad {
|
|
31
|
-
[super viewDidLoad];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
- (CGRect) invertFrameIfNeeded:(CGRect)rect {
|
|
35
|
-
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) {
|
|
36
|
-
CGFloat temp = rect.size.width;
|
|
37
|
-
rect.size.width = rect.size.height;
|
|
38
|
-
rect.size.height = temp;
|
|
39
|
-
}
|
|
40
|
-
rect.origin = CGPointZero;
|
|
41
|
-
return rect;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
#pragma mark CDVScreenOrientationDelegate
|
|
45
|
-
|
|
46
|
-
- (BOOL)shouldAutorotate
|
|
24
|
+
- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion
|
|
47
25
|
{
|
|
48
|
-
if (
|
|
49
|
-
|
|
26
|
+
if (self.presentedViewController) {
|
|
27
|
+
[super dismissViewControllerAnimated:flag completion:completion];
|
|
50
28
|
}
|
|
51
|
-
return YES;
|
|
52
29
|
}
|
|
53
30
|
|
|
54
|
-
- (
|
|
31
|
+
- (void)viewDidLoad
|
|
55
32
|
{
|
|
56
|
-
|
|
57
|
-
return [self.orientationDelegate supportedInterfaceOrientations];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return 1 << UIInterfaceOrientationPortrait;
|
|
33
|
+
[super viewDidLoad];
|
|
61
34
|
}
|
|
62
35
|
|
|
63
36
|
@end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
19
|
|
|
20
20
|
#import <Foundation/Foundation.h>
|
|
21
21
|
|
|
@@ -23,29 +23,29 @@
|
|
|
23
23
|
|
|
24
24
|
@property (nonatomic, assign) BOOL location;
|
|
25
25
|
@property (nonatomic, assign) BOOL toolbar;
|
|
26
|
-
@property (nonatomic, copy) NSString*
|
|
27
|
-
@property (nonatomic, copy) NSString*
|
|
26
|
+
@property (nonatomic, copy) NSString *closebuttoncaption;
|
|
27
|
+
@property (nonatomic, copy) NSString *closebuttoncolor;
|
|
28
28
|
@property (nonatomic, assign) BOOL lefttoright;
|
|
29
|
-
@property (nonatomic, copy) NSString*
|
|
30
|
-
@property (nonatomic, copy) NSString*
|
|
29
|
+
@property (nonatomic, copy) NSString *toolbarposition;
|
|
30
|
+
@property (nonatomic, copy) NSString *toolbarcolor;
|
|
31
31
|
@property (nonatomic, assign) BOOL toolbartranslucent;
|
|
32
32
|
@property (nonatomic, assign) BOOL hidenavigationbuttons;
|
|
33
|
-
@property (nonatomic, copy) NSString*
|
|
33
|
+
@property (nonatomic, copy) NSString *navigationbuttoncolor;
|
|
34
34
|
@property (nonatomic, assign) BOOL cleardata;
|
|
35
35
|
@property (nonatomic, assign) BOOL clearcache;
|
|
36
36
|
@property (nonatomic, assign) BOOL clearsessioncache;
|
|
37
37
|
@property (nonatomic, assign) BOOL hidespinner;
|
|
38
38
|
|
|
39
|
-
@property (nonatomic, copy) NSString*
|
|
40
|
-
@property (nonatomic, copy) NSString*
|
|
39
|
+
@property (nonatomic, copy) NSString *presentationstyle;
|
|
40
|
+
@property (nonatomic, copy) NSString *transitionstyle;
|
|
41
41
|
|
|
42
42
|
@property (nonatomic, assign) BOOL enableviewportscale;
|
|
43
43
|
@property (nonatomic, assign) BOOL mediaplaybackrequiresuseraction;
|
|
44
44
|
@property (nonatomic, assign) BOOL allowinlinemediaplayback;
|
|
45
45
|
@property (nonatomic, assign) BOOL hidden;
|
|
46
46
|
@property (nonatomic, assign) BOOL disallowoverscroll;
|
|
47
|
-
@property (nonatomic, copy) NSString*
|
|
47
|
+
@property (nonatomic, copy) NSString *beforeload;
|
|
48
48
|
|
|
49
|
-
+ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options;
|
|
49
|
+
+ (CDVInAppBrowserOptions *)parseOptions:(NSString *)options;
|
|
50
50
|
|
|
51
51
|
@end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
9
|
|
|
10
|
-
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
19
|
|
|
20
20
|
#import "CDVInAppBrowserOptions.h"
|
|
21
21
|
|
|
@@ -50,24 +50,24 @@
|
|
|
50
50
|
return self;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
+ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options
|
|
53
|
+
+ (CDVInAppBrowserOptions *)parseOptions:(NSString *)options
|
|
54
54
|
{
|
|
55
|
-
CDVInAppBrowserOptions*
|
|
55
|
+
CDVInAppBrowserOptions *obj = [[CDVInAppBrowserOptions alloc] init];
|
|
56
56
|
|
|
57
57
|
// NOTE: this parsing does not handle quotes within values
|
|
58
|
-
NSArray*
|
|
58
|
+
NSArray *pairs = [options componentsSeparatedByString:@","];
|
|
59
59
|
|
|
60
60
|
// parse keys and values, set the properties
|
|
61
|
-
for (NSString*
|
|
62
|
-
NSArray*
|
|
61
|
+
for (NSString *pair in pairs) {
|
|
62
|
+
NSArray *keyvalue = [pair componentsSeparatedByString:@"="];
|
|
63
63
|
|
|
64
64
|
if ([keyvalue count] == 2) {
|
|
65
|
-
NSString*
|
|
66
|
-
NSString*
|
|
67
|
-
NSString*
|
|
65
|
+
NSString *key = [[keyvalue objectAtIndex:0] lowercaseString];
|
|
66
|
+
NSString *value = [keyvalue objectAtIndex:1];
|
|
67
|
+
NSString *value_lc = [value lowercaseString];
|
|
68
68
|
|
|
69
69
|
BOOL isBoolean = [value_lc isEqualToString:@"yes"] || [value_lc isEqualToString:@"no"];
|
|
70
|
-
NSNumberFormatter*
|
|
70
|
+
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
|
|
71
71
|
[numberFormatter setAllowsFloats:YES];
|
|
72
72
|
BOOL isNumber = [numberFormatter numberFromString:value_lc] != nil;
|
|
73
73
|
|
|
@@ -1,80 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
9
|
|
|
10
|
-
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
19
|
|
|
20
20
|
#import <Cordova/CDVPlugin.h>
|
|
21
21
|
#import <Cordova/CDVInvokedUrlCommand.h>
|
|
22
|
-
#
|
|
22
|
+
#ifndef __CORDOVA_8_0_0
|
|
23
|
+
#import <Cordova/NSDictionary+CordovaPreferences.h>
|
|
24
|
+
// cordova-ios 8 introduced CDVSettingsDictionary, which should be used
|
|
25
|
+
// instead of NSDictionary+CordovaPreferences
|
|
26
|
+
// For cordova-ios 7 and earlier, we create a type alias for NSDictionary to CDVSettingsDictionary,
|
|
27
|
+
// so that a symbolic "CDVSettingsDictionary" can be used in these older cordova-ios versions.
|
|
28
|
+
typedef NSDictionary CDVSettingsDictionary;
|
|
29
|
+
#endif
|
|
23
30
|
#import "CDVWKInAppBrowserUIDelegate.h"
|
|
24
31
|
#import "CDVInAppBrowserOptions.h"
|
|
25
32
|
#import "CDVInAppBrowserNavigationController.h"
|
|
26
33
|
|
|
27
34
|
@class CDVWKInAppBrowserViewController;
|
|
28
35
|
|
|
29
|
-
@interface CDVWKInAppBrowser : CDVPlugin
|
|
36
|
+
@interface CDVWKInAppBrowser : CDVPlugin
|
|
37
|
+
{
|
|
30
38
|
UIWindow * tmpWindow;
|
|
31
39
|
|
|
32
40
|
@private
|
|
33
|
-
NSString*
|
|
41
|
+
NSString *_beforeload;
|
|
34
42
|
BOOL _waitForBeforeload;
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
@property (nonatomic, retain)
|
|
38
|
-
@property (nonatomic,
|
|
39
|
-
@property (nonatomic, copy) NSString* callbackId;
|
|
40
|
-
@property (nonatomic, copy) NSRegularExpression *callbackIdPattern;
|
|
45
|
+
@property (nonatomic, retain) CDVWKInAppBrowserViewController *inAppBrowserViewController;
|
|
46
|
+
@property (nonatomic, copy) NSString *callbackId;
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
- (void)
|
|
44
|
-
- (void)
|
|
45
|
-
- (void)
|
|
46
|
-
- (void)
|
|
47
|
-
- (void)
|
|
48
|
-
- (void)loadAfterBeforeload:(CDVInvokedUrlCommand*)command;
|
|
48
|
+
- (void)open:(CDVInvokedUrlCommand *)command;
|
|
49
|
+
- (void)close:(CDVInvokedUrlCommand *)command;
|
|
50
|
+
- (void)injectScriptCode:(CDVInvokedUrlCommand *)command;
|
|
51
|
+
- (void)show:(CDVInvokedUrlCommand *)command;
|
|
52
|
+
- (void)hide:(CDVInvokedUrlCommand *)command;
|
|
53
|
+
- (void)loadAfterBeforeload:(CDVInvokedUrlCommand *)command;
|
|
49
54
|
|
|
50
55
|
@end
|
|
51
56
|
|
|
52
|
-
@interface CDVWKInAppBrowserViewController : UIViewController <
|
|
57
|
+
@interface CDVWKInAppBrowserViewController : UIViewController <WKNavigationDelegate,
|
|
58
|
+
WKUIDelegate,
|
|
59
|
+
WKScriptMessageHandler,
|
|
60
|
+
UIAdaptivePresentationControllerDelegate>
|
|
61
|
+
{
|
|
53
62
|
@private
|
|
54
63
|
CDVInAppBrowserOptions *_browserOptions;
|
|
55
|
-
|
|
64
|
+
CDVSettingsDictionary *_settings;
|
|
56
65
|
}
|
|
57
66
|
|
|
58
|
-
@property (nonatomic, strong) IBOutlet WKWebView*
|
|
59
|
-
@property (nonatomic, strong) IBOutlet WKWebViewConfiguration*
|
|
60
|
-
@property (nonatomic, strong) IBOutlet UIBarButtonItem*
|
|
61
|
-
@property (nonatomic, strong) IBOutlet UILabel*
|
|
62
|
-
@property (nonatomic, strong) IBOutlet UIBarButtonItem*
|
|
63
|
-
@property (nonatomic, strong) IBOutlet UIBarButtonItem*
|
|
64
|
-
@property (nonatomic, strong) IBOutlet UIActivityIndicatorView*
|
|
65
|
-
@property (nonatomic, strong) IBOutlet UIToolbar*
|
|
66
|
-
@property (nonatomic, strong) IBOutlet CDVWKInAppBrowserUIDelegate*
|
|
67
|
+
@property (nonatomic, strong) IBOutlet WKWebView *webView;
|
|
68
|
+
@property (nonatomic, strong) IBOutlet WKWebViewConfiguration *configuration;
|
|
69
|
+
@property (nonatomic, strong) IBOutlet UIBarButtonItem *closeButton;
|
|
70
|
+
@property (nonatomic, strong) IBOutlet UILabel *addressLabel;
|
|
71
|
+
@property (nonatomic, strong) IBOutlet UIBarButtonItem *backButton;
|
|
72
|
+
@property (nonatomic, strong) IBOutlet UIBarButtonItem *forwardButton;
|
|
73
|
+
@property (nonatomic, strong) IBOutlet UIActivityIndicatorView *spinner;
|
|
74
|
+
@property (nonatomic, strong) IBOutlet UIToolbar *toolbar;
|
|
75
|
+
@property (nonatomic, strong) IBOutlet CDVWKInAppBrowserUIDelegate *webViewUIDelegate;
|
|
67
76
|
|
|
68
|
-
@property (nonatomic, weak)
|
|
69
|
-
@property (nonatomic
|
|
70
|
-
@property (nonatomic) NSURL* currentURL;
|
|
77
|
+
@property (nonatomic, weak) CDVWKInAppBrowser *navigationDelegate;
|
|
78
|
+
@property (nonatomic) NSURL *currentURL;
|
|
71
79
|
|
|
72
80
|
- (void)close;
|
|
73
|
-
- (void)navigateTo:(NSURL*)url;
|
|
81
|
+
- (void)navigateTo:(NSURL *)url;
|
|
74
82
|
- (void)showLocationBar:(BOOL)show;
|
|
75
|
-
- (void)showToolBar:(BOOL)show :
|
|
76
|
-
- (void)setCloseButtonTitle:(NSString*)title :
|
|
77
|
-
|
|
78
|
-
- (id)initWithBrowserOptions: (CDVInAppBrowserOptions*) browserOptions andSettings:(NSDictionary*) settings;
|
|
83
|
+
- (void)showToolBar:(BOOL)show atPosition:(NSString *)toolbarPosition;
|
|
84
|
+
- (void)setCloseButtonTitle:(NSString *)title withColor:(NSString *)colorString atIndex:(int)buttonIndex;
|
|
85
|
+
- (id)initWithBrowserOptions:(CDVInAppBrowserOptions *)browserOptions andSettings:(CDVSettingsDictionary *)settings;
|
|
79
86
|
|
|
80
87
|
@end
|