Skip to content

Commit

Permalink
Release 2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PSPDFKit committed Dec 19, 2023
1 parent 5b2716a commit 3c6ec7b
Show file tree
Hide file tree
Showing 135 changed files with 58,774 additions and 14,665 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:react/recommended',
'@react-native-community',
],
extends: ['eslint:recommended', 'plugin:react/recommended', '@react-native'],
plugins: ['simple-import-sort'],
parserOptions: {
ecmaVersion: 12,
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ PSPDFKit/PSPDFKitUI.xcframework
# UWP license file
samples/Catalog/windows/Catalog/License.xaml

#Jsdoc
jsdoc/

.fake
1,088 changes: 647 additions & 441 deletions ACKNOWLEDGEMENTS.md

Large diffs are not rendered by default.

29 changes: 21 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
## Newest Release

### 2.8.0 - 18 Dec 2023

- Adds TypeScript types support to PSPDFKit plugin. (#42380)
- Adds support for loading image documents using the PSPDFKit component on Android. (#42692)
- Updates plugin to target React Native 0.72.7. (#42800)
- Updates Android compileSdkVersion to API 34 and Gradle to 8. (#42380)
- Updates PSPDFKit for Android version to 8.10.0.
- Updates PSPDFKit for iOS version to 13.1.0.
- Fixes issue where building iOS project led to "'PSPDFKitReactNativeiOS-Swift.h' file not found" error. (#41986)
- Fixes issue where getAnnotations with invalid page index caused a crash on Android. (#42073)
- Fixes issue where onAnnotationsChanged event did not fire when a form field was updated on Android. (#42525)
- Fixes issue where annotation toolbar color picker wasn't added by default. (#42761)

## Previous Releases

### 2.7.0 - 07 Sep 2023

- Adds Annotation Preset customization. (#41528)
- Updates for PSPDFKit 8.8.1 for Android. (#41910)
- Updates for PSPDFKit 12.3.1 for iOS. (#41910)
- Updates the deployment target to iOS 15. (#39956)
- Fixed issue where configuration is overridden by ToolbarMenuItems. (#41681)
- Fixed issue where PDF generation returns "can not get property of null" on iOS. (#41247)
- Fixed annotation toolbar menu grouping customization values. (#41197)
- Fixed issue where the close button is not displayed on iOS. (#41710)
- Fixed issue where showCloseButton config removes all other BarButtonItems on iOS. (#41731)
- Fixed issue where presentInstant uses different parameters on iOS and Android. (#41922)

## Previous Releases
- Fixes issue where configuration is overridden by ToolbarMenuItems. (#41681)
- Fixes issue where PDF generation returns "can not get property of null" on iOS. (#41247)
- Fixes annotation toolbar menu grouping customization values. (#41197)
- Fixes issue where the close button is not displayed on iOS. (#41710)
- Fixes issue where showCloseButton config removes all other BarButtonItems on iOS. (#41731)
- Fixes issue where presentInstant uses different parameters on iOS and Android. (#41922)

### 2.6.1 - 19 Jun 2023

Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,12 @@ Let's create a simple app that integrates PSPDFKit and uses the `react-native-ps
Your Podfile should look like this:

```diff
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip

- platform :ios, '10.0'
+ platform :ios, '15.0'
Expand All @@ -130,7 +134,7 @@ Let's create a simple app that integrates PSPDFKit and uses the `react-native-ps
use_flipper!()

post_install do |installer|
react_native_post_install(installer)
react_native_post_install(installer, config[:reactNativePath])
end
end
```
Expand Down Expand Up @@ -542,7 +546,7 @@ Let's create a simple app that integrates PSPDFKit and uses the `react-native-ps
pageTransition: 'scrollContinuous',
scrollDirection: 'vertical',
}}
ref="pdfView"
ref={ this.pdfRef }
fragmentTag="PDF1"
style={{ flex: 1 }}
/>
Expand Down
19 changes: 12 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Contains gradle configuration constants
*/
ext {
PSPDFKIT_VERSION = '8.8.1'
PSPDFKIT_VERSION = '8.10.0'
}

buildscript {
Expand All @@ -32,7 +32,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.0-alpha03'
classpath("com.android.tools.build:gradle:8.1.0")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -41,24 +41,29 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33
buildToolsVersion "30.0.3"
compileSdkVersion 34
buildToolsVersion "34.0.0"

namespace "com.pspdfkit.react"
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
versionCode 1
versionName "1.0"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

lintOptions {
abortOnError false
}

buildFeatures {
buildConfig true
}
}

dependencies {
Expand Down
4 changes: 4 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application>
<meta-data
android:name="pspdfkit_automatic_initialize"
android:value="false" />

<activity
android:name="com.pspdfkit.ui.PdfActivity"
android:windowSoftInputMode="adjustNothing" />
Expand Down
43 changes: 17 additions & 26 deletions android/src/main/java/com/pspdfkit/react/PSPDFKitModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.pspdfkit.react.RNInstantPdfActivity;
import com.pspdfkit.listeners.SimpleDocumentListener;
import com.pspdfkit.react.helper.ConversionHelpers;
import com.pspdfkit.react.helper.PSPDFKitUtils;
import com.pspdfkit.ui.PdfActivity;
import com.pspdfkit.ui.PdfFragment;

Expand All @@ -65,15 +66,7 @@ public class PSPDFKitModule extends ReactContextBaseJavaModule implements Applic

private static final int REQUEST_CODE_TO_INDEX = 16;
private static final int MASKED_REQUEST_CODE_TO_REAL_CODE = 0xffff;
private static final String[] SUPPORTED_IMAGE_TYPES = new String[] {
".jpg",
".png",
".jpeg",
".tif",
".tiff"
};



@Nullable
private Activity resumedActivity;
@Nullable
Expand Down Expand Up @@ -115,10 +108,10 @@ public String getName() {
@ReactMethod
public void present(@NonNull String document, @NonNull ReadableMap configuration, @Nullable Promise promise) {
File documentFile = new File(document);
if(isPdf(documentFile)) {
if(PSPDFKitUtils.isValidPdf(documentFile)) {
lastPresentPromise = promise;
presentPdf(document, configuration, promise);
} else if(isImage(documentFile)) {
} else if(PSPDFKitUtils.isValidImage(documentFile)) {
lastPresentPromise = promise;
presentImage(document, configuration, promise);
}else {
Expand Down Expand Up @@ -166,7 +159,18 @@ public void presentImage(@NonNull String imageDocument, @NonNull ReadableMap con
}

@ReactMethod
public void presentInstant(@NonNull String serverUrl, @NonNull String jwt, @NonNull ReadableMap configuration, @Nullable Promise promise) {
public void presentInstant(@NonNull ReadableMap documentData, @NonNull ReadableMap configuration, @Nullable Promise promise) {
String serverUrl = documentData.getString("serverUrl");
String jwt = documentData.getString("jwt");

if (serverUrl == null || jwt == null) {
Throwable error = new Throwable("serverUrl and jwt are required");
if (promise != null) {
promise.reject(error);
}
return;
}

if (getCurrentActivity() != null) {
if (resumedActivity == null) {
// We register an activity lifecycle callback so we can get notified of the current activity.
Expand All @@ -178,7 +182,7 @@ public void presentInstant(@NonNull String serverUrl, @NonNull String jwt, @NonN
RNInstantPdfActivity.showInstantDocument(getCurrentActivity(), serverUrl, jwt, configurationAdapter.build());
}
}

@ReactMethod
public synchronized void setPageIndex(final int pageIndex, final boolean animated) {
if (resumedActivity instanceof PdfActivity) {
Expand Down Expand Up @@ -447,17 +451,4 @@ public void run() {
public void onNewIntent(Intent intent) {
// Not required right now.
}

private boolean isPdf(File file) {
return file.getName().toLowerCase().endsWith(".pdf");
}

private boolean isImage(File file) {
for (String extension: SUPPORTED_IMAGE_TYPES) {
if (file.getName().toLowerCase().endsWith(extension)) {
return true;
}
}
return false;
}
}
33 changes: 33 additions & 0 deletions android/src/main/java/com/pspdfkit/react/helper/PSPDFKitUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.pspdfkit.react.helper

import java.io.File
import java.util.Locale


class PSPDFKitUtils {
companion object {

private val SUPPORTED_IMAGE_TYPES = arrayOf(
".jpg",
".png",
".jpeg",
".tif",
".tiff"
)

@JvmStatic
public fun isValidImage(file: File): Boolean {
for (extension in SUPPORTED_IMAGE_TYPES) {
if (file.name.lowercase(Locale.getDefault()).endsWith(extension)) {
return true
}
}
return false
}

@JvmStatic
public fun isValidPdf(file: File): Boolean {
return file.name.lowercase(Locale.getDefault()).endsWith(".pdf")
}
}
}
Loading

0 comments on commit 3c6ec7b

Please sign in to comment.