@@ -19,7 +19,9 @@ Licensed to the Apache Software Foundation (ASF) under one
19
19
20
20
#import " CDVInAppBrowser.h"
21
21
#import " CDVInAppBrowserOptions.h"
22
+ #if !WK_WEB_VIEW_ONLY
22
23
#import " CDVUIInAppBrowser.h"
24
+ #endif
23
25
#import " CDVWKInAppBrowser.h"
24
26
#import < Cordova/CDVPluginResult.h>
25
27
@@ -49,86 +51,122 @@ - (void)open:(CDVInvokedUrlCommand*)command
49
51
return ;
50
52
}
51
53
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
57
63
}
58
64
59
65
- (void )close : (CDVInvokedUrlCommand*)command
60
66
{
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
66
76
}
67
77
68
78
69
79
- (void )show : (CDVInvokedUrlCommand*)command
70
80
{
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
76
90
}
77
91
78
92
- (void )hide : (CDVInvokedUrlCommand*)command
79
93
{
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
85
103
}
86
104
87
105
88
106
- (void )injectScriptCode : (CDVInvokedUrlCommand*)command
89
107
{
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
95
117
}
96
118
97
119
- (void )injectScriptFile : (CDVInvokedUrlCommand*)command
98
120
{
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
104
130
}
105
131
106
132
- (void )injectStyleCode : (CDVInvokedUrlCommand*)command
107
133
{
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
113
143
}
114
144
115
145
- (void )injectStyleFile : (CDVInvokedUrlCommand*)command
116
146
{
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
122
156
}
123
157
124
158
- (void )loadAfterBeforeload : (CDVInvokedUrlCommand*)command
125
159
{
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
131
169
}
132
170
133
171
134
- @end
172
+ @end
0 commit comments