fix view
This commit is contained in:
parent
d0209d298b
commit
3463e9b7b2
14
TODO.md
Normal file
14
TODO.md
Normal file
@ -0,0 +1,14 @@
|
||||
## 增加接口
|
||||
|
||||
### 1. 获取用户的关注数
|
||||
GET: /api/follow_num?user_id=$user_id
|
||||
|
||||
### 2. 保存用户的设备token
|
||||
url: /api/device_token
|
||||
method: post
|
||||
params:
|
||||
{
|
||||
user_id: string,
|
||||
token: string
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
C85F58C02D64D10F00D761E9 /* dimensionhub.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = dimensionhub.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C85F58D22D64D11000D761E9 /* dimensionhubTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = dimensionhubTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C85F58DC2D64D11000D761E9 /* dimensionhubUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = dimensionhubUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C8E6E2052DAF4A130014CDB3 /* TODO.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = TODO.md; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||
@ -88,6 +89,7 @@
|
||||
C85F58B72D64D10F00D761E9 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C8E6E2052DAF4A130014CDB3 /* TODO.md */,
|
||||
C85F58C22D64D10F00D761E9 /* dimensionhub */,
|
||||
C85F58D52D64D11000D761E9 /* dimensionhubTests */,
|
||||
C85F58DF2D64D11000D761E9 /* dimensionhubUITests */,
|
||||
|
||||
@ -15,7 +15,7 @@ struct SearchBar: View {
|
||||
var placeholder: String
|
||||
var onSearch: () -> Void
|
||||
|
||||
@FocusState private var isFocused
|
||||
@FocusState private var isFocused: Bool
|
||||
|
||||
var body: some View {
|
||||
// 自定义搜索栏
|
||||
@ -47,10 +47,15 @@ struct SearchBar: View {
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.onTapGesture {
|
||||
isFocused = true
|
||||
}
|
||||
|
||||
// 搜索按钮
|
||||
Button {
|
||||
onSearch()
|
||||
if !searchText.isEmpty {
|
||||
onSearch()
|
||||
}
|
||||
} label: {
|
||||
Text("搜索")
|
||||
.font(.system(size: 18))
|
||||
@ -60,11 +65,7 @@ struct SearchBar: View {
|
||||
.disabled(searchText.isEmpty)
|
||||
}
|
||||
.onChange(of: searchText) {
|
||||
if searchText.trimmingCharacters(in: .whitespaces).isEmpty {
|
||||
isSearching = false
|
||||
} else {
|
||||
isSearching = true
|
||||
}
|
||||
isSearching = !searchText.trimmingCharacters(in: .whitespaces).isEmpty
|
||||
}
|
||||
.onAppear {
|
||||
DispatchQueue.main.async {
|
||||
|
||||
@ -173,9 +173,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
||||
// MARK: 消息处理
|
||||
|
||||
private func handleRemoteNotification(userInfo: [AnyHashable: Any]) {
|
||||
if let customData = userInfo["custom_data"] as? [String: AnyObject],
|
||||
let dramaId = customData["drama_id"] as? Int {
|
||||
AppNavigation.shared.append(dest: .detail(id: dramaId))
|
||||
guard let customData = userInfo["custom_data"] as? [String: AnyObject],
|
||||
let target = customData["target"] as? String,
|
||||
let params = customData["params"] as? [String : AnyObject] else {
|
||||
return
|
||||
}
|
||||
|
||||
switch target {
|
||||
case "detail":
|
||||
if let dramaId = params["drama_id"] as? Int {
|
||||
AppNavigation.shared.append(dest: .detail(id: dramaId))
|
||||
}
|
||||
default:
|
||||
()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user