diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a0f3ff..77aaebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) @@ -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) diff --git a/android/build.gradle b/android/build.gradle index b72e732..411b762 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -38,7 +38,7 @@ apply plugin: 'kotlin-android' android { namespace "com.pspdfkit.flutter.pspdfkit" - compileSdkVersion androidCompileSdkVersion + compileSdk androidCompileSdkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_17 @@ -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" } diff --git a/android/config.gradle b/android/config.gradle index 8f7891e..2c94953 100644 --- a/android/config.gradle +++ b/android/config.gradle @@ -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' @@ -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" diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 15de902..75c04b1 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 76036d2..5cf3419 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -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" diff --git a/example/lib/main.dart b/example/lib/main.dart index ff227f6..2f8c885 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -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()); } @@ -73,19 +85,6 @@ class _HomePageState extends State 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 { diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c6cda8c..7f58d03 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -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: diff --git a/ios/Classes/PspdfkitPlugin.m b/ios/Classes/PspdfkitPlugin.m index fde9512..80420ab 100644 --- a/ios/Classes/PspdfkitPlugin.m +++ b/ios/Classes/PspdfkitPlugin.m @@ -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]) { diff --git a/ios/pspdfkit_flutter.podspec b/ios/pspdfkit_flutter.podspec index f15414d..53b57cf 100644 --- a/ios/pspdfkit_flutter.podspec +++ b/ios/pspdfkit_flutter.podspec @@ -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" } @@ -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 diff --git a/lib/pspdfkit.dart b/lib/pspdfkit.dart index d1c8d5e..7c765cd 100644 --- a/lib/pspdfkit.dart +++ b/lib/pspdfkit.dart @@ -47,7 +47,7 @@ class Pspdfkit { /// Sets the license key. /// @param licenseKey The license key to be used. - static Future setLicenseKey(String licenseKey) => + static Future setLicenseKey(String? licenseKey) => PspdfkitFlutterPlatform.instance.setLicenseKey(licenseKey); /// Sets the license keys for both platforms. diff --git a/lib/src/pspdfkit_flutter_method_channel.dart b/lib/src/pspdfkit_flutter_method_channel.dart index 2a7e805..b6e96b4 100644 --- a/lib/src/pspdfkit_flutter_method_channel.dart +++ b/lib/src/pspdfkit_flutter_method_channel.dart @@ -27,9 +27,9 @@ class MethodChannelPspdfkitFlutter extends PspdfkitFlutterPlatform { /// Sets the license key. @override - Future setLicenseKey(String licenseKey) async => + Future setLicenseKey(String? licenseKey) async => await methodChannel.invokeMethod( - 'setLicenseKey', {'licenseKey': licenseKey}); + 'setLicenseKey', {'licenseKey': licenseKey}); /// Sets the license keys for both platforms. @override diff --git a/lib/src/pspdfkit_flutter_platform_interface.dart b/lib/src/pspdfkit_flutter_platform_interface.dart index 727b25a..3594f8d 100644 --- a/lib/src/pspdfkit_flutter_platform_interface.dart +++ b/lib/src/pspdfkit_flutter_platform_interface.dart @@ -52,7 +52,7 @@ abstract class PspdfkitFlutterPlatform extends PlatformInterface { Future getFrameworkVersion(); /// Sets the license key. - Future setLicenseKey(String licenseKey); + Future setLicenseKey(String? licenseKey); /// Sets the license keys for both platforms. /// The [androidLicenseKey] is the license key for Android. diff --git a/lib/src/pspdfkit_flutter_web.dart b/lib/src/pspdfkit_flutter_web.dart index d5a0e38..ecba3d9 100644 --- a/lib/src/pspdfkit_flutter_web.dart +++ b/lib/src/pspdfkit_flutter_web.dart @@ -124,7 +124,7 @@ class PspdfkitFlutterWeb extends PspdfkitFlutterPlatform { } @override - Future setLicenseKey(String licenseKey) => + Future setLicenseKey(String? licenseKey) => PSPDFKitWeb.setLicenseKey(licenseKey); @override diff --git a/lib/src/web/pspdfkit_web.dart b/lib/src/web/pspdfkit_web.dart index ab358a1..81762f3 100644 --- a/lib/src/web/pspdfkit_web.dart +++ b/lib/src/web/pspdfkit_web.dart @@ -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 setLicenseKey(String licenseKey) async { + static Future 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'); } diff --git a/pubspec.yaml b/pubspec.yaml index f6a281d..aba7ad5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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