Skip to content

Commit ac08358

Browse files
author
PSPDFKit
committed
Release 4.3.0
1 parent 796e695 commit ac08358

Some content is hidden

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

50 files changed

+2097
-251
lines changed

ACKNOWLEDGEMENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,8 @@ that were granted to the IJG for code derived from their software.
22042204

22052205

22062206
--------------------------------------------------------------------------------
2207+
## magic_enum (https://github.com/Neargye/magic_enum)
2208+
22072209
MIT License
22082210

22092211
Copyright (c) 2019 - 2024 Daniil Goncharov
@@ -3957,7 +3959,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39573959
--------------------------------------------------------------------------------
39583960
## PorterTokenizer (https://github.com/mozilla/releases-comm-central/blob/master/mailnews/extensions/fts3/src/Normalize.c)
39593961

3960-
Modified file can be obtained by emailing legal@pspdfkit.com
3962+
Modified file can be obtained by emailing legal@nutrient.io
39613963

39623964
This Source Code Form is subject to the terms of the Mozilla Public
39633965
License, v. 2.0. If a copy of the MPL was not distributed with this

CHANGELOG.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
## 4.3.0 - 11 Apr 2025
2+
3+
- Adds setting custom stamp items support. Only custom text stamps are supported, and this is available only on iOS and Android for now. (J#HYB-715)
4+
- Adds signature creation configuration and signature saving strategy support. (J#HYB-739)
5+
- Adds support for custom main toolbar items with icons. (J#HYB-732)
6+
- Fixes issue where an annotation doesn't get selected when clicked on iOS. (J#HYB-735)
7+
18
## 4.2.2 - 24 Mar 2025
29

3-
- Updates for Nutrient Android SDK 10.1.1 - https://www.nutrient.io/guides/android/changelog/.
4-
- Updates Android bridging by moving `MethodCallHandler` from `PspdfkitPlugin` to `PspdfkitPluginMethodCallHandler`, preparing for a complete migration to Pigeon and proper deprecation path. (J#HYB-690)
5-
- Fixes issue on Android when adding an annotationDeleted event listener. (J#HYB-640)
10+
- Updates for Nutrient Android SDK 10.1.1 [see changelog](https://www.nutrient.io/guides/android/changelog/).
11+
- Updates Android bridging by moving `MethodCallHandler` from `PspdfkitPlugin` to `PspdfkitPluginMethodCallHandler`, preparing for a complete migration to Pigeon and a proper deprecation path. (J#HYB-690)
12+
- Fixes an issue on Android when adding an `annotationDeleted` event listener. (J#HYB-640)
613

714
## 4.2.1 - 10 Mar 2025
815

android/src/main/java/com/pspdfkit/flutter/pspdfkit/AnnotationConfigurationAdaptor.kt

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package com.pspdfkit.flutter.pspdfkit
1111

1212
import android.content.Context
1313
import android.graphics.Color
14+
import android.util.Log
1415
import androidx.core.util.Pair
1516
import com.pspdfkit.annotations.AnnotationType
1617
import com.pspdfkit.annotations.AnnotationType.CIRCLE
@@ -46,6 +47,7 @@ import com.pspdfkit.annotations.configuration.RedactionAnnotationConfiguration
4647
import com.pspdfkit.annotations.configuration.ShapeAnnotationConfiguration
4748
import com.pspdfkit.annotations.configuration.SoundAnnotationConfiguration
4849
import com.pspdfkit.annotations.configuration.StampAnnotationConfiguration
50+
import com.pspdfkit.annotations.stamps.PredefinedStampType
4951
import com.pspdfkit.annotations.stamps.StampPickerItem
5052
import com.pspdfkit.configuration.annotations.AnnotationAggregationStrategy
5153
import com.pspdfkit.flutter.pspdfkit.annotations.FlutterAnnotationPresetConfiguration
@@ -75,7 +77,7 @@ const val AVAILABLE_BORDER_STYLES_PRESETS = "availableBorderStylePresets"
7577
const val DEFAULT_BORDER_STYLE = "borderStyle"
7678
const val AUDION_SAMPLING_RATE = "audioSamplingRate"
7779
const val AUDIO_RECORDING_TIME_LIMIT = "audioRecordingTimeLimit"
78-
const val AVAILABLE_STAMP_ITEMS = "availableStampPickers"
80+
const val AVAILABLE_STAMP_ITEMS = "availableStampItems"
7981
const val DEFAULT_ICON_NAME = "defaultIconName"
8082
const val AVAILABLE_ICON_NAMES = "availableIconNames"
8183
const val DEFAULT_LINE_END = "lineEndStyle"
@@ -248,7 +250,7 @@ class AnnotationConfigurationAdaptor {
248250
}
249251

250252
else -> {
251-
throw IllegalArgumentException("Unknown annotation type: $key")
253+
Log.w("AnnotationConfigAdaptor", "Unknown annotation type: $key. Ignoring this configuration.")
252254
}
253255
}
254256
}
@@ -300,7 +302,7 @@ class AnnotationConfigurationAdaptor {
300302

301303
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
302304
else -> {
303-
throw IllegalArgumentException("Unknown annotation configuration key: $key")
305+
Log.w("AnnotationConfigAdaptor", "Unknown annotation configuration key: $key. Ignoring this property.")
304306
}
305307
}
306308
}
@@ -353,7 +355,7 @@ class AnnotationConfigurationAdaptor {
353355

354356
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
355357
else -> {
356-
throw IllegalArgumentException("Unknown annotation configuration key: $key")
358+
Log.w("AnnotationConfigAdaptor", "Unknown annotation configuration key: $key. Ignoring this property.")
357359
}
358360
}
359361
}
@@ -418,7 +420,7 @@ class AnnotationConfigurationAdaptor {
418420

419421
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
420422
else -> {
421-
throw IllegalArgumentException("Unknown annotation configuration key: $key")
423+
Log.w("AnnotationConfigAdaptor", "Unknown annotation configuration key: $key. Ignoring this property.")
422424
}
423425
}
424426
}
@@ -428,7 +430,8 @@ class AnnotationConfigurationAdaptor {
428430
private fun extractLineEndPair(lineEndPair: String): Pair<LineEndType, LineEndType> {
429431
val lineEnds = lineEndPair.split(",")
430432
if (lineEnds.size != 2) {
431-
throw IllegalArgumentException("Invalid line end pair: $lineEndPair")
433+
Log.w("AnnotationConfigAdaptor", "Invalid line end pair: $lineEndPair. Using default NONE,NONE pair.")
434+
return Pair(LineEndType.NONE, LineEndType.NONE)
432435
}
433436
val firstLineEnd = parseLineEnd(lineEnds[0])
434437
val secondLineEnd = parseLineEnd(lineEnds[1])
@@ -523,7 +526,7 @@ class AnnotationConfigurationAdaptor {
523526

524527
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
525528
else -> {
526-
throw IllegalArgumentException("Unknown key: $key")
529+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
527530
}
528531
}
529532
}
@@ -570,7 +573,7 @@ class AnnotationConfigurationAdaptor {
570573

571574
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
572575
else -> {
573-
throw IllegalArgumentException("Unknown key: $key")
576+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
574577
}
575578
}
576579
}
@@ -604,7 +607,7 @@ class AnnotationConfigurationAdaptor {
604607

605608
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
606609
else -> {
607-
throw IllegalArgumentException("Unknown key: $key")
610+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
608611
}
609612

610613
}
@@ -642,7 +645,7 @@ class AnnotationConfigurationAdaptor {
642645

643646
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
644647
else -> {
645-
throw IllegalArgumentException("Unknown key: $key")
648+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
646649
}
647650
}
648651
}
@@ -670,7 +673,7 @@ class AnnotationConfigurationAdaptor {
670673

671674
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
672675
else -> {
673-
throw IllegalArgumentException("Unknown key: $key")
676+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
674677
}
675678
}
676679
}
@@ -687,11 +690,11 @@ class AnnotationConfigurationAdaptor {
687690
while (iterator.hasNext()) {
688691
when (val key = iterator.next()) {
689692
AVAILABLE_STAMP_ITEMS -> (configuration[key] as List<*>?)?.let { stampItems ->
690-
builder.setAvailableStampPickerItems(
691-
extractStampPickerItems(
692-
stampItems.map { it as String }, context
693-
)
693+
val availableStampItems = extractStampPickerItems(
694+
stampItems.map { it as String }, context
694695
)
696+
if (availableStampItems.isNotEmpty())
697+
builder.setAvailableStampPickerItems(availableStampItems)
695698
}
696699

697700
Z_INDEX_EDITING_ENABLED -> builder.setZIndexEditingEnabled(
@@ -707,7 +710,7 @@ class AnnotationConfigurationAdaptor {
707710

708711
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
709712
else -> {
710-
throw IllegalArgumentException("Unknown key: $key")
713+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
711714
}
712715
}
713716
}
@@ -776,7 +779,7 @@ class AnnotationConfigurationAdaptor {
776779

777780
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
778781
else -> {
779-
throw IllegalArgumentException("Unknown key: $key")
782+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
780783
}
781784

782785
}
@@ -833,7 +836,7 @@ class AnnotationConfigurationAdaptor {
833836

834837
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
835838
else -> {
836-
throw IllegalArgumentException("Unknown key: $key")
839+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
837840
}
838841
}
839842
}
@@ -934,7 +937,7 @@ class AnnotationConfigurationAdaptor {
934937

935938
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
936939
else -> {
937-
throw IllegalArgumentException("Unknown key: $key")
940+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
938941
}
939942
}
940943
}
@@ -1040,7 +1043,7 @@ class AnnotationConfigurationAdaptor {
10401043

10411044
FORCE_DEFAULTS -> builder.setForceDefaults(configuration[key] as Boolean)
10421045
else -> {
1043-
throw IllegalArgumentException("Unknown key: $key")
1046+
Log.w("AnnotationConfigAdaptor", "Unknown key: $key. Ignoring this property.")
10441047
}
10451048
}
10461049
}
@@ -1115,7 +1118,7 @@ class AnnotationConfigurationAdaptor {
11151118
extractAggregationStrategy(configuration[key] as String)
11161119
)
11171120

1118-
else -> throw IllegalArgumentException("Unknown property $key")
1121+
else -> Log.w("AnnotationConfigAdaptor", "Unknown property $key. Ignoring this property.")
11191122
}
11201123
}
11211124
return builder.build();
@@ -1130,14 +1133,19 @@ class AnnotationConfigurationAdaptor {
11301133
}
11311134

