@aigens/aigens-sdk-core 0.0.1 → 0.0.5

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.
@@ -0,0 +1,76 @@
1
+ //
2
+ // WebContainerViewController.swift
3
+ // AigensAigensSdkCore
4
+ //
5
+ // Created by Peter Liu on 5/3/2022.
6
+ //
7
+ import UIKit;
8
+ import Foundation
9
+ import Capacitor
10
+
11
+
12
+ @objc open class WebContainerViewController: CAPBridgeViewController {
13
+
14
+ public var options: Dictionary<String, Any>?
15
+
16
+ override open func viewDidLoad() {
17
+
18
+ print("WebContainerViewController viewDidLoad")
19
+
20
+ self.becomeFirstResponder()
21
+ loadWebViewCustom()
22
+ //loadWebView()
23
+ }
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
+
52
+ public final func loadWebViewCustom() {
53
+
54
+ //let bridge = self.bridge
55
+ //let plugins = self.bridge["plugins"]
56
+
57
+
58
+ let urlString = self.options?["url"] as? String;
59
+
60
+ if(urlString == nil){
61
+ return;
62
+ }
63
+
64
+ let url = URL(string: urlString!)
65
+
66
+ let member = self.options?["member"] as? Dictionary<String, Any>
67
+
68
+ CorePlugin.member = member
69
+
70
+
71
+ //bridge.webViewDelegationHandler.willLoadWebview(webView)
72
+ _ = webView?.load(URLRequest(url: url!))
73
+
74
+
75
+ }
76
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigens/aigens-sdk-core",
3
- "version": "0.0.1",
3
+ "version": "0.0.5",
4
4
  "description": "Aigens Order.Place Core Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -11,7 +11,7 @@
11
11
  "android/build.gradle",
12
12
  "dist/",
13
13
  "ios/Plugin/",
14
- "CapacitorCommunityAigensCore.podspec"
14
+ "AigensAigensSdkCore.podspec"
15
15
  ],
16
16
  "author": "Aigens",
17
17
  "license": "MIT",
@@ -1,11 +0,0 @@
1
- package com.aigens.sdk.plugins;
2
-
3
- import android.util.Log;
4
-
5
- public class Core {
6
-
7
- public String echo(String value) {
8
- Log.i("Echo", value);
9
- return value;
10
- }
11
- }