Skip to content

Commit 72bf567

Browse files
committed
Release 3.1.0
1 parent 5bfda83 commit 72bf567

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+515
-291
lines changed

CHANGELOG.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1+
## 3.1.0 - 10 Sep 2025
2+
3+
- Adds the `getOverlappingSignature` API to `SignatureFormElement` objects to retrieve overlapping signature annotations. (J#HYB-867)
4+
- Updates `BookmarksEvent.CHANGED` to include entire `Bookmark` objects. (J#HYB-832)
5+
- Updates the `SignatureFormElement` object to only include `SignatureInfo` when the Electronic Signatures license feature is present. (J#HYB-862)
6+
- Updates to Nutrient iOS SDK 14.12.0.
7+
- Fixes inconsistent behavior between iOS and Android for the `updateChoiceFormFieldValue` API. (J#HYB-873)
8+
- Fixes an issue where the `updateFormField` APIs on Android used the `fieldName` rather than `fullyQualifiedName` as a reference. (J#HYB-869)
9+
- Fixes an issue where certain `FormElement` properties were parsed incorrectly during the `getFormElements` API call. (J#HYB-858)
10+
- Fixes an issue where calling `unsubscribeAllEvents` would result in all `NotificationCenter` listeners being removed on all active `NutrientView` instances. (J#HYB-866)
11+
- Fixes an issue where `NotificationCenter` would deliver duplicate events if multiple `NutrientView` instances are active. (J#HYB-866)
12+
- Fixes an issue where the `readerViewButtonItem` wasn’t being applied correctly on Android. (J#HYB-878)
13+
114
## 3.0.1 - 01 Aug 2025
215

316
- Updates README.md with Nutrient rebranding changes. (J#HG-681)
417

518
## 3.0.0 - 01 Aug 2025
619

20+
_[Migration guide](https://www.nutrient.io/guides/react-native/migration-guides/react-native-3-migration-guide/)._
21+
722
- Adds the `onReady` callback to `NutrientView` to make functional component integration easier. (J#HYB-809)
823
- Updates SDK to Nutrient branding. The new package name is now `@nutrient-sdk/react-native`. (J#HG-681)
924
- Updates to Nutrient Android SDK 10.5.0.
@@ -28,6 +43,7 @@
2843
- Fixes an issue where `AnnotationsEvent.REMOVED` contained null `name` and `creatorName` properties on Android. (J#HYB-829)
2944

3045
## 2.18.1 - 24 Jun 2025
46+
3147
- Updates to Nutrient Android SDK 10.4.0.
3248
- Fixes an issue where the `enterAnnotationCreationMode` and `exitCurrentlyActiveMode` calls on Android resolved before being complete. (J#HYB-824)
3349
- Fixes an issue where setting the `pageIndex` property could result in a crash on Android. (J#HYB-817)
@@ -40,9 +56,9 @@
4056
- Updates to Nutrient Android SDK 10.2.0.
4157
- Updates to Nutrient iOS SDK 14.8.0.
4258
- Fixes an issue where the `setLicenseKeys` API could cause a crash on Android if called too early during the application lifecycle. (J#HYB-790)
43-
- Fixes an issue where `NotificationCenter` events aren't always delivered when running the Release build configuration on iOS. (J#HYB-793)
44-
- Fixes an issue where toolbar button customization wasn't persisted on Android during component reload. (J#HYB-800)
45-
- Fixes an issue where the `onAnnotationTapped` callback wasn't called reliably on Android. (J#HYB-805)
59+
- Fixes an issue where `NotificationCenter` events arent always delivered when running the Release build configuration on iOS. (J#HYB-793)
60+
- Fixes an issue where toolbar button customization wasnt persisted on Android during component reload. (J#HYB-800)
61+
- Fixes an issue where the `onAnnotationTapped` callback wasnt called reliably on Android. (J#HYB-805)
4662

4763
## 2.17.0 - 14 Apr 2025
4864

android/src/main/java/com/pspdfkit/react/NutrientNotificationCenter.kt

Lines changed: 60 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import com.pspdfkit.forms.FormElement
1717
import com.pspdfkit.forms.FormField
1818
import com.pspdfkit.forms.TextFormElement
1919
import com.pspdfkit.react.helper.AnnotationUtils
20+
import com.pspdfkit.react.helper.BookmarkUtils
2021

2122
class CustomAnalyticsClient: AnalyticsClient {
2223
override fun onEvent(name: String, data: Bundle?) {
@@ -70,28 +71,38 @@ object NutrientNotificationCenter {
7071
?.emit(eventName, params)
7172
}
7273

73-
fun documentLoaded(documentID: String) {
74+
private fun createEventPayload(jsonData: WritableMap, componentID: Int): WritableMap {
75+
val payload = Arguments.createMap()
76+
payload.putMap("data", jsonData)
77+
payload.putInt("componentID", componentID)
78+
return payload
79+
}
80+
81+
fun documentLoaded(documentID: String, componentID: Int) {
7482
val jsonData = Arguments.createMap()
7583
jsonData.putString("event", NotificationEvent.DOCUMENT_LOADED.value)
7684
jsonData.putString("documentID", documentID)
77-
sendEvent(NotificationEvent.DOCUMENT_LOADED.value, jsonData)
85+
val payload = createEventPayload(jsonData, componentID)
86+
sendEvent(NotificationEvent.DOCUMENT_LOADED.value, payload)
7887
}
7988

80-
fun documentLoadFailed() {
89+
fun documentLoadFailed(componentID: Int) {
8190
val jsonData = Arguments.createMap()
8291
jsonData.putString("event", NotificationEvent.DOCUMENT_LOAD_FAILED.value)
83-
sendEvent(NotificationEvent.DOCUMENT_LOAD_FAILED.value, jsonData)
92+
val payload = createEventPayload(jsonData, componentID)
93+
sendEvent(NotificationEvent.DOCUMENT_LOAD_FAILED.value, payload)
8494
}
8595

86-
fun documentPageChanged(pageIndex: Int, documentID: String) {
96+
fun documentPageChanged(pageIndex: Int, documentID: String, componentID: Int) {
8797
val jsonData = Arguments.createMap()
8898
jsonData.putString("event", NotificationEvent.DOCUMENT_PAGE_CHANGED.value)
8999
jsonData.putInt("pageIndex", pageIndex)
90100
jsonData.putString("documentID", documentID)
91-
sendEvent(NotificationEvent.DOCUMENT_PAGE_CHANGED.value, jsonData)
101+
val payload = createEventPayload(jsonData, componentID)
102+
sendEvent(NotificationEvent.DOCUMENT_PAGE_CHANGED.value, payload)
92103
}
93104

94-
fun documentScrolled(scrollData: Map<String, Int>, documentID: String) {
105+
fun documentScrolled(scrollData: Map<String, Int>, documentID: String, componentID: Int) {
95106
val jsonData = Arguments.createMap()
96107
val scrollDataMap = Arguments.createMap()
97108
scrollData.forEach { (key, value) ->
@@ -100,10 +111,11 @@ object NutrientNotificationCenter {
100111
jsonData.putString("event", NotificationEvent.DOCUMENT_SCROLLED.value)
101112
jsonData.putMap("scrollData", scrollDataMap)
102113
jsonData.putString("documentID", documentID)
103-
sendEvent(NotificationEvent.DOCUMENT_SCROLLED.value, jsonData)
114+
val payload = createEventPayload(jsonData, componentID)
115+
sendEvent(NotificationEvent.DOCUMENT_SCROLLED.value, payload)
104116
}
105117

106-
fun didTapDocument(pointF: PointF, pageIndex: Int, documentID: String) {
118+
fun didTapDocument(pointF: PointF, pageIndex: Int, documentID: String, componentID: Int) {
107119
try {
108120
val pointMap = mapOf("x" to pointF.x, "y" to pointF.y)
109121
val nativePointMap = Arguments.makeNativeMap(pointMap)
@@ -113,13 +125,14 @@ object NutrientNotificationCenter {
113125
jsonData.putMap("point", nativePointMap)
114126
jsonData.putInt("pageIndex", pageIndex)
115127
jsonData.putString("documentID", documentID)
116-
sendEvent(NotificationEvent.DOCUMENT_TAPPED.value, jsonData)
128+
val payload = createEventPayload(jsonData, componentID)
129+
sendEvent(NotificationEvent.DOCUMENT_TAPPED.value, payload)
117130
} catch (e: Exception) {
118131
// Could not decode point data
119132
}
120133
}
121134

122-
fun annotationsChanged(changeType: String, annotation: Annotation, documentID: String) {
135+
fun annotationsChanged(changeType: String, annotation: Annotation, documentID: String, componentID: Int) {
123136
when (changeType) {
124137
"changed" -> {
125138
try {
@@ -132,7 +145,8 @@ object NutrientNotificationCenter {
132145
jsonData.putString("event", NotificationEvent.ANNOTATION_CHANGED.value)
133146
jsonData.putArray("annotations", nativeAnnotationsList)
134147
jsonData.putString("documentID", documentID)
135-
sendEvent(NotificationEvent.ANNOTATION_CHANGED.value, jsonData)
148+
val payload = createEventPayload(jsonData, componentID)
149+
sendEvent(NotificationEvent.ANNOTATION_CHANGED.value, payload)
136150
} catch (e: Exception) {
137151
// Could not decode annotation data
138152
}
@@ -152,7 +166,8 @@ object NutrientNotificationCenter {
152166
jsonData.putString("event", NotificationEvent.ANNOTATIONS_REMOVED.value)
153167
jsonData.putArray("annotations", nativeAnnotationsList)
154168
jsonData.putString("documentID", documentID)
155-
sendEvent(NotificationEvent.ANNOTATIONS_REMOVED.value, jsonData)
169+
val payload = createEventPayload(jsonData, componentID)
170+
sendEvent(NotificationEvent.ANNOTATIONS_REMOVED.value, payload)
156171
}
157172
}
158173
"added" -> {
@@ -166,37 +181,31 @@ object NutrientNotificationCenter {
166181
jsonData.putString("event", NotificationEvent.ANNOTATIONS_ADDED.value)
167182
jsonData.putArray("annotations", nativeAnnotationsList)
168183
jsonData.putString("documentID", documentID)
169-
sendEvent(NotificationEvent.ANNOTATIONS_ADDED.value, jsonData)
184+
val payload = createEventPayload(jsonData, componentID)
185+
sendEvent(NotificationEvent.ANNOTATIONS_ADDED.value, payload)
170186
} catch (e: Exception) {
171187
// Could not decode annotation data
172188
}
173189
}
174190
}
175191
}
176192

177-
fun bookmarksChanged(bookmarks: List<Bookmark>, documentID: String) {
193+
fun bookmarksChanged(bookmarks: List<Bookmark>, documentID: String, componentID: Int) {
178194
try {
179-
// Create a WritableArray to hold the bookmark maps
180-
val bookmarksArray: WritableArray = Arguments.createArray()
181-
182-
for (bookmark in bookmarks) {
183-
val bookmarkMap: WritableMap = Arguments.createMap()
184-
bookmarkMap.putString("identifier", bookmark.uuid)
185-
bookmark.pageIndex?.let { bookmarkMap.putInt("pageIndex", it) }
186-
bookmarksArray.pushMap(bookmarkMap)
187-
}
195+
val bookmarksJSON = BookmarkUtils.bookmarksToJSON(bookmarks)
188196

189197
val jsonData = Arguments.createMap()
190198
jsonData.putString("event", NotificationEvent.BOOKMARKS_CHANGED.value)
191-
jsonData.putArray("bookmarks", bookmarksArray)
199+
jsonData.putArray("bookmarks", Arguments.makeNativeArray(bookmarksJSON))
192200
jsonData.putString("documentID", documentID)
193-
sendEvent(NotificationEvent.BOOKMARKS_CHANGED.value, jsonData)
201+
val payload = createEventPayload(jsonData, componentID)
202+
sendEvent(NotificationEvent.BOOKMARKS_CHANGED.value, payload)
194203
} catch (e: Exception) {
195204
// Could not decode bookmark data
196205
}
197206
}
198207

199-
fun didSelectAnnotations(annotation: Annotation, documentID: String) {
208+
fun didSelectAnnotations(annotation: Annotation, documentID: String, componentID: Int) {
200209
try {
201210
val annotationsList = mutableListOf<Map<String, Any>>()
202211
val annotationMap = AnnotationUtils.processAnnotation(annotation)
@@ -207,13 +216,14 @@ object NutrientNotificationCenter {
207216
jsonData.putString("event", NotificationEvent.ANNOTATIONS_SELECTED.value)
208217
jsonData.putArray("annotations", nativeAnnotationsList)
209218
jsonData.putString("documentID", documentID)
210-
sendEvent(NotificationEvent.ANNOTATIONS_SELECTED.value, jsonData)
219+
val payload = createEventPayload(jsonData, componentID)
220+
sendEvent(NotificationEvent.ANNOTATIONS_SELECTED.value, payload)
211221
} catch (e: Exception) {
212222
// Could not decode annotation data
213223
}
214224
}
215225

216-
fun didDeselectAnnotations(annotation: Annotation, documentID: String) {
226+
fun didDeselectAnnotations(annotation: Annotation, documentID: String, componentID: Int) {
217227
try {
218228
val annotationsList = mutableListOf<Map<String, Any>>()
219229
val annotationMap = AnnotationUtils.processAnnotation(annotation)
@@ -224,13 +234,14 @@ object NutrientNotificationCenter {
224234
jsonData.putString("event", NotificationEvent.ANNOTATIONS_DESELECTED.value)
225235
jsonData.putArray("annotations", nativeAnnotationsList)
226236
jsonData.putString("documentID", documentID)
227-
sendEvent(NotificationEvent.ANNOTATIONS_DESELECTED.value, jsonData)
237+
val payload = createEventPayload(jsonData, componentID)
238+
sendEvent(NotificationEvent.ANNOTATIONS_DESELECTED.value, payload)
228239
} catch (e: Exception) {
229240
// Could not decode annotation data
230241
}
231242
}
232243

233-
fun didTapAnnotation(annotation: Annotation, pointF: PointF, documentID: String) {
244+
fun didTapAnnotation(annotation: Annotation, pointF: PointF, documentID: String, componentID: Int) {
234245
try {
235246
val annotationMap = AnnotationUtils.processAnnotation(annotation)
236247
val nativeAnnotationMap = Arguments.makeNativeMap(annotationMap)
@@ -243,40 +254,40 @@ object NutrientNotificationCenter {
243254
jsonData.putMap("annotation", nativeAnnotationMap)
244255
jsonData.putMap("annotationPoint", nativePointMap)
245256
jsonData.putString("documentID", documentID)
246-
sendEvent(NotificationEvent.ANNOTATION_TAPPED.value, jsonData)
257+
val payload = createEventPayload(jsonData, componentID)
258+
sendEvent(NotificationEvent.ANNOTATION_TAPPED.value, payload)
247259
} catch (e: Exception) {
248260
// Could not decode annotation data
249261
}
250262
}
251263

252-
fun didSelectText(text: String, documentID: String) {
264+
fun didSelectText(text: String, documentID: String, componentID: Int) {
253265
val jsonData = Arguments.createMap()
254266
jsonData.putString("event", NotificationEvent.TEXT_SELECTED.value)
255267
jsonData.putString("text", text)
256268
jsonData.putString("documentID", documentID)
257-
sendEvent(NotificationEvent.TEXT_SELECTED.value, jsonData)
269+
val payload = createEventPayload(jsonData, componentID)
270+
sendEvent(NotificationEvent.TEXT_SELECTED.value, payload)
258271
}
259272

260-
fun formFieldValuesUpdated(formField: FormField, documentID: String) {
273+
fun formFieldValuesUpdated(formField: FormField, documentID: String, componentID: Int) {
261274
try {
262275
val annotation = formField.formElement.annotation
263276
val annotationMap = AnnotationUtils.processAnnotation(annotation).toMutableMap()
264-
val annotationsList = mutableListOf<Map<String, Any>>()
265-
266-
annotationsList.add(annotationMap)
267-
val nativeAnnotationsList = Arguments.makeNativeArray(annotationsList)
277+
val nativeAnnotationMap = Arguments.makeNativeMap(annotationMap)
268278

269279
val jsonData = Arguments.createMap()
270280
jsonData.putString("event", NotificationEvent.FORM_FIELD_VALUES_UPDATED.value)
271-
jsonData.putArray("annotations", nativeAnnotationsList)
281+
jsonData.putMap("formField", nativeAnnotationMap)
272282
jsonData.putString("documentID", documentID)
273-
sendEvent(NotificationEvent.FORM_FIELD_VALUES_UPDATED.value, jsonData)
283+
val payload = createEventPayload(jsonData, componentID)
284+
sendEvent(NotificationEvent.FORM_FIELD_VALUES_UPDATED.value, payload)
274285
} catch (e: Exception) {
275286
// Could not decode annotation data
276287
}
277288
}
278289

279-
fun didSelectFormField(formElement: FormElement, documentID: String) {
290+
fun didSelectFormField(formElement: FormElement, documentID: String, componentID: Int) {
280291
try {
281292
val annotation = formElement.annotation
282293
val annotationMap = AnnotationUtils.processAnnotation(annotation).toMutableMap()
@@ -286,13 +297,14 @@ object NutrientNotificationCenter {
286297
jsonData.putString("event", NotificationEvent.FORM_FIELD_SELECTED.value)
287298
jsonData.putMap("annotation", nativeAnnotationMap)
288299
jsonData.putString("documentID", documentID)
289-
sendEvent(NotificationEvent.FORM_FIELD_SELECTED.value, jsonData)
300+
val payload = createEventPayload(jsonData, componentID)
301+
sendEvent(NotificationEvent.FORM_FIELD_SELECTED.value, payload)
290302
} catch (e: Exception) {
291303
// Could not decode annotation data
292304
}
293305
}
294306

295-
fun didDeSelectFormField(formElement: FormElement, documentID: String) {
307+
fun didDeSelectFormField(formElement: FormElement, documentID: String, componentID: Int) {
296308
try {
297309
val annotation = formElement.annotation
298310
val annotationMap = AnnotationUtils.processAnnotation(annotation).toMutableMap()
@@ -302,7 +314,8 @@ object NutrientNotificationCenter {
302314
jsonData.putString("event", NotificationEvent.FORM_FIELD_DESELECTED.value)
303315
jsonData.putMap("annotation", nativeAnnotationMap)
304316
jsonData.putString("documentID", documentID)
305-
sendEvent(NotificationEvent.FORM_FIELD_DESELECTED.value, jsonData)
317+
val payload = createEventPayload(jsonData, componentID)
318+
sendEvent(NotificationEvent.FORM_FIELD_DESELECTED.value, payload)
306319
} catch (e: Exception) {
307320
// Could not decode annotation data
308321
}
@@ -327,6 +340,7 @@ object NutrientNotificationCenter {
327340
jsonData.putString("analyticsEvent", event)
328341
jsonData.putMap("attributes", attributesMap)
329342
jsonData.putString("event", NotificationEvent.ANALYTICS.value)
330-
sendEvent(NotificationEvent.ANALYTICS.value, jsonData)
343+
val payload = createEventPayload(jsonData, 0)
344+
sendEvent(NotificationEvent.ANALYTICS.value, payload)
331345
}
332346
}

0 commit comments

Comments
 (0)