Skip to content

Commit

Permalink
Release 3.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
PSPDFKit committed Apr 12, 2024
1 parent 12e4d5b commit dfe418c
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 42 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Newest Release

### 3.9.1 - 12 Apr 2024
- Downgrades to AGP 7.* for backward compatibility (J#HYB-290)
- Allow null value for `Pspdfkit.setLicenseKey` (J#HYB-294)
- Updates for PSPDFKit 2024.2.1 for Android (J#HYB-303)

## Previous Releases

### 3.9.0 - 22 Mar 2024

- Adds annotation toolbar customization for iOS and Android. (J#HYB-209)
Expand All @@ -9,8 +16,6 @@
- Fixes events callback functions not being triggered on Web. (J#HYB-221)
- Fixes blank page when an annotation toolbar item is selected on Web. (#43792)

## Previous Releases

### 3.8.2 - 27 Feb 2024

- Updates for PSPDFKit 13.3.1 for iOS. (#43550)
Expand Down
9 changes: 3 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ apply plugin: 'kotlin-android'
android {
namespace "com.pspdfkit.flutter.pspdfkit"

compileSdkVersion androidCompileSdkVersion
compileSdk androidCompileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
Expand All @@ -56,12 +56,9 @@ android {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "com.pspdfkit:$pspdfkitMavenModuleName:$pspdfkitVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.compose.material:material:1.6.3"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.constraintlayout:constraintlayout-compose:1.0.1"
implementation "androidx.compose.foundation:foundation:1.6.3"
implementation "androidx.compose.ui:ui:1.6.3"
implementation "androidx.compose.material:material:1.6.5"
}
6 changes: 3 additions & 3 deletions android/config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (pspdfkitMavenUrl == null || pspdfkitMavenUrl == '') {

ext.pspdfkitVersion = localProperties.getProperty('pspdfkit.version')
if (pspdfkitVersion == null || pspdfkitVersion == '') {
ext.pspdfkitVersion = '2024.1.2'
ext.pspdfkitVersion = '2024.2.1'
}

ext.pspdfkitMavenModuleName = 'pspdfkit'
Expand All @@ -55,5 +55,5 @@ ext.pspdfkitFlutterVersion = pubspecYaml.version
ext.androidCompileSdkVersion = 34
ext.androidMinSdkVersion = 21
ext.androidTargetSdkVersion = 34
ext.androidGradlePluginVersion = '8.2.2'
ext.kotlinVersion = "1.8.10"
ext.androidGradlePluginVersion = '7.4.2'
ext.kotlinVersion = "1.9.20"
3 changes: 2 additions & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed Mar 27 15:41:24 EAT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
16 changes: 14 additions & 2 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@ pluginManagement {
mavenCentral()
gradlePluginPortal()
}

buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://storage.googleapis.com/r8-releases/raw")
}
}
dependencies {
classpath("com.android.tools:r8:8.3.37")
}
}
}

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.2.2" apply false
id "org.jetbrains.kotlin.android" version "1.8.10" apply false
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

include ":app"
Expand Down
25 changes: 12 additions & 13 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ const String _pspdfkitFor = 'PSPDFKit for';

void main() {
WidgetsFlutterBinding.ensureInitialized();
// Since PSPDFKit for Flutter 3.9.0, you are now required to initialize PSPDFKit with a license key.
// If you don't have one, you can set it to null. This will show a watermark on the document.
// To get a trial license key, please visit https://my.pspdfkit.com/trial/new
//
// To set the license key for both platforms, use:
// Pspdfkit.setLicenseKeys("YOUR_FLUTTER_ANDROID_LICENSE_KEY_GOES_HERE",
// "YOUR_FLUTTER_IOS_LICENSE_KEY_GOES_HERE", "YOUR_FLUTTER_WEB_LICENSE_KEY_GOES_HERE");
//
// To set the license key for the currently running platform, use:
// Pspdfkit.setLicenseKey(null);

Pspdfkit.setLicenseKey(null);
runApp(const MyApp());
}

Expand Down Expand Up @@ -73,19 +85,6 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {

// Platform messages are asynchronous, so we initialize in an async method.
void initPlatformState() async {
// By default, this example doesn't set a license key, but instead runs in
// trial mode (which is the default, and which requires no specific
// initialization). If you want to use a different license key for
// evaluation (e.g. a production license), you can uncomment the next line
// and set the license key.
//
// To set the license key for both platforms, use:
// await Pspdfkit.setLicenseKeys("YOUR_FLUTTER_ANDROID_LICENSE_KEY_GOES_HERE",
// "YOUR_FLUTTER_IOS_LICENSE_KEY_GOES_HERE");
//
// To set the license key for the currently running platform, use:
await Pspdfkit.setLicenseKey('');

String? frameworkVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pspdfkit_example
description: Demonstrates how to use the pspdfkit plugin.
version: 3.9.0
version: 3.9.1
homepage: https://pspdfkit.com/
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
Expand Down
6 changes: 6 additions & 0 deletions ios/Classes/PspdfkitPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
result([@"iOS " stringByAppendingString:PSPDFKitGlobal.versionNumber]);
} else if ([@"setLicenseKey" isEqualToString:call.method]) {
NSString *licenseKey = call.arguments[@"licenseKey"];
if ([licenseKey isKindOfClass:[NSNull class]]|| licenseKey.length <= 0) {
return;
}
[PSPDFKitGlobal setLicenseKey:licenseKey options:@{PSPDFSettingKeyHybridEnvironment: @"Flutter"}];
} else if ([@"setLicenseKeys" isEqualToString:call.method]) {
NSString *iOSLicenseKey = call.arguments[@"iOSLicenseKey"];
if ([iOSLicenseKey isKindOfClass:[NSNull class]]|| iOSLicenseKey.length <= 0) {
return;
}
[PSPDFKitGlobal setLicenseKey:iOSLicenseKey options:@{PSPDFSettingKeyHybridEnvironment: @"Flutter"}];
}else if ([@"present" isEqualToString:call.method]) {

Expand Down
4 changes: 2 additions & 2 deletions ios/pspdfkit_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
Pod::Spec.new do |s|
s.name = "pspdfkit_flutter"
s.version = "3.9.0"
s.version = "3.9.1"
s.homepage = "https://PSPDFKit.com"
s.documentation_url = "https://pspdfkit.com/guides/flutter"
s.license = { type: "Commercial", file: "../LICENSE" }
Expand All @@ -22,6 +22,6 @@ Pod::Spec.new do |s|
s.dependency("Instant", "13.3.3")
s.swift_version = "5.0"
s.platform = :ios, "15.0"
s.version = "3.9.0"
s.version = "3.9.1"
s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES", "SWIFT_INSTALL_OBJC_HEADER" => "NO" }
end
2 changes: 1 addition & 1 deletion lib/pspdfkit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Pspdfkit {

/// Sets the license key.
/// @param licenseKey The license key to be used.
static Future<void> setLicenseKey(String licenseKey) =>
static Future<void> setLicenseKey(String? licenseKey) =>
PspdfkitFlutterPlatform.instance.setLicenseKey(licenseKey);

/// Sets the license keys for both platforms.
Expand Down
4 changes: 2 additions & 2 deletions lib/src/pspdfkit_flutter_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class MethodChannelPspdfkitFlutter extends PspdfkitFlutterPlatform {

/// Sets the license key.
@override
Future<void> setLicenseKey(String licenseKey) async =>
Future<void> setLicenseKey(String? licenseKey) async =>
await methodChannel.invokeMethod(
'setLicenseKey', <String, String>{'licenseKey': licenseKey});
'setLicenseKey', <String, String?>{'licenseKey': licenseKey});

/// Sets the license keys for both platforms.
@override
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pspdfkit_flutter_platform_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract class PspdfkitFlutterPlatform extends PlatformInterface {
Future<String?> getFrameworkVersion();

/// Sets the license key.
Future<void> setLicenseKey(String licenseKey);
Future<void> setLicenseKey(String? licenseKey);

/// Sets the license keys for both platforms.
/// The [androidLicenseKey] is the license key for Android.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pspdfkit_flutter_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class PspdfkitFlutterWeb extends PspdfkitFlutterPlatform {
}

@override
Future<void> setLicenseKey(String licenseKey) =>
Future<void> setLicenseKey(String? licenseKey) =>
PSPDFKitWeb.setLicenseKey(licenseKey);

@override
Expand Down
12 changes: 6 additions & 6 deletions lib/src/web/pspdfkit_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ class PSPDFKitWeb {
/// This method tries to set the license key to confirm it is valid, then store it in a static variable to be used later in [PSPDFKit.load].
/// Throws an exception if it fails to set the license key.
///
static Future<void> setLicenseKey(String licenseKey) async {
static Future<void> setLicenseKey(String? licenseKey) async {
try {
if (licenseKey == null) {
return;
}
// Try to set the license key to confirm it is valid, then store it in local storage.
var config = JsObject.jsify({
'licenseKey': licenseKey,
'productId': flutterWebProductId,
});

await promiseToFuture(_pspdfkit.callMethod('preloadWorker', [config]))
.then((value) {
_pspdfkitLicenseKey = licenseKey;
});
_pspdfkitLicenseKey = licenseKey;
await promiseToFuture(_pspdfkit.callMethod('preloadWorker', [config]));
} catch (e) {
throw Exception('Failed to set license key: $e');
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pspdfkit_flutter
description: A Flutter plugin providing a feature-rich PDF viewing and editing experience to your users with the powerful PSPDFKit PDF SDK.
version: 3.9.0
version: 3.9.1
homepage: https://pspdfkit.com/
repository: https://github.com/PSPDFKit/pspdfkit-flutter
issue_tracker: https://support.pspdfkit.com/hc/en-us/requests/new
Expand Down

0 comments on commit dfe418c

Please sign in to comment.