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

Remove Favorites section header from NTP #3381

Merged
merged 5 commits into from
Sep 25, 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
2 changes: 0 additions & 2 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,6 @@ extension Pixel {
case newTabPageMessageDismissed

case newTabPageFavoritesPlaceholderTapped
case newTabPageFavoritesInfoTooltip

case newTabPageFavoritesSeeMore
case newTabPageFavoritesSeeLess
Expand Down Expand Up @@ -1581,7 +1580,6 @@ extension Pixel.Event {
case .newTabPageMessageDismissed: return "m_new_tab_page_message_dismissed"

case .newTabPageFavoritesPlaceholderTapped: return "m_new_tab_page_favorites_placeholder_click"
case .newTabPageFavoritesInfoTooltip: return "m_new_tab_page_favorites_info_tooltip"

case .newTabPageFavoritesSeeMore: return "m_new_tab_page_favorites_see_more"
case .newTabPageFavoritesSeeLess: return "m_new_tab_page_favorites_see_less"
Expand Down
44 changes: 12 additions & 32 deletions DuckDuckGo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// AddFavoritePlaceholderItemView.swift
// FavoriteAddItemView.swift
// DuckDuckGo
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
Expand All @@ -20,7 +20,7 @@
import SwiftUI
import DesignResourcesKit

struct AddFavoritePlaceholderItemView: View {
struct FavoriteAddItemView: View {
var body: some View {
RoundedRectangle(cornerRadius: 8, style: .continuous)
.fill(.clear)
Expand All @@ -33,6 +33,6 @@ struct AddFavoritePlaceholderItemView: View {
}

#Preview {
AddFavoritePlaceholderItemView()
FavoriteAddItemView()
.frame(width: 100)
}
5 changes: 4 additions & 1 deletion DuckDuckGo/FavoriteItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import UniformTypeIdentifiers
enum FavoriteItem {
case favorite(Favorite)
case addFavorite
case placeholder(_ id: String)
}

extension FavoriteItem: Identifiable {
Expand All @@ -32,6 +33,8 @@ extension FavoriteItem: Identifiable {
return favorite.id
case .addFavorite:
return "addFavorite"
case .placeholder(let id):
return id
}
}
}
Expand All @@ -43,7 +46,7 @@ extension FavoriteItem: Reorderable {
let itemProvider = NSItemProvider(object: (favorite.urlObject?.absoluteString ?? "") as NSString)
let metadata = MoveMetadata(itemProvider: itemProvider, type: .plainText)
return .movable(metadata)
case .addFavorite:
case .addFavorite, .placeholder:
return .stationary
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// FavoriteEmptyStateItem.swift
// FavoritePlaceholderItemView.swift
// DuckDuckGo
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
Expand All @@ -19,7 +19,7 @@

import SwiftUI

struct FavoriteEmptyStateItem: View {
struct FavoritePlaceholderItemView: View {
var body: some View {
RoundedRectangle(cornerRadius: 8, style: .continuous)
.stroke(Color(designSystemColor: .lines),
Expand All @@ -29,5 +29,5 @@ struct FavoriteEmptyStateItem: View {
}

#Preview {
FavoriteEmptyStateItem()
FavoritePlaceholderItemView()
}
218 changes: 0 additions & 218 deletions DuckDuckGo/FavoritesDefaultViewModel.swift

This file was deleted.

78 changes: 0 additions & 78 deletions DuckDuckGo/FavoritesEmptyStateView.swift

This file was deleted.

2 changes: 1 addition & 1 deletion DuckDuckGo/FavoritesPreviewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Combine
import Bookmarks
import Foundation

final class FavoritesPreviewModel: FavoritesDefaultViewModel {
final class FavoritesPreviewModel: FavoritesViewModel {
init(favorites: [Favorite] = randomFavorites) {
super.init(favoriteDataSource: FavoritesPreviewDataSource(favorites: favorites), faviconLoader: EmptyFaviconLoading())
}
Expand Down
Loading
Loading