Skip to content

Commit fddc242

Browse files
authored
Merge pull request #29 from PSPDFKit/rad/update-to-pspdfkit7
Update to PSPDFKit 7
2 parents 7c79767 + 8834c5f commit fddc242

13 files changed

+59
-51
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ android/app/libs
4343
*.keystore
4444

4545
PSPDFKit/PSPDFKit.framework
46+
PSPDFKit/PSPDFKitUI.framework
4647
samples/Catalog/android/pspdfkit-lib/*.aar
4748

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ See our [announcement blog post](https://pspdfkit.com/blog/2016/react-native-mod
55
### iOS
66

77
#### Requirements
8-
- Xcode 8.3.3
9-
- PSPDFKit >= 6.9.3
10-
- react-native >= 0.48.1
8+
- Xcode 9
9+
- PSPDFKit >= 7.0.0
10+
- react-native >= 0.48.4
1111

1212
#### Getting Started
1313

1414
**Note:** If you want to integrate PSPDFKit using CocoaPods, use [these instructions](ios/cocoapods.md) instead.
1515

16-
Let's create a simple app that integrates `PSPDFKit.framework` and uses the `react-native-pspdfkit` module.
16+
Let's create a simple app that integrates PSPDFKit and uses the `react-native-pspdfkit` module.
1717

1818
1. Make sure `react-native-cli` is installed: `yarn global add react-native-cli`
1919
2. Create the app with `react-native init YourApp`.
2020
3. Step into your newly created app folder: `cd YourApp`
2121
4. Install `react-native-pspdfkit` from GitHub: `yarn add github:PSPDFKit/react-native`
2222
5. Link module `react-native-pspdfkit`: `react-native link react-native-pspdfkit`
23-
6. Create the folder `ios/PSPDFKit` and copy `PSPDFKit.framework` into it.
23+
6. Create the folder `ios/PSPDFKit` and copy `PSPDFKit.framework` and `PSPDFKitUI.framework` into it.
2424
7. Open `ios/YourApp.xcodeproj` in Xcode: `open ios/YourApp.xcodeproj`
2525
8. Make sure the deployment target is set to 9.0 or higher:
2626
![Deployment Target](screenshots/deployment-target.png)
2727
9. Change "View controller-based status bar appearance" to `YES` in `Info.plist`:
2828
![View Controller-Based Status Bar Appearance](screenshots/view-controller-based-status-bar-appearance.png)
2929
10. Link with the `libRCTPSPDFKit.a` static library (if `libRCTPSPDFKit.a` is already there but greyed out, delete it and link it again):
3030
![Linking Static Library](screenshots/linking-static-library.png)
31-
11. Embed `PSPDFKit.framework` by drag and dropping it into the "Embedded Binaries" section of the "YourApp" target (Select "Create groups"). This will also add it to the "Linked Framworks and Libraries" section:
31+
11. Embed `PSPDFKit.framework` and `PSPDFKitUI.framework` by drag and dropping it into the "Embedded Binaries" section of the "YourApp" target (Select "Create groups"). This will also add it to the "Linked Framworks and Libraries" section:
3232
![Embedding PSPDFKit](screenshots/embedding-pspdfkit.png)
3333
12. Add a PDF by drag and dropping it into your Xcode project (Select "Create groups" and add to target "YourApp"). This will add the document to the "Copy Bundle Resources" build phase:
3434
![Adding PDF](screenshots/adding-pdf.png)
@@ -102,7 +102,7 @@ PSPDFKit.present('document.pdf', {
102102

103103
#### Running Catalog Project
104104

105-
- Copy `PSPDFKit.framework` into the `PSPDFKit` directory.
105+
- Copy `PSPDFKit.framework` and `PSPDFKitUI.framework` into the `PSPDFKit` directory.
106106
- Install dependencies: `yarn install` in `samples/Catalog` directory. (Because of a [bug](https://github.com/yarnpkg/yarn/issues/2165) you may need to clean `yarn`'s cache with `yarn cache clean` before.)
107107
- Run the app with `react-native-cli`: `react-native run-ios`
108108

ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFConfiguration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#import <React/RCTConvert.h>
1414
@import PSPDFKit;
15+
@import PSPDFKitUI;
1516

1617
@interface RCTConvert (PSPDFConfiguration)
1718

ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFConfiguration.m

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ + (PSPDFConfiguration *)PSPDFConfiguration:(id)json {
2020
NSDictionary *dictionary = [self NSDictionary:json];
2121

2222
return [PSPDFConfiguration configurationWithBuilder:^(PSPDFConfigurationBuilder * _Nonnull builder) {
23-
SET(margin, UIEdgeInsets)
24-
SET(padding, UIEdgeInsets)
25-
SET(pagePadding, CGFloat)
2623
SET(doubleTapAction, PSPDFTapAction)
2724
SET(formElementZoomEnabled, BOOL)
2825
SET(scrollOnTapPageEndEnabled, BOOL)
@@ -37,16 +34,15 @@ + (PSPDFConfiguration *)PSPDFConfiguration:(id)json {
3734
SET(bookmarkSortOrder, PSPDFBookmarkManagerSortOrder)
3835
SET(internalTapGesturesEnabled, BOOL)
3936
SET(useParentNavigationBar, BOOL)
40-
SET(shouldRestoreNavigationBarStyle, BOOL)
4137
SET(linkAction, PSPDFLinkAction)
4238
SET(allowedMenuActions, PSPDFTextSelectionMenuAction)
43-
SET(HUDViewMode, PSPDFHUDViewMode)
44-
SET(HUDViewAnimation, PSPDFHUDViewAnimation)
39+
SET(userInterfaceViewMode, PSPDFUserInterfaceViewMode)
40+
SET(userInterfaceViewAnimation, PSPDFUserInterfaceViewAnimation)
4541
SET(thumbnailBarMode, PSPDFThumbnailBarMode)
4642
SET(pageLabelEnabled, BOOL)
4743
SET(documentLabelEnabled, PSPDFAdaptiveConditional)
48-
SET(shouldHideHUDOnPageChange, BOOL)
49-
SET(shouldShowHUDOnViewWillAppear, BOOL)
44+
SET(shouldHideUserInterfaceOnPageChange, BOOL)
45+
SET(shouldShowUserInterfaceOnViewWillAppear, BOOL)
5046
SET(allowToolbarTitleChange, BOOL)
5147
SET(renderAnimationEnabled, BOOL)
5248
SET(renderStatusViewPosition, PSPDFRenderStatusViewPosition)
@@ -56,22 +52,16 @@ + (PSPDFConfiguration *)PSPDFConfiguration:(id)json {
5652
SET(pageTransition, PSPDFPageTransition)
5753
SET(scrollDirection, PSPDFScrollDirection)
5854
SET(scrollViewInsetAdjustment, PSPDFScrollInsetAdjustment)
59-
SET(doublePageModeOnFirstPage, BOOL)
60-
SET(zoomingSmallDocumentsEnabled, BOOL)
61-
SET(pageCurlDirectionLeftToRight, BOOL)
62-
SET(fitToWidthEnabled, BOOL)
63-
SET(showsHorizontalScrollIndicator, BOOL)
64-
SET(showsVerticalScrollIndicator, BOOL)
65-
SET(alwaysBouncePages, BOOL)
66-
SET(fixedVerticalPositionForFitToWidthEnabledMode, BOOL)
55+
SET(firstPageAlwaysSingle, BOOL)
56+
SET(spreadFitting, PSPDFConfigurationSpreadFitting)
6757
SET(clipToPageBoundaries, BOOL)
6858
SET(minimumZoomScale, float)
6959
SET(maximumZoomScale, float)
7060
SET(shadowEnabled, BOOL)
7161
SET(shadowOpacity, CGFloat)
72-
SET(shouldHideNavigationBarWithHUD, BOOL)
62+
SET(shouldHideNavigationBarWithUserInterface, BOOL)
7363
SET(shouldHideStatusBar, BOOL)
74-
SET(shouldHideStatusBarWithHUD, BOOL)
64+
SET(shouldHideStatusBarWithUserInterface, BOOL)
7565
SET(backgroundColor, UIColor)
7666
SET(allowedAppearanceModes, PSPDFAppearanceMode)
7767
SET(thumbnailSize, CGSize)
@@ -93,8 +83,7 @@ + (PSPDFConfiguration *)PSPDFConfiguration:(id)json {
9383
SET(shouldScrollToChangedPage, BOOL)
9484
SET(searchMode, PSPDFSearchMode)
9585
SET(searchResultZoomScale, CGFloat)
96-
SET(signatureSavingEnabled, BOOL)
97-
SET(customerSignatureFeatureEnabled, BOOL)
86+
SET(signatureSavingStrategy, PSPDFSignatureSavingStrategy)
9887
SET(naturalSignatureDrawingEnabled, BOOL)
9988
// currently unsupported: SET(*galleryConfiguration, PSPDFGalleryConfiguration)
10089
SET(showBackActionButton, BOOL)
@@ -139,23 +128,23 @@ + (PSPDFConfiguration *)PSPDFConfiguration:(id)json {
139128
@"alertView" : @(PSPDFLinkActionAlertView),
140129
@"openSafari" : @(PSPDFLinkActionOpenSafari),
141130
@"inlineBrowser" : @(PSPDFLinkActionInlineBrowser),
142-
@"browserLegacy" : @(PSPDFLinkActionInlineBrowserLegacy)}),
131+
@"InlineWebViewController" : @(PSPDFLinkActionInlineWebViewController)}),
143132
PSPDFLinkActionNone,
144133
unsignedIntegerValue)
145134

146-
RCT_ENUM_CONVERTER(PSPDFHUDViewMode,
147-
(@{@"always" : @(PSPDFHUDViewModeAlways),
148-
@"automatic" : @(PSPDFHUDViewModeAutomatic),
149-
@"automaticNoFirstLastPage" : @(PSPDFHUDViewModeAutomaticNoFirstLastPage),
150-
@"never" : @(PSPDFHUDViewModeNever)}),
151-
PSPDFHUDViewModeAutomatic,
135+
RCT_ENUM_CONVERTER(PSPDFUserInterfaceViewMode,
136+
(@{@"always" : @(PSPDFUserInterfaceViewModeAlways),
137+
@"automatic" : @(PSPDFUserInterfaceViewModeAutomatic),
138+
@"automaticNoFirstLastPage" : @(PSPDFUserInterfaceViewModeAutomaticNoFirstLastPage),
139+
@"never" : @(PSPDFUserInterfaceViewModeNever)}),
140+
PSPDFUserInterfaceViewModeAutomatic,
152141
unsignedIntegerValue)
153142

154-
RCT_ENUM_CONVERTER(PSPDFHUDViewAnimation,
155-
(@{@"none" : @(PSPDFHUDViewAnimationNone),
156-
@"fade" : @(PSPDFHUDViewAnimationFade),
157-
@"slide" : @(PSPDFHUDViewAnimationSlide)}),
158-
PSPDFHUDViewAnimationNone,
143+
RCT_ENUM_CONVERTER(PSPDFUserInterfaceViewAnimation,
144+
(@{@"none" : @(PSPDFUserInterfaceViewAnimationNone),
145+
@"fade" : @(PSPDFUserInterfaceViewAnimationFade),
146+
@"slide" : @(PSPDFUserInterfaceViewAnimationSlide)}),
147+
PSPDFUserInterfaceViewAnimationNone,
159148
unsignedIntegerValue)
160149

161150
RCT_ENUM_CONVERTER(PSPDFThumbnailBarMode,
@@ -200,10 +189,10 @@ + (PSPDFConfiguration *)PSPDFConfiguration:(id)json {
200189
unsignedIntegerValue)
201190

202191
RCT_ENUM_CONVERTER(PSPDFPageTransition,
203-
(@{@"scrollPerPage" : @(PSPDFPageTransitionScrollPerPage),
192+
(@{@"scrollPerSpread" : @(PSPDFPageTransitionScrollPerSpread),
204193
@"scrollContinuous" : @(PSPDFPageTransitionScrollContinuous),
205194
@"curl" : @(PSPDFPageTransitionCurl)}),
206-
PSPDFPageTransitionScrollPerPage,
195+
PSPDFPageTransitionScrollPerSpread,
207196
unsignedIntegerValue)
208197

209198
RCT_ENUM_CONVERTER(PSPDFScrollInsetAdjustment,
@@ -225,6 +214,13 @@ + (PSPDFConfiguration *)PSPDFConfiguration:(id)json {
225214
PSPDFSearchModeModal,
226215
unsignedIntegerValue)
227216

217+
RCT_ENUM_CONVERTER(PSPDFSignatureSavingStrategy,
218+
(@{@"alwaysSave" : @(PSPDFSignatureSavingStrategyAlwaysSave),
219+
@"neverSave" : @(PSPDFSignatureSavingStrategyNeverSave),
220+
@"saveIfSelected" : @(PSPDFSignatureSavingStrategySaveIfSelected)}),
221+
PSPDFSignatureSavingStrategyAlwaysSave,
222+
unsignedIntegerValue)
223+
228224
RCT_MULTI_ENUM_CONVERTER(PSPDFAnnotationType,
229225
(@{@"none" : @(PSPDFAnnotationTypeNone),
230226
@"undefined" : @(PSPDFAnnotationTypeUndefined),
@@ -300,4 +296,12 @@ + (PSPDFConfiguration *)PSPDFConfiguration:(id)json {
300296
PSPDFSettingsOptionAll,
301297
unsignedIntegerValue)
302298

299+
RCT_ENUM_CONVERTER(PSPDFConfigurationSpreadFitting,
300+
(@{@"fit" : @(PSPDFConfigurationSpreadFittingFit),
301+
@"fill" : @(PSPDFConfigurationSpreadFittingFill),
302+
@"adaptive" : @(PSPDFConfigurationSpreadFittingAdaptive)}),
303+
PSPDFScrollInsetAdjustmentNone,
304+
unsignedIntegerValue)
305+
303306
@end
307+

ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#import <React/RCTConvert.h>
1414
@import PSPDFKit;
15+
@import PSPDFKitUI;
1516

1617
@interface RCTConvert (PSPDFDocument)
1718

ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFDocument.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ + (PSPDFDocument *)PSPDFDocument:(NSString *)string {
2323
url = [[NSBundle mainBundle] URLForResource:string withExtension:nil];
2424
}
2525

26-
return [PSPDFDocument documentWithURL:url];
26+
return [[PSPDFDocument alloc] initWithURL:url];
2727
}
2828

2929
@end

ios/RCTPSPDFKit/RCTPSPDFKitManager.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#import <React/RCTConvert.h>
1818

1919
@import PSPDFKit;
20+
@import PSPDFKitUI;
2021

2122
@implementation RCTPSPDFKitManager
2223

ios/cocoapods.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
### CocoaPods integration
44

55
#### Requirements
6-
- Xcode 8.3.3
7-
- PSPDFKit >=6.9.3
8-
- react-native >= 0.48.1
6+
- Xcode 9
7+
- PSPDFKit >=7.0.0
8+
- react-native >= 0.48.4
99
- CocoaPods >= 1.3.1
1010

1111
#### Getting Started
1212

13-
Lets create a simple app that integrates `PSPDFKit.framework` using CocoaPods.
13+
Lets create a simple app that integrates PSPDFKit using CocoaPods.
1414

1515
1. Make sure `react-native-cli` is installed: `yarn global add react-native-cli`
1616
2. Create the app with `react-native init YourApp`.
1717
3. Step into your newly created app folder: `cd YourApp`
1818
4. Install `react-native-pspdfkit` from GitHub: `yarn add github:PSPDFKit/react-native`
1919
5. IMPORTANT: Do not link module react-native-pspdfkit: Do not use react-native link react-native-pspdfkit
20-
6. Create the folder `ios/PSPDFKit` and copy `PSPDFKit.framework` into it.
20+
6. Create the folder `ios/PSPDFKit` and copy `PSPDFKit.framework` and `PSPDFKitUI.framework` into it.
2121
7. Open ios/YourApp.xcodeproj in Xcode: open ios/YourApp.xcodeproj
2222
8. Make sure the deployment target is set to 9.0 or higher:
2323
![Deployment Target](../screenshots/deployment-target.png)
@@ -55,12 +55,12 @@ end
5555

5656
13. Run `pod install`
5757
14. Open the newly created workspace: `YourApp.workspace`
58-
15. Copy `PSPDFKit.framework` into the Pods folder: `YourApp/ios/Pods`
58+
15. Copy `PSPDFKit.framework` and `PSPDFKitUI.framework` into the Pods folder: `YourApp/ios/Pods`
5959
16. Drag and drop it from the Finder into the `RCTPSPDFKit` group:
6060
![Deployment Target](../screenshots/embedding-pspdfkit-pods.png)
6161
17. Add it to the `react-native-pspdfkit` framework:
6262
![Deployment Target](../screenshots/adding-to-react-native-pspdfkit.png)
63-
18. Embed `YourApp/ios/PSPDFKit/PSPDFKit.framework` (not the copy from `YourApp/ios/Pods/PSPDFKit.framework`) by drag and dropping it into the "Embedded Binaries" section of the "YourApp" target (Select "Create groups"). This will also add it to the "Linked Frameworks and Libraries" section:
63+
18. Embed `YourApp/ios/PSPDFKit/PSPDFKit.framework` and `YourApp/ios/PSPDFKit/PSPDFKitUI.framework` (not the copies from `YourApp/ios/Pods/`) by drag and dropping it into the "Embedded Binaries" section of the "YourApp" target (Select "Create groups"). This will also add it to the "Linked Frameworks and Libraries" section:
6464
![Embedding PSPDFKit](../screenshots/embedding-pspdfkit.png)
6565
19. Add a PDF by drag and dropping it into your Xcode project (Select "Create groups" and add to target "YourApp"). This will add the document to the "Copy Bundle Resources" build phase:
6666
![Adding PDF](../screenshots/adding-pdf.png)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-pspdfkit",
3-
"version": "1.4.0",
3+
"version": "1.5.0",
44
"description": "A React Native module for the PSPDFKit library.",
55
"keywords": [
66
"react native",

samples/Catalog/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"dependencies": {
99
"react": "16.0.0-alpha.12",
10-
"react-native": "0.48.1",
10+
"react-native": "0.48.4",
1111
"react-native-fs": "github:johanneslumpe/react-native-fs#55dd2a7624f4617e04a895a9a319cb012c1002a5",
1212
"react-native-pspdfkit": "file:../../"
1313
}

0 commit comments

Comments
 (0)