Permalink
Browse files

Support to #page=n annotation

  • Loading branch information...
1 parent c0ab34f commit 404c2c34847a22bd2bcdc9426dce5a0399023f4c Gianluca committed Nov 11, 2011
@@ -782,43 +782,65 @@ -(BOOL) documentViewController:(MFDocumentViewController *)dvc doesHaveToAutopla
}
-(void) documentViewController:(MFDocumentViewController *)dvc didReceiveURIRequest:(NSString *)uri{
- NSArray *arrayParameter = nil;
- NSString *uriType = nil;
- NSString *uriResource = nil;
- NSString * documentPath = nil;
+ NSArray *arrayParameter = nil;
+
+ if (![uri hasPrefix:@"#page="]){
+
+ NSArray *arrayParameter = nil;
+ NSString *uriType = nil;
+ NSString *uriResource = nil;
+
+ NSString * documentPath = nil;
+
+ arrayParameter = [uri componentsSeparatedByString:@"://"];
+
+ uriType = [NSString stringWithFormat:@"%@", [arrayParameter objectAtIndex:0]];
+
+ uriResource = [NSString stringWithFormat:@"%@", [arrayParameter objectAtIndex:1]];
+
+ if ([uriType isEqualToString:@"fpke"]) {
+
+ documentPath = [self.document.resourceFolder stringByAppendingPathComponent:uriResource];
+
+ [self playVideo:documentPath local:YES];
+ }
+
+ if ([uriType isEqualToString:@"fpkz"]) {
+
+ documentPath = [@"http://" stringByAppendingString:uriResource];
+
+ [self playVideo:documentPath local:NO];
+ }
+
+ if ([uriType isEqualToString:@"fpki"]){
+
+ documentPath = [self.document.resourceFolder stringByAppendingPathComponent:uriResource];
+
+ [self showWebView:documentPath local:YES];
+ }
+
+ if ([uriType isEqualToString:@"http"]){
+
+ [self showWebView:uri local:NO];
+ }
+
+
+ }else{
+
+ arrayParameter = [uri componentsSeparatedByString:@"="];
+
+ [self setPage:[[arrayParameter objectAtIndex:1]intValue]];
+
- arrayParameter = [uri componentsSeparatedByString:@"://"];
-
- uriType = [NSString stringWithFormat:@"%@", [arrayParameter objectAtIndex:0]];
-
- uriResource = [NSString stringWithFormat:@"%@", [arrayParameter objectAtIndex:1]];
-
- if ([uriType isEqualToString:@"fpke"]) {
-
- documentPath = [self.document.resourceFolder stringByAppendingPathComponent:uriResource];
-
- [self playVideo:documentPath local:YES];
}
+
+
+
+
+
+
- if ([uriType isEqualToString:@"fpkz"]) {
-
- documentPath = [@"http://" stringByAppendingString:uriResource];
-
- [self playVideo:documentPath local:NO];
- }
-
- if ([uriType isEqualToString:@"fpki"]){
-
- documentPath = [self.document.resourceFolder stringByAppendingPathComponent:uriResource];
-
- [self showWebView:documentPath local:YES];
- }
-
- if ([uriType isEqualToString:@"http"]){
-
- [self showWebView:uri local:NO];
- }
}
- (void)playAudio:(NSString *)audioURL local:(BOOL)_isLocal{
@@ -33,7 +33,7 @@
NSString *documentName = @"Manual";
/** Get temporary directory to save thumbnails */
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
/** Set thumbnails path */
NSString *thumbnailsPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",documentName]];
@@ -33,7 +33,7 @@
NSString *documentName = @"Manual";
/** Get temporary directory to save thumbnails */
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
/** Set thumbnails path */
NSString *thumbnailsPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",documentName]];

0 comments on commit 404c2c3

Please sign in to comment.