From b8cccd729e43dea017ac119d0de7235d57debd05 Mon Sep 17 00:00:00 2001 From: Wesley Gomes Date: Wed, 13 Jun 2018 18:36:36 -0300 Subject: [PATCH 1/6] Fixed FolioReaderWebView, menu controller still showing colors menu after select any color in menu. https://github.com/FolioReader/FolioReaderKit/issues/316 --- Source/FolioReaderWebView.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/FolioReaderWebView.swift b/Source/FolioReaderWebView.swift index 3fc9aed18..9711c6460 100644 --- a/Source/FolioReaderWebView.swift +++ b/Source/FolioReaderWebView.swift @@ -246,6 +246,9 @@ open class FolioReaderWebView: UIWebView { if let updateId = js("setHighlightStyle('\(HighlightStyle.classForStyle(style.rawValue))')") { Highlight.updateById(withConfiguration: self.readerConfig, highlightId: updateId, type: style) } + + //FIX: https://github.com/FolioReader/FolioReaderKit/issues/316 + setMenuVisible(false) } // MARK: - Create and show menu From 4b19a3648c94d40abd1ae063faeaf8b75c31aca2 Mon Sep 17 00:00:00 2001 From: Wesley Gomes Date: Fri, 29 Jun 2018 16:29:14 -0300 Subject: [PATCH 2/6] Created enum for two columns mode, set in setupScrollDirection() on FolioReaderWebView --- Source/FolioReaderConfig.swift | 26 ++++++++++++++++++++++++ Source/FolioReaderWebView.swift | 36 ++++++++++++++++++++++++++++++++- Source/Resources/Style.css | 3 ++- 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/Source/FolioReaderConfig.swift b/Source/FolioReaderConfig.swift index 033772f3e..e9962ff55 100755 --- a/Source/FolioReaderConfig.swift +++ b/Source/FolioReaderConfig.swift @@ -37,6 +37,29 @@ public enum FolioReaderScrollDirection: Int { } } +///Show book content in two columns side by side. Note: Only for `horizontal scroll direction`. +public enum FolioReaderTwoColumnsMode { + case disabled + + ///Enabled in any situation, iPhone or iPad, portrait or landscape orientation. + case alwaysEnabled + + ///Enabled in any device, only landscape orientation. + case onlyLandscape + + ///Enabled only on iPad, portrait or landscape orientation. + case onlyIpad + + ///Enabled only on iPad, only landscape orientation. + case onlyIpadLandscape + + ///Enabled only on iPhone, portrait or landscape orientation. + case onlyIphone + + ///Enabled only on iPhone, only landscape orientation. + case onlyIphoneLandscape +} + // MARK: - ClassBasedOnClickListener /** @@ -128,6 +151,9 @@ open class FolioReaderConfig: NSObject { /// If `canChangeScrollDirection` is `true` it will be overrided by user's option. open var scrollDirection: FolioReaderScrollDirection = .defaultVertical + + /// Show book content in two columns side by side. Note: Only for `horizontal scroll direction`. The default is 'disabled'. + open var twoColumnsMode = FolioReaderTwoColumnsMode.disabled /// Enable or disable hability to user change scroll direction on menu. open var canChangeScrollDirection = true diff --git a/Source/FolioReaderWebView.swift b/Source/FolioReaderWebView.swift index 9711c6460..cf23cd924 100644 --- a/Source/FolioReaderWebView.swift +++ b/Source/FolioReaderWebView.swift @@ -374,8 +374,42 @@ open class FolioReaderWebView: UIWebView { case .horizontal: scrollView.isPagingEnabled = true paginationMode = .leftToRight - paginationBreakingMode = .page scrollView.bounces = false + + var enableTwoColumns = false + if readerConfig.twoColumnsMode != .disabled { + let isIpad = UIDevice.current.userInterfaceIdiom == .pad + let isIphone = UIDevice.current.userInterfaceIdiom == .phone + let orientation = UIApplication.shared.statusBarOrientation + let isLandscape = orientation == .landscapeLeft || orientation == .landscapeRight + + switch readerConfig.twoColumnsMode { + case .alwaysEnabled: + enableTwoColumns = true + break + case .onlyLandscape: + enableTwoColumns = isLandscape + break + case .onlyIpad: + enableTwoColumns = isIpad + break + case .onlyIpadLandscape: + enableTwoColumns = isIpad && isLandscape + break + case .onlyIphone: + enableTwoColumns = isIphone + break + case .onlyIphoneLandscape: + enableTwoColumns = isIphone && isLandscape + break + default: + break + } + } + + paginationBreakingMode = enableTwoColumns ? .column : .page + pageLength = enableTwoColumns ? bounds.size.width/2 : bounds.size.width + break } } diff --git a/Source/Resources/Style.css b/Source/Resources/Style.css index c1a0a458f..3f7a461dd 100755 --- a/Source/Resources/Style.css +++ b/Source/Resources/Style.css @@ -49,7 +49,8 @@ body { /* Custom padding for tablets */ @media only screen and (min-device-width: 768px){ body { - padding: 60px 80px !important; +/* padding: 60px 80px !important;*/ + padding: 30px 40px !important; } } From 0b889f36c7ac55f71da715412f56c87e32703813 Mon Sep 17 00:00:00 2001 From: Wesley Gomes Date: Fri, 29 Jun 2018 20:59:03 -0300 Subject: [PATCH 3/6] Comment two columns mode code in ViewController Example. --- Example/Example.xcodeproj/project.pbxproj | 26 +++++------------------ Example/Example/ViewController.swift | 1 + Example/Podfile.lock | 2 +- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 076595264..baea99f78 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -333,7 +333,6 @@ CA10C12F1C572A4B0049165D /* Resources */, C1392FF51E4FD15EBB5AA8DD /* [CP] Embed Pods Frameworks */, E82F486563C1547E0775A59F /* 📦 Embed Pods Frameworks */, - 064D38CE83FACC358B7C0EC8 /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -376,7 +375,7 @@ TargetAttributes = { 1A42C2881C0E3882000F2137 = { CreatedOnToolsVersion = 7.1.1; - DevelopmentTeam = 32F2T8EJ6G; + DevelopmentTeam = ZA8S3VXNS5; LastSwiftMigration = 0800; ProvisioningStyle = Automatic; SystemCapabilities = { @@ -489,21 +488,6 @@ 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 */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "📦 Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FolioReaderTests/Pods-FolioReaderTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 1D8126CC73301F2413345444 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -944,10 +928,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = ZA8S3VXNS5; INFOPLIST_FILE = Example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.Example; + PRODUCT_BUNDLE_IDENTIFIER = "com.folioreader.Example-remove"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -961,10 +945,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = 32F2T8EJ6G; + DEVELOPMENT_TEAM = ZA8S3VXNS5; INFOPLIST_FILE = Example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.Example; + PRODUCT_BUNDLE_IDENTIFIER = "com.folioreader.Example-remove"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index 4e9a31728..56c82320e 100755 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -42,6 +42,7 @@ class ViewController: UIViewController { // config.menuBackgroundColor = UIColor.lightGrayColor() // config.hidePageIndicator = true // config.realmConfiguration = Realm.Configuration(fileURL: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("highlights.realm")) +// config.twoColumnsMode = .alwaysEnabled // Custom sharing quote background config.quoteCustomBackgrounds = [] diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 33f298757..b3a0d3de3 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -58,4 +58,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: d5e64429a71bc13b6eceb790b04656d8082e4d66 -COCOAPODS: 1.5.2 +COCOAPODS: 1.5.3 From 5ac8d8bba12221e35f906c07cab4b5ae3fb83073 Mon Sep 17 00:00:00 2001 From: Wesley Gomes Date: Fri, 29 Jun 2018 21:00:28 -0300 Subject: [PATCH 4/6] Comment two columns mode code in ViewController Example. (reverted from commit 0b889f36c7ac55f71da715412f56c87e32703813) --- Example/Example.xcodeproj/project.pbxproj | 26 ++++++++++++++++++----- Example/Example/ViewController.swift | 1 - Example/Podfile.lock | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index baea99f78..076595264 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -333,6 +333,7 @@ CA10C12F1C572A4B0049165D /* Resources */, C1392FF51E4FD15EBB5AA8DD /* [CP] Embed Pods Frameworks */, E82F486563C1547E0775A59F /* 📦 Embed Pods Frameworks */, + 064D38CE83FACC358B7C0EC8 /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -375,7 +376,7 @@ TargetAttributes = { 1A42C2881C0E3882000F2137 = { CreatedOnToolsVersion = 7.1.1; - DevelopmentTeam = ZA8S3VXNS5; + DevelopmentTeam = 32F2T8EJ6G; LastSwiftMigration = 0800; ProvisioningStyle = Automatic; SystemCapabilities = { @@ -488,6 +489,21 @@ 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 */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FolioReaderTests/Pods-FolioReaderTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 1D8126CC73301F2413345444 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -928,10 +944,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = ZA8S3VXNS5; + DEVELOPMENT_TEAM = 32F2T8EJ6G; INFOPLIST_FILE = Example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.folioreader.Example-remove"; + PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.Example; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -945,10 +961,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = ZA8S3VXNS5; + DEVELOPMENT_TEAM = 32F2T8EJ6G; INFOPLIST_FILE = Example/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.folioreader.Example-remove"; + PRODUCT_BUNDLE_IDENTIFIER = com.folioreader.Example; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index 56c82320e..4e9a31728 100755 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -42,7 +42,6 @@ class ViewController: UIViewController { // config.menuBackgroundColor = UIColor.lightGrayColor() // config.hidePageIndicator = true // config.realmConfiguration = Realm.Configuration(fileURL: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("highlights.realm")) -// config.twoColumnsMode = .alwaysEnabled // Custom sharing quote background config.quoteCustomBackgrounds = [] diff --git a/Example/Podfile.lock b/Example/Podfile.lock index b3a0d3de3..33f298757 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -58,4 +58,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: d5e64429a71bc13b6eceb790b04656d8082e4d66 -COCOAPODS: 1.5.3 +COCOAPODS: 1.5.2 From 7ec20efa80abcaa3fb60b869a9d4d4696be23c22 Mon Sep 17 00:00:00 2001 From: Wesley Gomes Date: Fri, 29 Jun 2018 21:03:39 -0300 Subject: [PATCH 5/6] Comment two columns mode code in ViewController Example. --- Example/Example/ViewController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index 4e9a31728..6c8217d1e 100755 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -42,7 +42,8 @@ class ViewController: UIViewController { // config.menuBackgroundColor = UIColor.lightGrayColor() // config.hidePageIndicator = true // config.realmConfiguration = Realm.Configuration(fileURL: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("highlights.realm")) - +// config.twoColumnsMode = .alwaysEnabled + // Custom sharing quote background config.quoteCustomBackgrounds = [] if let image = UIImage(named: "demo-bg") { From a772b9ce56bc67a7b8cf62517892151cce85ade1 Mon Sep 17 00:00:00 2001 From: Wesley Gomes Date: Fri, 29 Jun 2018 21:46:01 -0300 Subject: [PATCH 6/6] Fix pods. --- Example/Example.xcodeproj/project.pbxproj | 16 ---------------- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ Example/Podfile.lock | 2 +- 3 files changed, 9 insertions(+), 17 deletions(-) create mode 100644 Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 076595264..46b881672 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -333,7 +333,6 @@ CA10C12F1C572A4B0049165D /* Resources */, C1392FF51E4FD15EBB5AA8DD /* [CP] Embed Pods Frameworks */, E82F486563C1547E0775A59F /* 📦 Embed Pods Frameworks */, - 064D38CE83FACC358B7C0EC8 /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -489,21 +488,6 @@ 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 */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "📦 Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FolioReaderTests/Pods-FolioReaderTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 1D8126CC73301F2413345444 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 33f298757..b3a0d3de3 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -58,4 +58,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: d5e64429a71bc13b6eceb790b04656d8082e4d66 -COCOAPODS: 1.5.2 +COCOAPODS: 1.5.3