@hanwha-ss1/plugin 0.3.7 → 0.3.9

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.
@@ -12,7 +12,7 @@
12
12
  <application>
13
13
  <activity
14
14
  android:theme="@style/AppTheme.NoActionBar"
15
- android:name="com.plugin.openbrowser.WebViewActivity"
15
+ android:name=".WebViewActivity"
16
16
  android:exported="false" />
17
17
  </application>
18
18
 
@@ -108,10 +108,11 @@ public class LinkerPlugin extends Plugin{
108
108
  @PluginMethod
109
109
  public void open(PluginCall call) {
110
110
  String url = call.getString("url");
111
- boolean isExternal = call.getBoolean("ext");
111
+ boolean isExternal = Boolean.TRUE.equals(call.getBoolean("ext"));
112
+ boolean hasClose = Boolean.TRUE.equals(call.getBoolean("isCloseBtn"));
112
113
  if(openBrowserImplementation == null) {
113
114
  openBrowserImplementation = new OpenBrowser();
114
115
  }
115
- openBrowserImplementation.open(getActivity(), url, isExternal);
116
+ openBrowserImplementation.open(getActivity(), url, isExternal, hasClose);
116
117
  }
117
118
  }
@@ -5,6 +5,8 @@ import android.content.Intent;
5
5
  import android.net.Uri;
6
6
  import android.util.Log;
7
7
 
