@capacitor-mlkit/genai-proofreading 8.2.0 → 8.2.2

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.
package/README.md CHANGED
@@ -6,8 +6,8 @@ Unofficial Capacitor plugin for [ML Kit GenAI Proofreading](https://developers.g
6
6
  > The ML Kit GenAI APIs are currently in **beta**. The API surface and behavior may change in future releases.
7
7
 
8
8
  <div class="capawesome-z29o10a">
9
- <a href="https://cloud.capawesome.io/" target="_blank">
10
- <img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.png?t=1" />
9
+ <a href="https://capawesome.io/" target="_blank">
10
+ <img alt="Ship a fix in one command with Capawesome Cloud Live Updates, no store review" src="https://capawesome.io/assets/banners/cloud-ship-a-fix-in-one-command.png" />
11
11
  </a>
12
12
  </div>
13
13
 
@@ -47,57 +47,51 @@ public class GenAiProofreading {
47
47
  public void checkFeatureStatus(@NonNull FeatureOptions options, @NonNull NonEmptyResultCallback<CheckFeatureStatusResult> callback) {
48
48
  Proofreader proofreader = getProofreader(options);
49
49
  ListenableFuture<Integer> future = proofreader.checkFeatureStatus();
50
- future.addListener(
51
- () -> {
52
- try {
53
- int featureStatus = future.get();
54
- callback.success(new CheckFeatureStatusResult(featureStatus));
55
- } catch (Exception exception) {
56
- callback.error(unwrapException(exception));
57
- }
58
- },
59
- executor
60
- );
50
+ future.addListener(() -> {
51
+ try {
52
+ int featureStatus = future.get();
53
+ callback.success(new CheckFeatureStatusResult(featureStatus));
54
+ } catch (Exception exception) {
55
+ callback.error(unwrapException(exception));
56
+ }
57
+ }, executor);
61
58
  }
62
59
 
63
60
  public void downloadFeature(@NonNull FeatureOptions options, @NonNull EmptyCallback callback) {
64
61
  Proofreader proofreader = getProofreader(options);
65
62
  ListenableFuture<Integer> future = proofreader.checkFeatureStatus();
66
- future.addListener(
67
- () -> {
68
- try {
69
- int featureStatus = future.get();
70
- if (featureStatus == FeatureStatus.AVAILABLE) {
71
- callback.success();
72
- return;
73
- }
74
- proofreader.downloadFeature(
75
- new DownloadCallback() {
76
- @Override
77
- public void onDownloadStarted(long bytesToDownload) {}
78
-
79
- @Override
80
- public void onDownloadProgress(long totalBytesDownloaded) {
81
- plugin.notifyDownloadProgressListeners(new DownloadProgressEvent(totalBytesDownloaded));
82
- }
83
-
84
- @Override
85
- public void onDownloadCompleted() {
86
- callback.success();
87
- }
88
-
89
- @Override
90
- public void onDownloadFailed(@NonNull GenAiException exception) {
91
- callback.error(exception);
92
- }
93
- }
94
- );
95
- } catch (Exception exception) {
96
- callback.error(unwrapException(exception));
63
+ future.addListener(() -> {
64
+ try {
65
+ int featureStatus = future.get();
66
+ if (featureStatus == FeatureStatus.AVAILABLE) {
67
+ callback.success();
68
+ return;
97
69
  }
98
- },
99
- executor
100
- );
70
+ proofreader.downloadFeature(
71
+ new DownloadCallback() {
72
+ @Override
73
+ public void onDownloadStarted(long bytesToDownload) {}
74
+
75
+ @Override
76
+ public void onDownloadProgress(long totalBytesDownloaded) {
77
+ plugin.notifyDownloadProgressListeners(new DownloadProgressEvent(totalBytesDownloaded));
78
+ }
79
+
80
+ @Override
81
+ public void onDownloadCompleted() {
82
+ callback.success();
83
+ }
84
+
85
+ @Override
86
+ public void onDownloadFailed(@NonNull GenAiException exception) {
87
+ callback.error(exception);
88
+ }
89
+ }
90
+ );
91
+ } catch (Exception exception) {
92
+ callback.error(unwrapException(exception));
93
+ }
94
+ }, executor);
101
95
  }
102
96
 
103
97
  public void handleOnDestroy() {
@@ -110,21 +104,18 @@ public class GenAiProofreading {
110
104
  ListenableFuture<ProofreadingResult> future = proofreader.runInference(request, additionalText ->
111
105
  plugin.notifyInferenceProgressListeners(new InferenceProgressEvent(additionalText))
112
106
  );
113
- future.addListener(
114
- () -> {
115
- try {
116
- ProofreadingResult result = future.get();
117
- List<String> results = new ArrayList<>();
118
- for (ProofreadingSuggestion suggestion : result.getResults()) {
119
- results.add(suggestion.getText());
120
- }
121
- callback.success(new ProofreadResult(results));
122
- } catch (Exception exception) {
123
- callback.error(unwrapException(exception));
107
+ future.addListener(() -> {
108
+ try {
109
+ ProofreadingResult result = future.get();
110
+ List<String> results = new ArrayList<>();
111
+ for (ProofreadingSuggestion suggestion : result.getResults()) {
112
+ results.add(suggestion.getText());
124
113
  }
125
- },
126
- executor
127
- );
114
+ callback.success(new ProofreadResult(results));
115
+ } catch (Exception exception) {
116
+ callback.error(unwrapException(exception));
117
+ }
118
+ }, executor);
128
119
  }
129
120
 
130
121
  private void closeProofreader() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-mlkit/genai-proofreading",
3
- "version": "8.2.0",
3
+ "version": "8.2.2",
4
4
  "description": "Capacitor plugin for ML Kit GenAI Proofreading on Android.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -65,15 +65,15 @@
65
65
  },
66
66
  "devDependencies": {
67
67
  "@capacitor/android": "8.0.0",
68
- "@capacitor/cli": "8.0.0",
68
+ "@capacitor/cli": "8.5.0",
69
69
  "@capacitor/core": "8.0.0",
70
70
  "@capacitor/docgen": "0.3.1",
71
71
  "@capacitor/ios": "8.0.0",
72
72
  "@ionic/eslint-config": "0.4.0",
73
73
  "eslint": "8.57.0",
74
- "prettier-plugin-java": "2.6.7",
74
+ "prettier-plugin-java": "2.9.7",
75
75
  "rimraf": "6.1.2",
76
- "rollup": "4.53.3",
76
+ "rollup": "4.62.3",
77
77
  "swiftlint": "2.0.0",
78
78
  "typescript": "5.9.3"
79
79
  },