11321135
private fun extractStampPickerItems(it: Any, context: Context): List<StampPickerItem> {
1133-
val stampPickerItems = mutableListOf<StampPickerItem>()
1134-
(it as ArrayList<*>).forEach { stampPickerItem ->
1135-
val stampPickerItemString = stampPickerItem as String
1136-
stampPickerItems.add(
1137-
StampPickerItem.fromTitle(context, stampPickerItemString).build()
1138-
)
1136+
try {
1137+
val stampPickerItems = mutableListOf<StampPickerItem>()
1138+
(it as ArrayList<*>).forEach { stampPickerItem ->
1139+
val stampPickerItemString = stampPickerItem as String
1140+
stampPickerItems.add(
1141+
StampPickerItem.fromTitle(context, stampPickerItemString).build()
1142+
)
1143+
}
1144+
return stampPickerItems
1145+
}catch (e: Exception){
1146+
e.printStackTrace()
1147+
return listOf()
11391148
}
1140-
return stampPickerItems
11411149
}
11421150

11431151
private fun extractBorderStyles(it: List<String>): List<BorderStylePreset> {
@@ -1176,7 +1184,10 @@ class AnnotationConfigurationAdaptor {
11761184
"automatic" -> AnnotationAggregationStrategy.AUTOMATIC
11771185
"merge" -> AnnotationAggregationStrategy.MERGE_IF_POSSIBLE
11781186
"separate" -> AnnotationAggregationStrategy.SEPARATE
1179-
else -> throw IllegalArgumentException("Unknown aggregation strategy $string")
1187+
else -> {
1188+
Log.w("AnnotationConfigAdaptor", "Unknown aggregation strategy $string. Using AUTOMATIC as default.")
1189+
AnnotationAggregationStrategy.AUTOMATIC
1190+
}
11801191
}
11811192
}
11821193

0 commit comments

Comments
 (0)