Skip to content

Commit 5eac4b0

Browse files
authored
Merge pull request #71 from PSPDFKit/rad/disableAutomaticSaving
Adds the ability to disable auto save
2 parents 7fdf5f2 + 8a094f3 commit 5eac4b0

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

PSPDFKitPlugin/PSPDFKitPlugin.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ @interface PSPDFKitPlugin () <PSPDFViewControllerDelegate, PSPDFFlexibleToolbarC
2121
@property (nonatomic, strong) PSPDFViewController *pdfController;
2222
@property (nonatomic, strong) PSPDFDocument *pdfDocument;
2323
@property (nonatomic, strong) NSDictionary *defaultOptions;
24+
@property (nonatomic) BOOL disableAutomaticSaving;
2425

2526
@end
2627

@@ -713,6 +714,16 @@ - (void)setEditableAnnotationTypesForPSPDFViewControllerWithJSON:(NSArray *)type
713714
}];
714715
}
715716

717+
- (void)setDisableAutomaticSavingForPSPDFViewControllerWithJSON:(NSNumber *)shouldDisable
718+
{
719+
self.disableAutomaticSaving = shouldDisable.boolValue;
720+
}
721+
722+
- (NSNumber *)disableAutomaticSavingAsJSON
723+
{
724+
return @(self.disableAutomaticSaving);
725+
}
726+
716727
- (NSArray *)editableAnnotationTypesAsJSON
717728
{
718729
return _pdfController.configuration.editableAnnotationTypes.allObjects;
@@ -1318,6 +1329,11 @@ - (void)toggleAnnotationToolbar:(CDVInvokedUrlCommand *)command
13181329

13191330
#pragma mark Delegate methods
13201331

1332+
- (BOOL)pdfViewController:(PSPDFViewController *)pdfController shouldSaveDocument:(nonnull PSPDFDocument *)document withOptions:(NSDictionary<PSPDFDocumentSaveOption,id> *__autoreleasing _Nonnull * _Nonnull)options
1333+
{
1334+
return !self.disableAutomaticSaving;
1335+
}
1336+
13211337
- (void)pdfViewController:(PSPDFViewController *)pdfController willBeginDisplayingPageView:(PSPDFPageView *)pageView forPageAtIndex:(NSInteger)pageIndex
13221338
{
13231339
[self sendEventWithJSON:[NSString stringWithFormat:@"{type:'willBeginDisplayingPageView',page:%ld}", (long) pageIndex]];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pspdfkit-cordova-ios",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"description": "PSPDFKit Cordova Plugin for iOS",
55
"cordova": {
66
"id": "pspdfkit-cordova-ios",

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<plugin id="pspdfkit-cordova-ios" version="1.2.4" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2+
<plugin id="pspdfkit-cordova-ios" version="1.2.6" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
33
<engines>
44
<engine name="cordova" version=">=6.3.1"/>
55
</engines>

0 commit comments

Comments
 (0)