Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
豆子 authored and 豆子 committed Dec 5, 2022
1 parent 2a47b44 commit 8bed00a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 8 deletions.
Binary file not shown.
13 changes: 12 additions & 1 deletion Love Browser/Views/BookMarkView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct BookMarkView: View {
@Environment(\.presentationMode) var presentationMode
@Environment(\.managedObjectContext) private var viewContext
@State private var presentAlert = false
@State private var offset = CGSize.zero
var clickBookMarkCell:(String) -> Void

@FetchRequest(fetchRequest: BookMarkCategory.all) private var bookMarkCategorys:FetchedResults<BookMarkCategory>
Expand Down Expand Up @@ -91,7 +92,17 @@ struct BookMarkView: View {
}

}
}
}.gesture( DragGesture()
.onChanged { gesture in
offset = gesture.translation
}
.onEnded { _ in
if offset.width > 50 {
presentationMode.wrappedValue.dismiss()
} else {
offset = .zero
}
})

}

Expand Down
10 changes: 7 additions & 3 deletions Love Browser/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ struct ContentView: View {

currentModel.updatePreviewImage()

if title != "" && url != "" {
if url == "about:blank" {
text = ""
}

if title != "" && url != "" && url != "about:blank" {
saveSearchHistoryCategory(title: title, url: url)
}

Expand Down Expand Up @@ -274,8 +278,8 @@ struct ContentView: View {
if #available(iOS 15.0, *) {
currentModel.webViewModel.webView.pauseAllMediaPlayback()
} else {
// Fallback on earlier versions
// currentModel.updateUrl(url: "about:blank")
// on earlier versions
currentModel.webViewModel.webView.load(URLRequest(url: URL(string: "about:blank")!))
}
}

Expand Down
14 changes: 13 additions & 1 deletion Love Browser/Views/HistoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct HistoryView: View {
@Environment(\.presentationMode) var presentationMode
@Environment(\.managedObjectContext) private var viewContext
@State private var presentAlert = false
@State private var offset = CGSize.zero
var clickHistoryCell:(String) -> Void


Expand Down Expand Up @@ -122,7 +123,18 @@ struct HistoryView: View {

}

}
}.gesture( DragGesture()
.onChanged { gesture in
offset = gesture.translation
}
.onEnded { _ in
if offset.width > 50 {
presentationMode.wrappedValue.dismiss()
} else {
offset = .zero
}
})


}

Expand Down
19 changes: 16 additions & 3 deletions Love Browser/Views/TabsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct TabsView: View {
@Environment(\.presentationMode) var presentationMode
@EnvironmentObject var tabManagerModel: TabManagerModel

@State private var offset = CGSize.zero
var openNewTabs:() -> Void

let gridWidth = (UIScreen.main.bounds.width - 45) / 2
Expand Down Expand Up @@ -51,7 +52,8 @@ struct TabsView: View {
} label: {

Image("deleteTab")
.frame(width: 16, height: 16)
.aspectRatio(contentMode: .fit)
.frame(width: 20, height: 20)
}
.buttonStyle(BorderlessButtonStyle())
.padding(.top, 10)
Expand Down Expand Up @@ -83,7 +85,8 @@ struct TabsView: View {
.padding(.top,24)

}
.background(Color.lb_history)
.background(Color.lb_history)
.padding(.top, 1)

HStack {

Expand Down Expand Up @@ -126,7 +129,17 @@ struct TabsView: View {
}
}

}
}.gesture( DragGesture()
.onChanged { gesture in
offset = gesture.translation
}
.onEnded { _ in
if offset.width > 50 {
presentationMode.wrappedValue.dismiss()
} else {
offset = .zero
}
})

}

Expand Down

0 comments on commit 8bed00a

Please sign in to comment.