@aigens/aigens-sdk-core 0.4.6 → 0.5.1

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,8 +1,8 @@
1
1
  ext {
2
2
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
6
6
 
7
7
  }
8
8
 
@@ -12,17 +12,18 @@ buildscript {
12
12
  jcenter()
13
13
  }
14
14
  dependencies {
15
- classpath 'com.android.tools.build:gradle:7.2.1'
15
+ classpath 'com.android.tools.build:gradle:8.0.0'
16
16
  }
17
17
  }
18
18
 
19
19
  apply plugin: 'com.android.library'
20
20
 
21
21
  android {
22
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30
22
+ namespace "com.aigens.sdk"
23
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
23
24
  defaultConfig {
24
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
25
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
25
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
26
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
26
27
  versionCode 1
27
28
  versionName "1.0"
28
29
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -37,8 +38,8 @@ android {
37
38
  abortOnError false
38
39
  }
39
40
  compileOptions {
40
- sourceCompatibility JavaVersion.VERSION_11
41
- targetCompatibility JavaVersion.VERSION_11
41
+ sourceCompatibility JavaVersion.VERSION_17
42
+ targetCompatibility JavaVersion.VERSION_17
42
43
  }
43
44
  }
44
45
 
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.aigens.sdk">
3
+ >
4
4
  <uses-permission android:name="android.permission.INTERNET" />
5
5
  <application android:hardwareAccelerated="true">
6
6
  <activity android:name=".WebContainerActivity"
@@ -449,31 +449,42 @@ public class CorePlugin extends Plugin {
449
449
  public void readClipboard(PluginCall call) {
450
450
  JSObject object = new JSObject();
451
451
  try {
452
-
453
452
  ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
454
- CharSequence value = null;
453
+ String value = "";
454
+ String type = "text/plain";
455
+
455
456
  if (clipboard.hasPrimaryClip()) {
456
- if (clipboard.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
457
- ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
458
- value = item.getText();
459
- } else {
460
- ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
461
- value = item.coerceToText(getContext()).toString();
457
+ ClipData clipData = clipboard.getPrimaryClip();
458
+ if (clipData != null && clipData.getItemCount() > 0) {
459
+ ClipData.Item item = clipData.getItemAt(0);
460
+ ClipDescription description = clipData.getDescription();
461
+
462
+ // 优先使用系统报告的MIME类型
463
+ if (description != null && description.getMimeTypeCount() > 0) {
464
+ type = description.getMimeType(0);
465
+ }
466
+
467
+ // 获取剪贴板内容
468
+ CharSequence text = item.getText();
469
+ if (text != null) {
470
+ value = text.toString();
471
+ } else {
472
+ // 处理非文本内容
473
+ value = item.coerceToText(getContext()).toString();
474
+
475
+ // 如果系统未报告类型,检查URI格式
476
+ if (type.equals("text/plain") && value.startsWith("data:")) {
477
+ type = value.split(";")[0].split(":")[1];
478
+ }
479
+ }
462
480
  }
463
481
  }
464
- String type = "text/plain";
465
- if (value != null) {
466
- object.put("value", value.toString());
467
- }else {
468
- object.put("value", "");
469
- }
470
- if (value != null && value.toString().startsWith("data:")) {
471
- type = value.toString().split(";")[0].split(":")[1];
472
- }
482
+
483
+ object.put("value", value);
473
484
  object.put("type", type);
474
485
  } catch (Exception e) {
475
486
  object.put("value", "");
476
- object.put("type", "");
487
+ object.put("type", "text/plain");
477
488
  e.printStackTrace();
478
489
  }
479
490
  call.resolve(object);
@@ -100,18 +100,13 @@ public class CorePlugin: CAPPlugin {
100
100
  let typeIdentifier = call.getString("typeIdentifier", "hk.com.hkicl");
101
101
 
102
102
  let paymentData: [String: Any] = ["URL": paymentRequestUrl, "callback": callbackUrl]
103
- // let jsonData = try! JSONSerialization.data(withJSONObject: paymentData, options: [])
104
- // let itemProvider = NSItemProvider(item: jsonData as NSSecureCoding, typeIdentifier: typeIdentifier)
105
103
  let itemProvider = NSItemProvider(item: paymentData as NSSecureCoding, typeIdentifier: typeIdentifier)
106
104
  let extensionItem = NSExtensionItem()
107
105
  extensionItem.attachments = [itemProvider]
108
106
 
109
- // Invoke UIActivityViewController to choose Payment App
110
107
  let activityViewController = UIActivityViewController(activityItems: [extensionItem], applicationActivities: nil)
111
108
 
112
109
  activityViewController.completionWithItemsHandler = { (activityType, completed, returnedItems, activityError) in
113
- // Start the activity chosen to complete the payment
114
- print("Start the activity chosen to complete the payment : \(completed)")
115
110
  if !completed {
116
111
  CorePlugin.HKFPSCall?.keepAlive = false;
117
112
  CorePlugin.HKFPSCall = nil;
@@ -119,7 +114,6 @@ public class CorePlugin: CAPPlugin {
119
114
  }
120
115
  DispatchQueue.main.async {
121
116
  self.bridge?.viewController?.present(activityViewController, animated: true, completion: nil)
122
-
123
117
  call.keepAlive = true;
124
118
  CorePlugin.HKFPSCall = call;
125
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigens/aigens-sdk-core",
3
- "version": "0.4.6",
3
+ "version": "0.5.1",
4
4
  "description": "Aigens Order.Place Core 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": "^4.6.1",
48
- "@capacitor/core": "^4.6.1",
49
- "@capacitor/docgen": "^0.2.0",
50
- "@capacitor/ios": "^4.6.1",
47
+ "@capacitor/android": "^5.0.0",
48
+ "@capacitor/core": "^5.0.0",
49
+ "@capacitor/docgen": "^0.2.2",
50
+ "@capacitor/ios": "^5.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.8"
61
61
  },
62
62
  "peerDependencies": {
63
- "@capacitor/core": "^4.6.1"
63
+ "@capacitor/core": "^5.0.0"
64
64
  },
65
65
  "prettier": "@ionic/prettier-config",
66
66
  "swiftlint": "@ionic/swiftlint-config",