This commit is contained in:
anlicheng 2025-04-16 10:40:07 +08:00
parent d0209d298b
commit 3463e9b7b2
4 changed files with 37 additions and 10 deletions

14
TODO.md Normal file
View 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
}

View File

@ -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 */,

View File

@ -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 {

View File

@ -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:
()
}
}