Skip to content

Commit

Permalink
Release 2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
PSPDFKit committed Dec 8, 2021
1 parent ff02b91 commit c877e85
Show file tree
Hide file tree
Showing 12 changed files with 2,428 additions and 3,621 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
## Newest Release

### 2.0.4 - 07 Dec 2021

- Updates the Xcode build settings of the Catalog and Native Catalog example projects to work on iOS simulators on Apple Silicon Macs. (#32129)
- Sets `currentPageIndex` in `onStateChanged` callbacks always to the currently visible page index. Also adds `affectedPageIndex` to get the page that is corresponding to the other states in the callback. (#31926)
- PSPDFKit now requires React Native 0.66.3 or later. (#32119)
- Updates for PSPDFKit 8.0.2 for Android. (#32119)

## Previous Releases

### 2.0.3 - 02 Nov 2021

- PSPDFKit now requires React Native 0.66.1 or later. (#31744)
- Updates for PSPDFKit 8.0.1 for Android. (#31744)
- Updates for PSPDFKit 11.1 for iOS. (#31654)
- Improves the repository's README. (#31633)

## Previous Releases

### 2.0.2 - 07 Oct 2021

- Update to PSPDFKit for Android 8.
Expand Down
2 changes: 1 addition & 1 deletion 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.0.1'
PSPDFKIT_VERSION = '8.0.2'
}

buildscript {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void dispatch(RCTEventEmitter rctEventEmitter) {
eventData.putInt("currentPageIndex", currentPageIndex);
eventData.putInt("pageCount", pageCount);
eventData.putBoolean("annotationCreationActive", annotationCreationActive);
eventData.putInt("affectedPageIndex", currentPageIndex);
eventData.putBoolean("annotationEditingActive", annotationEditingActive);
eventData.putBoolean("textSelectionActive", textSelectionActive);
eventData.putBoolean("formEditingActive", formEditingActive);
Expand Down
15 changes: 13 additions & 2 deletions ios/RCTPSPDFKit/RCTPSPDFKitView.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ - (instancetype)initWithFrame:(CGRect)frame {
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(annotationChangedNotification:) name:PSPDFAnnotationChangedNotification object:nil];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(annotationChangedNotification:) name:PSPDFAnnotationsAddedNotification object:nil];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(annotationChangedNotification:) name:PSPDFAnnotationsRemovedNotification object:nil];

[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(spreadIndexDidChange:) name:PSPDFDocumentViewControllerSpreadIndexDidChangeNotification object:nil];
}

return self;
Expand Down Expand Up @@ -385,7 +387,15 @@ - (void)annotationChangedNotification:(NSNotification *)notification {
}
}

#pragma mark - Customize the Toolbar
- (void)spreadIndexDidChange:(NSNotification *)notification {
PSPDFDocumentViewController *documentViewController = self.pdfController.documentViewController;
if (notification.object != documentViewController) { return; }
PSPDFPageIndex pageIndex = [documentViewController.layout pageRangeForSpreadAtIndex:documentViewController.spreadIndex].location;
PSPDFPageView *pageView = [self.pdfController pageViewForPageAtIndex:pageIndex];
[self onStateChangedForPDFViewController:self.pdfController pageView:pageView pageAtIndex:pageIndex];
}

// MARK: - Customize the Toolbar

- (void)setLeftBarButtonItems:(nullable NSArray <NSString *> *)items forViewMode:(nullable NSString *) viewMode animated:(BOOL)animated {
NSMutableArray *leftItems = [NSMutableArray array];
Expand Down Expand Up @@ -459,9 +469,10 @@ - (void)onStateChangedForPDFViewController:(PSPDFViewController *)pdfController
}

self.onStateChanged(@{@"documentLoaded" : @(isDocumentLoaded),
@"currentPageIndex" : @(pageIndex),
@"currentPageIndex" : @(pdfController.pageIndex),
@"pageCount" : @(pageCount),
@"annotationCreationActive" : @(isAnnotationToolBarVisible),
@"affectedPageIndex": @(pageIndex),
@"annotationEditingActive" : @(hasSelectedAnnotations),
@"textSelectionActive" : @(hasSelectedText),
@"formEditingActive" : @(isFormEditingActive)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-pspdfkit",
"version": "2.0.3",
"version": "2.0.4",
"description": "React Native PDF Library by PSPDFKit",
"keywords": [
"react native",
Expand All @@ -23,10 +23,10 @@
"peerDependencies": {
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-native": "^0.66.1"
"react-native": "^0.66.3"
},
"dependencies": {},
"devDependencies": {
"prettier": "^2.4.1"
"prettier": "^2.5.0"
}
}
Loading

0 comments on commit c877e85

Please sign in to comment.