Skip to content
Permalink
Browse files

Merge pull request #424 from TortugaPower/develop

Release 3.6.2
  • Loading branch information
GianniCarlo committed Feb 11, 2020
2 parents c2fc9de + 6257fe9 commit 6fea218c67b5359ee223e8049f68cadb7ea382be
@@ -1778,7 +1778,7 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
IBSC_MODULE = BookPlayerWatch_Extension;
INFOPLIST_FILE = BookPlayerWatch/Info.plist;
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer.watchkitapp;
@@ -1810,7 +1810,7 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
IBSC_MODULE = BookPlayerWatch_Extension;
INFOPLIST_FILE = BookPlayerWatch/Info.plist;
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1840,7 +1840,7 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
IBSC_MODULE = BookPlayerWatch_Extension;
INFOPLIST_FILE = BookPlayerWatch/Info.plist;
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1868,7 +1868,7 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "BookPlayerWatch Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer.watchkitapp.watchkitextension;
@@ -1898,7 +1898,7 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "BookPlayerWatch Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
@@ -1926,7 +1926,7 @@
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "BookPlayerWatch Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
@@ -2171,7 +2171,7 @@
INFOPLIST_FILE = BookPlayer/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer;
PRODUCT_NAME = BookPlayer;
PROVISIONING_PROFILE_SPECIFIER = "BookPlayer 3 with CarPlay";
@@ -2201,7 +2201,7 @@
INFOPLIST_FILE = BookPlayer/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer;
PRODUCT_NAME = BookPlayer;
PROVISIONING_PROFILE_SPECIFIER = "BookPlayer 3 with CarPlay";
@@ -2370,7 +2370,7 @@
INFOPLIST_FILE = BookPlayerWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer.BookPlayerWidget;
@@ -2399,7 +2399,7 @@
INFOPLIST_FILE = BookPlayerWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer.BookPlayerWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2426,7 +2426,7 @@
INFOPLIST_FILE = BookPlayerWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer.BookPlayerWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2507,7 +2507,7 @@
INFOPLIST_FILE = BookPlayer/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
PRODUCT_BUNDLE_IDENTIFIER = com.tortugapower.audiobookplayer;
PRODUCT_NAME = BookPlayer;
PROVISIONING_PROFILE_SPECIFIER = "BookPlayer 3 with CarPlay";
@@ -195,11 +195,12 @@ class ItemListViewController: UIViewController, ItemList, ItemListAlerts, ItemLi
}
}

func setupPlayer(book: Book) {
func setupPlayer(book: Book, _ override: Bool = false) {
// Make sure player is for a different book
guard
let currentBook = PlayerManager.shared.currentBook,
currentBook == book
currentBook == book,
!override
else {
// Handle loading new player
self.loadPlayer(book: book)
@@ -492,7 +493,7 @@ extension ItemListViewController: UITableViewDataSource {

guard let book = self?.getNextBook(item) else { return }

self?.setupPlayer(book: book)
self?.setupPlayer(book: book, true)
}

if let book = item as? Book {
@@ -65,7 +65,6 @@ class RootViewController: UIViewController, UIGestureRecognizerDelegate {
NotificationCenter.default.addObserver(self, selector: #selector(self.onBookPlay), name: .bookPlayed, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.onBookPause), name: .bookPaused, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.onBookPause), name: .bookEnd, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.dismissMiniPlayer), name: .bookStopped, object: nil)

// Gestures
self.pan = UIPanGestureRecognizer(target: self, action: #selector(self.panAction))
@@ -16,12 +16,24 @@ import MediaPlayer
class PlayerManager: NSObject {
static let shared = PlayerManager()

static let speedOptions: [Float] = [2.5, 2, 1.75, 1.5, 1.25, 1, 0.75]
static let speedOptions: [Float] = [3, 2.5, 2, 1.75, 1.5, 1.25, 1, 0.9, 0.75, 0.5]

private var audioPlayer = AVPlayer()

private var playerItem: AVPlayerItem?

private var observeStatus: Bool = false {
didSet {
guard oldValue != observeStatus else { return }

if self.observeStatus {
self.playerItem?.addObserver(self, forKeyPath: "status", options: .new, context: nil)
} else {
self.playerItem?.removeObserver(self, forKeyPath: "status")
}
}
}

var currentBook: Book? {
didSet {
guard let book = currentBook,
@@ -106,7 +118,9 @@ class PlayerManager: NSObject {
MPNowPlayingInfoCenter.default().nowPlayingInfo = self.nowPlayingInfo

if book.currentTime > 0.0 {
self.jumpTo(book.currentTime)
// if book is truly finished, start book again to avoid autoplaying next one
let time = book.currentTime == book.duration ? 0 : book.currentTime
self.jumpTo(time)
}

NotificationCenter.default.post(name: .bookReady, object: nil, userInfo: ["book": book])
@@ -338,7 +352,7 @@ extension PlayerManager {
guard let item = self.playerItem,
item.status == .readyToPlay else {
//queue playback
self.playerItem?.addObserver(self, forKeyPath: "status", options: .new, context: nil)
self.observeStatus = true
return
}

@@ -416,7 +430,8 @@ extension PlayerManager {
return
}

self.playerItem?.removeObserver(self, forKeyPath: "status")
self.observeStatus = false

self.play()
}

@@ -425,6 +440,8 @@ extension PlayerManager {
return
}

self.observeStatus = false

UserActivityManager.shared.stopPlaybackActivity()

if let library = currentBook.library ?? currentBook.playlist?.library {
@@ -457,6 +474,8 @@ extension PlayerManager {
}

func stop() {
self.observeStatus = false

self.audioPlayer.pause()

UserActivityManager.shared.stopPlaybackActivity()
@@ -516,8 +535,6 @@ extension PlayerManager {
NotificationCenter.default.post(name: .bookChange,
object: nil,
userInfo: userInfo)

self.play()
})
}
}
@@ -90,7 +90,6 @@ class CarPlayManager: NSObject, MPPlayableContentDataSource, MPPlayableContentDe

guard let playlist = items[indexPath[IndexGuide.library.content]] as? Playlist,
let count = playlist.books?.count else {
print(items[indexPath[IndexGuide.library.content]])
return 0
}

@@ -100,7 +100,7 @@ public class Playlist: LibraryItem {

public func updateCompletionState() {
guard let books = self.books?.array as? [Book] else { return }
print(!books.contains(where: { !$0.isFinished }))

self.isFinished = !books.contains(where: { !$0.isFinished })
}

0 comments on commit 6fea218

Please sign in to comment.
You can’t perform that action at this time.