mirror of
https://github.com/shuto-cn/cordova-plugin-inappbrowser.git
synced 2025-04-21 07:16:22 +08:00
100 lines
3.9 KiB
Objective-C
100 lines
3.9 KiB
Objective-C
/*
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
*/
|
|
|
|
#import <Cordova/CDVPlugin.h>
|
|
#import <Cordova/CDVInvokedUrlCommand.h>
|
|
#import <Cordova/CDVScreenOrientationDelegate.h>
|
|
#import "CDVWKInAppBrowserUIDelegate.h"
|
|
#import "CDVInAppBrowserOptions.h"
|
|
#import "CDVInAppBrowserNavigationController.h"
|
|
|
|
@class CDVWKInAppBrowserViewController;
|
|
|
|
@interface CDVWKInAppBrowser : CDVPlugin {
|
|
UIWindow * tmpWindow;
|
|
|
|
@private
|
|
NSString* _beforeload;
|
|
BOOL _waitForBeforeload;
|
|
}
|
|
|
|
@property (nonatomic, retain) CDVWKInAppBrowser* instance;
|
|
@property (nonatomic, retain) CDVWKInAppBrowserViewController* inAppBrowserViewController;
|
|
@property (nonatomic, strong) IBOutlet CDVInAppBrowserOptions* browserOptions;
|
|
@property (nonatomic, copy) NSString* callbackId;
|
|
@property (nonatomic, copy) NSRegularExpression *callbackIdPattern;
|
|
|
|
@property (nonatomic) BOOL* statusbar;
|
|
|
|
+ (id) getInstance;
|
|
- (void)open:(CDVInvokedUrlCommand*)command;
|
|
- (void)close:(CDVInvokedUrlCommand*)command;
|
|
- (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
|
|
- (void)show:(CDVInvokedUrlCommand*)command;
|
|
- (void)hide:(CDVInvokedUrlCommand*)command;
|
|
- (void)back:(CDVInvokedUrlCommand*)command;
|
|
- (void)loadAfterBeforeload:(CDVInvokedUrlCommand*)command;
|
|
- (void)showStatusbar:(BOOL)show;
|
|
- (int)statusbarHieght;
|
|
|
|
@end
|
|
|
|
@interface CDVWKInAppBrowserViewController : UIViewController <CDVScreenOrientationDelegate,WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler>{
|
|
@private
|
|
CDVInAppBrowserOptions *_browserOptions;
|
|
NSDictionary *_settings;
|
|
}
|
|
|
|
@property (nonatomic, strong) IBOutlet UIViewController* parent;
|
|
@property (nonatomic, strong) IBOutlet WKWebView* webView;
|
|
@property (nonatomic, strong) IBOutlet WKWebViewConfiguration* configuration;
|
|
@property (nonatomic, strong) IBOutlet UIBarButtonItem* closeButton;
|
|
@property (nonatomic, strong) IBOutlet UILabel* addressLabel;
|
|
@property (nonatomic, strong) IBOutlet UIBarButtonItem* backButton;
|
|
@property (nonatomic, strong) IBOutlet UIBarButtonItem* forwardButton;
|
|
@property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner;
|
|
@property (nonatomic, strong) IBOutlet UIToolbar* toolbar;
|
|
@property (nonatomic, strong) IBOutlet UIView*titlebar;
|
|
@property (nonatomic, strong) IBOutlet UIButton*titleBackButton;
|
|
@property (nonatomic, strong) IBOutlet UIButton*titleCloseButton;
|
|
@property (nonatomic, strong) IBOutlet UILabel*titleTitle;
|
|
@property (nonatomic, strong) IBOutlet CDVWKInAppBrowserUIDelegate* webViewUIDelegate;
|
|
|
|
@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
|
|
@property (nonatomic, weak) CDVWKInAppBrowser* navigationDelegate;
|
|
@property (nonatomic) NSURL* currentURL;
|
|
|
|
@property (nonatomic) BOOL* statusbar;
|
|
|
|
- (void)close;
|
|
- (void)navigateTo:(NSURL*)url;
|
|
- (void)showStatusbar:(BOOL)show;
|
|
- (int)statusbarHieght;
|
|
- (void)showLocationBar:(BOOL)show;
|
|
- (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition;
|
|
- (void)setCloseButtonTitle:(NSString*)title : (NSString*) colorString : (int) buttonIndex;
|
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context;
|
|
|
|
- (id)initWithBrowserOptions: (CDVInAppBrowserOptions*) browserOptions andSettings:(NSDictionary*) settings andParent:(UIViewController*) parent;
|
|
|
|
|
|
|
|
- (void)showTitleBar:(BOOL)show;
|
|
@end
|