Skip to content
This repository was archived by the owner on Nov 26, 2020. It is now read-only.

Commit 8e3a2db

Browse files
Removed deprecated methods
1 parent fe3f81a commit 8e3a2db

5 files changed

Lines changed: 2 additions & 269 deletions

File tree

FolioReaderKit.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@
235235
isa = PBXGroup;
236236
children = (
237237
1A958F041D397BE900D56699 /* EPUBCore */,
238+
1A958F1D1D397BE900D56699 /* Models */,
239+
1A958F251D397BE900D56699 /* Resources */,
238240
3A27F08B1FD9BE5800D84A57 /* Extensions.swift */,
239241
1A958F0F1D397BE900D56699 /* FolioReaderAudioPlayer.swift */,
240242
1A958F101D397BE900D56699 /* FolioReaderCenter.swift */,
@@ -253,10 +255,8 @@
253255
1A958F1C1D397BE900D56699 /* FolioReaderSharingProvider.swift */,
254256
3A27F08A1FD9BE5800D84A57 /* FolioReaderUserDefaults.swift */,
255257
3AD5EEB81D9433C100E42810 /* FolioReaderWebView.swift */,
256-
1A958F1D1D397BE900D56699 /* Models */,
257258
1A958F241D397BE900D56699 /* PageViewController.swift */,
258259
1A65DDD41DA744410033C277 /* QuoteImage.swift */,
259-
1A958F251D397BE900D56699 /* Resources */,
260260
1A958F901D397BE900D56699 /* ScrollScrubber.swift */,
261261
);
262262
path = Source;

Source/Extensions.swift

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -10,121 +10,44 @@ import Foundation
1010
import UIKit
1111

1212
extension UICollectionViewScrollDirection {
13-
14-
@available(*, deprecated, message: "Use 'direction(withConfiguration:)' instead.")
15-
static func direction() -> UICollectionViewScrollDirection {
16-
guard let readerConfig = FolioReader.shared.readerContainer?.readerConfig else {
17-
return .vertical
18-
}
19-
20-
return UICollectionViewScrollDirection.direction(withConfiguration: readerConfig)
21-
}
22-
2313
static func direction(withConfiguration readerConfig: FolioReaderConfig) -> UICollectionViewScrollDirection {
2414
return readerConfig.isDirection(.vertical, .horizontal, .horizontal)
2515
}
2616
}
2717

2818
extension UICollectionViewScrollPosition {
29-
30-
@available(*, deprecated, message: "Use 'direction(withConfiguration:)' instead.")
31-
static func direction() -> UICollectionViewScrollPosition {
32-
guard let readerConfig = FolioReader.shared.readerContainer?.readerConfig else {
33-
return .top
34-
}
35-
36-
return UICollectionViewScrollPosition.direction(withConfiguration: readerConfig)
37-
}
38-
3919
static func direction(withConfiguration readerConfig: FolioReaderConfig) -> UICollectionViewScrollPosition {
4020
return readerConfig.isDirection(.top, .left, .left)
4121
}
4222
}
4323

4424
extension CGPoint {
45-
46-
@available(*, deprecated, message: "Use 'forDirection(withConfiguration:)' instead.")
47-
func forDirection() -> CGFloat {
48-
guard let readerConfig = FolioReader.shared.readerContainer?.readerConfig else {
49-
return self.y
50-
}
51-
52-
return self.forDirection(withConfiguration: readerConfig)
53-
}
54-
5525
func forDirection(withConfiguration readerConfig: FolioReaderConfig, scrollType: ScrollType = .page) -> CGFloat {
5626
return readerConfig.isDirection(self.y, self.x, ((scrollType == .page) ? self.y : self.x))
5727
}
5828
}
5929

