Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fake support for simulator #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions UXReader/UXReader.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
45FE1B8C1E7855CC00EB808E /* UXReader-Search-Reverse.png in Resources */ = {isa = PBXBuildFile; fileRef = 45FE1B831E7855CC00EB808E /* UXReader-Search-Reverse.png */; };
45FE1B8D1E7855CC00EB808E /* UXReader-Search-Reverse@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 45FE1B841E7855CC00EB808E /* UXReader-Search-Reverse@2x.png */; };
45FE1B8E1E7855CC00EB808E /* UXReader-Search-Reverse@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 45FE1B851E7855CC00EB808E /* UXReader-Search-Reverse@3x.png */; };
52A821E6205096F800237883 /* UXReaderSimulator.h in Headers */ = {isa = PBXBuildFile; fileRef = 52A821E4205096F800237883 /* UXReaderSimulator.h */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -254,6 +255,7 @@
45FE1B831E7855CC00EB808E /* UXReader-Search-Reverse.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "UXReader-Search-Reverse.png"; path = "UXReader/Graphics/UXReader-Search-Reverse.png"; sourceTree = "<group>"; };
45FE1B841E7855CC00EB808E /* UXReader-Search-Reverse@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "UXReader-Search-Reverse@2x.png"; path = "UXReader/Graphics/UXReader-Search-Reverse@2x.png"; sourceTree = "<group>"; };
45FE1B851E7855CC00EB808E /* UXReader-Search-Reverse@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "UXReader-Search-Reverse@3x.png"; path = "UXReader/Graphics/UXReader-Search-Reverse@3x.png"; sourceTree = "<group>"; };
52A821E4205096F800237883 /* UXReaderSimulator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UXReaderSimulator.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -403,6 +405,7 @@
453DED5F1E68E8E500DEE191 /* UXReader.mm */,
45F2853B1E6A20F000D2605F /* UXReaderFramework.h */,
45F2853C1E6A20F000D2605F /* UXReaderFramework.mm */,
52A821E4205096F800237883 /* UXReaderSimulator.h */,
);
path = UXReader;
sourceTree = "<group>";
Expand Down Expand Up @@ -522,6 +525,7 @@
45F2853F1E6A20F000D2605F /* UXReaderFramework.h in Headers */,
45AC09831E6E173B00655696 /* UXReaderMainScrollView.h in Headers */,
45635C341E6CC3DA00665D34 /* UXReaderPageScrollView.h in Headers */,
52A821E6205096F800237883 /* UXReaderSimulator.h in Headers */,
451ECD661E6DC89A0038E89D /* UXReaderPageImageView.h in Headers */,
45F285761E6A34D400D2605F /* UXReaderPageTiledView.h in Headers */,
451C82E01E6C287E00E6EB1C /* UXReaderMainToolbar.h in Headers */,
Expand Down Expand Up @@ -587,12 +591,11 @@
454179CD1E672BEB0044248A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Julius Oklamcak";
TargetAttributes = {
454179D51E672BEC0044248A = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 93KDX755KN;
ProvisioningStyle = Manual;
};
};
Expand Down Expand Up @@ -719,15 +722,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -754,7 +763,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -771,15 +780,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -800,6 +815,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand All @@ -812,9 +828,9 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 93KDX755KN;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -835,9 +851,9 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 93KDX755KN;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down
233 changes: 233 additions & 0 deletions UXReader/UXReader/UXReaderDocument.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,244 @@
#import "UXReaderAction.h"
#import "UXReaderDestination.h"
#import "UXReaderOutline.h"
#import "UXReaderSimulator.h"

#import "fpdfview.h"
#import "fpdf_text.h"
#import "fpdf_doc.h"

#import <CommonCrypto/CommonDigest.h>

#if TARGET_IPHONE_SIMULATOR

@interface UXReaderDocument () <UXReaderDocumentDataSource>

@end

@implementation UXReaderDocument

- (nullable instancetype)initWithURL:(nonnull NSURL *)URL
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (nullable instancetype)initWithData:(nonnull NSData *)data
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (nullable instancetype)initWithSource:(nonnull id <UXReaderDocumentDataSource>)source
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (void)close
{
NOT_AVAILABLE_IN_SIMULATOR;
}

