Follow

Managing downloaded documents

Limiting number of documents

You can limit the number of documents to the X most recent by using the maximumDocuments property on the KGDocumentManager Any older issues will have their contents removed and will not appear in the document picker.

@interface KGDocumentManager
@property(nonatomic,assign) NSUInteger maximumDocuments;

Removing downloaded documents

You may wish to provide a function for users of your pugpig-based app to manually remove a downloaded documents content. The framework provides two methods to do this. You can delete the document entirely, both the downloaded content and the entry in the document managers content array or can also remove just the downloaded content.

1. Remove the document from the Document Manager completely

Send a pointer to the KGDocument object you wish to clear the contents of to the KGDocumentManager singleton with the removeDocument: method as shown below:

[[KGDocumentManager sharedManager] removeDocument:selectedDocument];

During the removal the state property of the document will be set to KGDocumentStatedClearing. You will then need to refresh the datasource of KGDocumentManager. You can do this with the following method call.

[[KGDocumentManager sharedManager] addDocumentsFromOPDSFeedURL:url download:NO completionHandler:^(NSUInteger newDocsAdded){ }];

The completion block should handle whatever actions you wish to happen when new content is available.

2. Remove the downloaded document contents only (Pugpig v1.7+)

This is a call to the KGDocument object itself to clear it's contents:

[documentToDelete clearContent];

NOTE: calling these methods on the currently open document can have undefined results. We strongly recommend not doing this.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk