Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Added playlist button to URL Bar and Playlist tooltips.
Browse files Browse the repository at this point in the history
Remove PlaylistToast completely. Fixed Playlist URL Bar Icon display when switching tabs and when playlist items are detected.
Add Playlist Menu.
Dismiss menu properly.
Fixing glitch where web-view is somehow not removed when the tab is killed.
Integrated above readermode.
Adding ability to detect media element's information based on tagId.
Open playlist item at current time offset from page view offset.
  • Loading branch information
Brandon-T committed Aug 13, 2021
1 parent 7f1c479 commit a1b7adf
Show file tree
Hide file tree
Showing 31 changed files with 946 additions and 502 deletions.
31 changes: 31 additions & 0 deletions BraveShared/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ extension Strings {
// MARK:- TabLocationView.swift
extension Strings {
public static let tabToolbarStopButtonAccessibilityLabel = NSLocalizedString("TabToolbarStopButtonAccessibilityLabel", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Stop", comment: "Accessibility Label for the tab toolbar Stop button")
public static let tabToolbarPlaylistButtonAccessibilityLabel = NSLocalizedString("TabToolbarPlaylistButtonAccessibilityLabel", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Playlist", comment: "Accessibility Label for the tab toolbar Playlist button")
public static let tabToolbarReloadButtonAccessibilityLabel = NSLocalizedString("TabToolbarReloadButtonAccessibilityLabel", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Reload", comment: "Accessibility Label for the tab toolbar Reload button")
public static let tabToolbarSearchAddressPlaceholderText = NSLocalizedString("TabToolbarSearchAddressPlaceholderText", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Search or enter address", comment: "The text shown in the URL bar on about:home")
public static let tabToolbarLockImageAccessibilityLabel = NSLocalizedString("TabToolbarLockImageAccessibilityLabel", tableName: "BraveShared", bundle: Bundle.braveShared, value: "Secure connection", comment: "Accessibility label for the lock icon, which is only present if the connection is secure")
Expand Down Expand Up @@ -1375,6 +1376,36 @@ extension Strings {
bundle: .braveShared,
value: "Adding video and audio files for offline use can use a lot of storage on your device. Please remove some files to free up storage space.",
comment: "When the user's disk space is almost full")

public static let playlistPopoverAddTitle =
NSLocalizedString("playlist.popoverAddTitle",
bundle: .braveShared,
value: "Would you like to add this media to your Brave Playlist?",
comment: "Title of the popover that shows when you tap on the 'Add to Playlist' button in the URL bar")

public static let playlistPopoverAddBody =
NSLocalizedString("playlist.popoverAddBody",
bundle: .braveShared,
value: "Brave Playlists support Offline Playback, Picture-in-picture, continuous playback and repeat modes.",
comment: "Body of the popover that shows when you tap on the 'Add to Playlist' button in the URL bar")

public static let playlistPopoverAddedTitle =
NSLocalizedString("playlist.popoverAddedTitle",
bundle: .braveShared,
value: "This media is in your Brave Playlist",
comment: "Title of the popover that shows when you already have the current media item in your playlist and you tap on the 'Add to Playlist' button in the URL bar")

public static let playlistPopoverOpenInBravePlaylist =
NSLocalizedString("playlist.popoverOpenInBravePlaylist",
bundle: .braveShared,
value: "Open In Brave Playlist",
comment: "Button title in the popover when an item is already in your playlist and you tap the 'Add to Playlist' button in the URL bar")

public static let playlistPopoverRemoveFromBravePlaylist =
NSLocalizedString("playlist.popoverRemoveFromBravePlaylist",
bundle: .braveShared,
value: "Remove",
comment: "Button title in the popover when an item is already in your playlist and you tap the 'Add to Playlist' button in the URL bar")
}
}

Expand Down
24 changes: 20 additions & 4 deletions Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,6 @@
5E824A96260BCE0D00127F36 /* MainFrameAtDocumentStart.js in Resources */ = {isa = PBXBuildFile; fileRef = 5E824A94260BCE0D00127F36 /* MainFrameAtDocumentStart.js */; };
5E8CD8E123D5E3DA00548FC0 /* libarchive.2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E8CD8E023D5E3D100548FC0 /* libarchive.2.tbd */; };
5E9288CA22DF864C007BE7A6 /* TabSessionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E9288C922DF864C007BE7A6 /* TabSessionTests.swift */; };
5E99CAB025CC610B003F30B4 /* PlaylistToast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E99CAAF25CC610B003F30B4 /* PlaylistToast.swift */; };
5E99D01525E56BFB003F30B4 /* PlaylistManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E99C88A25C83BE3003F30B4 /* PlaylistManager.swift */; };
5E99D02025E56C15003F30B4 /* PlaylistDownloadManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E99CDEF25DD8C81003F30B4 /* PlaylistDownloadManager.swift */; };
5E99D02B25E56C18003F30B4 /* HLSThumbnailGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E99CDAC25DC70E6003F30B4 /* HLSThumbnailGenerator.swift */; };
Expand Down Expand Up @@ -857,9 +856,14 @@
CA439A5925E6F29D00FE9150 /* VideoPlayerInfoBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA439A5825E6F29D00FE9150 /* VideoPlayerInfoBar.swift */; };
CA439A7625E8054A00FE9150 /* VideoPlayerControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA439A7525E8054A00FE9150 /* VideoPlayerControlsView.swift */; };
CA439A9025E80EE400FE9150 /* VideoPlayerTrackbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA439A8F25E80EE400FE9150 /* VideoPlayerTrackbar.swift */; };
CA9A22FE26A71ADA00923D70 /* PlaylistPopoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA9A22FD26A71ADA00923D70 /* PlaylistPopoverView.swift */; };
CA9A230026A7370C00923D70 /* FontScaling.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA9A22FF26A7370C00923D70 /* FontScaling.swift */; };
CA9A233426B97B4300923D70 /* PlaylistMenuButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA9A233326B97B4300923D70 /* PlaylistMenuButton.swift */; };
CA9A234126B97B8400923D70 /* MenuButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA9A234026B97B8400923D70 /* MenuButton.swift */; };
CAA10597266FE94700A0372D /* RecentSearchQRCodeScannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAA1058B266FE94700A0372D /* RecentSearchQRCodeScannerController.swift */; };
CAB127632639F37C00BBFC75 /* RecentSearches.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAB127622639F37C00BBFC75 /* RecentSearches.swift */; };
CAB127652639FB7000BBFC75 /* RecentSearchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAB127642639FB7000BBFC75 /* RecentSearchCell.swift */; };
CAB54B8626A5BFA800F08BF3 /* PlaylistURLBarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAB54B8526A5BFA800F08BF3 /* PlaylistURLBarButton.swift */; };
CAC2CB402644488600BB8D36 /* RecentSearchHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAC2CB3F2644488600BB8D36 /* RecentSearchHeaderView.swift */; };
CAC2CB4D2644496400BB8D36 /* RecentSearchClipboardHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAC2CB4C2644496400BB8D36 /* RecentSearchClipboardHeaderView.swift */; };
CE7F11941F3CEEC800ABFC0B /* RemoteDevices.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE7F115E1F3CCEF900ABFC0B /* RemoteDevices.swift */; };
Expand Down Expand Up @@ -2447,7 +2451,6 @@
5E8CD8E023D5E3D100548FC0 /* libarchive.2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libarchive.2.tbd; path = usr/lib/libarchive.2.tbd; sourceTree = SDKROOT; };
5E9288C922DF864C007BE7A6 /* TabSessionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabSessionTests.swift; sourceTree = "<group>"; };
5E99C88A25C83BE3003F30B4 /* PlaylistManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistManager.swift; sourceTree = "<group>"; };
5E99CAAF25CC610B003F30B4 /* PlaylistToast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistToast.swift; sourceTree = "<group>"; };
5E99CDAC25DC70E6003F30B4 /* HLSThumbnailGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HLSThumbnailGenerator.swift; sourceTree = "<group>"; };
5E99CDEF25DD8C81003F30B4 /* PlaylistDownloadManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistDownloadManager.swift; sourceTree = "<group>"; };
5E9B28EA255047C80072E655 /* BookmarkModelStateObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkModelStateObserver.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2530,9 +2533,14 @@
CA439A5825E6F29D00FE9150 /* VideoPlayerInfoBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoPlayerInfoBar.swift; sourceTree = "<group>"; };
CA439A7525E8054A00FE9150 /* VideoPlayerControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoPlayerControlsView.swift; sourceTree = "<group>"; };
CA439A8F25E80EE400FE9150 /* VideoPlayerTrackbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoPlayerTrackbar.swift; sourceTree = "<group>"; };
CA9A22FD26A71ADA00923D70 /* PlaylistPopoverView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistPopoverView.swift; sourceTree = "<group>"; };
CA9A22FF26A7370C00923D70 /* FontScaling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontScaling.swift; sourceTree = "<group>"; };
CA9A233326B97B4300923D70 /* PlaylistMenuButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistMenuButton.swift; sourceTree = "<group>"; };
CA9A234026B97B8400923D70 /* MenuButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuButton.swift; sourceTree = "<group>"; };
CAA1058B266FE94700A0372D /* RecentSearchQRCodeScannerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentSearchQRCodeScannerController.swift; sourceTree = "<group>"; };
CAB127622639F37C00BBFC75 /* RecentSearches.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentSearches.swift; sourceTree = "<group>"; };
CAB127642639FB7000BBFC75 /* RecentSearchCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentSearchCell.swift; sourceTree = "<group>"; };
CAB54B8526A5BFA800F08BF3 /* PlaylistURLBarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistURLBarButton.swift; sourceTree = "<group>"; };
CAC2CB3F2644488600BB8D36 /* RecentSearchHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentSearchHeaderView.swift; sourceTree = "<group>"; };
CAC2CB4C2644496400BB8D36 /* RecentSearchClipboardHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentSearchClipboardHeaderView.swift; sourceTree = "<group>"; };
CE7F115E1F3CCEF900ABFC0B /* RemoteDevices.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoteDevices.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4575,6 +4583,7 @@
E4CD9F2C1A6DC91200318571 /* TabLocationView.swift */,
0AB2442B22AA789B00B4D9DD /* ReaderModeButton.swift */,
0AE5C09822CAA01E00DFF3EE /* RewardsButton.swift */,
CAB54B8526A5BFA800F08BF3 /* PlaylistURLBarButton.swift */,
);
path = UrlBar;
sourceTree = "<group>";
Expand Down Expand Up @@ -4768,8 +4777,9 @@
5E5E6E4425BA04120035B6A0 /* VideoPlayer */,
5E5E6E3925BA03510035B6A0 /* PlaylistViewController.swift */,
5E5E6F1425BA8DD70035B6A0 /* PlaylistMediaInfo.swift */,
5E99CAAF25CC610B003F30B4 /* PlaylistToast.swift */,
5E824A33260BC6CA00127F36 /* BrowserViewController+Playlist.swift */,
CA9A22FD26A71ADA00923D70 /* PlaylistPopoverView.swift */,
CA9A22FF26A7370C00923D70 /* FontScaling.swift */,
);
path = Playlist;
sourceTree = "<group>";
Expand Down Expand Up @@ -4866,6 +4876,7 @@
0AEF99A822E22C5E00294C76 /* DownloadsViewController.swift */,
27AE360C25E55AA200E795E5 /* MenuViewController.swift */,
277E94F125F834240001926E /* VPNMenuButton.swift */,
CA9A233326B97B4300923D70 /* PlaylistMenuButton.swift */,
);
path = Menu;
sourceTree = "<group>";
Expand Down Expand Up @@ -5056,6 +5067,7 @@
59A68B1F857A8638598A63A0 /* TwoLineCell.swift */,
D863C8E31F68BFC20058D95F /* GradientProgressBar.swift */,
5E1645A724ABA35B0003C3B2 /* SpinnerView.swift */,
CA9A234026B97B8400923D70 /* MenuButton.swift */,
);
path = Widgets;
sourceTree = "<group>";
Expand Down Expand Up @@ -7003,6 +7015,7 @@
278C700A24F96D7000A246C8 /* BraveShieldsAndPrivacySettingsController.swift in Sources */,
27D114D42358FBBF00166534 /* BraveRewardsSettingsViewController.swift in Sources */,
27036F8725684F64004EF6B6 /* Cryptography.swift in Sources */,
CAB54B8626A5BFA800F08BF3 /* PlaylistURLBarButton.swift in Sources */,
2746D27124A2A12700E38852 /* RewardsInternalsPromotionListController.swift in Sources */,
0A4BEFDA221EF3360005551A /* NetworkResourceType.swift in Sources */,
4422D4B921BFFB7600BF1855 /* crc32c.cc in Sources */,
Expand Down Expand Up @@ -7090,6 +7103,7 @@
0A55E53A2434EEB60069F06A /* EnableVPNPopupViewController.swift in Sources */,
0A3C78A3230597F10022F6D8 /* OnboardingShieldsView.swift in Sources */,
4422D4E221BFFB7600BF1855 /* format.cc in Sources */,
CA9A233426B97B4300923D70 /* PlaylistMenuButton.swift in Sources */,
39F819C61FD70F5D009E31E4 /* TabEventHandlers.swift in Sources */,
4422D50B21BFFB7600BF1855 /* memenv.cc in Sources */,
0A0D3D6121A596BE00BEE65B /* MalwareList.swift in Sources */,
Expand Down Expand Up @@ -7144,8 +7158,8 @@
E4CD9F2D1A6DC91200318571 /* TabLocationView.swift in Sources */,
4452CAF0255412800053EFE6 /* DefaultBrowserIntroCalloutViewController.swift in Sources */,
0BB5B2881AC0A2B90052877D /* SnackBar.swift in Sources */,
CA9A234126B97B8400923D70 /* MenuButton.swift in Sources */,
27A1AC0224855C1700344503 /* FeedItemView.swift in Sources */,
5E99CAB025CC610B003F30B4 /* PlaylistToast.swift in Sources */,
27036F9B25684F9F004EF6B6 /* AdsNotificationHandler.swift in Sources */,
7BEFC6801BFF68C30059C952 /* QuickActions.swift in Sources */,
0A0D3D5221A565C300BEE65B /* SafeBrowsingHandler.swift in Sources */,
Expand Down Expand Up @@ -7209,6 +7223,7 @@
0AF4C59424F8003A00E500DD /* NTPDefaultBrowserCalloutProvider.swift in Sources */,
C4EFEECF1CEBB6F2009762A4 /* BackForwardTableViewCell.swift in Sources */,
E689C7301E0C7617008BAADB /* NSAttributedStringExtensions.swift in Sources */,
CA9A230026A7370C00923D70 /* FontScaling.swift in Sources */,
27036F9A25684F9F004EF6B6 /* AdView.swift in Sources */,
27A1AC0C2485A1C200344503 /* FeedDataSource.swift in Sources */,
0AE5C69424F005F9004CBC9B /* OnboardingPrivacyConsentView.swift in Sources */,
Expand Down Expand Up @@ -7345,6 +7360,7 @@
270A0F392605267D0091D880 /* LegacyWalletTransferStatusButton.swift in Sources */,
4422D4DF21BFFB7600BF1855 /* table_builder.cc in Sources */,
27448536245B608E001920B5 /* QRCodePopupView.swift in Sources */,
CA9A22FE26A71ADA00923D70 /* PlaylistPopoverView.swift in Sources */,
4422D50121BFFB7600BF1855 /* repair.cc in Sources */,
E660BDD91BB06521009AC090 /* TabsButton.swift in Sources */,
2FA01E5D25F2C93800103D67 /* ShieldsActivityItemSourceProvider.swift in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions Client/Application/ClientPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ extension Preferences {
static let listViewSide = Option<String>(key: "playlist.listViewSide", default: PlayListSide.left.rawValue)
/// Whether to show Add to playlist Toast
static let showToastForAdd = Option<Bool>(key: "playlist.showToastForAdd", default: true)
/// Whether to show the Add to Playlist URL-Bar onboarding
static let showAddToPlaylistURLBarOnboarding = Option<Bool>(key: "playlist.showAddToPlaylistURLBarOnboarding", default: true)
/// The last played item url
static let lastPlayedItemUrl = Option<String?>(key: "playlist.last.played.item.url", default: nil)
/// The last played item time
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a1b7adf

Please sign in to comment.