@capgo/inappbrowser 0.3.1 → 0.3.4

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.
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var core = require('@capacitor/core');
6
4
 
7
5
  exports.BackgroundColor = void 0;
@@ -18,7 +16,7 @@ exports.ToolBarType = void 0;
18
16
  })(exports.ToolBarType || (exports.ToolBarType = {}));
19
17
 
20
18
  const InAppBrowser = core.registerPlugin('InAppBrowser', {
21
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.InAppBrowserWeb()),
19
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.InAppBrowserWeb()),
22
20
  });
23
21
 
24
22
  class InAppBrowserWeb extends core.WebPlugin {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n ToolBarType[\"BLANK\"] = \"blank\";\n ToolBarType[\"DEFAULT\"] = \"\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst InAppBrowser = registerPlugin('InAppBrowser', {\n web: () => import('./web').then(m => new m.InAppBrowserWeb()),\n});\nexport * from './definitions';\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class InAppBrowserWeb extends WebPlugin {\n async open(options) {\n console.log('open', options);\n return options;\n }\n async openWebView(options) {\n console.log('openWebView', options);\n return options;\n }\n async close() {\n console.log('close');\n return;\n }\n async setUrl(options) {\n console.log('setUrl', options.url);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","registerPlugin","WebPlugin"],"mappings":";;;;;;AAAWA,iCAAgB;AAC3B,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACvC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACvC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC,CAAC;AACnCC,6BAAY;AACvB,CAAC,UAAU,WAAW,EAAE;AACxB,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACzC,IAAI,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AAC7C,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACnC,IAAI,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;AAChC,CAAC,EAAEA,mBAAW,KAAKA,mBAAW,GAAG,EAAE,CAAC,CAAC;;ACVhC,MAAC,YAAY,GAAGC,mBAAc,CAAC,cAAc,EAAE;AACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACjE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC5C,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC7B,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,MAAM,CAAC,OAAO,EAAE;AAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;AAC3C,QAAQ,OAAO;AACf,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n ToolBarType[\"BLANK\"] = \"blank\";\n ToolBarType[\"DEFAULT\"] = \"\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst InAppBrowser = registerPlugin('InAppBrowser', {\n web: () => import('./web').then((m) => new m.InAppBrowserWeb()),\n});\nexport * from './definitions';\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class InAppBrowserWeb extends WebPlugin {\n async open(options) {\n console.log('open', options);\n return options;\n }\n async openWebView(options) {\n console.log('openWebView', options);\n return options;\n }\n async close() {\n console.log('close');\n return;\n }\n async setUrl(options) {\n console.log('setUrl', options.url);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA,iCAAgB;AAC3B,CAAC,UAAU,eAAe,EAAE;AAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACvC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACvC,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7 @@ var capacitorInAppBrowser = (function (exports, core) {
15
15
  })(exports.ToolBarType || (exports.ToolBarType = {}));
16
16
 
17
17
  const InAppBrowser = core.registerPlugin('InAppBrowser', {
18
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.InAppBrowserWeb()),
18
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.InAppBrowserWeb()),
19
19
  });
20
20
 
