UNPKG

4.06 kBtext/x-cView Raw
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 <Cordova/CDVPlugin.h>
21#import <Cordova/CDVInvokedUrlCommand.h>
22#import <Cordova/CDVScreenOrientationDelegate.h>
23
24#ifdef __CORDOVA_4_0_0
25 #import <Cordova/CDVUIWebViewDelegate.h>
26#else
27 #import <Cordova/CDVWebViewDelegate.h>
28#endif
29
30@class CDVInAppBrowserViewController;
31
32@interface CDVInAppBrowser : CDVPlugin {
33}
34
35@property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController;
36@property (nonatomic, copy) NSString* callbackId;
37@property (nonatomic, copy) NSRegularExpression *callbackIdPattern;
38
39- (void)open:(CDVInvokedUrlCommand*)command;
40- (void)close:(CDVInvokedUrlCommand*)command;
41- (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
42- (void)show:(CDVInvokedUrlCommand*)command;
43- (void)hide:(CDVInvokedUrlCommand*)command;
44
45@end
46
47@interface CDVInAppBrowserOptions : NSObject {}
48
49@property (nonatomic, assign) BOOL location;
50@property (nonatomic, assign) BOOL toolbar;
51@property (nonatomic, copy) NSString* closebuttoncaption;
52@property (nonatomic, copy) NSString* toolbarposition;
53@property (nonatomic, assign) BOOL clearcache;
54@property (nonatomic, assign) BOOL clearsessioncache;
55
56@property (nonatomic, copy) NSString* presentationstyle;
57@property (nonatomic, copy) NSString* transitionstyle;
58
59@property (nonatomic, assign) BOOL enableviewportscale;
60@property (nonatomic, assign) BOOL mediaplaybackrequiresuseraction;
61@property (nonatomic, assign) BOOL allowinlinemediaplayback;
62@property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction;
63@property (nonatomic, assign) BOOL suppressesincrementalrendering;
64@property (nonatomic, assign) BOOL hidden;
65@property (nonatomic, assign) BOOL disallowoverscroll;
66
67+ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options;
68
69@end
70
71@interface CDVInAppBrowserViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
72 @private
73 NSString* _userAgent;
74 NSString* _prevUserAgent;
75 NSInteger _userAgentLockToken;
76 CDVInAppBrowserOptions *_browserOptions;
77
78#ifdef __CORDOVA_4_0_0
79 CDVUIWebViewDelegate* _webViewDelegate;
80#else
81 CDVWebViewDelegate* _webViewDelegate;
82#endif
83
84}
85
86@property (nonatomic, strong) IBOutlet UIWebView* webView;
87@property (nonatomic, strong) IBOutlet UIBarButtonItem* closeButton;
88@property (nonatomic, strong) IBOutlet UILabel* addressLabel;
89@property (nonatomic, strong) IBOutlet UIBarButtonItem* backButton;
90@property (nonatomic, strong) IBOutlet UIBarButtonItem* forwardButton;
91@property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner;
92@property (nonatomic, strong) IBOutlet UIToolbar* toolbar;
93
94@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
95@property (nonatomic, weak) CDVInAppBrowser* navigationDelegate;
96@property (nonatomic) NSURL* currentURL;
97
98- (void)close;
99- (void)navigateTo:(NSURL*)url;
100- (void)showLocationBar:(BOOL)show;
101- (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition;
102- (void)setCloseButtonTitle:(NSString*)title;
103
104- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions;
105
106@end
107
108@interface CDVInAppBrowserNavigationController : UINavigationController
109
110@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
111
112@end
113