@simplysm/capacitor-plugin-intent 12.16.52 → 14.0.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.
Files changed (36) hide show
  1. package/README.md +69 -139
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/kotlin/kr/co/simplysm/capacitor/intent/IntentPlugin.kt +365 -0
  4. package/dist/Intent.d.ts +29 -18
  5. package/dist/Intent.d.ts.map +1 -0
  6. package/dist/Intent.js +41 -22
  7. package/dist/Intent.js.map +1 -0
  8. package/dist/IntentPlugin.d.ts +72 -0
  9. package/dist/IntentPlugin.d.ts.map +1 -0
  10. package/dist/IntentPlugin.js +2 -0
  11. package/dist/IntentPlugin.js.map +1 -0
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +4 -2
  15. package/dist/index.js.map +1 -0
  16. package/dist/web/IntentWeb.d.ts +7 -5
  17. package/dist/web/IntentWeb.d.ts.map +1 -0
  18. package/dist/web/IntentWeb.js +17 -13
  19. package/dist/web/IntentWeb.js.map +1 -0
  20. package/package.json +15 -10
  21. package/src/Intent.ts +56 -25
  22. package/src/IntentPlugin.ts +81 -0
  23. package/src/index.ts +2 -1
  24. package/src/web/IntentWeb.ts +27 -16
  25. package/android/src/main/java/kr/co/simplysm/capacitor/intent/IntentPlugin.java +0 -376
  26. package/dist/IIntentPlugin.d.ts +0 -63
  27. package/dist/IIntentPlugin.js +0 -1
  28. package/src/IIntentPlugin.ts +0 -65
  29. package/tests/slice1-directory-and-config.spec.ts +0 -50
  30. package/tests/slice2-java-renaming.spec.ts +0 -34
  31. package/tests/slice3-typescript-renaming.spec.ts +0 -76
  32. package/tests/slice4-docs-and-deprecation.spec.ts +0 -31
  33. package/tests/slice5-start-activity-for-result-android.spec.md +0 -98
  34. package/tests/slice5-start-activity-for-result-types.spec.ts +0 -40
  35. package/tests/slice6-start-activity-for-result-web.spec.ts +0 -34
  36. package/tsconfig.json +0 -8
@@ -1,34 +1,45 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
- import { IActivityResult, IIntentPlugin, IIntentResult, IStartActivityForResultOptions } from "../IIntentPlugin";
2
+ import type {
3
+ IntentPlugin,
4
+ IntentResult,
5
+ StartActivityForResultOptions,
6
+ StartActivityForResultResult,
7
+ } from "../IntentPlugin";
3
8
 
