Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Move add / import button to the top right in the navigation bar #1173

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ jobs:

steps:
- uses: actions/checkout@v4
# We only use Xcode 15.4
- name: Remove unused applications
run: |
df -hI /dev/disk3s1s1
sudo rm -rf /Applications/Xcode_14.3.1.app
sudo rm -rf /Applications/Xcode_15.0.1.app
sudo rm -rf /Applications/Xcode_15.1.app
sudo rm -rf /Applications/Xcode_15.2.app
sudo rm -rf /Applications/Xcode_15.3.app
df -hI /dev/disk3s1s1
- name: Create Debug.xcconfig
run: cp ./BuildConfiguration/Debug.template.xcconfig ./BuildConfiguration/Debug.xcconfig
- name: Set Xcode version
Expand Down
22 changes: 1 addition & 21 deletions BookPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
4197240021874D5F00AB1190 /* UserActivityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419723FF21874D5F00AB1190 /* UserActivityManager.swift */; };
4197FAFC267E480100811CC8 /* ImportViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4197FAFB267E480100811CC8 /* ImportViewController.swift */; };
419B373923B8D0C600128A8F /* Player.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 419B373B23B8D0C600128A8F /* Player.storyboard */; };
419B373C23B8D12200128A8F /* AddCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419B373E23B8D12200128A8F /* AddCellView.xib */; };
419B373F23B8D14100128A8F /* LoadingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419B374123B8D14100128A8F /* LoadingView.xib */; };
419B374223B8D18000128A8F /* PlusBannerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419B374423B8D18000128A8F /* PlusBannerView.xib */; };
419B375623B8D5A500128A8F /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 419B375423B8D5A500128A8F /* Localizable.strings */; };
Expand Down Expand Up @@ -210,7 +209,6 @@
41B2A5E121CCC21000917584 /* ThemeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41B2A5E021CCC21000917584 /* ThemeManager.swift */; };
41B2A5ED21CCC6D100917584 /* AppNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41B2A5EC21CCC6D100917584 /* AppNavigationController.swift */; };
41B2A5EF21CD5AAE00917584 /* StaticCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41B2A5EE21CD5AAE00917584 /* StaticCellView.swift */; };
41B2A5F121CD857800917584 /* AddCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41B2A5F021CD857800917584 /* AddCellView.swift */; };
41B2AC8E1D43CCE8005382A9 /* ChaptersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41B2AC8D1D43CCE8005382A9 /* ChaptersViewController.swift */; };
41B30A33230232D200025D69 /* CarPlayManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41B30A32230232D200025D69 /* CarPlayManager.swift */; };
41C233FD272E1957006BC7B8 /* SimpleLibraryItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41188D3026ED715D0017124E /* SimpleLibraryItem.swift */; };
Expand All @@ -234,7 +232,6 @@
41D20DB225D5F5A100AAEE30 /* MappingModel_v1_to_v2.xcmappingmodel in Sources */ = {isa = PBXBuildFile; fileRef = 41D20DAE25D5F5A100AAEE30 /* MappingModel_v1_to_v2.xcmappingmodel */; };
41D20DB325D5F5A100AAEE30 /* MappingModel_v1_to_v2.xcmappingmodel in Sources */ = {isa = PBXBuildFile; fileRef = 41D20DAE25D5F5A100AAEE30 /* MappingModel_v1_to_v2.xcmappingmodel */; };
41D20DB425D5F5A100AAEE30 /* MappingModel_v1_to_v2.xcmappingmodel in Sources */ = {isa = PBXBuildFile; fileRef = 41D20DAE25D5F5A100AAEE30 /* MappingModel_v1_to_v2.xcmappingmodel */; };
41D4F2EF21053944009F1B1E /* IndexPath+BookPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41D4F2EE21053944009F1B1E /* IndexPath+BookPlayer.swift */; };
41DA44BD26FAEC4F00F3A05D /* BookActivityItemProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41D39D40215F177D00B65290 /* BookActivityItemProvider.swift */; };
41E562CE22394F5200C06BC9 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 41E562CC22394F5200C06BC9 /* [email protected] */; };
41E562CF22394F5200C06BC9 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 41E562CD22394F5200C06BC9 /* [email protected] */; };
Expand Down Expand Up @@ -949,7 +946,6 @@
419723FF21874D5F00AB1190 /* UserActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserActivityManager.swift; sourceTree = "<group>"; };
4197FAFB267E480100811CC8 /* ImportViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImportViewController.swift; sourceTree = "<group>"; };
419B373A23B8D0C600128A8F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Player.storyboard; sourceTree = "<group>"; };
419B373D23B8D12200128A8F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AddCellView.xib; sourceTree = "<group>"; };
419B374023B8D14100128A8F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LoadingView.xib; sourceTree = "<group>"; };
419B374323B8D18000128A8F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PlusBannerView.xib; sourceTree = "<group>"; };
419B375523B8D5A500128A8F /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1006,7 +1002,6 @@
41B2A5E021CCC21000917584 /* ThemeManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeManager.swift; sourceTree = "<group>"; };
41B2A5EC21CCC6D100917584 /* AppNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppNavigationController.swift; sourceTree = "<group>"; };
41B2A5EE21CD5AAE00917584 /* StaticCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StaticCellView.swift; sourceTree = "<group>"; };
41B2A5F021CD857800917584 /* AddCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddCellView.swift; sourceTree = "<group>"; };
41B2A6AB21D3274500917584 /* Themeable.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Themeable.framework; path = Carthage/Build/iOS/Themeable.framework; sourceTree = "<group>"; };
41B2AC8D1D43CCE8005382A9 /* ChaptersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChaptersViewController.swift; sourceTree = "<group>"; };
41B30A32230232D200025D69 /* CarPlayManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarPlayManager.swift; sourceTree = "<group>"; };
Expand All @@ -1020,7 +1015,6 @@
41D20DAE25D5F5A100AAEE30 /* MappingModel_v1_to_v2.xcmappingmodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcmappingmodel; path = MappingModel_v1_to_v2.xcmappingmodel; sourceTree = "<group>"; };
41D39D40215F177D00B65290 /* BookActivityItemProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookActivityItemProvider.swift; sourceTree = "<group>"; };
41D4F2EA2101A278009F1B1E /* DirectoryWatcher.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DirectoryWatcher.framework; path = Carthage/Build/iOS/DirectoryWatcher.framework; sourceTree = "<group>"; };
41D4F2EE21053944009F1B1E /* IndexPath+BookPlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "IndexPath+BookPlayer.swift"; sourceTree = "<group>"; };
41D7944E22260EC000228580 /* SwiftyStoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyStoreKit.framework; path = Carthage/Build/iOS/SwiftyStoreKit.framework; sourceTree = "<group>"; };
41E34E4F2138EA8200A3997C /* ImportOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImportOperation.swift; sourceTree = "<group>"; };
41E562CC22394F5200C06BC9 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2695,8 +2689,6 @@
C33E843B20C6E179004A0489 /* ItemProgress.swift */,
C398559B20C492FF00BE9EC0 /* AddButton.swift */,
C3FE94782080086800BCEA37 /* BookCellView.swift */,
419B373E23B8D12200128A8F /* AddCellView.xib */,
41B2A5F021CD857800917584 /* AddCellView.swift */,
4165EE0A20A7A33500616EDF /* BookCellView.xib */,
4142964321F21D95004356DA /* BulkControlsView.swift */,
4142964521F21DAE004356DA /* BulkControlsView.xib */,
Expand Down Expand Up @@ -2728,7 +2720,6 @@
isa = PBXGroup;
children = (
416B640C1E72F362000E955A /* Notification+BookPlayer.swift */,
41D4F2EE21053944009F1B1E /* IndexPath+BookPlayer.swift */,
C3A479142094CA3800D92122 /* UIImage+BookPlayer.swift */,
C39401E820DEE83100F3DC71 /* UIView+BookPlayer.swift */,
C3A479182094CAF300D92122 /* UIViewController+BookPlayer.swift */,
Expand Down Expand Up @@ -3154,7 +3145,6 @@
418B6D031D2707F800F974FB /* Main.storyboard in Resources */,
9F665ED42A4894C4004BFE27 /* [email protected] in Resources */,
634BA54A2C0BD06B0015314D /* [email protected] in Resources */,
419B373C23B8D12200128A8F /* AddCellView.xib in Resources */,
41E562EB2239531E00C06BC9 /* [email protected] in Resources */,
9F665EE12A4898F6004BFE27 /* [email protected] in Resources */,
41E56302223956B800C06BC9 /* [email protected] in Resources */,
Expand Down Expand Up @@ -3459,7 +3449,6 @@
9F2681AD2888B26100359BD3 /* LoginBenefitView.swift in Sources */,
634BA5A72C1777BB0015314D /* PricingBoxView.swift in Sources */,
9F588DBF2902C798000DA799 /* ComposedButton.swift in Sources */,
41B2A5F121CD857800917584 /* AddCellView.swift in Sources */,
4151A6B326E491A800E49DBE /* NibLoadableView.swift in Sources */,
4197FAFC267E480100811CC8 /* ImportViewController.swift in Sources */,
631C75C92AB92C540013E7E5 /* BPPushPresentationFlow.swift in Sources */,
Expand Down Expand Up @@ -3560,7 +3549,6 @@
9F3D0CE528C2BF5C00E9E8A3 /* ButtonFreeViewController.swift in Sources */,
4197240021874D5F00AB1190 /* UserActivityManager.swift in Sources */,
634BA5972C161FBE0015314D /* StoryView.swift in Sources */,
41D4F2EF21053944009F1B1E /* IndexPath+BookPlayer.swift in Sources */,
6356F9C52AC86D9200B7A027 /* BPAppShortcuts.swift in Sources */,
69343D332133844D000C425E /* VoiceOverService.swift in Sources */,
C359C30720A9F35B00A626E3 /* SkipDurationViewController.swift in Sources */,
Expand Down Expand Up @@ -3960,14 +3948,6 @@
name = Player.storyboard;
sourceTree = "<group>";
};
419B373E23B8D12200128A8F /* AddCellView.xib */ = {
isa = PBXVariantGroup;
children = (
419B373D23B8D12200128A8F /* Base */,
);
name = AddCellView.xib;
sourceTree = "<group>";
};
419B374123B8D14100128A8F /* LoadingView.xib */ = {
isa = PBXVariantGroup;
children = (
Expand Down Expand Up @@ -5427,7 +5407,7 @@
repositoryURL = "https://github.com/getsentry/sentry-cocoa.git";
requirement = {
kind = exactVersion;
version = 8.32.0;
version = 8.36.0;
};
};
41F1A214254B0AA40043FCF3 /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/getsentry/sentry-cocoa.git",
"state" : {
"revision" : "5421f94cc859eb65f5ae3866165a053aa634431e",
"version" : "8.32.0"
"revision" : "5575af93efb776414f243e93d6af9f6258dc539a",
"version" : "8.36.0"
}
},
{
Expand Down
104 changes: 53 additions & 51 deletions BookPlayer/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -275,60 +275,62 @@ class AppDelegate: UIResponder, UIApplicationDelegate, BPLogger {
}

func setupMPPlaybackRemoteCommands() {
// Play / Pause
MPRemoteCommandCenter.shared().togglePlayPauseCommand.isEnabled = true
MPRemoteCommandCenter.shared().togglePlayPauseCommand.addTarget { [weak self] (_) -> MPRemoteCommandHandlerStatus in
guard let playerManager = self?.playerManager else { return .commandFailed }

let wasPlaying = playerManager.isPlaying
playerManager.playPause()

if wasPlaying,
UIApplication.shared.applicationState == .background {
self?.scheduleAppRefresh()
Task {
// Play / Pause
MPRemoteCommandCenter.shared().togglePlayPauseCommand.isEnabled = true
MPRemoteCommandCenter.shared().togglePlayPauseCommand.addTarget { [weak self] (_) -> MPRemoteCommandHandlerStatus in
guard let playerManager = self?.playerManager else { return .commandFailed }

let wasPlaying = playerManager.isPlaying
playerManager.playPause()

if wasPlaying,
UIApplication.shared.applicationState == .background {
self?.scheduleAppRefresh()
}
return .success
}
return .success
}

MPRemoteCommandCenter.shared().playCommand.isEnabled = true
MPRemoteCommandCenter.shared().playCommand.addTarget { [weak self] (_) -> MPRemoteCommandHandlerStatus in
guard let playerManager = self?.playerManager else { return .commandFailed }

playerManager.play()
return .success
}

MPRemoteCommandCenter.shared().pauseCommand.isEnabled = true
MPRemoteCommandCenter.shared().pauseCommand.addTarget { [weak self] (_) -> MPRemoteCommandHandlerStatus in
guard let playerManager = self?.playerManager else { return .commandFailed }

playerManager.pause()

if UIApplication.shared.applicationState == .background {
self?.scheduleAppRefresh()

MPRemoteCommandCenter.shared().playCommand.isEnabled = true
MPRemoteCommandCenter.shared().playCommand.addTarget { [weak self] (_) -> MPRemoteCommandHandlerStatus in
guard let playerManager = self?.playerManager else { return .commandFailed }

playerManager.play()
return .success
}

return .success
}

MPRemoteCommandCenter.shared().changePlaybackPositionCommand.isEnabled = true
MPRemoteCommandCenter.shared().changePlaybackPositionCommand.addTarget { [weak self] remoteEvent in
guard
let playerManager = self?.playerManager,
let currentItem = playerManager.currentItem,
let event = remoteEvent as? MPChangePlaybackPositionCommandEvent
else { return .commandFailed }

var newTime = event.positionTime

if UserDefaults.sharedDefaults.bool(forKey: Constants.UserDefaults.chapterContextEnabled),
let currentChapter = currentItem.currentChapter {
newTime += currentChapter.start

MPRemoteCommandCenter.shared().pauseCommand.isEnabled = true
MPRemoteCommandCenter.shared().pauseCommand.addTarget { [weak self] (_) -> MPRemoteCommandHandlerStatus in
guard let playerManager = self?.playerManager else { return .commandFailed }

playerManager.pause()

if UIApplication.shared.applicationState == .background {
self?.scheduleAppRefresh()
}

return .success
}

MPRemoteCommandCenter.shared().changePlaybackPositionCommand.isEnabled = true
MPRemoteCommandCenter.shared().changePlaybackPositionCommand.addTarget { [weak self] remoteEvent in
guard
let playerManager = self?.playerManager,
let currentItem = playerManager.currentItem,
let event = remoteEvent as? MPChangePlaybackPositionCommandEvent
else { return .commandFailed }

var newTime = event.positionTime

if UserDefaults.sharedDefaults.bool(forKey: Constants.UserDefaults.chapterContextEnabled),
let currentChapter = currentItem.currentChapter {
newTime += currentChapter.start
}

playerManager.jumpTo(newTime, recordBookmark: true)

return .success
}

playerManager.jumpTo(newTime, recordBookmark: true)

return .success
}
}

Expand Down
Loading