6030
extension CGSize {
61-
62-
@available(*, deprecated, message: "Use 'forDirection(withConfiguration:)' instead.")
63-
func forDirection() -> CGFloat {
64-
guard let readerConfig = FolioReader.shared.readerContainer?.readerConfig else {
65-
return self.height
66-
}
67-
return self.forDirection(withConfiguration: readerConfig)
68-
}
69-
7031
func forDirection(withConfiguration readerConfig: FolioReaderConfig) -> CGFloat {
7132
return readerConfig.isDirection(height, width, height)
7233
}
7334

74-
@available(*, deprecated, message: "Use 'forReverseDirection(withConfiguration:)' instead.")
75-
func forReverseDirection() -> CGFloat {
76-
guard let readerConfig = FolioReader.shared.readerContainer?.readerConfig else {
77-
return self.width
78-
}
79-
80-
return self.forReverseDirection(withConfiguration: readerConfig)
81-
}
82-
8335
func forReverseDirection(withConfiguration readerConfig: FolioReaderConfig) -> CGFloat {
8436
return readerConfig.isDirection(width, height, width)
8537
}
8638
}
8739

8840
extension CGRect {
89-
90-
@available(*, deprecated, message: "Use 'forDirection(withConfiguration:)' instead.")
91-
func forDirection() -> CGFloat {
92-
guard let readerConfig = FolioReader.shared.readerContainer?.readerConfig else {
93-
return self.height
94-
}
95-
96-
return self.forDirection(withConfiguration: readerConfig)
97-
}
98-
9941
func forDirection(withConfiguration readerConfig: FolioReaderConfig) -> CGFloat {
10042
return readerConfig.isDirection(height, width, height)
10143
}
10244
}
10345