4
- export class IntentWeb extends WebPlugin implements IIntentPlugin {
5
- async subscribe(
9
+ export class IntentWeb extends WebPlugin implements IntentPlugin {
10
+ private static readonly _warn = () =>
11
+ // eslint-disable-next-line no-console
12
+ console.warn("[Intent] 웹 환경에서는 지원하지 않습니다.");
13
+
14
+ subscribe(
6
15
  _options: { filters: string[] },
7
- _callback: (result: IIntentResult) => void,
16
+ _callback: (result: IntentResult) => void,
8
17
  ): Promise<{ id: string }> {
9
- alert("[Intent] 웹 환경에서는 Intent를 지원하지 않습니다.");
10
- return await Promise.resolve({ id: "web-stub" });
18
+ IntentWeb._warn();
19
+ return Promise.resolve({ id: "web-stub" });
11
20
  }
12
21
 
13
22
  async unsubscribe(_options: { id: string }): Promise<void> {
14
- await Promise.resolve();
23
+ // 웹에서는 동작 없음
15
24
  }
16
25
 
17
26
  async unsubscribeAll(): Promise<void> {
18
- await Promise.resolve();
27
+ // 웹에서는 동작 없음
19
28
  }
20
29
 
21
- async send(_options: { action: string; extras?: Record<string, unknown> }): Promise<void> {
22
- alert("[Intent] 웹 환경에서는 Intent를 지원하지 않습니다.");
23
- await Promise.resolve();
30
+ send(_options: { action: string; extras?: Record<string, unknown> }): Promise<void> {
31
+ IntentWeb._warn();
32
+ return Promise.resolve();
24
33
  }
25
34
 
26
- async getLaunchIntent(): Promise<IIntentResult> {
27
- return await Promise.resolve({});
35
+ getLaunchIntent(): Promise<IntentResult> {
36
+ return Promise.resolve({});
28
37
  }
29
38
 
30
- async startActivityForResult(_options: IStartActivityForResultOptions): Promise<IActivityResult> {
31
- alert("[Intent] 웹 환경에서는 startActivityForResult를 지원하지 않습니다.");
32
- return await Promise.resolve({ resultCode: 0 });
39
+ startActivityForResult(
40
+ _options: StartActivityForResultOptions,
41
+ ): Promise<StartActivityForResultResult> {
42
+ IntentWeb._warn();
43
+ return Promise.resolve({ resultCode: 0 });
33
44
  }
34
45
  }
@@ -1,376 +0,0 @@
1
- package kr.co.simplysm.capacitor.intent;
2
-
3
- import android.content.BroadcastReceiver;
4
- import android.content.ComponentName;
5
- import android.content.Context;
6
- import android.content.Intent;
7
- import android.content.IntentFilter;
8
- import android.net.Uri;
9
- import android.os.Build;
10
- import android.os.Bundle;
11
- import android.os.Parcelable;
12
- import android.util.Log;
13
-
14
- import androidx.activity.result.ActivityResult;
15
-
16
- import com.getcapacitor.JSArray;
17
- import com.getcapacitor.JSObject;
18
- import com.getcapacitor.Plugin;
19
- import com.getcapacitor.PluginCall;
20
- import com.getcapacitor.PluginMethod;
21
- import com.getcapacitor.annotation.ActivityCallback;
22
- import com.getcapacitor.annotation.CapacitorPlugin;
23
-
24
- import org.json.JSONArray;
25
- import org.json.JSONException;
26
- import org.json.JSONObject;
27
-
28
- import java.util.HashMap;
29
- import java.util.Iterator;
30
- import java.util.Map;
31
- import java.util.Set;
32
- import java.util.UUID;
33
-
34
- @CapacitorPlugin(name = "Intent")
35
- public class IntentPlugin extends Plugin {
36
-
37
- private static final String TAG = "IntentPlugin";
38
- private final Map<String, BroadcastReceiver> receivers = new HashMap<>();
39
-
40
- @Override
41
- protected void handleOnNewIntent(Intent intent) {
42
- super.handleOnNewIntent(intent);
43
- notifyListeners("onNewIntent", intentToJson(intent));
44
- }
45
-
46
- @PluginMethod(returnType = PluginMethod.RETURN_CALLBACK)
47
- public void subscribe(PluginCall call) {
48
- try {
49
- JSArray filters = call.getArray("filters");
50
-
51
- if (filters == null || filters.length() == 0) {
52
- call.reject("filters is required");
53
- return;
54
- }
55
-
56
- call.setKeepAlive(true);
57
-
58
- String receiverId = UUID.randomUUID().toString();
59
-
60
- IntentFilter intentFilter = new IntentFilter();
61
- for (int i = 0; i < filters.length(); i++) {
62
- intentFilter.addAction(filters.getString(i));
63
- }
64
-
65
- BroadcastReceiver receiver = new BroadcastReceiver() {
66
- @Override
67
- public void onReceive(Context context, Intent intent) {
68
- JSObject result = intentToJson(intent);
69
- result.put("id", receiverId);
70
- call.resolve(result);
71
- }
72
- };
73
-
74
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
75
- getContext().registerReceiver(receiver, intentFilter, Context.RECEIVER_EXPORTED);
76
- } else {
77
- getContext().registerReceiver(receiver, intentFilter);
78
- }
79
-
80
- receivers.put(receiverId, receiver);
81
-
82
- JSObject ret = new JSObject();
83
- ret.put("id", receiverId);
84
- call.resolve(ret);
85
- } catch (Exception e) {
86
- Log.e(TAG, "subscribe failed", e);
87
- call.reject("subscribe failed: " + e.getMessage());
88
- }
89
- }
90
-
91
- @PluginMethod
92
- public void unsubscribe(PluginCall call) {
93
- try {
94
- String id = call.getString("id");
95
- if (id == null) {
96
- call.reject("id is required");
97
- return;
98
- }
99
-
100
- BroadcastReceiver receiver = receivers.remove(id);
101
- if (receiver != null) {
102
- getContext().unregisterReceiver(receiver);
103
- }
104
-
105
- call.resolve();
106
- } catch (Exception e) {
107
- Log.e(TAG, "unsubscribe failed", e);
108
- call.reject("unsubscribe failed: " + e.getMessage());
109
- }
110
- }
111
-
112
- @PluginMethod
113
- public void unsubscribeAll(PluginCall call) {
114
- try {
115
- for (BroadcastReceiver receiver : receivers.values()) {
116
- try {
117
- getContext().unregisterReceiver(receiver);
118
- } catch (Exception ignored) {
119
- }
120
- }
121
- receivers.clear();
122
- call.resolve();
123
- } catch (Exception e) {
124
- Log.e(TAG, "unsubscribeAll failed", e);
125
- call.reject("unsubscribeAll failed: " + e.getMessage());
126
- }
127
- }
128
-
129
- @PluginMethod
130
- public void send(PluginCall call) {
131
- try {
132
- String action = call.getString("action");
133
- if (action == null) {
134
- call.reject("action is required");
135
- return;
136
- }
137
-
138
- Intent intent = new Intent(action);
139
-
140
- JSObject extras = call.getObject("extras");
141
- if (extras != null) {
142
- populateExtras(intent, extras);
143
- }
144
-
145
- getContext().sendBroadcast(intent);
146
- call.resolve();
147
- } catch (Exception e) {
148
- Log.e(TAG, "send failed", e);
149
- call.reject("send failed: " + e.getMessage());
150
- }
151
- }
152
-
153
- @PluginMethod
154
- public void getLaunchIntent(PluginCall call) {
155
- try {
156
- Intent intent = getActivity().getIntent();
157
- call.resolve(intentToJson(intent));
158
- } catch (Exception e) {
159
- Log.e(TAG, "getLaunchIntent failed", e);
160
- call.reject("getLaunchIntent failed: " + e.getMessage());
161
- }
162
- }
163
-
164
- @PluginMethod
165
- public void startActivityForResult(PluginCall call) {
166
- try {
167
- String action = call.getString("action");
168
- if (action == null) {
169
- call.reject("action is required");
170
- return;
171
- }
172
-
173
- Intent intent = new Intent(action);
174
-
175
- String uri = call.getString("uri");
176
- String type = call.getString("type");
177
- if (uri != null && type != null) {
178
- intent.setDataAndType(Uri.parse(uri), type);
179
- } else if (uri != null) {
180
- intent.setData(Uri.parse(uri));
181
- } else if (type != null) {
182
- intent.setType(type);
183
- }
184
-
185
- String pkg = call.getString("package");
186
- String component = call.getString("component");
187
- if (component != null && pkg == null) {
188
- call.reject("component requires package");
189
- return;
190
- }
191
- if (pkg != null && component != null) {
192
- intent.setComponent(new ComponentName(pkg, component));
193
- } else if (pkg != null) {
194
- intent.setPackage(pkg);
195
- }
196
-
197
- JSObject extras = call.getObject("extras");
198
- if (extras != null) {
199
- populateExtras(intent, extras);
200
- }
201
-
202
- startActivityForResult(call, intent, "onActivityResult");
203
- } catch (Exception e) {
204
- Log.e(TAG, "startActivityForResult failed", e);
205
- call.reject("startActivityForResult failed: " + e.getMessage());
206
- }
207
- }
208
-
209
- @ActivityCallback
210
- private void onActivityResult(PluginCall call, ActivityResult result) {
211
- if (call == null) {
212
- return;
213
- }
214
-
215
- JSObject ret = new JSObject();
216
- ret.put("resultCode", result.getResultCode());
217
-
218
- Intent data = result.getData();
219
- if (data != null) {
220
- String dataString = data.getDataString();
221
- if (dataString != null) {
222
- ret.put("data", dataString);
223
- }
224
-
225
- Bundle extras = data.getExtras();
226
- if (extras != null && !extras.isEmpty()) {
227
- ret.put("extras", bundleToJson(extras));
228
- }
229
- }
230
-
231
- call.resolve(ret);
232
- }
233
-
234
- private void populateExtras(Intent intent, JSObject extras) throws JSONException {
235
- Iterator<String> keys = extras.keys();
236
- while (keys.hasNext()) {
237
- String key = keys.next();
238
- Object value = extras.get(key);
239
-
240
- if (value instanceof String) {
241
- intent.putExtra(key, (String) value);
242
- } else if (value instanceof Integer) {
243
- intent.putExtra(key, (Integer) value);
244
- } else if (value instanceof Long) {
245
- intent.putExtra(key, (Long) value);
246
- } else if (value instanceof Double) {
247
- intent.putExtra(key, (Double) value);
248
- } else if (value instanceof Boolean) {
249
- intent.putExtra(key, (Boolean) value);
250
- } else if (value instanceof JSONArray) {
251
- JSONArray arr = (JSONArray) value;
252
- String[] strArr = new String[arr.length()];
253
- for (int i = 0; i < arr.length(); i++) {
254
- strArr[i] = arr.getString(i);
255
- }
256
- intent.putExtra(key, strArr);
257
- } else if (value instanceof JSONObject) {
258
- Bundle bundle = jsonToBundle((JSONObject) value);
259
- intent.putExtra(key, bundle);
260
- }
261
- }
262
- }
263
-
264
- private Bundle jsonToBundle(JSONObject json) throws JSONException {
265
- Bundle bundle = new Bundle();
266
- Iterator<String> keys = json.keys();
267
- while (keys.hasNext()) {
268
- String key = keys.next();
269
- Object value = json.get(key);
270
-
271
- if (value instanceof String) {
272
- bundle.putString(key, (String) value);
273
- } else if (value instanceof Integer) {
274
- bundle.putInt(key, (Integer) value);
275
- } else if (value instanceof Long) {
276
- bundle.putLong(key, (Long) value);
277
- } else if (value instanceof Double) {
278
- bundle.putDouble(key, (Double) value);
279
- } else if (value instanceof Boolean) {
280
- bundle.putBoolean(key, (Boolean) value);
281
- }
282
- }
283
- return bundle;
284
- }
285
-
286
- private JSObject intentToJson(Intent intent) {
287
- JSObject json = new JSObject();
288
-
289
- if (intent == null) {
290
- return json;
291
- }
292
-
293
- try {
294
- json.put("action", intent.getAction());
295
-
296
- Bundle extras = intent.getExtras();
297
- if (extras != null) {
298
- json.put("extras", bundleToJson(extras));
299
- }
300
- } catch (Exception e) {
301
- Log.e(TAG, "intentToJson failed", e);
302
- }
303
-
304
- return json;
305
- }
306
-
307
- private JSObject bundleToJson(Bundle bundle) {
308
- JSObject json = new JSObject();
309
-
310
- if (bundle == null) {
311
- return json;
312
- }
313
-
314
- for (String key : bundle.keySet()) {
315
- try {
316
- Object value = bundle.get(key);
317
-
318
- if (value == null) {
319
- json.put(key, JSONObject.NULL);
320
- } else if (value instanceof String) {
321
- json.put(key, value);
322
- } else if (value instanceof Integer) {
323
- json.put(key, value);
324
- } else if (value instanceof Long) {
325
- json.put(key, value);
326
- } else if (value instanceof Double) {
327
- json.put(key, value);
328
- } else if (value instanceof Float) {
329
- json.put(key, ((Float) value).doubleValue());
330
- } else if (value instanceof Boolean) {
331
- json.put(key, value);
332
- } else if (value instanceof Bundle) {
333
- json.put(key, bundleToJson((Bundle) value));
334
- } else if (value instanceof String[]) {
335
- JSArray arr = new JSArray();
336
- for (String s : (String[]) value) {
337
- arr.put(s);
338
- }
339
- json.put(key, arr);
340
- } else if (value instanceof int[]) {
341
- JSArray arr = new JSArray();
342
- for (int i : (int[]) value) {
343
- arr.put(i);
344
- }
345
- json.put(key, arr);
346
- } else if (value instanceof Parcelable) {
347
- json.put(key, value.toString());
348
- } else if (value instanceof Parcelable[]) {
349
- JSArray arr = new JSArray();
350
- for (Parcelable p : (Parcelable[]) value) {
351
- arr.put(p.toString());
352
- }
353
- json.put(key, arr);
354
- } else {
355
- json.put(key, value.toString());
356
- }
357
- } catch (Exception e) {
358
- Log.w(TAG, "bundleToJson key failed: " + key, e);
359
- }
360
- }
361
-
362
- return json;
363
- }
364
-
365
- @Override
366
- protected void handleOnDestroy() {
367
- for (BroadcastReceiver receiver : receivers.values()) {
368
- try {
369
- getContext().unregisterReceiver(receiver);
370
- } catch (Exception ignored) {
371
- }
372
- }
373
- receivers.clear();
374
- super.handleOnDestroy();
375
- }
376
- }
@@ -1,63 +0,0 @@
1
- export interface IIntentResult {
2
- /** Intent action */
3
- action?: string;
4
- /** Extra data */
5
- extras?: Record<string, unknown>;
6
- }
7
- export interface IStartActivityForResultOptions {
8
- /** Intent action */
9
- action: string;
10
- /** Data URI */
11
- uri?: string;
12
- /** Extra data */
13
- extras?: Record<string, unknown>;
14
- /** Target package name */
15
- package?: string;
16
- /** Target component class name */
17
- component?: string;
18
- /** MIME type */
19
- type?: string;
20
- }
21
- export interface IActivityResult {
22
- /** Activity result code (RESULT_OK = -1, RESULT_CANCELED = 0) */
23
- resultCode: number;
24
- /** Result data URI */
25
- data?: string;
26
- /** Result extras */
27
- extras?: Record<string, unknown>;
28
- }
29
- export interface IIntentPlugin {
30
- /**
31
- * Intent 수신기 등록
32
- */
33
- subscribe(options: {
34
- filters: string[];
35
- }, callback: (result: IIntentResult) => void): Promise<{
36
- id: string;
37
- }>;
38
- /**
39
- * 특정 Intent 수신기 해제
40
- */
41
- unsubscribe(options: {
42
- id: string;
43
- }): Promise<void>;
44
- /**
45
- * 모든 Intent 수신기 해제
46
- */
47
- unsubscribeAll(): Promise<void>;
48
- /**
49
- * Intent 전송
50
- */
51
- send(options: {
52
- action: string;
53
- extras?: Record<string, unknown>;
54
- }): Promise<void>;
55
- /**
56
- * 앱 시작 Intent 가져오기
57
- */
58
- getLaunchIntent(): Promise<IIntentResult>;
59
- /**
60
- * Activity 시작 후 결과 수신
61
- */
62
- startActivityForResult(options: IStartActivityForResultOptions): Promise<IActivityResult>;
63
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,65 +0,0 @@
1
- export interface IIntentResult {
2
- /** Intent action */
3
- action?: string;
4
- /** Extra data */
5
- extras?: Record<string, unknown>;
6
- }
7
-
8
- export interface IStartActivityForResultOptions {
9
- /** Intent action */
10
- action: string;
11
- /** Data URI */
12
- uri?: string;
13
- /** Extra data */
14
- extras?: Record<string, unknown>;
15
- /** Target package name */
16
- package?: string;
17
- /** Target component class name */
18
- component?: string;
19
- /** MIME type */
20
- type?: string;
21
- }
22
-
23
- export interface IActivityResult {
24
- /** Activity result code (RESULT_OK = -1, RESULT_CANCELED = 0) */
25
- resultCode: number;
26
- /** Result data URI */
27
- data?: string;
28
- /** Result extras */
29
- extras?: Record<string, unknown>;
30
- }
31
-
32
- export interface IIntentPlugin {
33
- /**
34
- * Intent 수신기 등록
35
- */
36
- subscribe(
37
- options: { filters: string[] },
38
- callback: (result: IIntentResult) => void,
39
- ): Promise<{ id: string }>;
40
-
41
- /**
42
- * 특정 Intent 수신기 해제
43
- */
44
- unsubscribe(options: { id: string }): Promise<void>;
45
-
46
- /**
47
- * 모든 Intent 수신기 해제
48
- */
49
- unsubscribeAll(): Promise<void>;
50
-
51
- /**
52
- * Intent 전송
53
- */
54
- send(options: { action: string; extras?: Record<string, unknown> }): Promise<void>;
55
-
56
- /**
57
- * 앱 시작 Intent 가져오기
58
- */
59
- getLaunchIntent(): Promise<IIntentResult>;
60
-
61
- /**
62
- * Activity 시작 후 결과 수신
63
- */
64
- startActivityForResult(options: IStartActivityForResultOptions): Promise<IActivityResult>;
65
- }
@@ -1,50 +0,0 @@
1
- import { existsSync, readFileSync } from "fs";
2
- import { resolve } from "path";
3
-
4
- const pkgRoot = resolve(import.meta.dirname, "..");
5
- const monoRoot = resolve(pkgRoot, "../..");
6
-
7
- describe("Slice 1: 디렉토리 이동 및 설정 파일 변경", () => {
8
- // Scenario: 디렉토리 이동
9
- test("패키지가 packages/capacitor-plugin-intent/ 경로에 존재한다", () => {
10
- expect(existsSync(resolve(monoRoot, "packages/capacitor-plugin-intent"))).toBe(true);
11
- });
12
-
13
- test("packages/capacitor-plugin-broadcast/ 경로는 존재하지 않는다", () => {
14
- expect(existsSync(resolve(monoRoot, "packages/capacitor-plugin-broadcast"))).toBe(false);
15
- });
16
-
17
- // Scenario: npm 패키지명 변경
18
- test("package.json의 name이 @simplysm/capacitor-plugin-intent이다", () => {
19
- const pkg = JSON.parse(readFileSync(resolve(pkgRoot, "package.json"), "utf-8"));
20
- expect(pkg.name).toBe("@simplysm/capacitor-plugin-intent");
21
- });
22
-
23
- // Scenario: package.json 메타데이터 갱신
24
- test("package.json의 description에 Intent가 포함된다", () => {
25
- const pkg = JSON.parse(readFileSync(resolve(pkgRoot, "package.json"), "utf-8"));
26
- expect(pkg.description).toContain("Intent");
27
- });
28
-
29
- test("package.json의 repository.directory가 packages/capacitor-plugin-intent이다", () => {
30
- const pkg = JSON.parse(readFileSync(resolve(pkgRoot, "package.json"), "utf-8"));
31
- expect(pkg.repository.directory).toBe("packages/capacitor-plugin-intent");
32
- });
33
-
34
- // Scenario: simplysm.js 설정 키 변경
35
- test("simplysm.js에서 capacitor-plugin-intent 키로 패키지가 등록되어 있다", async () => {
36
- const config = (await import(resolve(monoRoot, "simplysm.js"))).default();
37
- expect(config.packages["capacitor-plugin-intent"]).toBeDefined();
38
- });
39
-
40
- test("simplysm.js에서 capacitor-plugin-broadcast 키는 존재하지 않는다", async () => {
41
- const config = (await import(resolve(monoRoot, "simplysm.js"))).default();
42
- expect(config.packages["capacitor-plugin-broadcast"]).toBeUndefined();
43
- });
44
-
45
- // Scenario: build.gradle namespace 변경
46
- test("build.gradle namespace가 kr.co.simplysm.capacitor.intent이다", () => {
47
- const gradle = readFileSync(resolve(pkgRoot, "android/build.gradle"), "utf-8");
48
- expect(gradle).toContain('namespace "kr.co.simplysm.capacitor.intent"');
49
- });
50
- });
@@ -1,34 +0,0 @@
1
- import { existsSync, readFileSync } from "fs";
2
- import { resolve } from "path";
3
-
4
- const pkgRoot = resolve(import.meta.dirname, "..");
5
- const javaBase = resolve(pkgRoot, "android/src/main/java/kr/co/simplysm/capacitor");
6
-
7
- describe("Slice 2: Java 소스 리네이밍", () => {
8
- // Scenario: Java 패키지 경로 변경
9
- test("IntentPlugin.java가 intent/ 경로에 존재한다", () => {
10
- expect(existsSync(resolve(javaBase, "intent/IntentPlugin.java"))).toBe(true);
11
- });
12
-
13
- test("이전 broadcast/ 디렉토리는 존재하지 않는다", () => {
14
- expect(existsSync(resolve(javaBase, "broadcast"))).toBe(false);
15
- });
16
-
17
- // Scenario: Java 패키지 선언 변경
18
- test("package 선언이 kr.co.simplysm.capacitor.intent이다", () => {
19
- const java = readFileSync(resolve(javaBase, "intent/IntentPlugin.java"), "utf-8");
20
- expect(java).toContain("package kr.co.simplysm.capacitor.intent;");
21
- });
22
-
23
- // Scenario: Java 클래스명 변경
24
- test("클래스명이 IntentPlugin이다", () => {
25
- const java = readFileSync(resolve(javaBase, "intent/IntentPlugin.java"), "utf-8");
26
- expect(java).toContain("public class IntentPlugin extends Plugin");
27
- });
28
-
29
- // Scenario: Capacitor 플러그인 등록명 변경
30
- test('@CapacitorPlugin(name = "Intent")로 등록된다', () => {
31
- const java = readFileSync(resolve(javaBase, "intent/IntentPlugin.java"), "utf-8");
32
- expect(java).toContain('@CapacitorPlugin(name = "Intent")');
33
- });
34
- });