Skip to content

Commit

Permalink
改动页面布局
Browse files Browse the repository at this point in the history
  • Loading branch information
豆子 authored and 豆子 committed Nov 22, 2022
1 parent 48e8305 commit a382c59
Show file tree
Hide file tree
Showing 50 changed files with 556 additions and 601 deletions.
24 changes: 12 additions & 12 deletions Love Browser.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
171AED0E292B1CA3006C08F2 /* WebViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 171AED0D292B1CA3006C08F2 /* WebViewModel.swift */; };
171AED10292BC801006C08F2 /* KeyboardHeightHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 171AED0F292BC801006C08F2 /* KeyboardHeightHelper.swift */; };
171E435A291E3556007D1648 /* LBTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 171E4359291E3556007D1648 /* LBTextField.swift */; };
171E436D291F815B007D1648 /* MenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 171E436C291F815B007D1648 /* MenuView.swift */; };
171E436F291FA434007D1648 /* BookMarkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 171E436E291FA434007D1648 /* BookMarkView.swift */; };
Expand All @@ -24,8 +26,7 @@
177EE23B2922AD9800CCACEB /* DarkTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177EE23A2922AD9800CCACEB /* DarkTheme.swift */; };
177EE24229236F3100CCACEB /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177EE24129236F3100CCACEB /* String+Extensions.swift */; };
177EE2442923767F00CCACEB /* SearchWordsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177EE2432923767F00CCACEB /* SearchWordsView.swift */; };
177EE246292390B100CCACEB /* HomeWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177EE245292390B100CCACEB /* HomeWebView.swift */; };
177EE2482923939B00CCACEB /* HomeSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177EE2472923939B00CCACEB /* HomeSearchView.swift */; };
177EE2482923939B00CCACEB /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177EE2472923939B00CCACEB /* SearchView.swift */; };
177EE24C2923B2C800CCACEB /* MaskView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177EE24B2923B2C800CCACEB /* MaskView.swift */; };
177EE24F2923B75800CCACEB /* HomePageCategory+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177EE24E2923B75800CCACEB /* HomePageCategory+CoreDataClass.swift */; };
177EE27E2923DD6C00CCACEB /* DataBase.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 177EE27C2923DD6C00CCACEB /* DataBase.xcdatamodeld */; };
Expand All @@ -38,14 +39,15 @@
1780EE4D291916EC006B9FFC /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1780EE4C291916EC006B9FFC /* Persistence.swift */; };
1780EE50291916EC006B9FFC /* Love_Browser.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 1780EE4E291916EC006B9FFC /* Love_Browser.xcdatamodeld */; };
1780EE5D29191783006B9FFC /* BottomBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1780EE5729191783006B9FFC /* BottomBar.swift */; };
1780EE5E29191783006B9FFC /* WebSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1780EE5829191783006B9FFC /* WebSearchView.swift */; };
1780EE5F29191783006B9FFC /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1780EE5929191783006B9FFC /* WebView.swift */; };
1780EE6029191783006B9FFC /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1780EE5A29191783006B9FFC /* ContentView.swift */; };
1780EE6129191783006B9FFC /* HomePageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1780EE5B29191783006B9FFC /* HomePageView.swift */; };
1780EE6329192D9D006B9FFC /* HistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1780EE6229192D9D006B9FFC /* HistoryView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
171AED0D292B1CA3006C08F2 /* WebViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewModel.swift; sourceTree = "<group>"; };
171AED0F292BC801006C08F2 /* KeyboardHeightHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardHeightHelper.swift; sourceTree = "<group>"; };
171E4359291E3556007D1648 /* LBTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LBTextField.swift; sourceTree = "<group>"; };
171E436C291F815B007D1648 /* MenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuView.swift; sourceTree = "<group>"; };
171E436E291FA434007D1648 /* BookMarkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookMarkView.swift; sourceTree = "<group>"; };
Expand All @@ -63,8 +65,7 @@
177EE23A2922AD9800CCACEB /* DarkTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DarkTheme.swift; sourceTree = "<group>"; };
177EE24129236F3100CCACEB /* String+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = "<group>"; };
177EE2432923767F00CCACEB /* SearchWordsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchWordsView.swift; sourceTree = "<group>"; };
177EE245292390B100CCACEB /* HomeWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeWebView.swift; sourceTree = "<group>"; };
177EE2472923939B00CCACEB /* HomeSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeSearchView.swift; sourceTree = "<group>"; };
177EE2472923939B00CCACEB /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; };
177EE24B2923B2C800CCACEB /* MaskView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaskView.swift; sourceTree = "<group>"; };
177EE24E2923B75800CCACEB /* HomePageCategory+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HomePageCategory+CoreDataClass.swift"; sourceTree = "<group>"; };
177EE27D2923DD6C00CCACEB /* DataBase.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = DataBase.xcdatamodel; sourceTree = "<group>"; };
Expand All @@ -78,7 +79,6 @@
1780EE4C291916EC006B9FFC /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = "<group>"; };
1780EE4F291916EC006B9FFC /* Love_Browser.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Love_Browser.xcdatamodel; sourceTree = "<group>"; };
1780EE5729191783006B9FFC /* BottomBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomBar.swift; sourceTree = "<group>"; };
1780EE5829191783006B9FFC /* WebSearchView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebSearchView.swift; sourceTree = "<group>"; };
1780EE5929191783006B9FFC /* WebView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = "<group>"; };
1780EE5A29191783006B9FFC /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
1780EE5B29191783006B9FFC /* HomePageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomePageView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -136,12 +136,11 @@
children = (
1780EE5A29191783006B9FFC /* ContentView.swift */,
1780EE5B29191783006B9FFC /* HomePageView.swift */,
177EE2472923939B00CCACEB /* HomeSearchView.swift */,
177EE245292390B100CCACEB /* HomeWebView.swift */,
1780EE5829191783006B9FFC /* WebSearchView.swift */,
177EE2472923939B00CCACEB /* SearchView.swift */,
171E4359291E3556007D1648 /* LBTextField.swift */,
177EE2432923767F00CCACEB /* SearchWordsView.swift */,
1780EE5929191783006B9FFC /* WebView.swift */,
171AED0D292B1CA3006C08F2 /* WebViewModel.swift */,
1780EE5729191783006B9FFC /* BottomBar.swift */,
1780EE6229192D9D006B9FFC /* HistoryView.swift */,
171E436E291FA434007D1648 /* BookMarkView.swift */,
Expand All @@ -156,6 +155,7 @@
isa = PBXGroup;
children = (
177EE24B2923B2C800CCACEB /* MaskView.swift */,
171AED0F292BC801006C08F2 /* KeyboardHeightHelper.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -330,8 +330,10 @@
1767786C2927765100EDF706 /* LBAsyncImage.swift in Sources */,
171E435A291E3556007D1648 /* LBTextField.swift in Sources */,
171E4379292246A6007D1648 /* CoreDataManager.swift in Sources */,
171AED10292BC801006C08F2 /* KeyboardHeightHelper.swift in Sources */,
171E4371291FA810007D1648 /* TabsView.swift in Sources */,
171E437F2922A7F8007D1648 /* Theme.swift in Sources */,
171AED0E292B1CA3006C08F2 /* WebViewModel.swift in Sources */,
1767786A2927420B00EDF706 /* Color+Extentions.swift in Sources */,
177EE23B2922AD9800CCACEB /* DarkTheme.swift in Sources */,
1780EE50291916EC006B9FFC /* Love_Browser.xcdatamodeld in Sources */,
Expand All @@ -341,16 +343,14 @@
177EE24C2923B2C800CCACEB /* MaskView.swift in Sources */,
177EE2392922AD8A00CCACEB /* LightTheme.swift in Sources */,
177EE2862923F00B00CCACEB /* SearchHistoryCategory+CoreDataClass.swift in Sources */,
177EE2482923939B00CCACEB /* HomeSearchView.swift in Sources */,
177EE2482923939B00CCACEB /* SearchView.swift in Sources */,
177EE24F2923B75800CCACEB /* HomePageCategory+CoreDataClass.swift in Sources */,
1780EE5D29191783006B9FFC /* BottomBar.swift in Sources */,
171E437B29224D75007D1648 /* HomePageItemModel.swift in Sources */,
1780EE5E29191783006B9FFC /* WebSearchView.swift in Sources */,
177EE24229236F3100CCACEB /* String+Extensions.swift in Sources */,
171E436D291F815B007D1648 /* MenuView.swift in Sources */,
177EE2802923DE0B00CCACEB /* SearchWordsCategory+CoreDataClass.swift in Sources */,
1780EE6329192D9D006B9FFC /* HistoryView.swift in Sources */,
177EE246292390B100CCACEB /* HomeWebView.swift in Sources */,
1780EE6129191783006B9FFC /* HomePageView.swift in Sources */,
1780EE5F29191783006B9FFC /* WebView.swift in Sources */,
17677864292677AF00EDF706 /* TabsModel.swift in Sources */,
Expand Down
Binary file not shown.
Binary file modified Love Browser/.DS_Store
Binary file not shown.
Binary file modified Love Browser/Assets.xcassets/.DS_Store
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions Love Browser/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
"size" : "40x40"
},
{
"filename" : "[email protected]",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "[email protected]",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
Expand Down
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.
2 changes: 1 addition & 1 deletion Love Browser/Assets.xcassets/QRCode.imageset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "QRCode.pdf",
"filename" : "QRCode@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Binary file not shown.
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
Expand Up @@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "addHomePage.pdf",
"filename" : "addHomePage@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Binary file not shown.
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
Expand Up @@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "menu.pdf",
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Love Browser/Assets.xcassets/more.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"images" : [
{
"filename" : "more.pdf",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Binary file removed Love Browser/Assets.xcassets/more.imageset/more.pdf
Binary file not shown.
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
@@ -1,11 +1,11 @@
{
"images" : [
{
"filename" : "refresh.pdf",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Binary file not shown.
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
Expand Up @@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "searchOnPage.pdf",
"filename" : "searchOnPage@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Binary file not shown.
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
Expand Up @@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "tabs.pdf",
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Love Browser/Assets.xcassets/vector.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"images" : [
{
"filename" : "vector.pdf",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 6 additions & 8 deletions Love Browser/DataBase.xcdatamodeld/DataBase.xcdatamodel/contents
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="19574" systemVersion="21E258" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21279" systemVersion="22A400" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="BookMarkCategory" representedClassName="BookMarkCategory" syncable="YES" codeGenerationType="category">
<attribute name="title" attributeType="String"/>
<attribute name="url" attributeType="String"/>
Expand All @@ -16,12 +16,10 @@
</entity>
<entity name="SearchWordsCategory" representedClassName="SearchWordsCategory" syncable="YES" codeGenerationType="category">
<attribute name="title" attributeType="String"/>
<attribute name="url" attributeType="String"/>
<uniquenessConstraints>
<uniquenessConstraint>
<constraint value="title"/>
</uniquenessConstraint>
</uniquenessConstraints>
</entity>
<elements>
<element name="HomePageCategory" positionX="-18" positionY="27" width="128" height="74"/>
<element name="SearchWordsCategory" positionX="36" positionY="108" width="128" height="59"/>
<element name="SearchHistoryCategory" positionX="9" positionY="81" width="128" height="74"/>
<element name="BookMarkCategory" positionX="18" positionY="90" width="128" height="59"/>
</elements>
</model>
1 change: 1 addition & 0 deletions Love Browser/Extentions/Color+Extentions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public extension Color {
static let lb_gray = Color.init(0x919191)
static let lb_black = Color.init(0x222222)
static let lb_item = Color.init(0xF5F5F7)
static let lb_history = Color.init(0xF4F4F4)

}

Expand Down
4 changes: 2 additions & 2 deletions Love Browser/Love_BrowserApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import CryptoKit
@main

struct Love_BrowserApp: App {

var body: some Scene {

WindowGroup {

ContentView()
ContentView(tabsBarView: TabsView())
.environment(\.managedObjectContext, CoreDataManager.shared.persistentContainer.viewContext)


Expand Down
2 changes: 1 addition & 1 deletion Love Browser/Managers/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TabManager {

private(set) var model: TabsModel

private var tabControllerCache = [HomeWebView]()
private var tabControllerCache = [TabsView]()

init(model: TabsModel) {
self.model = model
Expand Down
42 changes: 42 additions & 0 deletions Love Browser/Utils/KeyboardHeightHelper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// KeyboardHeightHelper.swift
// Love Browser
//
// Created by 豆子 on 2022/11/21.
//

import SwiftUI
import Foundation

// 创建 KeyboardHeightHelper类,并且实现ObservableObject接口
class KeyboardHeightHelper: ObservableObject {

// 键盘高度
@Published var keyboardHeight: CGFloat = 0
private func listenForKeyboardNotifications() {

// 监听键盘弹出事件
NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillShowNotification,
object: nil,
queue: .main) { (notification) in
guard let userInfo = notification.userInfo,
let keyboardRect = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else { return }
// print(keyboardRect.height)
self.keyboardHeight = keyboardRect.height
// 通过NotificationCenter把键盘弹出的事件传递出去,SwiftUI可以通过onReceive监听接收到通知。
// NotificationCenter.default.post(name: .editBegin, object: nil, userInfo: nil)
}
// 监听键盘关闭事件
NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillHideNotification,
object: nil,
queue: .main) { (notification) in
self.keyboardHeight = 0
// 通过NotificationCenter把键盘弹出的事件传递出去,SwiftUI可以通过onReceive监听接收到通知。
// NotificationCenter.default.post(name: .editEnd, object: nil, userInfo: nil)
}
}

init() {
self.listenForKeyboardNotifications()
}
}
12 changes: 5 additions & 7 deletions Love Browser/Views/BottomBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ struct BottomBar: View {
var openTabsView:() -> Void // open tabs 标签页
var saveBookMarkCategory:() -> Void

@Binding var canBack: Bool
@Binding var canForward: Bool
@Binding var showHome: Bool
var canBack = false
var canForward = false
var showHome = false
@State var hasBackground = false

// bottom
Expand Down Expand Up @@ -73,8 +73,7 @@ struct BottomBar: View {
}

Button {



clickHomeButton()

} label: {
Expand Down Expand Up @@ -179,7 +178,6 @@ struct BottomBar: View {
}

}
.frame(maxWidth:.infinity)

}
.frame(height: 30)
Expand Down Expand Up @@ -208,7 +206,7 @@ struct BottomBar_Previews: PreviewProvider {

}, saveBookMarkCategory: {

}, canBack: $showHome, canForward: $showHome, showHome: $showHome)
}, canBack: false, canForward: false , showHome: false)

}
}
Expand Down
Loading

0 comments on commit a382c59

Please sign in to comment.