@@ -19,7 +19,9 @@ Licensed to the Apache Software Foundation (ASF) under one
1919
2020#import " CDVInAppBrowser.h"
2121#import " CDVInAppBrowserOptions.h"
22+ #if !WK_WEB_VIEW_ONLY
2223#import " CDVUIInAppBrowser.h"
24+ #endif
2325#import " CDVWKInAppBrowser.h"
2426#import < Cordova/CDVPluginResult.h>
2527
@@ -49,86 +51,122 @@ - (void)open:(CDVInvokedUrlCommand*)command
4951 return ;
5052 }
5153 self.usewkwebview = browserOptions.usewkwebview ;
52- if (self.usewkwebview ){
53- [[CDVWKInAppBrowser getInstance ] open: command];
54- }else {
55- [[CDVUIInAppBrowser getInstance ] open: command];
56- }
54+ #if WK_WEB_VIEW_ONLY
55+ [[CDVWKInAppBrowser getInstance ] open: command];
56+ #else
57+ if (self.usewkwebview ){
58+ [[CDVWKInAppBrowser getInstance ] open: command];
59+ }else {
60+ [[CDVUIInAppBrowser getInstance ] open: command];
61+ }
62+ #endif
5763}
5864
5965- (void )close : (CDVInvokedUrlCommand*)command
6066{
61- if (self.usewkwebview ){
62- [[CDVWKInAppBrowser getInstance ] close: command];
63- }else {
64- [[CDVUIInAppBrowser getInstance ] close: command];
65- }
67+ #if WK_WEB_VIEW_ONLY
68+ [[CDVWKInAppBrowser getInstance ] close: command];
69+ #else
70+ if (self.usewkwebview ){
71+ [[CDVWKInAppBrowser getInstance ] close: command];
72+ }else {
73+ [[CDVUIInAppBrowser getInstance ] close: command];
74+ }
75+ #endif
6676}
6777
6878
6979- (void )show : (CDVInvokedUrlCommand*)command
7080{
71- if (self.usewkwebview ){
72- [[CDVWKInAppBrowser getInstance ] show: command];
73- }else {
74- [[CDVUIInAppBrowser getInstance ] show: command];
75- }
81+ #if WK_WEB_VIEW_ONLY
82+ [[CDVWKInAppBrowser getInstance ] show: command];
83+ #else
84+ if (self.usewkwebview ){
85+ [[CDVWKInAppBrowser getInstance ] show: command];
86+ }else {
87+ [[CDVUIInAppBrowser getInstance ] show: command];
88+ }
89+ #endif
7690}
7791
7892- (void )hide : (CDVInvokedUrlCommand*)command
7993{
80- if (self.usewkwebview ){
81- [[CDVWKInAppBrowser getInstance ] hide: command];
82- }else {
83- [[CDVUIInAppBrowser getInstance ] hide: command];
84- }
94+ #if WK_WEB_VIEW_ONLY
95+ [[CDVWKInAppBrowser getInstance ] hide: command];
96+ #else
97+ if (self.usewkwebview ){
98+ [[CDVWKInAppBrowser getInstance ] hide: command];
99+ }else {
100+ [[CDVUIInAppBrowser getInstance ] hide: command];
101+ }
102+ #endif
85103}
86104
87105
88106- (void )injectScriptCode : (CDVInvokedUrlCommand*)command
89107{
90- if (self.usewkwebview ){
91- [[CDVWKInAppBrowser getInstance ] injectScriptCode: command];
92- }else {
93- [[CDVUIInAppBrowser getInstance ] injectScriptCode: command];
94- }
108+ #if WK_WEB_VIEW_ONLY
109+ [[CDVWKInAppBrowser getInstance ] injectScriptCode: command];
110+ #else
111+ if (self.usewkwebview ){
112+ [[CDVWKInAppBrowser getInstance ] injectScriptCode: command];
113+ }else {
114+ [[CDVUIInAppBrowser getInstance ] injectScriptCode: command];
115+ }
116+ #endif
95117}
96118
97119- (void )injectScriptFile : (CDVInvokedUrlCommand*)command
98120{
99- if (self.usewkwebview ){
100- [[CDVWKInAppBrowser getInstance ] injectScriptFile: command];
101- }else {
102- [[CDVUIInAppBrowser getInstance ] injectScriptFile: command];
103- }
121+ #if WK_WEB_VIEW_ONLY
122+ [[CDVWKInAppBrowser getInstance ] injectScriptCode: command];
123+ #else
124+ if (self.usewkwebview ){
125+ [[CDVWKInAppBrowser getInstance ] injectScriptCode: command];
126+ }else {
127+ [[CDVUIInAppBrowser getInstance ] injectScriptCode: command];
128+ }
129+ #endif
104130}
105131
106132- (void )injectStyleCode : (CDVInvokedUrlCommand*)command
107133{
108- if (self.usewkwebview ){
109- [[CDVWKInAppBrowser getInstance ] injectStyleCode: command];
110- }else {
111- [[CDVUIInAppBrowser getInstance ] injectStyleCode: command];
112- }
134+ #if WK_WEB_VIEW_ONLY
135+ [[CDVWKInAppBrowser getInstance ] injectStyleCode: command];
136+ #else
137+ if (self.usewkwebview ){
138+ [[CDVWKInAppBrowser getInstance ] injectStyleCode: command];
139+ }else {
140+ [[CDVUIInAppBrowser getInstance ] injectStyleCode: command];
141+ }
142+ #endif
113143}
114144
115145- (void )injectStyleFile : (CDVInvokedUrlCommand*)command
116146{
117- if (self.usewkwebview ){
118- [[CDVWKInAppBrowser getInstance ] injectStyleFile: command];
119- }else {
120- [[CDVUIInAppBrowser getInstance ] injectStyleFile: command];
121- }
147+ #if WK_WEB_VIEW_ONLY
148+ [[CDVWKInAppBrowser getInstance ] injectStyleFile: command];
149+ #else
150+ if (self.usewkwebview ){
151+ [[CDVWKInAppBrowser getInstance ] injectStyleFile: command];
152+ }else {
153+ [[CDVUIInAppBrowser getInstance ] injectStyleFile: command];
154+ }
155+ #endif
122156}
123157
124158- (void )loadAfterBeforeload : (CDVInvokedUrlCommand*)command
125159{
126- if (self.usewkwebview ){
127- [[CDVWKInAppBrowser getInstance ] loadAfterBeforeload: command];
128- }else {
129- [[CDVUIInAppBrowser getInstance ] loadAfterBeforeload: command];
130- }
160+ #if WK_WEB_VIEW_ONLY
161+ [[CDVWKInAppBrowser getInstance ] loadAfterBeforeload: command];
162+ #else
163+ if (self.usewkwebview ){
164+ [[CDVWKInAppBrowser getInstance ] loadAfterBeforeload: command];
165+ }else {
166+ [[CDVUIInAppBrowser getInstance ] loadAfterBeforeload: command];
167+ }
168+ #endif
131169}
132170
133171
134- @end
172+ @end
0 commit comments