Skip to content

Commit a922e3b

Browse files
committed
Release 5.1.0
1 parent e9afc5f commit a922e3b

File tree

54 files changed

+3505
-249
lines changed

Some content is hidden

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

54 files changed

+3505
-249
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 5.1.0 - 04 Sep 2025
2+
3+
- Adds the `androidShowAnnotationCreationAction` configuration option to hide the default annotation creation button while keeping annotation editing functionality enabled on Android. (J#HYB-864)
4+
- Adds `OfficeConversionSettings` for configuring Office document conversion parameters in Nutrient Flutter Web, including spreadsheet dimension controls. (J#HYB-861)
5+
- Adds annotation contextual menu customization support with `AnnotationMenuConfiguration`. (J#HYB-683)
6+
- Improves event listeners handling for better performance and reliability. (J#HYB-868)
7+
- Updates to Nutrient iOS SDK 14.12.0 with the latest features and fixes.
8+
- Updates to Nutrient Android SDK 10.5.0 with the latest features and fixes.
9+
- Updates Kotlin version to 2.1.20 for compatibility with Nutrient Android SDK 10.6.0.
10+
- Fixes an iOS issue where the signature dialog would immediately dismiss when entering annotation creation mode programmatically. (J#HYB-859)
11+
- Fixes an Android race condition when calling `getPageInfo` immediately after `onDocumentLoaded` on a cold start. (J#HYB-870)
12+
113
## 5.0.1 - 24 Jul 2025
214

315
- Update README.md files to include the latest rebranding changes for Nutrient Flutter SDK. (J#HYB-842)

analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
include: package:flutter_lints/flutter.yaml
99

1010
analyzer:
11-
# exclude:
11+
exclude:
12+
- lib/src/api/nutrient_api.g.dart
1213
# - ../../core/Vendor
1314
errors:
1415
invalid_assignment: error

android/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ android {
6060
}
6161

6262
dependencies {
63-
implementation 'androidx.appcompat:appcompat:1.7.0'
63+
implementation 'androidx.appcompat:appcompat:1.7.1'
6464
implementation "io.nutrient:$pspdfkitMavenModuleName:$pspdfkitVersion"
6565
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
6666
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
67-
implementation "androidx.compose.material:material:1.8.1"
67+
implementation "androidx.compose.material:material:1.8.3"
6868
implementation "androidx.constraintlayout:constraintlayout:2.2.1"
6969
implementation "androidx.constraintlayout:constraintlayout-compose:1.1.1"
70-
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0") // Use the latest stable version
71-
implementation "androidx.compose.foundation:foundation:1.8.1"
72-
implementation "androidx.compose.ui:ui:1.8.1"
70+
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.9.2") // Use the latest stable version
71+
implementation "androidx.compose.foundation:foundation:1.8.3"
72+
implementation "androidx.compose.ui:ui:1.8.3"
7373
implementation("io.noties.markwon:core:4.6.2")
7474
implementation("io.noties.markwon:html:4.6.2")
7575
implementation("io.noties.markwon:linkify:4.6.2")

android/config.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if (pspdfkitMavenUrl == null || pspdfkitMavenUrl == '') {
3838

3939
ext.pspdfkitVersion = localProperties.getProperty('pspdfkit.version')
4040
if (pspdfkitVersion == null || pspdfkitVersion == '') {
41-
ext.pspdfkitVersion = '10.4.1'
41+
ext.pspdfkitVersion = '10.5.0'
4242
}
4343

4444
ext.pspdfkitMavenModuleName = 'nutrient'
@@ -56,4 +56,4 @@ ext.androidCompileSdkVersion = 35
5656
ext.androidMinSdkVersion = 21
5757
ext.androidTargetSdkVersion = 35
5858
ext.androidGradlePluginVersion = '8.9.2'
59-
ext.kotlinVersion = "1.9.20"
59+
ext.kotlinVersion = "2.1.20"

android/src/main/java/com/pspdfkit/flutter/pspdfkit/ConfigurationAdapter.java

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class ConfigurationAdapter {
9292
// Annotation, Forms and Bookmark Options
9393
private static final String ENABLE_ANNOTATION_EDITING = "enableAnnotationEditing";
9494
private static final String SHOW_ANNOTATION_LIST_ACTION = "showAnnotationListAction";
95+
private static final String SHOW_ANNOTATION_CREATION_ACTION = "showAnnotationCreationAction";
9596

9697
private static final String SIGNATURE_SAVING_STRATEGY = "signatureSavingStrategy";
9798

@@ -216,12 +217,16 @@ class ConfigurationAdapter {
216217
@NonNull
217218
private final PdfActivityConfiguration.Builder configuration;
218219
@Nullable
220+
private final HashMap<String, Object> configurationMap;
221+
@Nullable
219222
private String password = null;
220223
private boolean enableInstantComments = false;
224+
private boolean hideAnnotationCreationButton = false;
221225

222226
ConfigurationAdapter(@NonNull Context context,
223227
@Nullable HashMap<String, Object> configurationMap) {
224228
this.configuration = new PdfActivityConfiguration.Builder(context);
229+
this.configurationMap = configurationMap;
225230
if (configurationMap != null && !configurationMap.isEmpty()) {
226231
String key = null;
227232

@@ -289,6 +294,10 @@ class ConfigurationAdapter {
289294
if (key != null) {
290295
configureShowAnnotationListAction((Boolean) configurationMap.get(key));
291296
}
297+
key = getKeyOfType(configurationMap, SHOW_ANNOTATION_CREATION_ACTION, Boolean.class);
298+
if (key != null) {
299+
configureShowAnnotationCreationAction((Boolean) configurationMap.get(key));
300+
}
292301
key = getKeyOfType(configurationMap, SHOW_PAGE_NUMBER_OVERLAY, Boolean.class);
293302
if (key != null) {
294303
configureShowPageLabels((Boolean) configurationMap.get(key));
@@ -646,7 +655,9 @@ private void configureShowSearchAction(boolean showSearchAction) {
646655
}
647656

648657
private void configureImmersiveMode(boolean immersiveMode) {
649-
configuration.useImmersiveMode(immersiveMode);
658+
// useImmersiveMode() method removed in SDK 10.6.0 - immersive mode is now default (true)
659+
// If developers need to disable it, they should set it to false in PdfActivityConfiguration
660+
// configuration.useImmersiveMode(immersiveMode);
650661
}
651662

652663
private void configureShowThumbnailBar(@NonNull String showThumbnailBar) {
@@ -682,6 +693,19 @@ private void configureShowAnnotationListAction(boolean showAnnotationListAction)
682693
configuration.annotationListEnabled(showAnnotationListAction);
683694
}
684695

696+
private void configureShowAnnotationCreationAction(boolean showAnnotationCreationAction) {
697+
// Store the configuration to pass to the fragment
698+
this.hideAnnotationCreationButton = !showAnnotationCreationAction;
699+
700+
// Try to configure annotation editing at the PSPDFKit level
701+
// Note: We keep annotation editing enabled but hide the button
702+
if (!showAnnotationCreationAction) {
703+
// We could potentially disable specific annotation tools here
704+
// but we want to keep the editing functionality, just hide the main button
705+
Log.d("ConfigurationAdapter", "Configured to hide annotation creation button");
706+
}
707+
}
708+
685709
private void configureShowPageLabels(boolean showPageLabels) {
686710
configuration.pageLabelsEnabled(showPageLabels);
687711
configuration.pageNumberOverlayEnabled(showPageLabels);
@@ -935,7 +959,72 @@ private static <T> String javaToDartTypeConverted(Class<T> clazz) {
935959
throw new IllegalArgumentException("Undefined dart type conversion for " + clazz.getName());
936960
}
937961

962+
/**
963+
* Extracts annotation menu configuration from the configuration map.
964+
*
965+
* @return The annotation menu configuration data, or null if not configured
966+
*/
938967
@Nullable
968+
public com.pspdfkit.flutter.pspdfkit.api.AnnotationMenuConfigurationData getAnnotationMenuConfiguration() {
969+
if (configurationMap == null) {
970+
return null;
971+
}
972+
973+
@SuppressWarnings("unchecked")
974+
Map<String, Object> annotationMenuConfig = (Map<String, Object>) configurationMap.get("annotationMenuConfiguration");
975+
976+
if (annotationMenuConfig == null) {
977+
return null;
978+
}
979+
980+
try {
981+
// Extract items to remove (now using enum indices)
982+
@SuppressWarnings("unchecked")
983+
List<Number> itemsToRemoveIndices = (List<Number>) annotationMenuConfig.get("itemsToRemove");
984+
List<com.pspdfkit.flutter.pspdfkit.api.AnnotationMenuAction> itemsToRemove = new ArrayList<>();
985+
if (itemsToRemoveIndices != null) {
986+
for (Number index : itemsToRemoveIndices) {
987+
com.pspdfkit.flutter.pspdfkit.api.AnnotationMenuAction action =
988+
com.pspdfkit.flutter.pspdfkit.api.AnnotationMenuAction.values()[index.intValue()];
989+
itemsToRemove.add(action);
990+
}
991+
}
992+
993+
// Extract items to disable (now using enum indices)
994+
@SuppressWarnings("unchecked")
995+
List<Number> itemsToDisableIndices = (List<Number>) annotationMenuConfig.get("itemsToDisable");
996+
List<com.pspdfkit.flutter.pspdfkit.api.AnnotationMenuAction> itemsToDisable = new ArrayList<>();
997+
if (itemsToDisableIndices != null) {
998+
for (Number index : itemsToDisableIndices) {
999+
com.pspdfkit.flutter.pspdfkit.api.AnnotationMenuAction action =
1000+
com.pspdfkit.flutter.pspdfkit.api.AnnotationMenuAction.values()[index.intValue()];
1001+
itemsToDisable.add(action);
1002+
}
1003+
}
1004+
1005+
// Extract other configuration options
1006+
Boolean showStylePicker = (Boolean) annotationMenuConfig.get("showStylePicker");
1007+
Boolean groupMarkupItems = (Boolean) annotationMenuConfig.get("groupMarkupItems");
1008+
Number maxVisibleItems = (Number) annotationMenuConfig.get("maxVisibleItems");
1009+
1010+
return new com.pspdfkit.flutter.pspdfkit.api.AnnotationMenuConfigurationData(
1011+
itemsToRemove,
1012+
itemsToDisable,
1013+
showStylePicker != null ? showStylePicker : true,
1014+
groupMarkupItems != null ? groupMarkupItems : false,
1015+
maxVisibleItems != null ? maxVisibleItems.longValue() : null
1016+
);
1017+
1018+
} catch (Exception e) {
1019+
Log.e(LOG_TAG, "Error parsing annotation menu configuration", e);
1020+
return null;
1021+
}
1022+
}
1023+
1024+
boolean shouldHideAnnotationCreationButton() {
1025+
return hideAnnotationCreationButton;
1026+
}
1027+
9391028
String getPassword() {
9401029
return password;
9411030
}

0 commit comments

Comments
 (0)