diff --git a/.swift-version b/.swift-version index 9f55b2ccb..5186d0706 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -3.0 +4.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 9a7404577..e6c492019 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,7 +1,7 @@ -github "tadija/AEXML" "4.0.0" github "ArtSabintsev/FontBlaster" "3.0.0" -github "jessesquires/JSQWebViewController" "5.0.0" -github "cxa/MenuItemKit" "2.0" -github "alexpopov/ZFDragableModalTransition" "8da951efb4202385630d1cf7104b60d1208f807e" github "ZipArchive/ZipArchive" "v1.8.1" +github "alexpopov/ZFDragableModalTransition" "8da951efb4202385630d1cf7104b60d1208f807e" +github "cxa/MenuItemKit" "2.0" +github "jessesquires/JSQWebViewController" "5.0.0" github "realm/realm-cocoa" "v3.0.2" +github "tadija/AEXML" "4.0.0" diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 717083b95..1573fa41c 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -375,12 +375,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = FolioReader; TargetAttributes = { 1A42C2881C0E3882000F2137 = { CreatedOnToolsVersion = 7.1.1; - DevelopmentTeam = 32F2T8EJ6G; + DevelopmentTeam = 99AHAA343Q; LastSwiftMigration = 0800; ProvisioningStyle = Automatic; SystemCapabilities = { @@ -390,19 +390,19 @@ }; }; 3AAA8B671E9BB78B00A47E5A = { - DevelopmentTeam = 32F2T8EJ6G; + DevelopmentTeam = 99AHAA343Q; ProvisioningStyle = Automatic; }; CA10C1301C572A4B0049165D = { CreatedOnToolsVersion = 7.3; - DevelopmentTeam = 32F2T8EJ6G; + DevelopmentTeam = 99AHAA343Q; LastSwiftMigration = 0800; ProvisioningStyle = Automatic; TestTargetID = 1A42C2881C0E3882000F2137; }; D12066621D65FABD006E1D18 = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 32F2T8EJ6G; + DevelopmentTeam = 99AHAA343Q; ProvisioningStyle = Automatic; }; }; @@ -481,13 +481,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-FolioReaderTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 064D38CE83FACC358B7C0EC8 /* 📦 Copy Pods Resources */ = { @@ -526,13 +529,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Storyboard-Example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 3AAA8B681E9BB78B00A47E5A /* [CP] Check Pods Manifest.lock */ = { @@ -541,13 +547,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-MultipleInstance-Example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 3AAA8B751E9BB78B00A47E5A /* [CP] Embed Pods Frameworks */ = { @@ -556,9 +565,28 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-MultipleInstance-Example/Pods-MultipleInstance-Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/AEXML/AEXML.framework", + "${BUILT_PRODUCTS_DIR}/FolioReaderKit/FolioReaderKit.framework", + "${BUILT_PRODUCTS_DIR}/FontBlaster/FontBlaster.framework", + "${BUILT_PRODUCTS_DIR}/JSQWebViewController/JSQWebViewController.framework", + "${BUILT_PRODUCTS_DIR}/MenuItemKit/MenuItemKit.framework", + "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", + "${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework", + "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", + "${BUILT_PRODUCTS_DIR}/ZFDragableModalTransition/ZFDragableModalTransition.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AEXML.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FolioReaderKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FontBlaster.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewController.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MenuItemKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZFDragableModalTransition.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -586,9 +614,28 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/AEXML/AEXML.framework", + "${BUILT_PRODUCTS_DIR}/FolioReaderKit/FolioReaderKit.framework", + "${BUILT_PRODUCTS_DIR}/FontBlaster/FontBlaster.framework", + "${BUILT_PRODUCTS_DIR}/JSQWebViewController/JSQWebViewController.framework", + "${BUILT_PRODUCTS_DIR}/MenuItemKit/MenuItemKit.framework", + "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", + "${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework", + "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", + "${BUILT_PRODUCTS_DIR}/ZFDragableModalTransition/ZFDragableModalTransition.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AEXML.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FolioReaderKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FontBlaster.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewController.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MenuItemKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZFDragableModalTransition.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -631,9 +678,28 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Storyboard-Example/Pods-Storyboard-Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/AEXML/AEXML.framework", + "${BUILT_PRODUCTS_DIR}/FolioReaderKit/FolioReaderKit.framework", + "${BUILT_PRODUCTS_DIR}/FontBlaster/FontBlaster.framework", + "${BUILT_PRODUCTS_DIR}/JSQWebViewController/JSQWebViewController.framework", + "${BUILT_PRODUCTS_DIR}/MenuItemKit/MenuItemKit.framework", + "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", + "${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework", + "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", + "${BUILT_PRODUCTS_DIR}/ZFDragableModalTransition/ZFDragableModalTransition.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AEXML.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FolioReaderKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FontBlaster.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewController.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MenuItemKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZFDragableModalTransition.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -661,9 +727,32 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-FolioReaderTests/Pods-FolioReaderTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/AEXML/AEXML.framework", + "${BUILT_PRODUCTS_DIR}/FolioReaderKit/FolioReaderKit.framework", + "${BUILT_PRODUCTS_DIR}/FontBlaster/FontBlaster.framework", + "${BUILT_PRODUCTS_DIR}/JSQWebViewController/JSQWebViewController.framework", + "${BUILT_PRODUCTS_DIR}/MenuItemKit/MenuItemKit.framework", + "${BUILT_PRODUCTS_DIR}/Realm/Realm.framework", + "${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework", + "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", + "${BUILT_PRODUCTS_DIR}/ZFDragableModalTransition/ZFDragableModalTransition.framework", + "${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework", + "${BUILT_PRODUCTS_DIR}/Quick/Quick.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AEXML.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FolioReaderKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FontBlaster.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSQWebViewController.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MenuItemKit.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZFDragableModalTransition.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -691,13 +780,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -815,14 +907,20 @@ 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_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; @@ -850,6 +948,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -862,14 +961,20 @@ 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_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; @@ -890,6 +995,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -902,14 +1008,13 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = 99AHAA343Q; INFOPLIST_FILE = Example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.Example; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -920,14 +1025,13 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = 99AHAA343Q; INFOPLIST_FILE = Example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.Example; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; }; name = Release; }; @@ -939,15 +1043,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ANALYZER_NONNULL = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = 99AHAA343Q; INFOPLIST_FILE = "MultipleInstances-Example/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.example.multipleinstances; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 2; }; name = Debug; @@ -960,13 +1062,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ANALYZER_NONNULL = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = 99AHAA343Q; INFOPLIST_FILE = "MultipleInstances-Example/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.example.multipleinstances; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = 2; }; name = Release; @@ -978,13 +1078,12 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; BUNDLE_LOADER = "$(TEST_HOST)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = 99AHAA343Q; INFOPLIST_FILE = FolioReaderTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.FolioReaderTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; }; name = Debug; @@ -996,13 +1095,12 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; BUNDLE_LOADER = "$(TEST_HOST)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = 99AHAA343Q; INFOPLIST_FILE = FolioReaderTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.FolioReaderTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; }; name = Release; @@ -1015,13 +1113,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ANALYZER_NONNULL = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = 99AHAA343Q; INFOPLIST_FILE = "Storyboard-Example/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.example.storyboard; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -1033,13 +1129,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ANALYZER_NONNULL = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = 99AHAA343Q; INFOPLIST_FILE = "Storyboard-Example/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.example.storyboard; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index d78b6713e..b59c9f1de 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -1,6 +1,6 @@ @@ -45,6 +46,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Storyboard-Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Storyboard-Example.xcscheme index 6e52ff0ee..307bc4f3b 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/Storyboard-Example.xcscheme +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Storyboard-Example.xcscheme @@ -1,6 +1,6 @@ @@ -45,6 +46,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Example/Podfile b/Example/Podfile index 11cc4a336..b16485040 100755 --- a/Example/Podfile +++ b/Example/Podfile @@ -8,8 +8,8 @@ def shared_pods end def testing_pods - pod 'Quick', '0.10.0' - pod 'Nimble', '~> 5.0.0' + pod 'Quick', '1.2.0' + pod 'Nimble', '7.0.2' end target 'Example' do diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 8ec540186..e72ccf180 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,46 +1,48 @@ PODS: - - AEXML (4.0.0) - - FolioReaderKit (1.2.0): - - AEXML (= 4.0) - - FontBlaster (= 3.0.0) - - JSQWebViewController (~> 5.0) - - MenuItemKit (= 2.0) + - AEXML (4.2.2) + - FolioReaderKit (1.3.0): + - AEXML (= 4.2.2) + - FontBlaster (= 4.0.1) + - JSQWebViewController (= 6.0.0) + - MenuItemKit (= 3.0.0) - RealmSwift (= 3.0.2) - - SSZipArchive (~> 1.8) - - ZFDragableModalTransition (~> 0.6) - - FontBlaster (3.0.0) - - JSQWebViewController (5.0.0) - - MenuItemKit (2.0) + - SSZipArchive (= 2.1.1) + - ZFDragableModalTransition (= 0.6) + - FontBlaster (4.0.1) + - JSQWebViewController (6.0.0) + - MenuItemKit (3.0.0) + - Nimble (7.0.2) + - Quick (1.2.0) - Realm (3.0.2): - Realm/Headers (= 3.0.2) - Realm/Headers (3.0.2) - RealmSwift (3.0.2): - Realm (= 3.0.2) - - SSZipArchive (1.8.1) + - SSZipArchive (2.1.1) - ZFDragableModalTransition (0.6) DEPENDENCIES: - FolioReaderKit (from `../`) - - Nimble (~> 5.0.0) - - Quick (= 0.10.0) + - Nimble (= 7.0.2) + - Quick (= 1.2.0) EXTERNAL SOURCES: FolioReaderKit: :path: ../ SPEC CHECKSUMS: - AEXML: 6fc6433aa35bdc15dd8eb8d54eb7aa4520a010eb - FolioReaderKit: 8aca75320da0de2164daa9c498bd2eed3c3cafd3 - FontBlaster: 0f4a3e2f965968e2dfc3f7f5cec7214c3f3b2f07 - JSQWebViewController: 0461aa42612b221571556df61d9c09f080cb2eef - MenuItemKit: 9af69953dc983803ee85230e205fadbac0f26213 - Nimble: 56fc9f5020effa2206de22c3dd910f4fb011b92f - Quick: 5d290df1c69d5ee2f0729956dcf0fd9a30447eaa + AEXML: 5ebafc1b75e0bcf0f1b09b8ca8fed2d5a199479b + FolioReaderKit: f2a3a19c1041924974d68da48abd0463b6a8748a + FontBlaster: 84229df8e3a7a6dacb190565bc543747a0c323f9 + JSQWebViewController: 51041569b75d19dbb6b7fe0b7ae053c32409a9be + MenuItemKit: d9b539b28fdbbd7980d6f3668b9cd6daefeabd9b + Nimble: bfe1f814edabba69ff145cb1283e04ed636a67f2 + Quick: 58d203b1c5e27fff7229c4c1ae445ad7069a7a08 Realm: 6f23fd1f178a09342eac21bfa7c2bf4312a7a180 RealmSwift: 695393add1b8f9d5fa75dd16e6355cf3935f71e2 - SSZipArchive: 04547dfa448be5ed7ecbaf7eaf8a6e9eb9b42997 + SSZipArchive: 14401ade5f8e82aba1ff03e9f88e9de60937ae60 ZFDragableModalTransition: 0d294eaaba6edfcb9839595de765f9ca06a4b524 -PODFILE CHECKSUM: 38a26e71a3566d844488629f70fa094d06893b23 +PODFILE CHECKSUM: d5e64429a71bc13b6eceb790b04656d8082e4d66 COCOAPODS: 1.3.1 diff --git a/Example/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json index ec6730cd9..1b6967475 100644 --- a/Example/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -97,6 +97,11 @@ "idiom" : "ipad", "filename" : "Icon-iPadPro@2x.png", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/FolioReaderKit.podspec b/FolioReaderKit.podspec index 2fe1d6d5e..15a4a95e8 100644 --- a/FolioReaderKit.podspec +++ b/FolioReaderKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "FolioReaderKit" - s.version = "1.2.0" + s.version = "1.3.0" s.summary = "A Swift ePub reader and parser framework for iOS." s.description = <<-DESC Written in Swift. @@ -29,12 +29,12 @@ Pod::Spec.new do |s| s.public_header_files = 'Source/*.h' s.libraries = "z" - s.dependency 'SSZipArchive', '~> 1.8' - s.dependency 'MenuItemKit', '2.0' - s.dependency 'ZFDragableModalTransition', '~> 0.6' - s.dependency 'AEXML', '4.0' - s.dependency 'FontBlaster', '3.0.0' - s.dependency 'JSQWebViewController', '~> 5.0' + s.dependency 'SSZipArchive', '2.1.1' + s.dependency 'MenuItemKit', '3.0.0' + s.dependency 'ZFDragableModalTransition', '0.6' + s.dependency 'AEXML', '4.2.2' + s.dependency 'FontBlaster', '4.0.1' + s.dependency 'JSQWebViewController', '6.0.0' s.dependency 'RealmSwift', '3.0.2' end diff --git a/FolioReaderKit.xcodeproj/project.pbxproj b/FolioReaderKit.xcodeproj/project.pbxproj index ae3dd71e3..64a8a0daf 100644 --- a/FolioReaderKit.xcodeproj/project.pbxproj +++ b/FolioReaderKit.xcodeproj/project.pbxproj @@ -60,6 +60,42 @@ 1A9590131D397BE900D56699 /* ScrollScrubber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F901D397BE900D56699 /* ScrollScrubber.swift */; }; 1A9590151D397C1300D56699 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A9590141D397C1300D56699 /* Images.xcassets */; }; 1A9590171D397CAF00D56699 /* FolioReaderKit.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 1A9590161D397CAF00D56699 /* FolioReaderKit.podspec */; }; + 3A27F08C1FD9BE5800D84A57 /* FolioReaderUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A27F08A1FD9BE5800D84A57 /* FolioReaderUserDefaults.swift */; }; + 3A27F08E1FD9BE5800D84A57 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A27F08B1FD9BE5800D84A57 /* Extensions.swift */; }; + 3A27F09D1FD9C24A00D84A57 /* FRBook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F051D397BE900D56699 /* FRBook.swift */; }; + 3A27F09E1FD9C24A00D84A57 /* FREpubParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F061D397BE900D56699 /* FREpubParser.swift */; }; + 3A27F09F1FD9C24A00D84A57 /* FRMediaType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F071D397BE900D56699 /* FRMediaType.swift */; }; + 3A27F0A01FD9C24A00D84A57 /* FRMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F081D397BE900D56699 /* FRMetadata.swift */; }; + 3A27F0A11FD9C24A00D84A57 /* FRResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F091D397BE900D56699 /* FRResource.swift */; }; + 3A27F0A21FD9C24A00D84A57 /* FRResources.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F0A1D397BE900D56699 /* FRResources.swift */; }; + 3A27F0A31FD9C24A00D84A57 /* FRSmilElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F0B1D397BE900D56699 /* FRSmilElement.swift */; }; + 3A27F0A41FD9C24A00D84A57 /* FRSmils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F0C1D397BE900D56699 /* FRSmils.swift */; }; + 3A27F0A51FD9C24A00D84A57 /* FRSpine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F0D1D397BE900D56699 /* FRSpine.swift */; }; + 3A27F0A61FD9C24A00D84A57 /* FRTocReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F0E1D397BE900D56699 /* FRTocReference.swift */; }; + 3A27F0AF1FD9C25500D84A57 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A27F08B1FD9BE5800D84A57 /* Extensions.swift */; }; + 3A27F0B01FD9C25500D84A57 /* FolioReaderAudioPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F0F1D397BE900D56699 /* FolioReaderAudioPlayer.swift */; }; + 3A27F0B11FD9C25500D84A57 /* FolioReaderCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F101D397BE900D56699 /* FolioReaderCenter.swift */; }; + 3A27F0B21FD9C25500D84A57 /* FolioReaderChapterList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F111D397BE900D56699 /* FolioReaderChapterList.swift */; }; + 3A27F0B31FD9C25500D84A57 /* FolioReaderChapterListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F121D397BE900D56699 /* FolioReaderChapterListCell.swift */; }; + 3A27F0B41FD9C25500D84A57 /* FolioReaderConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F131D397BE900D56699 /* FolioReaderConfig.swift */; }; + 3A27F0B51FD9C25500D84A57 /* FolioReaderContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F141D397BE900D56699 /* FolioReaderContainer.swift */; }; + 3A27F0B61FD9C25500D84A57 /* FolioReaderFontsMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F151D397BE900D56699 /* FolioReaderFontsMenu.swift */; }; + 3A27F0B71FD9C25500D84A57 /* FolioReaderHighlightList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F161D397BE900D56699 /* FolioReaderHighlightList.swift */; }; + 3A27F0B81FD9C25500D84A57 /* FolioReaderKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F181D397BE900D56699 /* FolioReaderKit.swift */; }; + 3A27F0B91FD9C25500D84A57 /* FolioReaderPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F191D397BE900D56699 /* FolioReaderPage.swift */; }; + 3A27F0BA1FD9C25500D84A57 /* FolioReaderPageIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F1A1D397BE900D56699 /* FolioReaderPageIndicator.swift */; }; + 3A27F0BB1FD9C25500D84A57 /* FolioReaderPlayerMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F1B1D397BE900D56699 /* FolioReaderPlayerMenu.swift */; }; + 3A27F0BC1FD9C25500D84A57 /* FolioReaderQuoteShare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A65DDD61DA7450A0033C277 /* FolioReaderQuoteShare.swift */; }; + 3A27F0BD1FD9C25500D84A57 /* FolioReaderSharingProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F1C1D397BE900D56699 /* FolioReaderSharingProvider.swift */; }; + 3A27F0BE1FD9C25500D84A57 /* FolioReaderUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A27F08A1FD9BE5800D84A57 /* FolioReaderUserDefaults.swift */; }; + 3A27F0BF1FD9C25500D84A57 /* FolioReaderWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AD5EEB81D9433C100E42810 /* FolioReaderWebView.swift */; }; + 3A27F0C21FD9C25C00D84A57 /* PageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F241D397BE900D56699 /* PageViewController.swift */; }; + 3A27F0C31FD9C25C00D84A57 /* QuoteImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A65DDD41DA744410033C277 /* QuoteImage.swift */; }; + 3A27F0C41FD9C25C00D84A57 /* ScrollScrubber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F901D397BE900D56699 /* ScrollScrubber.swift */; }; + 3A27F0C51FD9C31E00D84A57 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A65DDD01DA744190033C277 /* Realm.framework */; }; + 3A27F0C61FD9C31E00D84A57 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A65DDD11DA744190033C277 /* RealmSwift.framework */; }; + 3A27F0C71FD9C33A00D84A57 /* Highlight+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F211D397BE900D56699 /* Highlight+Helper.swift */; }; + 3A27F0C81FD9C33A00D84A57 /* Highlight.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A958F231D397BE900D56699 /* Highlight.swift */; }; 3AD5EEB91D9433C100E42810 /* FolioReaderWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AD5EEB81D9433C100E42810 /* FolioReaderWebView.swift */; }; B0D6990F1D035FA2003B4CCD /* FolioReaderKit.h in Headers */ = {isa = PBXBuildFile; fileRef = B0D6990E1D035FA2003B4CCD /* FolioReaderKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; B0D699161D035FA2003B4CCD /* FolioReaderKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0D6990B1D035FA2003B4CCD /* FolioReaderKit.framework */; }; @@ -138,6 +174,8 @@ 1A958F901D397BE900D56699 /* ScrollScrubber.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScrollScrubber.swift; sourceTree = ""; }; 1A9590141D397C1300D56699 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 1A9590161D397CAF00D56699 /* FolioReaderKit.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FolioReaderKit.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 3A27F08A1FD9BE5800D84A57 /* FolioReaderUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FolioReaderUserDefaults.swift; sourceTree = ""; }; + 3A27F08B1FD9BE5800D84A57 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; 3AD5EEB81D9433C100E42810 /* FolioReaderWebView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FolioReaderWebView.swift; sourceTree = ""; }; B0D6990B1D035FA2003B4CCD /* FolioReaderKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FolioReaderKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B0D6990E1D035FA2003B4CCD /* FolioReaderKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FolioReaderKit.h; sourceTree = ""; }; @@ -175,6 +213,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3A27F0C51FD9C31E00D84A57 /* Realm.framework in Frameworks */, + 3A27F0C61FD9C31E00D84A57 /* RealmSwift.framework in Frameworks */, B0D699161D035FA2003B4CCD /* FolioReaderKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -196,6 +236,7 @@ isa = PBXGroup; children = ( 1A958F041D397BE900D56699 /* EPUBCore */, + 3A27F08B1FD9BE5800D84A57 /* Extensions.swift */, 1A958F0F1D397BE900D56699 /* FolioReaderAudioPlayer.swift */, 1A958F101D397BE900D56699 /* FolioReaderCenter.swift */, 1A958F111D397BE900D56699 /* FolioReaderChapterList.swift */, @@ -211,12 +252,13 @@ 1A958F1B1D397BE900D56699 /* FolioReaderPlayerMenu.swift */, 1A65DDD61DA7450A0033C277 /* FolioReaderQuoteShare.swift */, 1A958F1C1D397BE900D56699 /* FolioReaderSharingProvider.swift */, + 3A27F08A1FD9BE5800D84A57 /* FolioReaderUserDefaults.swift */, 3AD5EEB81D9433C100E42810 /* FolioReaderWebView.swift */, + 1A958F1D1D397BE900D56699 /* Models */, 1A958F241D397BE900D56699 /* PageViewController.swift */, 1A65DDD41DA744410033C277 /* QuoteImage.swift */, - 1A958F901D397BE900D56699 /* ScrollScrubber.swift */, - 1A958F1D1D397BE900D56699 /* Models */, 1A958F251D397BE900D56699 /* Resources */, + 1A958F901D397BE900D56699 /* ScrollScrubber.swift */, ); path = Source; sourceTree = SOURCE_ROOT; @@ -416,7 +458,6 @@ B0D699071D035FA2003B4CCD /* Frameworks */, B0D699081D035FA2003B4CCD /* Headers */, B0D699091D035FA2003B4CCD /* Resources */, - 1A65DDCF1DA7409C0033C277 /* ShellScript */, ); buildRules = ( ); @@ -452,18 +493,17 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = FolioReader; TargetAttributes = { B0D6990A1D035FA2003B4CCD = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 32F2T8EJ6G; LastSwiftMigration = 0800; }; B0D699141D035FA2003B4CCD = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = 32F2T8EJ6G; - LastSwiftMigration = 0800; + LastSwiftMigration = 0920; }; }; }; @@ -522,24 +562,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 1A65DDCF1DA7409C0033C277 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(SRCROOT)/Carthage/Build/iOS/Realm.framework", - "$(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework", - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/usr/local/bin/carthage copy-frameworks"; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ B0D699061D035FA2003B4CCD /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -556,6 +578,7 @@ 3AD5EEB91D9433C100E42810 /* FolioReaderWebView.swift in Sources */, 1A958FA41D397BE900D56699 /* FolioReaderKit.swift in Sources */, 1A65DDD71DA7450A0033C277 /* FolioReaderQuoteShare.swift in Sources */, + 3A27F08C1FD9BE5800D84A57 /* FolioReaderUserDefaults.swift in Sources */, 1A958FA21D397BE900D56699 /* FolioReaderHighlightList.swift in Sources */, 1A958FA71D397BE900D56699 /* FolioReaderPlayerMenu.swift in Sources */, 1A958F921D397BE900D56699 /* FREpubParser.swift in Sources */, @@ -564,6 +587,7 @@ 1A958FAD1D397BE900D56699 /* Highlight.swift in Sources */, 1A958F981D397BE900D56699 /* FRSmils.swift in Sources */, 1A958F971D397BE900D56699 /* FRSmilElement.swift in Sources */, + 3A27F08E1FD9BE5800D84A57 /* Extensions.swift in Sources */, 1A958F9D1D397BE900D56699 /* FolioReaderChapterList.swift in Sources */, 1A958F951D397BE900D56699 /* FRResource.swift in Sources */, 1A958F9B1D397BE900D56699 /* FolioReaderAudioPlayer.swift in Sources */, @@ -585,7 +609,39 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3A27F0A31FD9C24A00D84A57 /* FRSmilElement.swift in Sources */, + 3A27F0A11FD9C24A00D84A57 /* FRResource.swift in Sources */, + 3A27F0BC1FD9C25500D84A57 /* FolioReaderQuoteShare.swift in Sources */, + 3A27F0B01FD9C25500D84A57 /* FolioReaderAudioPlayer.swift in Sources */, + 3A27F0A41FD9C24A00D84A57 /* FRSmils.swift in Sources */, + 3A27F0B31FD9C25500D84A57 /* FolioReaderChapterListCell.swift in Sources */, + 3A27F0BD1FD9C25500D84A57 /* FolioReaderSharingProvider.swift in Sources */, B0D6991B1D035FA2003B4CCD /* FolioReaderKitTests.swift in Sources */, + 3A27F0BF1FD9C25500D84A57 /* FolioReaderWebView.swift in Sources */, + 3A27F0BA1FD9C25500D84A57 /* FolioReaderPageIndicator.swift in Sources */, + 3A27F0A51FD9C24A00D84A57 /* FRSpine.swift in Sources */, + 3A27F0B81FD9C25500D84A57 /* FolioReaderKit.swift in Sources */, + 3A27F0C21FD9C25C00D84A57 /* PageViewController.swift in Sources */, + 3A27F0A01FD9C24A00D84A57 /* FRMetadata.swift in Sources */, + 3A27F0B21FD9C25500D84A57 /* FolioReaderChapterList.swift in Sources */, + 3A27F0B41FD9C25500D84A57 /* FolioReaderConfig.swift in Sources */, + 3A27F09F1FD9C24A00D84A57 /* FRMediaType.swift in Sources */, + 3A27F0B61FD9C25500D84A57 /* FolioReaderFontsMenu.swift in Sources */, + 3A27F0AF1FD9C25500D84A57 /* Extensions.swift in Sources */, + 3A27F0C81FD9C33A00D84A57 /* Highlight.swift in Sources */, + 3A27F0B51FD9C25500D84A57 /* FolioReaderContainer.swift in Sources */, + 3A27F0C71FD9C33A00D84A57 /* Highlight+Helper.swift in Sources */, + 3A27F0B11FD9C25500D84A57 /* FolioReaderCenter.swift in Sources */, + 3A27F0A61FD9C24A00D84A57 /* FRTocReference.swift in Sources */, + 3A27F0BE1FD9C25500D84A57 /* FolioReaderUserDefaults.swift in Sources */, + 3A27F0B91FD9C25500D84A57 /* FolioReaderPage.swift in Sources */, + 3A27F09D1FD9C24A00D84A57 /* FRBook.swift in Sources */, + 3A27F0BB1FD9C25500D84A57 /* FolioReaderPlayerMenu.swift in Sources */, + 3A27F0C41FD9C25C00D84A57 /* ScrollScrubber.swift in Sources */, + 3A27F0C31FD9C25C00D84A57 /* QuoteImage.swift in Sources */, + 3A27F0B71FD9C25500D84A57 /* FolioReaderHighlightList.swift in Sources */, + 3A27F09E1FD9C24A00D84A57 /* FREpubParser.swift in Sources */, + 3A27F0A21FD9C24A00D84A57 /* FRResources.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -609,14 +665,20 @@ 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_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; @@ -645,6 +707,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -660,14 +723,20 @@ 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_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; @@ -689,6 +758,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -699,9 +769,9 @@ B0D699201D035FA2003B4CCD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -716,16 +786,15 @@ PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.FolioReaderKit; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; }; name = Debug; }; B0D699211D035FA2003B4CCD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -740,7 +809,6 @@ PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.FolioReaderKit; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; }; name = Release; }; @@ -748,11 +816,15 @@ isa = XCBuildConfiguration; buildSettings = { DEVELOPMENT_TEAM = 32F2T8EJ6G; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = FolioReaderKitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.FolioReaderKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; }; name = Debug; }; @@ -760,11 +832,15 @@ isa = XCBuildConfiguration; buildSettings = { DEVELOPMENT_TEAM = 32F2T8EJ6G; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = FolioReaderKitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.FolioReaderKitTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; }; name = Release; }; diff --git a/FolioReaderKit.xcodeproj/xcshareddata/xcschemes/FolioReaderKit.xcscheme b/FolioReaderKit.xcodeproj/xcshareddata/xcschemes/FolioReaderKit.xcscheme index e11054961..2e3f859ca 100644 --- a/FolioReaderKit.xcodeproj/xcshareddata/xcschemes/FolioReaderKit.xcscheme +++ b/FolioReaderKit.xcodeproj/xcshareddata/xcschemes/FolioReaderKit.xcscheme @@ -1,6 +1,6 @@ CFBundleSignature ???? CFBundleVersion - 1 + 1 diff --git a/Package.swift b/Package.swift index 924922789..da0d82600 100644 --- a/Package.swift +++ b/Package.swift @@ -3,12 +3,12 @@ import PackageDescription let package = Package( name: "FolioReaderKit", dependencies: [ - .Package(url: "https://github.com/ZipArchive/ZipArchive.git", majorVersion: 1, minor: 4), - .Package(url: "https://github.com/cxa/UIMenuItem-CXAImageSupport.git", majorVersion: 0, minor: 0), + .Package(url: "https://github.com/ZipArchive/ZipArchive.git", majorVersion: 2, minor: 1), + .Package(url: "https://github.com/cxa/MenuItemKit.git", majorVersion: 3, minor: 0), .Package(url: "https://github.com/zoonooz/ZFDragableModalTransition.git", majorVersion: 0, minor: 6), - .Package(url: "https://github.com/tadija/AEXML.git", majorVersion: 3, minor: 0), - .Package(url: "https://github.com/ArtSabintsev/FontBlaster.git", majorVersion: 2, minor: 1), - .Package(url: "https://github.com/jessesquires/JSQWebViewController.git", majorVersion: 3, minor: 0), - .Package(url: "https://github.com/realm/realm-cocoa.git", majorVersion: 1, minor: 0), + .Package(url: "https://github.com/tadija/AEXML.git", majorVersion: 4, minor: 2), + .Package(url: "https://github.com/ArtSabintsev/FontBlaster.git", majorVersion: 4, minor: 0), + .Package(url: "https://github.com/jessesquires/JSQWebViewController.git", majorVersion: 6, minor: 0), + .Package(url: "https://github.com/realm/realm-cocoa.git", majorVersion: 3, minor: 0), ] ) diff --git a/Source/EPUBCore/FRBook.swift b/Source/EPUBCore/FRBook.swift index cb9c4db20..c45aad9d7 100755 --- a/Source/EPUBCore/FRBook.swift +++ b/Source/EPUBCore/FRBook.swift @@ -10,28 +10,29 @@ import UIKit open class FRBook: NSObject { - var resources = FRResources() var metadata = FRMetadata() var spine = FRSpine() var smils = FRSmils() - var tableOfContents: [FRTocReference]! - var flatTableOfContents: [FRTocReference]! - var opfResource: FRResource! - var tocResource: FRResource? - var coverImage: FRResource? var version: Double? - var uniqueIdentifier: String? - var name: String? - - func hasAudio() -> Bool { + + public var opfResource: FRResource! + public var tocResource: FRResource? + public var uniqueIdentifier: String? + public var coverImage: FRResource? + public var name: String? + public var resources = FRResources() + public var tableOfContents: [FRTocReference]! + public var flatTableOfContents: [FRTocReference]! + + public func hasAudio() -> Bool { return smils.smils.count > 0 ? true : false } - func title() -> String? { + public func title() -> String? { return metadata.titles.first } - func authorName() -> String? { + public func authorName() -> String? { return metadata.creators.first?.name } diff --git a/Source/EPUBCore/FRResource.swift b/Source/EPUBCore/FRResource.swift index aec785005..d7a2a763f 100755 --- a/Source/EPUBCore/FRResource.swift +++ b/Source/EPUBCore/FRResource.swift @@ -8,13 +8,14 @@ import UIKit -class FRResource: NSObject { +open class FRResource: NSObject { var id: String! var properties: String? - var href: String! - var fullHref: String! var mediaType: MediaType! var mediaOverlay: String? + + public var href: String! + public var fullHref: String! func basePath() -> String! { if href == nil || href.isEmpty { return nil } diff --git a/Source/EPUBCore/FRResources.swift b/Source/EPUBCore/FRResources.swift index 004f28e8c..b900438e6 100755 --- a/Source/EPUBCore/FRResources.swift +++ b/Source/EPUBCore/FRResources.swift @@ -8,7 +8,7 @@ import UIKit -class FRResources: NSObject { +open class FRResources: NSObject { var resources = [String: FRResource]() diff --git a/Source/EPUBCore/FRTocReference.swift b/Source/EPUBCore/FRTocReference.swift index d13fea6b2..e5597ac3c 100755 --- a/Source/EPUBCore/FRTocReference.swift +++ b/Source/EPUBCore/FRTocReference.swift @@ -8,12 +8,13 @@ import UIKit -class FRTocReference: NSObject { - var resource: FRResource? - var title: String! - var fragmentID: String? +open class FRTocReference: NSObject { var children: [FRTocReference]! + public var title: String! + public var resource: FRResource? + public var fragmentID: String? + convenience init(title: String, resource: FRResource?, fragmentID: String = "") { self.init(title: title, resource: resource, fragmentID: fragmentID, children: [FRTocReference]()) } diff --git a/Source/Extensions.swift b/Source/Extensions.swift index cf76c0cab..5ca5a7df0 100644 --- a/Source/Extensions.swift +++ b/Source/Extensions.swift @@ -499,10 +499,10 @@ internal extension UIViewController { func setCloseButton(withConfiguration readerConfig: FolioReaderConfig) { let closeImage = UIImage(readerImageNamed: "icon-navbar-close")?.ignoreSystemTint(withConfiguration: readerConfig) - self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: closeImage, style: .plain, target: self, action: #selector(dismiss as (Void) -> Void)) + self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: closeImage, style: .plain, target: self, action: #selector(dismiss as () -> Void)) } - func dismiss() { + @objc func dismiss() { self.dismiss(nil) } @@ -529,7 +529,7 @@ internal extension UIViewController { navBar?.showBottomHairline() navBar?.isTranslucent = translucent navBar?.tintColor = tintColor - navBar?.titleTextAttributes = [NSForegroundColorAttributeName: titleColor, NSFontAttributeName: font] + navBar?.titleTextAttributes = [NSAttributedStringKey.foregroundColor: titleColor, NSAttributedStringKey.font: font] } } diff --git a/Source/FolioReaderAudioPlayer.swift b/Source/FolioReaderAudioPlayer.swift index 2b42e43e8..c1b510840 100644 --- a/Source/FolioReaderAudioPlayer.swift +++ b/Source/FolioReaderAudioPlayer.swift @@ -136,7 +136,7 @@ open class FolioReaderAudioPlayer: NSObject { completion?() } - func pause() { + @objc func pause() { playing = false if !isTextToSpeech { @@ -150,11 +150,11 @@ open class FolioReaderAudioPlayer: NSObject { } } - func togglePlay() { + @objc func togglePlay() { isPlaying() ? pause() : play() } - func play() { + @objc func play() { if (self.book.hasAudio() == true) { guard let currentPage = self.folioReader.readerCenter?.currentPage else { return } currentPage.webView?.js("playAudio()") @@ -205,13 +205,13 @@ open class FolioReaderAudioPlayer: NSObject { } } - func _autoPlayNextChapter() { + @objc func _autoPlayNextChapter() { // if user has stopped playing, dont play the next chapter if isPlaying() == false { return } playNextChapter() } - func playPrevChapter() { + @objc func playPrevChapter() { stopPlayerTimer() // Wait for "currentPage" to update, then request to play audio self.folioReader.readerCenter?.changePageToPrevious { @@ -223,7 +223,7 @@ open class FolioReaderAudioPlayer: NSObject { } } - func playNextChapter() { + @objc func playNextChapter() { stopPlayerTimer() // Wait for "currentPage" to update, then request to play audio self.folioReader.readerCenter?.changePageToNext { @@ -416,7 +416,7 @@ open class FolioReaderAudioPlayer: NSObject { } } - func playerTimerObserver() { + @objc func playerTimerObserver() { guard let player = player else { return } if currentEndTime != nil && currentEndTime > 0 && player.currentTime > currentEndTime { diff --git a/Source/FolioReaderCenter.swift b/Source/FolioReaderCenter.swift index 894e8fd28..0691d13eb 100755 --- a/Source/FolioReaderCenter.swift +++ b/Source/FolioReaderCenter.swift @@ -12,7 +12,7 @@ import ZFDragableModalTransition /// Protocol which is used from `FolioReaderCenter`s. @objc public protocol FolioReaderCenterDelegate: class { - /// Notifies that a page appeared. This is triggered is a page is chosen and displayed. + /// Notifies that a page appeared. This is triggered when a page is chosen and displayed. /// /// - Parameter page: The appeared page @objc optional func pageDidAppear(_ page: FolioReaderPage) @@ -24,10 +24,16 @@ import ZFDragableModalTransition /// - htmlContent: The current HTML content as `String`. /// - Returns: The adjusted HTML content as `String`. This is the content which will be loaded into the given `FolioReaderPage`. @objc optional func htmlContentForPage(_ page: FolioReaderPage, htmlContent: String) -> String + + /// Notifies that a page changed. This is triggered when collection view cell is changed. + /// + /// - Parameter pageNumber: The appeared page item + @objc optional func pageItemChanged(_ pageNumber: Int) + } /// The base reader class -open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource { +open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { /// This delegate receives the events from the current `FolioReaderPage`s delegate. open weak var delegate: FolioReaderCenterDelegate? @@ -41,7 +47,9 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl /// The current visible page on reader open fileprivate(set) var currentPage: FolioReaderPage? - var collectionView: UICollectionView! + /// The collection view with pages + open var collectionView: UICollectionView! + let collectionViewLayout = UICollectionViewFlowLayout() var loadingView: UIActivityIndicatorView! var pages: [String]! @@ -107,7 +115,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl if (self.readerConfig.hideBars == true) { self.pageIndicatorHeight = 0 } - + self.totalPages = book.spine.spineReferences.count // Loading indicator @@ -123,7 +131,8 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl override open func viewDidLoad() { super.viewDidLoad() - screenBounds = self.view.frame + screenBounds = self.getScreenBounds() + setPageSize(UIApplication.shared.statusBarOrientation) // Layout @@ -131,7 +140,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl collectionViewLayout.minimumLineSpacing = 0 collectionViewLayout.minimumInteritemSpacing = 0 collectionViewLayout.scrollDirection = .direction(withConfiguration: self.readerConfig) - + let background = folioReader.isNight(self.readerConfig.nightModeBackground, UIColor.white) view.backgroundColor = background @@ -151,7 +160,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl // Activity Indicator self.activityIndicator.activityIndicatorViewStyle = .gray self.activityIndicator.hidesWhenStopped = true - self.activityIndicator = UIActivityIndicatorView(frame: CGRect(x: self.view.frame.width/2, y: self.view.frame.height/2, width: 30, height: 30)) + self.activityIndicator = UIActivityIndicatorView(frame: CGRect(x: screenBounds.size.width/2, y: screenBounds.size.height/2, width: 30, height: 30)) self.activityIndicator.backgroundColor = UIColor.gray self.view.addSubview(self.activityIndicator) self.view.bringSubview(toFront: self.activityIndicator) @@ -198,7 +207,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl override open func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() - screenBounds = view.frame + screenBounds = self.getScreenBounds() loadingView.center = view.center setPageSize(UIApplication.shared.statusBarOrientation) @@ -222,7 +231,13 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl } fileprivate func frameForPageIndicatorView() -> CGRect { - return CGRect(x: 0, y: view.frame.height-pageIndicatorHeight, width: view.frame.width, height: pageIndicatorHeight) + var bounds = CGRect(x: 0, y: screenBounds.size.height-pageIndicatorHeight, width: screenBounds.size.width, height: pageIndicatorHeight) + + if #available(iOS 11.0, *) { + bounds.size.height = bounds.size.height + view.safeAreaInsets.bottom + } + + return bounds } fileprivate func frameForScrollScrubber() -> CGRect { @@ -282,17 +297,19 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl self.configureNavBarButtons() self.setCollectionViewProgressiveDirection() - guard - let bookId = self.book.name, - let position = folioReader.savedPositionForCurrentBook as? NSDictionary, - let pageNumber = position["pageNumber"] as? Int, - (pageNumber > 0) else { - self.currentPageNumber = 1 - return - } + if self.readerConfig.loadSavedPositionForCurrentBook { + guard + let bookId = self.book.name, + let position = folioReader.savedPositionForCurrentBook as? NSDictionary, + let pageNumber = position["pageNumber"] as? Int, + (pageNumber > 0) else { + self.currentPageNumber = 1 + return + } - self.changePageWith(page: pageNumber) - self.currentPageNumber = pageNumber + self.changePageWith(page: pageNumber) + self.currentPageNumber = pageNumber + } } // MARK: Change page progressive direction @@ -480,10 +497,22 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl return cell } - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: IndexPath) -> CGSize { - return CGSize(width: collectionView.frame.width, height: collectionView.frame.height) + public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + var size = CGSize(width: collectionView.frame.width, height: collectionView.frame.height) + + if #available(iOS 11.0, *) { + let orientation = UIDevice.current.orientation + + if orientation == .portrait || orientation == .portraitUpsideDown { + if readerConfig.scrollDirection == .horizontal { + size.height = size.height - view.safeAreaInsets.bottom + } + } + } + + return size } - + // MARK: - Device rotation override open func willRotate(to toInterfaceOrientation: UIInterfaceOrientation, duration: TimeInterval) { @@ -500,7 +529,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl pageIndicatorFrame?.size.height = pageIndicatorHeight var scrollScrubberFrame = scrollScrubber?.slider.frame; - scrollScrubberFrame?.origin.x = ((screenBounds.size.height < screenBounds.size.width) ? (view.frame.width - 100) : (view.frame.height + 10)) + scrollScrubberFrame?.origin.x = ((screenBounds.size.height < screenBounds.size.width) ? (screenBounds.size.width - 100) : (screenBounds.size.height + 10)) scrollScrubberFrame?.size.height = ((screenBounds.size.height < screenBounds.size.width) ? (self.collectionView.frame.height - 100) : (self.collectionView.frame.width - 100)) self.collectionView.collectionViewLayout.invalidateLayout() @@ -576,21 +605,21 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl func setPageSize(_ orientation: UIInterfaceOrientation) { guard orientation.isPortrait else { if screenBounds.size.width > screenBounds.size.height { - self.pageWidth = self.view.frame.width - self.pageHeight = self.view.frame.height + self.pageWidth = screenBounds.size.width + self.pageHeight = screenBounds.size.height } else { - self.pageWidth = self.view.frame.height - self.pageHeight = self.view.frame.width + self.pageWidth = screenBounds.size.height + self.pageHeight = screenBounds.size.width } return } if screenBounds.size.width < screenBounds.size.height { - self.pageWidth = self.view.frame.width - self.pageHeight = self.view.frame.height + self.pageWidth = screenBounds.size.width + self.pageHeight = screenBounds.size.height } else { - self.pageWidth = self.view.frame.height - self.pageHeight = self.view.frame.width + self.pageWidth = screenBounds.size.height + self.pageHeight = screenBounds.size.width } } @@ -625,6 +654,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl pagesForCurrentPage(currentPage) delegate?.pageDidAppear?(currentPage) + delegate?.pageItemChanged?(self.getCurrentPageItemNumber()) completion?() } @@ -688,7 +718,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl ) } - func changePageWith(page: Int, andFragment fragment: String, animated: Bool = false, completion: (() -> Void)? = nil) { + open func changePageWith(page: Int, andFragment fragment: String, animated: Bool = false, completion: (() -> Void)? = nil) { if (self.currentPageNumber == page) { if let currentPage = currentPage , fragment != "" { currentPage.handleAnchor(fragment, avoidBeginningAnchors: true, animated: animated) @@ -704,7 +734,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl } } - func changePageWith(href: String, animated: Bool = false, completion: (() -> Void)? = nil) { + open func changePageWith(href: String, animated: Bool = false, completion: (() -> Void)? = nil) { let item = findPageByHref(href) let indexPath = IndexPath(row: item, section: 0) changePageWith(indexPath: indexPath, animated: animated, completion: { () -> Void in @@ -714,7 +744,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl }) } - func changePageWith(href: String, andAudioMarkID markID: String) { + open func changePageWith(href: String, andAudioMarkID markID: String) { if recentlyScrolled { return } // if user recently scrolled, do not change pages or scroll the webview guard let currentPage = currentPage else { return } @@ -732,7 +762,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl } } - func changePageWith(indexPath: IndexPath, animated: Bool = false, completion: (() -> Void)? = nil) { + open func changePageWith(indexPath: IndexPath, animated: Bool = false, completion: (() -> Void)? = nil) { guard indexPathIsValid(indexPath) else { print("ERROR: Attempt to scroll to invalid index path") completion?() @@ -745,6 +775,12 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl completion?() } } + + open func changePageWith(href: String, pageItem: Int, animated: Bool = false, completion: (() -> Void)? = nil) { + changePageWith(href: href, animated: animated) { + self.changePageItem(to: pageItem) + } + } func indexPathIsValid(_ indexPath: IndexPath) -> Bool { let section = indexPath.section @@ -760,26 +796,144 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl return row <= rowCount } - func isLastPage() -> Bool{ + open func isLastPage() -> Bool{ return (currentPageNumber == self.nextPageNumber) } - func changePageToNext(_ completion: (() -> Void)? = nil) { + public func changePageToNext(_ completion: (() -> Void)? = nil) { changePageWith(page: self.nextPageNumber, animated: true) { () -> Void in completion?() } } - func changePageToPrevious(_ completion: (() -> Void)? = nil) { + public func changePageToPrevious(_ completion: (() -> Void)? = nil) { changePageWith(page: self.previousPageNumber, animated: true) { () -> Void in completion?() } } + + public func changePageItemToNext(_ completion: (() -> Void)? = nil) { + // TODO: It was implemented for horizontal orientation. + // Need check page orientation (v/h) and make correct calc for vertical + guard + let cell = collectionView.cellForItem(at: getCurrentIndexPath()) as? FolioReaderPage, + let contentOffset = cell.webView?.scrollView.contentOffset, + let contentOffsetXLimit = cell.webView?.scrollView.contentSize.width else { + completion?() + return + } + + let cellSize = cell.frame.size + let contentOffsetX = contentOffset.x + cellSize.width + + if contentOffsetX >= contentOffsetXLimit { + changePageToNext(completion) + } else { + cell.scrollPageToOffset(contentOffsetX, animated: true) + } + + completion?() + } + + public func getCurrentPageItemNumber() -> Int { + guard let page = currentPage, let webView = page.webView else { return 0 } + + let pageSize = readerConfig.isDirection(pageHeight, pageWidth, pageHeight) + let pageOffSet = readerConfig.isDirection(webView.scrollView.contentOffset.x, webView.scrollView.contentOffset.x, webView.scrollView.contentOffset.y) + let webViewPage = pageForOffset(pageOffSet, pageHeight: pageSize) + + return webViewPage + } + + public func changePageItemToPrevious(_ completion: (() -> Void)? = nil) { + // TODO: It was implemented for horizontal orientation. + // Need check page orientation (v/h) and make correct calc for vertical + guard + let cell = collectionView.cellForItem(at: getCurrentIndexPath()) as? FolioReaderPage, + let contentOffset = cell.webView?.scrollView.contentOffset else { + completion?() + return + } + + let cellSize = cell.frame.size + let contentOffsetX = contentOffset.x - cellSize.width + + if contentOffsetX < 0 { + changePageToPrevious(completion) + } else { + cell.scrollPageToOffset(contentOffsetX, animated: true) + } + + completion?() + } + + public func changePageItemToLast(animated: Bool = true, _ completion: (() -> Void)? = nil) { + // TODO: It was implemented for horizontal orientation. + // Need check page orientation (v/h) and make correct calc for vertical + guard + let cell = collectionView.cellForItem(at: getCurrentIndexPath()) as? FolioReaderPage, + let contentOffset = cell.webView?.scrollView.contentOffset, + let contentSize = cell.webView?.scrollView.contentSize else { + completion?() + return + } + + let cellSize = cell.frame.size + var contentOffsetX: CGFloat = 0.0 + + if contentSize.width > 0 && cellSize.width > 0 { + contentOffsetX = (cellSize.width * (contentSize.width / cellSize.width)) - cellSize.width + } + + if contentOffsetX < 0 { + contentOffsetX = 0 + } + + cell.scrollPageToOffset(contentOffsetX, animated: animated) + + completion?() + } + + public func changePageItem(to: Int, animated: Bool = true, completion: (() -> Void)? = nil) { + // TODO: It was implemented for horizontal orientation. + // Need check page orientation (v/h) and make correct calc for vertical + guard + let cell = collectionView.cellForItem(at: getCurrentIndexPath()) as? FolioReaderPage, + let contentOffset = cell.webView?.scrollView.contentOffset, + let contentSize = cell.webView?.scrollView.contentSize else { + delegate?.pageItemChanged?(getCurrentPageItemNumber()) + completion?() + return + } + + let cellSize = cell.frame.size + var contentOffsetX: CGFloat = 0.0 + + if contentSize.width > 0 && cellSize.width > 0 { + contentOffsetX = (cellSize.width * CGFloat(to)) - cellSize.width + } + + if contentOffsetX > contentSize.width { + contentOffsetX = contentSize.width - cellSize.width + } + + if contentOffsetX < 0 { + contentOffsetX = 0 + } + + UIView.animate(withDuration: animated ? 0.3 : 0, delay: 0, options: UIViewAnimationOptions(), animations: { () -> Void in + cell.scrollPageToOffset(contentOffsetX, animated: animated) + }) { (finished: Bool) -> Void in + self.updateCurrentPage { + completion?() + } + } + } /** Find a page by FRTocReference. */ - func findPageByResource(_ reference: FRTocReference) -> Int { + public func findPageByResource(_ reference: FRTocReference) -> Int { var count = 0 for item in self.book.spine.spineReferences { if let resource = reference.resource, item.resource == resource { @@ -793,7 +947,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl /** Find a page by href. */ - func findPageByHref(_ href: String) -> Int { + public func findPageByHref(_ href: String) -> Int { var count = 0 for item in self.book.spine.spineReferences { if item.resource.href == href { @@ -807,7 +961,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl /** Find and return the current chapter resource. */ - func getCurrentChapter() -> FRResource? { + public func getCurrentChapter() -> FRResource? { for item in self.book.flatTableOfContents { if let reference = self.book.spine.spineReferences[safe: (self.currentPageNumber - 1)], @@ -819,10 +973,24 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl return nil } + /** + Return the current chapter progress based on current chapter and total of chapters. + */ + public func getCurrentChapterProgress() -> CGFloat { + let total = totalPages + let current = currentPageNumber + + if total == 0 { + return 0 + } + + return CGFloat((100 * current) / total) + } + /** Find and return the current chapter name. */ - func getCurrentChapterName() -> String? { + public func getCurrentChapterName() -> String? { for item in self.book.flatTableOfContents { guard let reference = self.book.spine.spineReferences[safe: (self.currentPageNumber - 1)], @@ -847,7 +1015,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl - parameter animated: En-/Disables the animation of the page change. - parameter completion: A Closure which is called if the page change is completed. */ - open func changePageWith(page: Int, animated: Bool = false, completion: (() -> Void)? = nil) { + public func changePageWith(page: Int, animated: Bool = false, completion: (() -> Void)? = nil) { if page > 0 && page-1 < totalPages { let indexPath = IndexPath(row: page-1, section: 0) changePageWith(indexPath: indexPath, animated: animated, completion: { () -> Void in @@ -869,7 +1037,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl /** Sharing chapter method. */ - func shareChapter(_ sender: UIBarButtonItem) { + @objc func shareChapter(_ sender: UIBarButtonItem) { guard let currentPage = currentPage else { return } if let chapterText = currentPage.webView?.js("getBodyText()") { @@ -1038,6 +1206,8 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl if (pageIndicatorView?.currentPage != webViewPage) { pageIndicatorView?.currentPage = webViewPage } + + self.delegate?.pageItemChanged?(webViewPage) } } @@ -1067,7 +1237,6 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl // Perform the page after a short delay as the collection view hasn't completed it's transition if this method is called (the index paths aren't right during fast scrolls). delay(0.2, closure: { [weak self] in - if (self?.readerConfig.scrollDirection == .horizontalWithVerticalContent), let cell = ((scrollView.superview as? UIWebView)?.delegate as? FolioReaderPage) { let currentIndexPathRow = cell.pageNumber - 1 @@ -1075,8 +1244,13 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl } if (scrollView is UICollectionView) { - if self?.totalPages > 0 { - self?.updateCurrentPage() + guard let instance = self else { + return + } + + if instance.totalPages > 0 { + instance.updateCurrentPage() + instance.delegate?.pageItemChanged?(instance.getCurrentPageItemNumber()) } } else { self?.scrollScrubber?.scrollViewDidEndDecelerating(scrollView) @@ -1089,7 +1263,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl RunLoop.current.add(recentlyScrolledTimer, forMode: RunLoopMode.commonModes) } - func clearRecentlyScrolled() { + @objc func clearRecentlyScrolled() { if(recentlyScrolledTimer != nil) { recentlyScrolledTimer.invalidate() recentlyScrolledTimer = nil @@ -1101,10 +1275,9 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl scrollScrubber?.scrollViewDidEndScrollingAnimation(scrollView) } - // MARK: NavigationBar Actions - func closeReader(_ sender: UIBarButtonItem) { + @objc func closeReader(_ sender: UIBarButtonItem) { dismiss() folioReader.close() } @@ -1112,7 +1285,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl /** Present chapter list */ - func presentChapterList(_ sender: UIBarButtonItem) { + @objc func presentChapterList(_ sender: UIBarButtonItem) { folioReader.saveReaderState() let chapter = FolioReaderChapterList(folioReader: folioReader, readerConfig: readerConfig, book: book, delegate: self) @@ -1130,7 +1303,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl /** Present fonts and settings menu */ - func presentFontsMenu() { + @objc func presentFontsMenu() { folioReader.saveReaderState() hideBars() @@ -1152,7 +1325,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl /** Present audio player menu */ - func presentPlayerMenu(_ sender: UIBarButtonItem) { + @objc func presentPlayerMenu(_ sender: UIBarButtonItem) { folioReader.saveReaderState() hideBars() @@ -1190,8 +1363,8 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl extension FolioReaderCenter: FolioReaderPageDelegate { public func pageDidLoad(_ page: FolioReaderPage) { - - if let bookId = self.book.name, + if self.readerConfig.loadSavedPositionForCurrentBook, + let bookId = self.book.name, let position = folioReader.savedPositionForCurrentBook as? NSDictionary { let pageNumber = position["pageNumber"] as? Int let offset = self.readerConfig.isDirection(position["pageOffsetY"], position["pageOffsetX"], position["pageOffsetY"]) as? CGFloat @@ -1231,6 +1404,12 @@ extension FolioReaderCenter: FolioReaderPageDelegate { // Pass the event to the centers `pageDelegate` pageDelegate?.pageWillLoad?(page) } + + public func pageTap(_ recognizer: UITapGestureRecognizer) { + // Pass the event to the centers `pageDelegate` + pageDelegate?.pageTap?(recognizer) + } + } // MARK: FolioReaderChapterListDelegate @@ -1262,4 +1441,15 @@ extension FolioReaderCenter: FolioReaderChapterListDelegate { tempReference = nil } } + + func getScreenBounds() -> CGRect { + var bounds = view.frame + + if #available(iOS 11.0, *) { + bounds.size.height = bounds.size.height - view.safeAreaInsets.bottom + } + + return bounds + } + } diff --git a/Source/FolioReaderConfig.swift b/Source/FolioReaderConfig.swift index 8ca8541af..2f1be730b 100755 --- a/Source/FolioReaderConfig.swift +++ b/Source/FolioReaderConfig.swift @@ -144,9 +144,12 @@ open class FolioReaderConfig: NSObject { /// Display book title in navbar open var displayTitle = false - // hide the page indicator + /// Hide the page indicator open var hidePageIndicator = false + /// Go to saved position when open a book + open var loadSavedPositionForCurrentBook = true + // MARK: Quote image share /// Custom Quote logo diff --git a/Source/FolioReaderContainer.swift b/Source/FolioReaderContainer.swift index 2572f6469..3ab6eddbc 100755 --- a/Source/FolioReaderContainer.swift +++ b/Source/FolioReaderContainer.swift @@ -11,15 +11,17 @@ import FontBlaster /// Reader container open class FolioReaderContainer: UIViewController { - var centerNavigationController: UINavigationController? - var centerViewController: FolioReaderCenter? - var audioPlayer: FolioReaderAudioPlayer? var shouldHideStatusBar = true var shouldRemoveEpub = true - var epubPath: String - var book: FRBook - + // Mark those property as public so they can accessed from other classes/subclasses. + public var epubPath: String + public var book: FRBook + + public var centerNavigationController: UINavigationController? + public var centerViewController: FolioReaderCenter? + public var audioPlayer: FolioReaderAudioPlayer? + public var readerConfig: FolioReaderConfig public var folioReader: FolioReader diff --git a/Source/FolioReaderFontsMenu.swift b/Source/FolioReaderFontsMenu.swift index 24a5555ab..dbcf53154 100644 --- a/Source/FolioReaderFontsMenu.swift +++ b/Source/FolioReaderFontsMenu.swift @@ -296,7 +296,7 @@ class FolioReaderFontsMenu: UIViewController, SMSegmentViewDelegate, UIGestureRe // MARK: - Font slider changed - func sliderValueChanged(_ sender: HADiscreteSlider) { + @objc func sliderValueChanged(_ sender: HADiscreteSlider) { guard (self.folioReader.readerCenter?.currentPage != nil), let fontSize = FolioReaderFontSize(rawValue: Int(sender.value)) else { @@ -308,7 +308,7 @@ class FolioReaderFontsMenu: UIViewController, SMSegmentViewDelegate, UIGestureRe // MARK: - Gestures - func tapGesture() { + @objc func tapGesture() { dismiss() if (self.readerConfig.shouldHideNavigationOnTap == false) { diff --git a/Source/FolioReaderHighlightList.swift b/Source/FolioReaderHighlightList.swift index e1c7361e0..8344c70f7 100644 --- a/Source/FolioReaderHighlightList.swift +++ b/Source/FolioReaderHighlightList.swift @@ -86,16 +86,16 @@ class FolioReaderHighlightList: UITableViewController { paragraph.lineSpacing = 3 let textColor = self.folioReader.isNight(self.readerConfig.menuTextColor, UIColor.black) - text.addAttribute(NSParagraphStyleAttributeName, value: paragraph, range: range) - text.addAttribute(NSFontAttributeName, value: UIFont(name: "Avenir-Light", size: 16)!, range: range) - text.addAttribute(NSForegroundColorAttributeName, value: textColor, range: range) + text.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraph, range: range) + text.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "Avenir-Light", size: 16)!, range: range) + text.addAttribute(NSAttributedStringKey.foregroundColor, value: textColor, range: range) if (highlight.type == HighlightStyle.underline.rawValue) { - text.addAttribute(NSBackgroundColorAttributeName, value: UIColor.clear, range: range) - text.addAttribute(NSUnderlineColorAttributeName, value: HighlightStyle.colorForStyle(highlight.type, nightMode: self.folioReader.nightMode), range: range) - text.addAttribute(NSUnderlineStyleAttributeName, value: NSNumber(value: NSUnderlineStyle.styleSingle.rawValue as Int), range: range) + text.addAttribute(NSAttributedStringKey.backgroundColor, value: UIColor.clear, range: range) + text.addAttribute(NSAttributedStringKey.underlineColor, value: HighlightStyle.colorForStyle(highlight.type, nightMode: self.folioReader.nightMode), range: range) + text.addAttribute(NSAttributedStringKey.underlineStyle, value: NSNumber(value: NSUnderlineStyle.styleSingle.rawValue as Int), range: range) } else { - text.addAttribute(NSBackgroundColorAttributeName, value: HighlightStyle.colorForStyle(highlight.type, nightMode: self.folioReader.nightMode), range: range) + text.addAttribute(NSAttributedStringKey.backgroundColor, value: HighlightStyle.colorForStyle(highlight.type, nightMode: self.folioReader.nightMode), range: range) } // Text @@ -128,8 +128,8 @@ class FolioReaderHighlightList: UITableViewController { let range = NSRange(location: 0, length: text.length) let paragraph = NSMutableParagraphStyle() paragraph.lineSpacing = 3 - text.addAttribute(NSParagraphStyleAttributeName, value: paragraph, range: range) - text.addAttribute(NSFontAttributeName, value: UIFont(name: "Avenir-Light", size: 16)!, range: range) + text.addAttribute(NSAttributedStringKey.paragraphStyle, value: paragraph, range: range) + text.addAttribute(NSAttributedStringKey.font, value: UIFont(name: "Avenir-Light", size: 16)!, range: range) let s = text.boundingRect(with: CGSize(width: view.frame.width-40, height: CGFloat.greatestFiniteMagnitude), options: [NSStringDrawingOptions.usesLineFragmentOrigin, NSStringDrawingOptions.usesFontLeading], diff --git a/Source/FolioReaderKit.swift b/Source/FolioReaderKit.swift index ac95c618c..3080bc3a2 100755 --- a/Source/FolioReaderKit.swift +++ b/Source/FolioReaderKit.swift @@ -72,19 +72,19 @@ public enum MediaOverlayStyle: Int { /// FolioReader actions delegate @objc public protocol FolioReaderDelegate: class { - + /// Did finished loading book. /// /// - Parameters: /// - folioReader: The FolioReader instance /// - book: The Book instance @objc optional func folioReader(_ folioReader: FolioReader, didFinishedLoading book: FRBook) - + /// Called when reader did closed. /// /// - Parameter folioReader: The FolioReader instance @objc optional func folioReaderDidClose(_ folioReader: FolioReader) - + /// Called when reader did closed. @available(*, deprecated, message: "Use 'folioReaderDidClose(_ folioReader: FolioReader)' instead.") @objc optional func folioReaderDidClosed() @@ -104,7 +104,7 @@ open class FolioReader: NSObject { /// FolioReaderDelegate open weak var delegate: FolioReaderDelegate? - + open weak var readerContainer: FolioReaderContainer? open weak var readerAudioPlayer: FolioReaderAudioPlayer? open weak var readerCenter: FolioReaderCenter? { @@ -334,7 +334,7 @@ extension FolioReader { extension FolioReader { /// Save Reader state, book, page and scroll offset. - open func saveReaderState() { + @objc open func saveReaderState() { guard isReaderOpen else { return } diff --git a/Source/FolioReaderPage.swift b/Source/FolioReaderPage.swift index 8e68c42da..af857d01e 100755 --- a/Source/FolioReaderPage.swift +++ b/Source/FolioReaderPage.swift @@ -27,6 +27,13 @@ import JSQWebViewController - parameter page: The loaded page */ @objc optional func pageDidLoad(_ page: FolioReaderPage) + + /** + Notifies that page receive tap gesture. + + - parameter recognizer: The tap recognizer + */ + @objc optional func pageTap(_ recognizer: UITapGestureRecognizer) } open class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRecognizerDelegate { @@ -35,7 +42,7 @@ open class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRe /// The index of the current page. Note: The index start at 1! open var pageNumber: Int! - var webView: FolioReaderWebView? + open var webView: FolioReaderWebView? fileprivate var colorView: UIView! fileprivate var shouldShowBar = true @@ -126,12 +133,14 @@ open class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRe let paddingTop: CGFloat = 20 let paddingBottom: CGFloat = 30 - return CGRect( + var frame = CGRect( x: bounds.origin.x, y: self.readerConfig.isDirection(bounds.origin.y + navTotal, bounds.origin.y + navTotal + paddingTop, bounds.origin.y + navTotal), width: bounds.width, height: self.readerConfig.isDirection(bounds.height - navTotal, bounds.height - navTotal - paddingTop - paddingBottom, bounds.height - navTotal) ) + + return frame } func loadHTMLString(_ htmlContent: String!, baseURL: URL!) { @@ -354,7 +363,6 @@ open class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRe // MARK: Gesture recognizer open func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { - if gestureRecognizer.view is FolioReaderWebView { if otherGestureRecognizer is UILongPressGestureRecognizer { if UIMenuController.shared.isMenuVisible { @@ -367,24 +375,24 @@ open class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRe return false } - open func handleTapGesture(_ recognizer: UITapGestureRecognizer) { - + @objc open func handleTapGesture(_ recognizer: UITapGestureRecognizer) { + self.delegate?.pageTap?(recognizer) + if let _navigationController = self.folioReader.readerCenter?.navigationController, (_navigationController.isNavigationBarHidden == true) { - let selected = webView?.js("getSelectedText()") + guard (selected == nil || selected?.isEmpty == true) else { return } let delay = 0.4 * Double(NSEC_PER_SEC) // 0.4 seconds * nanoseconds per seconds let dispatchTime = (DispatchTime.now() + (Double(Int64(delay)) / Double(NSEC_PER_SEC))) + DispatchQueue.main.asyncAfter(deadline: dispatchTime, execute: { - if (self.shouldShowBar == true && self.menuIsVisible == false) { self.folioReader.readerCenter?.toggleBars() } }) - } else if (self.readerConfig.shouldHideNavigationOnTap == true) { self.folioReader.readerCenter?.hideBars() self.menuIsVisible = false @@ -504,7 +512,7 @@ open class FolioReaderPage: UICollectionViewCell, UIWebViewDelegate, UIGestureRe } // MARK: ColorView fix for horizontal layout - func refreshPageMode() { + @objc func refreshPageMode() { guard let webView = webView else { return } if (self.folioReader.nightMode == true) { diff --git a/Source/FolioReaderPageIndicator.swift b/Source/FolioReaderPageIndicator.swift index a535a9e84..4ef8581b9 100644 --- a/Source/FolioReaderPageIndicator.swift +++ b/Source/FolioReaderPageIndicator.swift @@ -59,7 +59,7 @@ class FolioReaderPageIndicator: UIView { let fullW = pagesLabel.frame.width + minutesLabel.frame.width minutesLabel.frame.origin = CGPoint(x: frame.width/2-fullW/2, y: 2) pagesLabel.frame.origin = CGPoint(x: minutesLabel.frame.origin.x+minutesLabel.frame.width, y: 2) - + if updateShadow { layer.shadowPath = UIBezierPath(rect: bounds).cgPath self.reloadColors() @@ -95,7 +95,6 @@ class FolioReaderPageIndicator: UIView { pagesLabel.text = " \(pagesRemaining) " + self.readerConfig.localizedReaderManyPagesLeft } - let minutesRemaining = Int(ceil(CGFloat((pagesRemaining * totalMinutes)/totalPages))) if minutesRemaining > 1 { minutesLabel.text = "\(minutesRemaining) " + self.readerConfig.localizedReaderManyMinutes+" ·" diff --git a/Source/FolioReaderPlayerMenu.swift b/Source/FolioReaderPlayerMenu.swift index b8c19b899..af0c6bd74 100644 --- a/Source/FolioReaderPlayerMenu.swift +++ b/Source/FolioReaderPlayerMenu.swift @@ -161,14 +161,14 @@ class FolioReaderPlayerMenu: UIViewController, SMSegmentViewDelegate, UIGestureR style1.titleLabel!.font = UIFont(name: "Avenir-Light", size: 17) style1.setTitleColor(normalColor, for: UIControlState()) style1.setAttributedTitle(NSAttributedString(string: "Style", attributes: [ - NSForegroundColorAttributeName: normalColor, - NSUnderlineStyleAttributeName: NSUnderlineStyle.patternDot.rawValue|NSUnderlineStyle.styleSingle.rawValue, - NSUnderlineColorAttributeName: normalColor + NSAttributedStringKey.foregroundColor: normalColor, + NSAttributedStringKey.underlineStyle: NSUnderlineStyle.patternDot.rawValue|NSUnderlineStyle.styleSingle.rawValue, + NSAttributedStringKey.underlineColor: normalColor ]), for: UIControlState()) style1.setAttributedTitle(NSAttributedString(string: self.readerConfig.localizedPlayerMenuStyle, attributes: [ - NSForegroundColorAttributeName: self.folioReader.isNight(UIColor.white, UIColor.black), - NSUnderlineStyleAttributeName: NSUnderlineStyle.patternDot.rawValue|NSUnderlineStyle.styleSingle.rawValue, - NSUnderlineColorAttributeName: selectedColor + NSAttributedStringKey.foregroundColor: self.folioReader.isNight(UIColor.white, UIColor.black), + NSAttributedStringKey.underlineStyle: NSUnderlineStyle.patternDot.rawValue|NSUnderlineStyle.styleSingle.rawValue, + NSAttributedStringKey.underlineColor: selectedColor ]), for: .selected) menuView.addSubview(style1); @@ -239,21 +239,21 @@ class FolioReaderPlayerMenu: UIViewController, SMSegmentViewDelegate, UIGestureR } } - func prevChapter(_ sender: UIButton!) { + @objc func prevChapter(_ sender: UIButton!) { self.folioReader.readerAudioPlayer?.playPrevChapter() } - func nextChapter(_ sender: UIButton!) { + @objc func nextChapter(_ sender: UIButton!) { self.folioReader.readerAudioPlayer?.playNextChapter() } - func togglePlay(_ sender: UIButton!) { + @objc func togglePlay(_ sender: UIButton!) { sender.isSelected = sender.isSelected != true self.folioReader.readerAudioPlayer?.togglePlay() closeView() } - func changeStyle(_ sender: UIButton!) { + @objc func changeStyle(_ sender: UIButton!) { self.folioReader.currentMediaOverlayStyle = MediaOverlayStyle(rawValue: sender.tag)! // select the proper style button @@ -281,7 +281,7 @@ class FolioReaderPlayerMenu: UIViewController, SMSegmentViewDelegate, UIGestureR // MARK: - Gestures - func tapGesture() { + @objc func tapGesture() { closeView() } diff --git a/Source/FolioReaderQuoteShare.swift b/Source/FolioReaderQuoteShare.swift index 42af4f1cd..b195e9ca6 100644 --- a/Source/FolioReaderQuoteShare.swift +++ b/Source/FolioReaderQuoteShare.swift @@ -53,7 +53,7 @@ class FolioReaderQuoteShare: UIViewController { self.setCloseButton(withConfiguration: self.readerConfig) configureNavBar() - let titleAttrs = [NSForegroundColorAttributeName: self.readerConfig.tintColor] + let titleAttrs = [NSAttributedStringKey.foregroundColor: self.readerConfig.tintColor] let share = UIBarButtonItem(title: self.readerConfig.localizedShare, style: .plain, target: self, action: #selector(shareQuote(_:))) share.setTitleTextAttributes(titleAttrs, for: UIControlState()) navigationItem.rightBarButtonItem = share @@ -81,7 +81,7 @@ class FolioReaderQuoteShare: UIViewController { quoteLabel.translatesAutoresizingMaskIntoConstraints = false quoteLabel.adjustsFontSizeToFitWidth = true quoteLabel.minimumScaleFactor = 0.3 - quoteLabel.setContentCompressionResistancePriority(100, for: .vertical) + quoteLabel.setContentCompressionResistancePriority(UILayoutPriority(100), for: .vertical) filterImage.addSubview(quoteLabel) var bookTitle = "" @@ -104,14 +104,14 @@ class FolioReaderQuoteShare: UIViewController { titleLabel.translatesAutoresizingMaskIntoConstraints = false titleLabel.adjustsFontSizeToFitWidth = true titleLabel.minimumScaleFactor = 0.8 - titleLabel.setContentCompressionResistancePriority(600, for: .vertical) + titleLabel.setContentCompressionResistancePriority(UILayoutPriority(600), for: .vertical) filterImage.addSubview(titleLabel) // Attributed author - let attrs = [NSFontAttributeName: UIFont(name: "Lato-Italic", size: 15)!] + let attrs = [NSAttributedStringKey.font: UIFont(name: "Lato-Italic", size: 15)!] let attributedString = NSMutableAttributedString(string:"\(self.readerConfig.localizedShareBy) ", attributes: attrs) - let attrs1 = [NSFontAttributeName: UIFont(name: "Lato-Regular", size: 15)!] + let attrs1 = [NSAttributedStringKey.font: UIFont(name: "Lato-Regular", size: 15)!] let boldString = NSMutableAttributedString(string: authorName, attributes:attrs1) attributedString.append(boldString) @@ -254,7 +254,7 @@ class FolioReaderQuoteShare: UIViewController { // MARK: Share - func shareQuote(_ sender: UIBarButtonItem) { + @objc func shareQuote(_ sender: UIBarButtonItem) { var subject = self.readerConfig.localizedShareHighlightSubject var text = "" var bookTitle = "" diff --git a/Source/FolioReaderSharingProvider.swift b/Source/FolioReaderSharingProvider.swift index 4924fedcb..307bbf5db 100644 --- a/Source/FolioReaderSharingProvider.swift +++ b/Source/FolioReaderSharingProvider.swift @@ -26,8 +26,8 @@ class FolioReaderSharingProvider: UIActivityItemProvider { override func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivityType?) -> String { return subject } - - override func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivityType) -> Any? { + + override func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivityType?) -> Any? { if let html = html , activityType == UIActivityType.mail { return html } diff --git a/Source/FolioReaderWebView.swift b/Source/FolioReaderWebView.swift index ae85a8773..0935ea322 100644 --- a/Source/FolioReaderWebView.swift +++ b/Source/FolioReaderWebView.swift @@ -70,7 +70,7 @@ open class FolioReaderWebView: UIWebView { // MARK: - UIMenuController - Actions - func share(_ sender: UIMenuController) { + @objc func share(_ sender: UIMenuController) { let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) let shareImage = UIAlertAction(title: self.readerConfig.localizedShareImageQuote, style: .default, handler: { (action) -> Void in @@ -128,7 +128,7 @@ open class FolioReaderWebView: UIWebView { setMenuVisible(false) } - func highlight(_ sender: UIMenuController?) { + @objc func highlight(_ sender: UIMenuController?) { let highlightAndReturn = js("highlightString('\(HighlightStyle.classForStyle(self.folioReader.currentHighlightStyle))')") let jsonData = highlightAndReturn?.data(using: String.Encoding.utf8) @@ -164,7 +164,7 @@ open class FolioReaderWebView: UIWebView { } } - func define(_ sender: UIMenuController?) { + @objc func define(_ sender: UIMenuController?) { guard let selectedText = js("getSelectedText()") else { return } @@ -178,7 +178,7 @@ open class FolioReaderWebView: UIWebView { readerContainer.show(vc, sender: nil) } - func play(_ sender: UIMenuController?) { + @objc func play(_ sender: UIMenuController?) { self.folioReader.readerAudioPlayer?.play() self.clearTextSelection() @@ -304,7 +304,7 @@ open class FolioReaderWebView: UIWebView { // MARK: - Java Script Bridge - @discardableResult func js(_ script: String) -> String? { + @discardableResult open func js(_ script: String) -> String? { let callback = self.stringByEvaluatingJavaScript(from: script) if callback!.isEmpty { return nil } return callback diff --git a/Source/Models/Highlight+Helper.swift b/Source/Models/Highlight+Helper.swift index 3e4e42e8b..8a99bfcdb 100644 --- a/Source/Models/Highlight+Helper.swift +++ b/Source/Models/Highlight+Helper.swift @@ -302,9 +302,9 @@ extension Highlight { let highlight = Highlight() highlight.highlightId = matchingHighlight.id - highlight.type = HighlightStyle.styleForClass(str.substring(with: match.rangeAt(1))).rawValue + highlight.type = HighlightStyle.styleForClass(str.substring(with: match.range(at: 1))).rawValue highlight.date = Foundation.Date() - highlight.content = Highlight.removeSentenceSpam(str.substring(with: match.rangeAt(2))) + highlight.content = Highlight.removeSentenceSpam(str.substring(with: match.range(at: 2))) highlight.contentPre = Highlight.removeSentenceSpam(contentPre) highlight.contentPost = Highlight.removeSentenceSpam(contentPost) highlight.page = matchingHighlight.currentPage @@ -367,7 +367,7 @@ extension Highlight { var newLocator = "" matches?.forEach({ (match: NSTextCheckingResult) in - newLocator += str.substring(with: match.rangeAt(1)) + newLocator += str.substring(with: match.range(at: 1)) }) if (matches?.count > 0 && newLocator.isEmpty == false) { diff --git a/Source/Models/Highlight.swift b/Source/Models/Highlight.swift index acf271e7e..5c8956aac 100644 --- a/Source/Models/Highlight.swift +++ b/Source/Models/Highlight.swift @@ -11,16 +11,16 @@ import RealmSwift /// A Highlight object open class Highlight: Object { - open dynamic var bookId: String! - open dynamic var content: String! - open dynamic var contentPost: String! - open dynamic var contentPre: String! - open dynamic var date: Foundation.Date! - open dynamic var highlightId: String! - open dynamic var page: Int = 0 - open dynamic var type: Int = 0 - open dynamic var startOffset: Int = -1 - open dynamic var endOffset: Int = -1 + @objc open dynamic var bookId: String! + @objc open dynamic var content: String! + @objc open dynamic var contentPost: String! + @objc open dynamic var contentPre: String! + @objc open dynamic var date: Foundation.Date! + @objc open dynamic var highlightId: String! + @objc open dynamic var page: Int = 0 + @objc open dynamic var type: Int = 0 + @objc open dynamic var startOffset: Int = -1 + @objc open dynamic var endOffset: Int = -1 override open class func primaryKey()-> String { return "highlightId" diff --git a/Source/PageViewController.swift b/Source/PageViewController.swift index d9d5a03be..fcfaf6383 100644 --- a/Source/PageViewController.swift +++ b/Source/PageViewController.swift @@ -82,7 +82,7 @@ class PageViewController: UIPageViewController { // MARK: - Segmented control changes - func didSwitchMenu(_ sender: UISegmentedControl) { + @objc func didSwitchMenu(_ sender: UISegmentedControl) { self.index = sender.selectedSegmentIndex let direction: UIPageViewControllerNavigationDirection = (index == 0 ? .reverse : .forward) setViewControllers([viewList[index]], direction: direction, animated: true, completion: nil) diff --git a/Source/ScrollScrubber.swift b/Source/ScrollScrubber.swift index 02c70f46e..0def0031b 100644 --- a/Source/ScrollScrubber.swift +++ b/Source/ScrollScrubber.swift @@ -110,17 +110,17 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { // MARK: - slider events - func sliderTouchDown(_ slider:UISlider) { + @objc func sliderTouchDown(_ slider:UISlider) { usingSlider = true show() } - func sliderTouchUp(_ slider:UISlider) { + @objc func sliderTouchUp(_ slider:UISlider) { usingSlider = false hideAfterDelay() } - func sliderChange(_ slider:UISlider) { + @objc func sliderChange(_ slider:UISlider) { let movePosition = (height() * CGFloat(slider.value)) let offset = readerConfig.isDirection(CGPoint(x: 0, y: movePosition), CGPoint(x: movePosition, y: 0), CGPoint(x: 0, y: movePosition)) scrollView()?.setContentOffset(offset, animated: false) @@ -150,7 +150,7 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { } - func hide() { + @objc func hide() { visible = false resetScrollDelta() UIView.animate(withDuration: hideSpeed, animations: { @@ -224,7 +224,7 @@ class ScrollScrubber: NSObject, UIScrollViewDelegate { RunLoop.current.add(scrollDeltaTimer, forMode: RunLoopMode.commonModes) } - func resetScrollDelta() { + @objc func resetScrollDelta() { if scrollDeltaTimer != nil { scrollDeltaTimer.invalidate() scrollDeltaTimer = nil diff --git a/Vendor/SMSegmentView/SMSegment.swift b/Vendor/SMSegmentView/SMSegment.swift index 5c5111e50..e153581da 100755 --- a/Vendor/SMSegmentView/SMSegment.swift +++ b/Vendor/SMSegmentView/SMSegment.swift @@ -58,7 +58,7 @@ class SMSegment: UIView { self.label.text = self.title if let titleText = self.label.text as NSString? { - self.labelWidth = titleText.boundingRect(with: CGSize(width: self.frame.size.width, height: self.frame.size.height), options:NSStringDrawingOptions.usesLineFragmentOrigin , attributes: [NSFontAttributeName: self.label.font], context: nil).size.width + self.labelWidth = titleText.boundingRect(with: CGSize(width: self.frame.size.width, height: self.frame.size.height), options:NSStringDrawingOptions.usesLineFragmentOrigin , attributes: [NSAttributedStringKey.font: self.label.font], context: nil).size.width } else { self.labelWidth = 0.0 @@ -86,7 +86,7 @@ class SMSegment: UIView { self.label.font = self.titleFont if let titleText = self.label.text as NSString? { - self.labelWidth = titleText.boundingRect(with: CGSize(width: self.frame.size.width + 1.0, height: self.frame.size.height), options:NSStringDrawingOptions.usesLineFragmentOrigin , attributes: [NSFontAttributeName: self.label.font], context: nil).size.width + self.labelWidth = titleText.boundingRect(with: CGSize(width: self.frame.size.width + 1.0, height: self.frame.size.height), options:NSStringDrawingOptions.usesLineFragmentOrigin , attributes: [NSAttributedStringKey.font: self.label.font], context: nil).size.width } else { self.labelWidth = 0.0