Skip to content

Commit

Permalink
修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
豆子 authored and 豆子 committed Dec 2, 2022
1 parent 48fe839 commit bb5f7e2
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Love Browser.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,12 @@
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Love-Browser-Info.plist";
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "App需要您的同意,才能访问相册";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UIUserInterfaceStyle = UIUserInterfaceStyleLight;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -558,12 +558,12 @@
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Love-Browser-Info.plist";
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "App需要您的同意,才能访问相册";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UIUserInterfaceStyle = UIUserInterfaceStyleLight;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
Binary file not shown.
8 changes: 7 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
var clickBookMarkCell:(String) -> Void

@FetchRequest(fetchRequest: BookMarkCategory.all) private var bookMarkCategorys:FetchedResults<BookMarkCategory>

Expand Down Expand Up @@ -42,6 +43,9 @@ struct BookMarkView: View {
.padding(.leading,20)
Text(bookMarkCategory.title ?? "")
.padding(.leading,10)
}.onTapGesture {
clickBookMarkCell(bookMarkCategory.url!)
presentationMode.wrappedValue.dismiss()
}

}
Expand Down Expand Up @@ -112,6 +116,8 @@ struct BookMarkView: View {

struct BookMarkView_Previews: PreviewProvider {
static var previews: some View {
BookMarkView()
BookMarkView { url in

}
}
}
13 changes: 11 additions & 2 deletions Love Browser/Views/BottomBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct BottomBar: View {
var openTabsView:() -> Void // open tabs 标签页
var saveBookMarkCategory:() -> Void
var openNewTabs:() -> Void
var clickHistoryCell:(String) -> Void

var showHome = false

Expand Down Expand Up @@ -186,13 +187,17 @@ struct BottomBar: View {

} content: {

HistoryView()
HistoryView { url in
clickHistoryOrBookMarkCell(url: url)
}
}
.fullScreenCover(isPresented: $openBookMark) {

} content: {

BookMarkView()
BookMarkView { url in
clickHistoryOrBookMarkCell(url: url)
}
}
.fullScreenCover(isPresented: $openSetting) {

Expand All @@ -209,6 +214,10 @@ struct BottomBar: View {
.padding([.horizontal,.top])

}

func clickHistoryOrBookMarkCell(url: String) {
clickHistoryCell(url)
}

}

Expand Down
7 changes: 6 additions & 1 deletion Love Browser/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ struct ContentView: View {
showSearchIcon = true
tabManagerModel.addTab()

},showHome: isSearch)
}, clickHistoryCell: { url in

currentModel.isDesktop = false
currentModel.updateUrl(url: url)

} ,showHome: isSearch)
}

}
Expand Down
10 changes: 9 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
var clickHistoryCell:(String) -> Void


@FetchRequest(fetchRequest: SearchHistoryCategory.all) private var searchHistoryCategorys:FetchedResults<SearchHistoryCategory>
Expand Down Expand Up @@ -55,6 +56,10 @@ struct HistoryView: View {
.lineLimit(1)
.padding(.trailing,20)
}
.onTapGesture {
clickHistoryCell(searchHistoryCategory.url!)
presentationMode.wrappedValue.dismiss()
}

}

Expand Down Expand Up @@ -150,6 +155,9 @@ struct HistoryView: View {

struct HistoryView_Previews: PreviewProvider {
static var previews: some View {
HistoryView().environment(\.managedObjectContext, CoreDataManager.shared.persistentContainer.viewContext)
HistoryView(clickHistoryCell: { url in

})
.environment(\.managedObjectContext, CoreDataManager.shared.persistentContainer.viewContext)
}
}
2 changes: 0 additions & 2 deletions Love-Browser-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSPhotoLibraryLimitedAccessAPISupport</key>
<true/>
<key>UIAppFonts</key>
<array>
<string></string>
Expand Down

0 comments on commit bb5f7e2

Please sign in to comment.