- (nullable NSURL *)URL
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (nullable NSData *)data
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (void)setUUID:(nonnull NSUUID *)UUID
{
NOT_AVAILABLE_IN_SIMULATOR;
}
- (nonnull NSUUID *)UUID
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (void)setTitle:(nonnull NSString *)text
{
NOT_AVAILABLE_IN_SIMULATOR;
}
- (nullable NSString *)title
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (void)setShowRTL:(BOOL)RTL
{
NOT_AVAILABLE_IN_SIMULATOR;
}
- (BOOL)showRTL
{
NOT_AVAILABLE_IN_SIMULATOR;
return NO;
}

- (void)setHighlightLinks:(BOOL)RTL
{
NOT_AVAILABLE_IN_SIMULATOR;
}
- (BOOL)highlightLinks
{
NOT_AVAILABLE_IN_SIMULATOR;
return NO;
}

- (void)setRenderTile:(nullable id <UXReaderRenderTileInContext>)renderTile
{
NOT_AVAILABLE_IN_SIMULATOR;
}
- (nullable id <UXReaderRenderTileInContext>)renderTile
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (void)setUseNativeRendering
{
NOT_AVAILABLE_IN_SIMULATOR;
}

- (uint32_t)permissions
{
NOT_AVAILABLE_IN_SIMULATOR;
return 0;
}
- (nullable NSString *)fileVersion
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (BOOL)isSameDocument:(nonnull UXReaderDocument *)document
{
NOT_AVAILABLE_IN_SIMULATOR;
return NO;
}

- (void)openWithPassword:(nullable NSString *)password
completion:(nonnull void (^)(NSError *_Nullable error))handler
{
NOT_AVAILABLE_IN_SIMULATOR;
}
- (BOOL)isOpen
{
NOT_AVAILABLE_IN_SIMULATOR;
return NO;
}

- (nullable void *)pdfDocumentCG
{
NOT_AVAILABLE_IN_SIMULATOR;
return NULL;
}
- (nullable void *)pdfDocumentFP
{
NOT_AVAILABLE_IN_SIMULATOR;
return NULL;
}

- (NSUInteger)pageCount
{
NOT_AVAILABLE_IN_SIMULATOR;
return 0;
}

- (CGSize)pageSize:(NSUInteger)page
{
NOT_AVAILABLE_IN_SIMULATOR;
return CGSizeZero;
}

- (nullable UXReaderDocumentPage *)documentPage:(NSUInteger)page
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (nullable NSString *)pageLabel:(NSUInteger)page
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (BOOL)isSearching
{
NOT_AVAILABLE_IN_SIMULATOR;
return NO;
}
- (void)cancelSearch
{
NOT_AVAILABLE_IN_SIMULATOR;
}
- (void)beginSearch:(nonnull NSString *)text options:(UXReaderSearchOptions)options
{
NOT_AVAILABLE_IN_SIMULATOR;
}

- (void)setSearchSelections:(nullable NSDictionary<NSNumber *, NSArray<UXReaderSelection *> *> *)selections
{
NOT_AVAILABLE_IN_SIMULATOR;
}
- (nullable NSDictionary<NSNumber *, NSArray<UXReaderSelection *> *> *)searchSelections
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (void)thumbForPage:(NSUInteger)page
size:(CGSize)size
canceller:(nonnull UXReaderCanceller *)canceller
completion:(nonnull void (^)(UIImage *_Nonnull thumb))handler
{
NOT_AVAILABLE_IN_SIMULATOR;
}

- (nullable NSDictionary<NSString *, NSString *> *)information
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (nullable NSArray<UXReaderOutline *> *)outline
{
NOT_AVAILABLE_IN_SIMULATOR;
return nil;
}

- (BOOL)document:(nonnull UXReaderDocument *)document UUID:(NSUUID *__autoreleasing _Nullable * _Nullable)uuid
{
NOT_AVAILABLE_IN_SIMULATOR;
return NO;
}

- (BOOL)document:(nonnull UXReaderDocument *)document dataLength:(nonnull size_t *)length
{
NOT_AVAILABLE_IN_SIMULATOR;
return NO;
}

- (BOOL)document:(nonnull UXReaderDocument *)document
offset:(size_t)offset
length:(size_t)length
buffer:(nonnull uint8_t *)buffer
{
NOT_AVAILABLE_IN_SIMULATOR;
return NO;
}

@end

#else // now comes the real implementation

@interface UXReaderDocument () <UXReaderDocumentDataSource>

@end
Expand Down Expand Up @@ -1155,3 +1386,5 @@ - (BOOL)document:(nonnull UXReaderDocument *)document UUID:(NSUUID * _Nullable *
#pragma clang diagnostic pop

@end

#endif // TARGET_IPHONE_SIMULATOR
Loading