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

Fix new tab page fire glitch #521

Merged
merged 1 commit into from
Apr 11, 2022
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
4 changes: 4 additions & 0 deletions DuckDuckGo/Home Page/Model/HomePageRecentlyVisitedModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ final class RecentlyVisitedSiteModel: ObservableObject {
@Published var numberOfTrackersBlocked = 0
@Published var trackersFound = false

// These are used by the burning animation
@Published var isBurning = false
@Published var isHidden = false

init(domain: String, bookmarkManager: BookmarkManager = LocalBookmarkManager.shared) {
self.domain = domain
if let url = domain.url {
Expand Down
14 changes: 6 additions & 8 deletions DuckDuckGo/Home Page/View/RecentlyVisitedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ struct RecentlyVisitedSite: View {
@ObservedObject var site: HomePage.Models.RecentlyVisitedSiteModel

@State var isHovering = false
@State var isBurning = false
@State var isHidden = false

var body: some View {
ZStack(alignment: .top) {
Expand Down Expand Up @@ -141,7 +139,7 @@ struct RecentlyVisitedSite: View {

}
.padding([.leading, .trailing, .top], 12)
.visibility(isHidden ? .invisible : .visible)
.visibility(site.isHidden ? .invisible : .visible)

HStack(spacing: 2) {

Expand All @@ -155,9 +153,9 @@ struct RecentlyVisitedSite: View {

HoverButton(size: 24, imageName: "Burn", imageSize: 16, cornerRadius: 4) {
isHovering = false
isBurning = true
site.isBurning = true
withAnimation(.default.delay(0.4)) {
isHidden = true
site.isHidden = true
}
}
.foregroundColor(Color("HomeFeedItemButtonTintColor"))
Expand All @@ -166,15 +164,15 @@ struct RecentlyVisitedSite: View {
}
.padding(.trailing, 12)
.padding(.top, 13)
.visibility(isHidden ? .invisible : .visible)
.visibility(site.isHidden ? .invisible : .visible)

FireAnimation()
.cornerRadius(8)
.visibility(isBurning ? .visible : .gone)
.visibility(site.isBurning ? .visible : .gone)
.zIndex(100)
.onAppear {
withAnimation(.default.delay(1.0)) {
isBurning = false
site.isBurning = false
}
}
.onDisappear {
Expand Down