10446
extension ScrollDirection {
105-
106-
@available(*, deprecated, message: "Use 'negative(withConfiguration:)' instead.")
107-
static func negative() -> ScrollDirection {
108-
guard let readerConfig = FolioReader.shared.readerContainer?.readerConfig else {
109-
return self.down
110-
}
111-
112-
return self.negative(withConfiguration: readerConfig)
113-
}
114-
11547
static func negative(withConfiguration readerConfig: FolioReaderConfig, scrollType: ScrollType = .page) -> ScrollDirection {
11648
return readerConfig.isDirection(.down, .right, .right)
11749
}
11850

119-
@available(*, deprecated, message: "Use 'positive(withConfiguration:)' instead.")
120-
static func positive() -> ScrollDirection {
121-
guard let readerConfig = FolioReader.shared.readerContainer?.readerConfig else {
122-
return self.up
123-
}
124-
125-
return self.positive(withConfiguration: readerConfig)
126-
}
127-
12851
static func positive(withConfiguration readerConfig: FolioReaderConfig, scrollType: ScrollType = .page) -> ScrollDirection {
12952
return readerConfig.isDirection(.up, .left, .left)
13053
}
@@ -416,18 +339,6 @@ internal extension UIImage {
416339
self.init(named: readerImageNamed, in: Bundle.frameworkBundle(), compatibleWith: nil)
417340
}
418341

419-
/// Forces the image to be colored with Reader Config tintColor
420-
///
421-
/// - Returns: Returns a colored image
422-
@available(*, deprecated, message: "Use 'ignoreSystemTint(withConfiguration:)' instead.")
423-
func ignoreSystemTint() -> UIImage? {
424-
guard let readerConfig = FolioReader.shared.readerContainer?.readerConfig else {
425-
return nil
426-
}
427-
428-
return self.ignoreSystemTint(withConfiguration: readerConfig)
429-
}
430-
431342
/// Forces the image to be colored with Reader Config tintColor
432343
///
433344
/// - Parameter readerConfig: Current folio reader configuration.
@@ -519,15 +430,6 @@ internal extension UIImage {
519430

520431
internal extension UIViewController {
521432

522-
@available(*, deprecated, message: "Use 'setCloseButton(withConfiguration:)' instead.")
523-
func setCloseButton() {
524-
guard let config = FolioReader.shared.readerContainer?.readerConfig else {
525-
return
526-
}
527-
528-
self.setCloseButton(withConfiguration: config)
529-
}
530-
531433
func setCloseButton(withConfiguration readerConfig: FolioReaderConfig) {
532434
let closeImage = UIImage(readerImageNamed: "icon-navbar-close")?.ignoreSystemTint(withConfiguration: readerConfig)
533435
self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: closeImage, style: .plain, target: self, action: #selector(dismiss as () -> Void))

Source/FolioReaderContainer.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ open class FolioReaderContainer: UIViewController {
7272

7373
// Configure the folio reader.
7474
self.folioReader.readerContainer = self
75-
76-
// Set the shared instance to support old version.
77-
FolioReader.shared = self.folioReader
7875
}
7976

8077
/// Common Initialization
@@ -109,9 +106,6 @@ open class FolioReaderContainer: UIViewController {
109106
self.epubPath = path
110107
self.unzipPath = unzipPath
111108
self.shouldRemoveEpub = removeEpub
112-
113-
// Set the shared instance to support old version.
114-
FolioReader.shared = self.folioReader
115109
}
116110

117111
// MARK: - View life cicle

Source/FolioReaderKit.swift

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ extension FolioReader {
166166
self.readerContainer = readerContainer
167167
parentViewController.present(readerContainer, animated: animated, completion: nil)
168168
addObservers()
169-
170-
// Set the shared instance to support old version.
171-
FolioReader.shared = self
172169
}
173170
}
174171

@@ -363,94 +360,5 @@ extension FolioReader {
363360
self.readerAudioPlayer?.stop(immediate: true)
364361
self.defaults.set(0, forKey: kCurrentTOCMenu)
365362
self.delegate?.folioReaderDidClose?(self)
366-
self.delegate?.folioReaderDidClosed?()
367-
}
368-
}
369-
370-
// MARK: - Public static functions. All Deprecated function
371-
372-
@available(*, deprecated, message: "Shared instance removed. Use a local instance instead.")
373-
extension FolioReader {
374-
375-
private static var _sharedInstance = FolioReader()
376-
open static var shared : FolioReader {
377-
get { return _sharedInstance }
378-
set { _sharedInstance = newValue }
379-
}
380-
381-
/// Check the current Media Overlay or TTS style
382-
static var currentMediaOverlayStyle: MediaOverlayStyle {
383-
return FolioReader.shared.currentMediaOverlayStyle
384363
}
385-
386-
/// Check if current theme is Night mode
387-
open class var nightMode: Bool {
388-
get { return FolioReader.shared.nightMode }
389-
set { FolioReader.shared.nightMode = newValue }
390-
}
391-
392-
/// Check current font name
393-
open class var currentFont: FolioReaderFont {
394-
get { return FolioReader.shared.currentFont }
395-
set { FolioReader.shared.currentFont = newValue }
396-
}
397-
398-
/// Check current font size
399-
open class var currentFontSize: FolioReaderFontSize {
400-
get { return FolioReader.shared.currentFontSize }
401-
set { FolioReader.shared.currentFontSize = newValue }
402-
}
403-
404-
/// Check the current scroll direction
405-
open class var currentScrollDirection: Int {
406-
get { return FolioReader.shared.currentScrollDirection }
407-
set { FolioReader.shared.currentScrollDirection = newValue }
408-
}
409-
410-
/// Check current audio rate, the speed of speech voice
411-
open class var currentAudioRate: Int {
412-
get { return FolioReader.shared.currentAudioRate }
413-
set { FolioReader.shared.currentAudioRate = newValue }
414-
}
415-
416-
/// Check if reader is open and ready
417-
open class var isReaderReady : Bool {
418-
return FolioReader.shared.isReaderReady
419-
}
420-
421-
/// Save Reader state, book, page and scroll are saved
422-
@available(*, deprecated, message: "You no longer need to call `saveReaderState` for `applicationWillResignActive` and `applicationWillTerminate`. FolioReader Already handle that.")
423-
open class func saveReaderState() {
424-
FolioReader.shared.saveReaderState()
425-
}
426-
427-
/// Closes and save the reader current instance
428-
open class func close() {
429-
FolioReader.shared.close()
430-
}
431-
432-
/// Check the current highlight style
433-
open class var currentHighlightStyle: Int {
434-
get { return FolioReader.shared.currentHighlightStyle }
435-
set { FolioReader.shared.currentHighlightStyle = newValue }
436-
}
437-
438-
/// Check if layout needs to change to fit Right To Left
439-
open class var needsRTLChange: Bool {
440-
return FolioReader.shared.needsRTLChange
441-
}
442-
}
443-
444-
// MARK: - Global Functions
445-
446-
@available(*, deprecated, message: "Shared instance removed. Use a local instance instead.")
447-
func isNight<T> (_ f: T, _ l: T) -> T {
448-
return FolioReader.shared.isNight(f, l)
449-
}
450-
451-
// MARK: - Scroll Direction Functions
452-
453-
@available(*, deprecated, message: "Shared instance removed. Use a local instance instead.")
454-
func isDirection<T> (_ vertical: T, _ horizontal: T, _ horizontalContentVertical: T) -> T {
455-
return FolioReader.shared.readerContainer!.readerConfig.isDirection(vertical, horizontal, horizontalContentVertical)
456364
}

Source/Models/Highlight+Helper.swift

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -199,77 +199,6 @@ extension Highlight {
199199
}
200200
}
201201

202-
// MARK: - Static functions
203-
204-
extension Highlight {
205-
206-
@available(*, deprecated, message: "Shared instance removed. Use a local instance instead.")
207-
private static var readerConfig : FolioReaderConfig {
208-
return FolioReader.shared.readerContainer!.readerConfig
209-
}
210-
211-
/// Save a Highlight with completion block
212-
///
213-
/// - Parameter completion: Completion block
214-
@available(*, deprecated, message: "Use 'persist(withConfiguration:completion:)' instead.")
215-
public func persist(_ completion: Completion? = nil) {
216-
self.persist(withConfiguration: Highlight.readerConfig, completion: completion)
217-
}
218-
219-
/// Return all Highlights
220-
///
221-
/// - Returns: Return all Highlights
222-
@available(*, deprecated, message: "Use 'all(withConfiguration:)' instead.")
223-
public static func all() -> [Highlight] {
224-
return Highlight.all(withConfiguration: Highlight.readerConfig)
225-
}
226-
227-
/// Return a list of Highlights with a given ID
228-
///
229-
/// - Parameters:
230-
/// - bookId: Book ID
231-
/// - page: Page number
232-
/// - Returns: Return a list of Highlights
233-
@available(*, deprecated, message: "Use 'allByBookId(withConfiguration:bookId:andPage:)' instead.")
234-
public static func allByBookId(_ bookId: String, andPage page: NSNumber? = nil) -> [Highlight] {
235-
return Highlight.allByBookId(withConfiguration: Highlight.readerConfig, bookId: bookId, andPage: page)
236-
}
237-
238-
/// Update a Highlight by ID
239-
///
240-
/// - Parameters:
241-
/// - highlightId: The ID to be removed
242-
/// - type: The `HighlightStyle`
243-
@available(*, deprecated, message: "Use 'updateById(withConfiguration:highlightId:type:)' instead.")
244-
public static func updateById(_ highlightId: String, type: HighlightStyle) {
245-
Highlight.updateById(withConfiguration: Highlight.readerConfig, highlightId: highlightId, type: type)
246-
}
247-
248-
/// Remove a Highlight by ID
249-
///
250-
/// - Parameter highlightId: The ID to be removed
251-
@available(*, deprecated, message: "Use 'removeById(withConfiguration:highlightId:)' instead.")
252-
public static func removeById(_ highlightId: String) {
253-
Highlight.removeById(withConfiguration: Highlight.readerConfig, highlightId: highlightId)
254-
}
255-
256-
/// Remove a Highlight
257-
@available(*, deprecated, message: "Use 'remove(withConfiguration:)' instead.")
258-
public func remove() {
259-
self.remove(withConfiguration: Highlight.readerConfig)
260-
}
261-
262-
/// Remove a Highlight from HTML by ID
263-
///
264-
/// - Parameter highlightId: The ID to be removed
265-
/// - Returns: The removed id
266-
@available(*, deprecated, message: "Use 'removeFromHTMLById(withinPage:highlightId:)' instead.")
267-
@discardableResult public static func removeFromHTMLById(_ highlightId: String) -> String? {
268-
let page = FolioReader.shared.readerCenter?.currentPage
269-
return self.removeFromHTMLById(withinPage: page, highlightId: highlightId)
270-
}
271-
}
272-
273202
// MARK: - HTML Methods
274203

275204
extension Highlight {

0 commit comments

Comments
 (0)