21
21
  class InAppBrowserWeb extends core.WebPlugin {
@@ -44,8 +44,6 @@ var capacitorInAppBrowser = (function (exports, core) {
44
44
 
45
45
  exports.InAppBrowser = InAppBrowser;
46
46
 
47
- Object.defineProperty(exports, '__esModule', { value: true });
48
-
49
47
  return exports;
50
48
 
51
49
  })({}, capacitorExports);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n ToolBarType[\"BLANK\"] = \"blank\";\n ToolBarType[\"DEFAULT\"] = \"\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst InAppBrowser = registerPlugin('InAppBrowser', {\n web: () => import('./web').then(m => new m.InAppBrowserWeb()),\n});\nexport * from './definitions';\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class InAppBrowserWeb extends WebPlugin {\n async open(options) {\n console.log('open', options);\n return options;\n }\n async openWebView(options) {\n console.log('openWebView', options);\n return options;\n }\n async close() {\n console.log('close');\n return;\n }\n async setUrl(options) {\n console.log('setUrl', options.url);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundCol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,MAAM,MAAM,CAAC,OAAO,EAAE;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3C,QAAQ,OAAO;IACf,KAAK;IACL;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var BackgroundColor;\n(function (BackgroundColor) {\n BackgroundColor[\"WHITE\"] = \"white\";\n BackgroundColor[\"BLACK\"] = \"black\";\n})(BackgroundColor || (BackgroundColor = {}));\nexport var ToolBarType;\n(function (ToolBarType) {\n ToolBarType[\"ACTIVITY\"] = \"activity\";\n ToolBarType[\"NAVIGATION\"] = \"navigation\";\n ToolBarType[\"BLANK\"] = \"blank\";\n ToolBarType[\"DEFAULT\"] = \"\";\n})(ToolBarType || (ToolBarType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst InAppBrowser = registerPlugin('InAppBrowser', {\n web: () => import('./web').then((m) => new m.InAppBrowserWeb()),\n});\nexport * from './definitions';\nexport { InAppBrowser };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class InAppBrowserWeb extends WebPlugin {\n async open(options) {\n console.log('open', options);\n return options;\n }\n async openWebView(options) {\n console.log('openWebView', options);\n return options;\n }\n async close() {\n console.log('close');\n return;\n }\n async setUrl(options) {\n console.log('setUrl', options.url);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["BackgroundColor","ToolBarType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA,qCAAgB;IAC3B,CAAC,UAAU,eAAe,EAAE;IAC5B,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACvC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACvC,CAAC,EAAEA,uBAAe,KAAKA,uBAAe,GAAG,EAAE,CAAC,CAAC,CAAC;AACnCC,iCAAY;IACvB,C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
  case file(URL, access: URL)
14
15
  case string(String, base: URL?)
15
-
16
+
16
17
  public var url: URL? {
17
18
  switch self {
18
19
  case .remote(let u): return u
@@ -20,14 +21,14 @@ public enum WKWebSource: Equatable {
20
21
  default: return nil
21
22
  }
22
23
  }
23
-
24
+
24
25
  public var remoteURL: URL? {
25
26
  switch self {
26
27
  case .remote(let u): return u
27
28
  default: return nil
28
29
  }
29
30
  }
30
-
31
+
31
32
  public var absoluteString: String? {
32
33
  switch self {
33
34
  case .remote(let u): return u.absoluteString
@@ -13,62 +13,62 @@ public class InAppBrowserPlugin: CAPPlugin {
13
13
  var currentPluginCall: CAPPluginCall?
14
14
  var isPresentAfterPageLoad = false
15
15
  var webViewController: WKWebViewController?
16
-
17
- private func setup(){
16
+
17
+ private func setup() {
18
18
  self.isSetupDone = true
19
-
19
+
20
20
  #if swift(>=4.2)
21
21
  NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive(_:)), name: UIApplication.didBecomeActiveNotification, object: nil)
22
22
  NotificationCenter.default.addObserver(self, selector: #selector(appWillResignActive(_:)), name: UIApplication.willResignActiveNotification, object: nil)
23
23
  #else
24
- NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive(_:)), name:.UIApplicationDidBecomeActive, object: nil)
25
- NotificationCenter.default.addObserver(self, selector: #selector(appWillResignActive(_:)), name:.UIApplicationWillResignActive, object: nil)
24
+ NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive(_:)), name: .UIApplicationDidBecomeActive, object: nil)
25
+ NotificationCenter.default.addObserver(self, selector: #selector(appWillResignActive(_:)), name: .UIApplicationWillResignActive, object: nil)
26
26
  #endif
27
27
  }
28
-
28
+
29
29
  func presentView() {
30
30
  self.bridge?.viewController?.present(self.navigationWebViewController!, animated: true, completion: {
31
31
  self.currentPluginCall?.resolve()
32
32
  })
33
33
  }
34
-
34
+
35
35
  @objc func openWebView(_ call: CAPPluginCall) {
36
36
  if !self.isSetupDone {
37
37
  self.setup()
38
38
  }
39
39
  self.currentPluginCall = call
40
-
40
+
41
41
  guard let urlString = call.getString("url") else {
42
42
  call.reject("Must provide a URL to open")
43
43
  return
44
44
  }
45
-
45
+
46
46
  if urlString.isEmpty {
47
47
  call.reject("URL must not be empty")
48
48
  return
49
49
  }
50
-
50
+
51
51
  let headers = call.getObject("headers", [:]).mapValues { String(describing: $0 as Any) }
52
-
52
+
53
53
  var disclaimerContent = call.getObject("shareDisclaimer")
54
54
  let toolbarType = call.getString("toolbarType", "")
55
55
  let backgroundColor = call.getString("backgroundColor", "black") == "white" ? UIColor.white : UIColor.black
56
56
  if toolbarType != "activity" {
57
57
  disclaimerContent = nil
58
58
  }
59
-
59
+
60
60
  self.isPresentAfterPageLoad = call.getBool("isPresentAfterPageLoad", false)
61
-
61
+
62
62
  DispatchQueue.main.async {
63
63
  let url = URL(string: urlString)
64
-
64
+
65
65
  if self.isPresentAfterPageLoad {
66
66
  self.webViewController = WKWebViewController.init(url: url!, headers: headers)
67
67
  } else {
68
68
  self.webViewController = WKWebViewController.init()
69
69
  self.webViewController?.setHeaders(headers: headers)
70
70
  }
71
-
71
+
72
72
  self.webViewController?.source = .remote(url!)
73
73
  self.webViewController?.leftNavigaionBarItemTypes = self.getToolbarItems(toolbarType: toolbarType)
74
74
  self.webViewController?.toolbarItemTypes = []
@@ -91,7 +91,7 @@ public class InAppBrowserPlugin: CAPPlugin {
91
91
  }
92
92
  }
93
93
  }
94
-
94
+
95
95
  func getToolbarItems(toolbarType: String) -> [BarButtonItemType] {
96
96
  var result: [BarButtonItemType] = []
97
97
  if toolbarType == "activity" {
@@ -102,7 +102,7 @@ public class InAppBrowserPlugin: CAPPlugin {
102
102
  }
103
103
  return result
104
104
  }
105
-
105
+
106
106
  @objc func setUrl(_ call: CAPPluginCall) {
107
107
  guard let url = call.getString("url") else {
108
108
  call.reject("Cannot get new url to set")
@@ -116,33 +116,33 @@ public class InAppBrowserPlugin: CAPPlugin {
116
116
  if !self.isSetupDone {
117
117
  self.setup()
118
118
  }
119
-
119
+
120
120
  self.currentPluginCall = call
121
-
121
+
122
122
  guard let urlString = call.getString("url") else {
123
123
  call.reject("Must provide a URL to open")
124
124
  return
125
125
  }
126
-
126
+
127
127
  if urlString.isEmpty {
128
128
  call.reject("URL must not be empty")
129
129
  return
130
130
  }
131
-
131
+
132
132
  let headers = call.getObject("headers", [:]).mapValues { String(describing: $0 as Any) }
133
-
133
+
134
134
  self.isPresentAfterPageLoad = call.getBool("isPresentAfterPageLoad", false)
135
-
135
+
136
136
  DispatchQueue.main.async {
137
137
  let url = URL(string: urlString)
138
-
138
+
139
139
  if self.isPresentAfterPageLoad {
140
140
  self.webViewController = WKWebViewController.init(url: url!, headers: headers)
141
141
  } else {
142
142
  self.webViewController = WKWebViewController.init()
143
143
  self.webViewController?.setHeaders(headers: headers)
144
144
  }
145
-
145
+
146
146
  self.webViewController?.source = .remote(url!)
147
147
  self.webViewController?.leftNavigaionBarItemTypes = [.reload]
148
148
  self.webViewController?.toolbarItemTypes = [.back, .forward, .activity]
@@ -159,15 +159,15 @@ public class InAppBrowserPlugin: CAPPlugin {
159
159
  }
160
160
  }
161
161
  }
162
-
162
+
163
163
  @objc func close(_ call: CAPPluginCall) {
164
164
  DispatchQueue.main.async {
165
- self.navigationWebViewController?.dismiss(animated: true, completion: nil)
166
- call.resolve()
165
+ self.navigationWebViewController?.dismiss(animated: true, completion: nil)
166
+ call.resolve()
167
167
  }
168
168
  }
169
-
170
- private func showPrivacyScreen(){
169
+
170
+ private func showPrivacyScreen() {
171
171
  if privacyScreen == nil {
172
172
  self.privacyScreen = UIImageView()
173
173
  if let launchImage = UIImage(named: "LaunchImage") {
@@ -184,15 +184,15 @@ public class InAppBrowserPlugin: CAPPlugin {
184
184
  }
185
185
  self.navigationWebViewController?.view.addSubview(self.privacyScreen!)
186
186
  }
187
-
188
- private func hidePrivacyScreen(){
187
+
188
+ private func hidePrivacyScreen() {
189
189
  self.privacyScreen?.removeFromSuperview()
190
190
  }
191
-
191
+
192
192
  @objc func appDidBecomeActive(_ notification: NSNotification) {
193
193
  self.hidePrivacyScreen()
194
194
  }
195
-
195
+
196
196
  @objc func appWillResignActive(_ notification: NSNotification) {
197
197
  self.showPrivacyScreen()
198
198
  }