8
+ import androidx.appcompat.app.AppCompatActivity;
9
+
8
10
  public class OpenBrowser {
9
11
 
10
12
  public String echo(String value) {
@@ -19,7 +21,7 @@ public class OpenBrowser {
19
21
  * @param url
20
22
  * @param isExternal
21
23
  */
22
- public void open(Activity activity, String url, boolean isExternal) {
24
+ public void open(AppCompatActivity activity, String url, boolean isExternal, boolean hasClose) {
23
25
  if(activity != null && url != null && !url.isEmpty()) {
24
26
  Intent intent;
25
27
  if(isExternal) {
@@ -27,6 +29,7 @@ public class OpenBrowser {
27
29
  } else {
28
30
  intent = new Intent(activity, WebViewActivity.class);
29
31
  intent.putExtra("url", url);
32
+ intent.putExtra("hasClose", hasClose);
30
33
  }
31
34
  activity.startActivity(intent);
32
35
  }
@@ -19,4 +19,15 @@ public class OpenBrowserPlugin extends Plugin {
19
19
  ret.put("value", implementation.echo(value));
20
20
  call.resolve(ret);
21
21
  }
22
+
23
+ @PluginMethod
24
+ public void open(PluginCall call) {
25
+ String url = call.getString("url");
26
+ boolean isExternal = Boolean.TRUE.equals(call.getBoolean("ext"));
27
+ boolean hasClose = Boolean.TRUE.equals(call.getBoolean("isCloseBtn"));
28
+ if(implementation == null) {
29
+ implementation = new OpenBrowser();
30
+ }
31
+ implementation.open(getActivity(), url, isExternal, hasClose);
32
+ }
22
33
  }
@@ -12,23 +12,34 @@ import androidx.appcompat.app.AppCompatActivity;
12
12
  public class WebViewActivity extends AppCompatActivity {
13
13
 
14
14
  private WebView webView;
15
- private ImageView ivClose;
16
15
 
17
16
  @Override
18
17
  protected void onCreate(Bundle savedInstanceState) {
19
18
  super.onCreate(savedInstanceState);
20
19
  setContentView(R.layout.activity_webview);
21
20
 
22
- initLayout();
23
21
 
24
22
  String url = getIntent().getStringExtra("url");
23
+ boolean hasClose = getIntent().getBooleanExtra("hasClose", true);
24
+
25
+ initLayout(hasClose);
25
26
 
26
27
  openUrl(url);
27
28
  }
28
29
 
29
- private void initLayout() {
30
+ private void initLayout(boolean hasClose) {
30
31
  webView = findViewById(R.id.webView);
31
- ivClose = findViewById(R.id.ivClose);
32
+
33
+ if(hasClose) {
34
+ findViewById(R.id.ivClose).setOnClickListener(new View.OnClickListener() {
35
+ @Override
36
+ public void onClick(View v) {
37
+ WebViewActivity.this.finish();
38
+ }
39
+ });
40
+ } else {
41
+ findViewById(R.id.layoutTitle).setVisibility(View.GONE);
42
+ }
32
43
 
33
44
  webView.getSettings().setJavaScriptEnabled(true);
34
45
  webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
@@ -47,13 +58,6 @@ public class WebViewActivity extends AppCompatActivity {
47
58
  return super.shouldOverrideUrlLoading(view, url);
48
59
  }
49
60
  });
50
-
51
- ivClose.setOnClickListener(new View.OnClickListener() {
52
- @Override
53
- public void onClick(View v) {
54
- WebViewActivity.this.finish();
55
- }
56
- });
57
61
  }
58
62
 
59
63
  private void openUrl(String url) {
@@ -40,6 +40,11 @@ export interface Plugin {
40
40
  timezone(): Promise<{
41
41
  value: string;
42
42
  }>;
43
+ /**
44
+ *
45
+ * @param options url : "웹 페이지 주소"
46
+ * @param options ext : false(내부 웹뷰), true(외부 브라우저)
47
+ */
43
48
  open(options: {
44
49
  url: string;
45
50
  ext: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface Plugin {\n /**\n * 앱 실행\n * @param options package : 패키지명\n */\n executeApp(options: {\n package: string;\n }): Promise<{ value: string }>;\n\n /**\n * 연락처 저장\n * @param options name : 성명\n * @param options phone : 전화번호\n * @param options email : 이메일\n * @param options dept : 소속\n * @param options ext : 내선번호\n */\n addContact(options: {\n name: string;\n phone: string;\n email: string;\n dept: string;\n ext: string;\n }): Promise<{ value: string }>;\n\n /**\n * TouchID, FaceID\n */\n auth(): Promise<{ value: string }>;\n\n /**\n * 시스템에 설정된 지역이 서울인지 확인\n */\n checkSeoulTimeZone(): Promise<{ value: string }>;\n\n timezone(): Promise<{ value: string }>;\n\n open(options: {\n url: string;\n ext: boolean;\n }): Promise<{ value: string }>;\n}\n\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface Plugin {\n /**\n * 앱 실행\n * @param options package : 패키지명\n */\n executeApp(options: {\n package: string;\n }): Promise<{ value: string }>;\n\n /**\n * 연락처 저장\n * @param options name : 성명\n * @param options phone : 전화번호\n * @param options email : 이메일\n * @param options dept : 소속\n * @param options ext : 내선번호\n */\n addContact(options: {\n name: string;\n phone: string;\n email: string;\n dept: string;\n ext: string;\n }): Promise<{ value: string }>;\n\n /**\n * TouchID, FaceID\n */\n auth(): Promise<{ value: string }>;\n\n /**\n * 시스템에 설정된 지역이 서울인지 확인\n */\n checkSeoulTimeZone(): Promise<{ value: string }>;\n\n timezone(): Promise<{ value: string }>;\n\n /**\n *\n * @param options url : \"웹 페이지 주소\"\n * @param options ext : false(내부 웹뷰), true(외부 브라우저)\n */\n open(options: { url: string; ext: boolean; }): Promise<{ value: string }>;\n}\n\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -3,8 +3,11 @@ import type { Plugin } from './definitions';
3
3
  export declare class PluginWeb extends WebPlugin implements Plugin {
4
4
  executeApp(): Promise<any>;
5
5
  addContact(): Promise<any>;
6
- open(): Promise<any>;
7
6
  auth(): Promise<any>;
8
7
  checkSeoulTimeZone(): Promise<any>;
9
8
  timezone(): Promise<any>;
9
+ open(_options: {
10
+ url: string;
11
+ ext: boolean;
12
+ }): Promise<any>;
10
13
  }
package/dist/esm/web.js CHANGED
@@ -7,9 +7,6 @@ export class PluginWeb extends WebPlugin {
7
7
  async addContact() {
8
8
  return { results: {} };
9
9
  }
10
- async open() {
11
- return { results: {} };
12
- }
13
10
  async auth() {
14
11
  return { results: {} };
15
12
  }
@@ -19,5 +16,8 @@ export class PluginWeb extends WebPlugin {
19
16
  async timezone() {
20
17
  return { results: {} };
21
18
  }
19
+ async open(_options) {
20
+ return { results: {} };
21
+ }
22
22
  }
23
23
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,SAAU,SAAQ,SAAS;IAEtC,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nimport type { Plugin } from './definitions';\nexport class PluginWeb extends WebPlugin implements Plugin {\n\n async executeApp(): Promise<any> {\n return { results: {} };\n }\n\n async addContact(): Promise<any> {\n return { results: {} };\n }\n\n async open(): Promise<any> {\n return { results: {} };\n }\n\n async auth(): Promise<any> {\n return { results: {} };\n }\n\n async checkSeoulTimeZone(): Promise<any> {\n return { results: {} };\n }\n\n async timezone(): Promise<any> {\n return { results: {} };\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAG1C,MAAM,OAAO,SAAU,SAAQ,SAAS;IAEtC,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAuC;QAChD,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport {WebPlugin} from '@capacitor/core';\nimport type {Plugin} from './definitions';\n\nexport class PluginWeb extends WebPlugin implements Plugin {\n\n async executeApp(): Promise<any> {\n return { results: {} };\n }\n\n async addContact(): Promise<any> {\n return { results: {} };\n }\n\n async auth(): Promise<any> {\n return { results: {} };\n }\n\n async checkSeoulTimeZone(): Promise<any> {\n return { results: {} };\n }\n\n async timezone(): Promise<any> {\n return { results: {} };\n }\n\n async open(_options: { url: string, ext: boolean }): Promise<any> {\n return { results: {} };\n }\n}\n"]}
@@ -16,9 +16,6 @@ class PluginWeb extends core.WebPlugin {
16
16
  async addContact() {
17
17
  return { results: {} };
18
18
  }
19
- async open() {
20
- return { results: {} };
21
- }
22
19
  async auth() {
23
20
  return { results: {} };
24
21
  }
@@ -28,6 +25,9 @@ class PluginWeb extends core.WebPlugin {
28
25
  async timezone() {
29
26
  return { results: {} };
30
27
  }
28
+ async open(_options) {
29
+ return { results: {} };
30
+ }
31
31
  }
32
32
 
33
33
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HanwhaPlugin = registerPlugin('Plugin', {\n web: () => import('./web').then(m => new m.PluginWeb()),\n});\nexport * from './definitions';\nexport { HanwhaPlugin };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class PluginWeb extends WebPlugin {\n async executeApp() {\n return { results: {} };\n }\n async addContact() {\n return { results: {} };\n }\n async open() {\n return { results: {} };\n }\n async auth() {\n return { results: {} };\n }\n async checkSeoulTimeZone() {\n return { results: {} };\n }\n async timezone() {\n return { results: {} };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,YAAY,GAAGA,mBAAc,CAAC,QAAQ,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACHD;AAEO,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HanwhaPlugin = registerPlugin('Plugin', {\n web: () => import('./web').then(m => new m.PluginWeb()),\n});\nexport * from './definitions';\nexport { HanwhaPlugin };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class PluginWeb extends WebPlugin {\n async executeApp() {\n return { results: {} };\n }\n async addContact() {\n return { results: {} };\n }\n async auth() {\n return { results: {} };\n }\n async checkSeoulTimeZone() {\n return { results: {} };\n }\n async timezone() {\n return { results: {} };\n }\n async open(_options) {\n return { results: {} };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,YAAY,GAAGA,mBAAc,CAAC,QAAQ,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACHD;AAEO,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;AACzB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -13,9 +13,6 @@ var capacitorContact = (function (exports, core) {
13
13
  async addContact() {
14
14
  return { results: {} };
15
15
  }
16
- async open() {
17
- return { results: {} };
18
- }
19
16
  async auth() {
20
17
  return { results: {} };
21
18
  }
@@ -25,6 +22,9 @@ var capacitorContact = (function (exports, core) {
25
22
  async timezone() {
26
23
  return { results: {} };
27
24
  }
25
+ async open(_options) {
26
+ return { results: {} };
27
+ }
28
28
  }
29
29
 
30
30
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HanwhaPlugin = registerPlugin('Plugin', {\n web: () => import('./web').then(m => new m.PluginWeb()),\n});\nexport * from './definitions';\nexport { HanwhaPlugin };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class PluginWeb extends WebPlugin {\n async executeApp() {\n return { results: {} };\n }\n async addContact() {\n return { results: {} };\n }\n async open() {\n return { results: {} };\n }\n async auth() {\n return { results: {} };\n }\n async checkSeoulTimeZone() {\n return { results: {} };\n }\n async timezone() {\n return { results: {} };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,YAAY,GAAGA,mBAAc,CAAC,QAAQ,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICHD;IAEO,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HanwhaPlugin = registerPlugin('Plugin', {\n web: () => import('./web').then(m => new m.PluginWeb()),\n});\nexport * from './definitions';\nexport { HanwhaPlugin };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class PluginWeb extends WebPlugin {\n async executeApp() {\n return { results: {} };\n }\n async addContact() {\n return { results: {} };\n }\n async auth() {\n return { results: {} };\n }\n async checkSeoulTimeZone() {\n return { results: {} };\n }\n async timezone() {\n return { results: {} };\n }\n async open(_options) {\n return { results: {} };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,YAAY,GAAGA,mBAAc,CAAC,QAAQ,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICHD;IAEO,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE;IACzB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,26 @@
1
+ import Foundation
2
+ import Capacitor
3
+ import Contacts
4
+ /**
5
+ * Please read the Capacitor iOS Plugin Development Guide
6
+ * here: https://capacitorjs.com/docs/plugins/ios
7
+ */
8
+
9
+ public class OpenBrowserPlugin: CAPPlugin {
10
+ private let implementation = OpenBrowserService()
11
+
12
+ @objc func openBrowser(_ call: CAPPluginCall, _bridge: CAPBridgeProtocol) {
13
+ let url = call.getString("url") ?? ""
14
+
15
+
16
+ DispatchQueue.main.async {
17
+ let controller = self.implementation.builder(url: url)
18
+ controller.modalPresentationStyle = .fullScreen
19
+
20
+ _bridge.viewController?.present(controller, animated: true)
21
+ }
22
+
23
+
24
+ }
25
+ }
26
+
@@ -0,0 +1,22 @@
1
+ import Foundation
2
+ import UIKit
3
+ import LocalAuthentication
4
+ import Capacitor
5
+
6
+
7
+
8
+ public class OpenBrowserService: NSObject {
9
+ @objc public func builder(url: String) -> UIViewController {
10
+ let bundle = Bundle(for: self.classForCoder)
11
+ let controller = ViewController(nibName: "ViewController", bundle: bundle)
12
+ controller.url = url
13
+ return controller
14
+ }
15
+
16
+ public func openBrowser(call: CAPPluginCall) {
17
+ call.resolve([
18
+ "result": true,
19
+ "message": "완료"
20
+ ])
21
+ }
22
+ }
@@ -0,0 +1,65 @@
1
+ //
2
+ // ViewController.swift
3
+ // Plugin
4
+ //
5
+ // Created by HanWhaLee on 2022/10/07.
6
+ // Copyright © 2022 Max Lynch. All rights reserved.
7
+ //
8
+
9
+ import UIKit
10
+ import WebKit
11
+
12
+
13
+
14
+ class ViewController: UIViewController {
15
+ @IBOutlet var wkWebview: WKWebView!
16
+ @IBOutlet var btnClose: UIButton!
17
+ @IBOutlet var indicator: UIActivityIndicatorView!
18
+
19
+
20
+ var url: String = ""
21
+ var naviTitle: String = ""
22
+
23
+ override func viewDidLoad() {
24
+ super.viewDidLoad()
25
+ indicator.startAnimating()
26
+ wkWebview.navigationDelegate = self
27
+ wkWebview.load(URLRequest.init(url: URL(string: url)!))
28
+ }
29
+
30
+
31
+ /*
32
+ // MARK: - Navigation
33
+
34
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
35
+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
36
+ // Get the new view controller using segue.destination.
37
+ // Pass the selected object to the new view controller.
38
+ }
39
+ */
40
+
41
+ @IBAction func doClose() {
42
+ self.dismiss(animated: true)
43
+ }
44
+ }
45
+
46
+
47
+ extension ViewController: WKNavigationDelegate {
48
+ func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
49
+ indicator.stopAnimating()
50
+ webView.isHidden = false
51
+ }
52
+
53
+ func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
54
+
55
+ let url = navigationAction.request.url?.absoluteString
56
+
57
+ if "close://" == url {
58
+ doClose()
59
+ }
60
+
61
+
62
+ decisionHandler(.allow)
63
+ }
64
+ }
65
+
@@ -0,0 +1,88 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3
+ <device id="retina6_0" orientation="portrait" appearance="light"/>
4
+ <dependencies>
5
+ <deployment identifier="iOS"/>
6
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
7
+ <capability name="Safe area layout guides" minToolsVersion="9.0"/>
8
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9
+ </dependencies>
10
+ <objects>
11
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ViewController" customModule="HanwhaSs1Plugin" customModuleProvider="target">
12
+ <connections>
13
+ <outlet property="btnClose" destination="1PV-Mj-hAT" id="mlS-cq-Qaz"/>
14
+ <outlet property="indicator" destination="Vt7-sZ-fvc" id="LWz-jE-fvu"/>
15
+ <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
16
+ <outlet property="wkWebview" destination="gNx-5x-FOs" id="rA7-7h-TvS"/>
17
+ </connections>
18
+ </placeholder>
19
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
20
+ <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
21
+ <rect key="frame" x="0.0" y="0.0" width="390" height="844"/>
22
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
23
+ <subviews>
24
+ <wkWebView hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gNx-5x-FOs">
25
+ <rect key="frame" x="0.0" y="95" width="390" height="715"/>
26
+ <color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
27
+ <wkWebViewConfiguration key="configuration">
28
+ <audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
29
+ <wkPreferences key="preferences"/>
30
+ </wkWebViewConfiguration>
31
+ </wkWebView>
32
+ <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="Vt7-sZ-fvc">
33
+ <rect key="frame" x="185" y="443" width="20" height="20"/>
34
+ </activityIndicatorView>
35
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Uoe-RW-I9y">
36
+ <rect key="frame" x="16" y="47" width="358" height="48"/>
37
+ <subviews>
38
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ggB-EF-tKn">
39
+ <rect key="frame" x="310" y="0.0" width="48" height="48"/>
40
+ <subviews>
41
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1PV-Mj-hAT">
42
+ <rect key="frame" x="0.0" y="0.0" width="78" height="48"/>
43
+ <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
44
+ <state key="normal" image="icon_close.png"/>
45
+ <connections>
46
+ <action selector="doClose" destination="-1" eventType="touchUpInside" id="Gr4-Oa-scu"/>
47
+ </connections>
48
+ </button>
49
+ </subviews>
50
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
51
+ <constraints>
52
+ <constraint firstAttribute="height" constant="48" id="1yX-lJ-u7H"/>
53
+ <constraint firstAttribute="trailing" secondItem="1PV-Mj-hAT" secondAttribute="trailing" constant="-30" id="7tb-jm-OtG"/>
54
+ <constraint firstAttribute="width" constant="48" id="RTc-AQ-7fF"/>
55
+ <constraint firstItem="1PV-Mj-hAT" firstAttribute="leading" secondItem="ggB-EF-tKn" secondAttribute="leading" id="aPF-d4-HZK"/>
56
+ <constraint firstItem="1PV-Mj-hAT" firstAttribute="top" secondItem="ggB-EF-tKn" secondAttribute="top" id="l02-cK-1sJ"/>
57
+ <constraint firstAttribute="bottom" secondItem="1PV-Mj-hAT" secondAttribute="bottom" id="y0O-NI-XKg"/>
58
+ </constraints>
59
+ </view>
60
+ </subviews>
61
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
62
+ <constraints>
63
+ <constraint firstItem="ggB-EF-tKn" firstAttribute="centerY" secondItem="Uoe-RW-I9y" secondAttribute="centerY" id="4gg-0z-qsr"/>
64
+ <constraint firstAttribute="height" constant="48" id="G6Y-b0-xtz"/>
65
+ <constraint firstAttribute="trailing" secondItem="ggB-EF-tKn" secondAttribute="trailing" id="I2k-Is-fHx"/>
66
+ </constraints>
67
+ </view>
68
+ </subviews>
69
+ <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
70
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
71
+ <constraints>
72
+ <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Uoe-RW-I9y" secondAttribute="trailing" constant="16" id="6is-dt-a4x"/>
73
+ <constraint firstItem="Uoe-RW-I9y" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="16" id="B7c-Sh-6EG"/>
74
+ <constraint firstItem="Vt7-sZ-fvc" firstAttribute="top" secondItem="ggB-EF-tKn" secondAttribute="bottom" constant="348" id="EGx-1y-d0l"/>
75
+ <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="gNx-5x-FOs" secondAttribute="trailing" id="KUb-Em-jbo"/>
76
+ <constraint firstItem="gNx-5x-FOs" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="ULf-Xk-qo3"/>
77
+ <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="gNx-5x-FOs" secondAttribute="bottom" id="als-Ra-M5R"/>
78
+ <constraint firstItem="gNx-5x-FOs" firstAttribute="top" secondItem="Uoe-RW-I9y" secondAttribute="bottom" id="bGR-9m-8J5"/>
79
+ <constraint firstItem="Vt7-sZ-fvc" firstAttribute="centerX" secondItem="fnl-2z-Ty3" secondAttribute="centerX" id="mkc-cw-JpA"/>
80
+ <constraint firstItem="Uoe-RW-I9y" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="tr7-Ux-Bpj"/>
81
+ </constraints>
82
+ <point key="canvasLocation" x="21.538461538461537" y="20.616113744075829"/>
83
+ </view>
84
+ </objects>
85
+ <resources>
86
+ <image name="icon_close.png" width="24" height="24"/>
87
+ </resources>
88
+ </document>
@@ -9,4 +9,5 @@ CAP_PLUGIN(Plugin, "Plugin",
9
9
  CAP_PLUGIN_METHOD(addContact, CAPPluginReturnPromise);
10
10
  CAP_PLUGIN_METHOD(checkSeoulTimeZone, CAPPluginReturnPromise);
11
11
  CAP_PLUGIN_METHOD(timezone, CAPPluginReturnPromise);
12
+ CAP_PLUGIN_METHOD(open, CAPPluginReturnPromise);
12
13
  )
@@ -17,16 +17,6 @@ public class Plugin: CAPPlugin {
17
17
  "message": "완료"
18
18
  ])
19
19
  }
20
-
21
- /**
22
- 안드로이드에서만 사용
23
- */
24
- @objc func open(_ call: CAPPluginCall) {
25
- call.resolve([
26
- "result": true,
27
- "message": "완료"
28
- ])
29
- }
30
20
 
31
21
  @objc func auth(_ call: CAPPluginCall) {
32
22
  AuthPlugin().auth(call)
@@ -44,5 +34,10 @@ public class Plugin: CAPPlugin {
44
34
  TimeZonePlugin().timezone(call)
45
35
  }
46
36
 
37
+ @objc func open(_ call: CAPPluginCall) {
38
+ OpenBrowserPlugin().openBrowser(call, _bridge: self.bridge!)
39
+ }
40
+
41
+
47
42
  }
48
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanwha-ss1/plugin",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -44,10 +44,10 @@
44
44
  "prepublishOnly": "npm run build"
45
45
  },
46
46
  "devDependencies": {
47
- "@capacitor/android": "3.0.0",
48
- "@capacitor/core": "3.0.0",
47
+ "@capacitor/android": "^3.0.0",
48
+ "@capacitor/core": "^3.0.0",
49
49
  "@capacitor/docgen": "0.0.18",
50
- "@capacitor/ios": "3.0.0",
50
+ "@capacitor/ios": "^3.0.0",
51
51
  "@ionic/eslint-config": "0.3.0",
52
52
  "@ionic/prettier-config": "1.0.1",
53
53
  "@ionic/swiftlint-config": "1.1.2",
@@ -60,7 +60,7 @@
60
60
  "typescript": "4.0.3"
61
61
  },
62
62
  "peerDependencies": {
63
- "@capacitor/core": "3.0.0"
63
+ "@capacitor/core": "^3.0.0"
64
64
  },
65
65
  "prettier": "@ionic/prettier-config",
66
66
  "swiftlint": "@ionic/swiftlint-config",