@aigens/aigens-sdk-core 0.0.3 → 0.0.7

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.
@@ -10,36 +10,67 @@ import Capacitor
10
10
 
11
11
 
12
12
  @objc open class WebContainerViewController: CAPBridgeViewController {
13
-
14
- public var options: Dictionary<String, AnyObject>?
15
-
13
+
14
+ public var options: Dictionary<String, Any>?
15
+
16
16
  override open func viewDidLoad() {
17
-
17
+
18
18
  print("WebContainerViewController viewDidLoad")
19
-
19
+
20
20
  self.becomeFirstResponder()
21
21
  loadWebViewCustom()
22
22
  //loadWebView()
23
23
  }
24
-
25
-
24
+
25
+ //this method overwrite parent to return a desc with custom config.json
26
+ override open func instanceDescriptor() -> InstanceDescriptor {
27
+
28
+ //print("WebContainerViewController custom instanceDescriptor")
29
+
30
+ //let configLoc = Bundle.main.url(forResource: "capacitor.config", withExtension: "json")
31
+
32
+ //default config paths
33
+ var wwwLoc = Bundle.main.url(forResource: "public", withExtension: nil)
34
+ var configLoc = Bundle.main.url(forResource: "capacitor.config", withExtension: "json")
35
+
36
+ //if config is missing, it's a dynamic page, load config from sdk core
37
+ if(configLoc == nil){
38
+ configLoc = Bundle(for: WebContainerViewController.self).url(forResource: "capacitor.config", withExtension: "json")
39
+
40
+ //www folder will be dynamic, set to anything is ok
41
+ //wwwLoc = configLoc
42
+ wwwLoc = FileManager.default.temporaryDirectory
43
+ }
44
+
45
+
46
+ let descriptor = InstanceDescriptor.init(at: wwwLoc!, configuration: configLoc, cordovaConfiguration: nil)
47
+
48
+
49
+ return descriptor
50
+ }
51
+
26
52
  public final func loadWebViewCustom() {
27
-
53
+
28
54
  //let bridge = self.bridge
29
55
  //let plugins = self.bridge["plugins"]
30
-
31
-
56
+
57
+
32
58
  let urlString = self.options?["url"] as? String;
33
59
 
34
60
  if(urlString == nil){
35
61
  return;
36
62
  }
37
-
63
+
38
64
  let url = URL(string: urlString!)
39
-
65
+
66
+ let member = self.options?["member"] as? Dictionary<String, Any>
67
+
68
+ CorePlugin.member = member
69
+
70
+
40
71
  //bridge.webViewDelegationHandler.willLoadWebview(webView)
41
72
  _ = webView?.load(URLRequest(url: url!))
42
-
43
-
73
+
74
+
44
75
  }
45
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigens/aigens-sdk-core",
3
- "version": "0.0.3",
3
+ "version": "0.0.7",
4
4
  "description": "Aigens Order.Place Core Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",