UX Improvement
This commit is contained in:
parent
97e9016d6a
commit
8f0af64846
|
@ -134,6 +134,7 @@
|
||||||
625CB5752678C33500530A6E /* LibraryListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 625CB5742678C33500530A6E /* LibraryListViewModel.swift */; };
|
625CB5752678C33500530A6E /* LibraryListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 625CB5742678C33500530A6E /* LibraryListViewModel.swift */; };
|
||||||
625CB5772678C34300530A6E /* ConnectToServerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 625CB5762678C34300530A6E /* ConnectToServerViewModel.swift */; };
|
625CB5772678C34300530A6E /* ConnectToServerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 625CB5762678C34300530A6E /* ConnectToServerViewModel.swift */; };
|
||||||
625CB57A2678C4A400530A6E /* ActivityIndicator in Frameworks */ = {isa = PBXBuildFile; productRef = 625CB5792678C4A400530A6E /* ActivityIndicator */; };
|
625CB57A2678C4A400530A6E /* ActivityIndicator in Frameworks */ = {isa = PBXBuildFile; productRef = 625CB5792678C4A400530A6E /* ActivityIndicator */; };
|
||||||
|
6260FFF926A09754003FA968 /* CombineExt in Frameworks */ = {isa = PBXBuildFile; productRef = 6260FFF826A09754003FA968 /* CombineExt */; };
|
||||||
6267B3D42671024A00A7371D /* APIExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5364F454266CA0DC0026ECBA /* APIExtensions.swift */; };
|
6267B3D42671024A00A7371D /* APIExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5364F454266CA0DC0026ECBA /* APIExtensions.swift */; };
|
||||||
6267B3D626710B8900A7371D /* CollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6267B3D526710B8900A7371D /* CollectionExtensions.swift */; };
|
6267B3D626710B8900A7371D /* CollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6267B3D526710B8900A7371D /* CollectionExtensions.swift */; };
|
||||||
6267B3D726710B9700A7371D /* CollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6267B3D526710B8900A7371D /* CollectionExtensions.swift */; };
|
6267B3D726710B9700A7371D /* CollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6267B3D526710B8900A7371D /* CollectionExtensions.swift */; };
|
||||||
|
@ -389,6 +390,7 @@
|
||||||
53352571265EA0A0006CCA86 /* Introspect in Frameworks */,
|
53352571265EA0A0006CCA86 /* Introspect in Frameworks */,
|
||||||
621C638026672A30004216EA /* NukeUI in Frameworks */,
|
621C638026672A30004216EA /* NukeUI in Frameworks */,
|
||||||
625CB57A2678C4A400530A6E /* ActivityIndicator in Frameworks */,
|
625CB57A2678C4A400530A6E /* ActivityIndicator in Frameworks */,
|
||||||
|
6260FFF926A09754003FA968 /* CombineExt in Frameworks */,
|
||||||
53A431BD266B0FF20016769F /* JellyfinAPI in Frameworks */,
|
53A431BD266B0FF20016769F /* JellyfinAPI in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
@ -760,6 +762,7 @@
|
||||||
53EC6E24267EB10F006DD26A /* SwiftyJSON */,
|
53EC6E24267EB10F006DD26A /* SwiftyJSON */,
|
||||||
62CB3F452685BAF7003D0A6F /* Defaults */,
|
62CB3F452685BAF7003D0A6F /* Defaults */,
|
||||||
53649AAC269CFAEA00A2D8B7 /* Puppy */,
|
53649AAC269CFAEA00A2D8B7 /* Puppy */,
|
||||||
|
6260FFF826A09754003FA968 /* CombineExt */,
|
||||||
);
|
);
|
||||||
productName = JellyfinPlayer;
|
productName = JellyfinPlayer;
|
||||||
productReference = 5377CBF1263B596A003A4E83 /* JellyfinPlayer iOS.app */;
|
productReference = 5377CBF1263B596A003A4E83 /* JellyfinPlayer iOS.app */;
|
||||||
|
@ -832,6 +835,7 @@
|
||||||
62CB3F442685BAF7003D0A6F /* XCRemoteSwiftPackageReference "Defaults" */,
|
62CB3F442685BAF7003D0A6F /* XCRemoteSwiftPackageReference "Defaults" */,
|
||||||
53272533268BF9710035FBF1 /* XCRemoteSwiftPackageReference "SwiftUIFocusGuide" */,
|
53272533268BF9710035FBF1 /* XCRemoteSwiftPackageReference "SwiftUIFocusGuide" */,
|
||||||
53649AAB269CFAEA00A2D8B7 /* XCRemoteSwiftPackageReference "Puppy" */,
|
53649AAB269CFAEA00A2D8B7 /* XCRemoteSwiftPackageReference "Puppy" */,
|
||||||
|
6260FFF726A09754003FA968 /* XCRemoteSwiftPackageReference "CombineExt" */,
|
||||||
);
|
);
|
||||||
productRefGroup = 5377CBF2263B596A003A4E83 /* Products */;
|
productRefGroup = 5377CBF2263B596A003A4E83 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
|
@ -1558,6 +1562,14 @@
|
||||||
minimumVersion = 1.1.0;
|
minimumVersion = 1.1.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
6260FFF726A09754003FA968 /* XCRemoteSwiftPackageReference "CombineExt" */ = {
|
||||||
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
repositoryURL = "https://github.com/CombineCommunity/CombineExt";
|
||||||
|
requirement = {
|
||||||
|
kind = upToNextMajorVersion;
|
||||||
|
minimumVersion = 1.3.0;
|
||||||
|
};
|
||||||
|
};
|
||||||
62CB3F442685BAF7003D0A6F /* XCRemoteSwiftPackageReference "Defaults" */ = {
|
62CB3F442685BAF7003D0A6F /* XCRemoteSwiftPackageReference "Defaults" */ = {
|
||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/sindresorhus/Defaults";
|
repositoryURL = "https://github.com/sindresorhus/Defaults";
|
||||||
|
@ -1654,6 +1666,11 @@
|
||||||
package = 625CB5782678C4A400530A6E /* XCRemoteSwiftPackageReference "ActivityIndicator" */;
|
package = 625CB5782678C4A400530A6E /* XCRemoteSwiftPackageReference "ActivityIndicator" */;
|
||||||
productName = ActivityIndicator;
|
productName = ActivityIndicator;
|
||||||
};
|
};
|
||||||
|
6260FFF826A09754003FA968 /* CombineExt */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 6260FFF726A09754003FA968 /* XCRemoteSwiftPackageReference "CombineExt" */;
|
||||||
|
productName = CombineExt;
|
||||||
|
};
|
||||||
628B95322670CAEA0091AF3B /* NukeUI */ = {
|
628B95322670CAEA0091AF3B /* NukeUI */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = 621C637E26672A30004216EA /* XCRemoteSwiftPackageReference "NukeUI" */;
|
package = 621C637E26672A30004216EA /* XCRemoteSwiftPackageReference "NukeUI" */;
|
||||||
|
|
|
@ -19,6 +19,24 @@
|
||||||
"version": "0.6.0"
|
"version": "0.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"package": "combine-schedulers",
|
||||||
|
"repositoryURL": "https://github.com/pointfreeco/combine-schedulers",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "c37e5ae8012fb654af776cc556ff8ae64398c841",
|
||||||
|
"version": "0.5.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "CombineExt",
|
||||||
|
"repositoryURL": "https://github.com/CombineCommunity/CombineExt",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "5b8a0c0f178527f9204200505c5fefa6847e528f",
|
||||||
|
"version": "1.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"package": "Defaults",
|
"package": "Defaults",
|
||||||
"repositoryURL": "https://github.com/sindresorhus/Defaults",
|
"repositoryURL": "https://github.com/sindresorhus/Defaults",
|
||||||
|
@ -38,7 +56,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"package": "jellyfin-sdk-swift",
|
"package": "JellyfinAPI",
|
||||||
"repositoryURL": "https://github.com/jellyfin/jellyfin-sdk-swift",
|
"repositoryURL": "https://github.com/jellyfin/jellyfin-sdk-swift",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": "main",
|
"branch": "main",
|
||||||
|
@ -47,7 +65,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"package": "keychain-swift",
|
"package": "KeychainSwift",
|
||||||
"repositoryURL": "https://github.com/evgenyneu/keychain-swift",
|
"repositoryURL": "https://github.com/evgenyneu/keychain-swift",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
|
@ -101,7 +119,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"package": "SwiftUI-Introspect",
|
"package": "Introspect",
|
||||||
"repositoryURL": "https://github.com/siteline/SwiftUI-Introspect",
|
"repositoryURL": "https://github.com/siteline/SwiftUI-Introspect",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
|
@ -126,6 +144,15 @@
|
||||||
"revision": "b3dcd7dbd0d488e1a7077cb33b00f2083e382f07",
|
"revision": "b3dcd7dbd0d488e1a7077cb33b00f2083e382f07",
|
||||||
"version": null
|
"version": null
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "xctest-dynamic-overlay",
|
||||||
|
"repositoryURL": "https://github.com/pointfreeco/xctest-dynamic-overlay",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "603974e3909ad4b48ba04aad7e0ceee4f077a518",
|
||||||
|
"version": "0.1.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Combine
|
import Combine
|
||||||
|
import CombineExt
|
||||||
import Foundation
|
import Foundation
|
||||||
import JellyfinAPI
|
import JellyfinAPI
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ final class LibrarySearchViewModel: ViewModel {
|
||||||
|
|
||||||
@Published var supportedItemTypeList = [ItemType]()
|
@Published var supportedItemTypeList = [ItemType]()
|
||||||
|
|
||||||
@Published var selectedItemType = ItemType.movie
|
@Published var selectedItemType: ItemType = .movie
|
||||||
|
|
||||||
@Published var movieItems = [BaseItemDto]()
|
@Published var movieItems = [BaseItemDto]()
|
||||||
@Published var showItems = [BaseItemDto]()
|
@Published var showItems = [BaseItemDto]()
|
||||||
|
@ -35,8 +36,15 @@ final class LibrarySearchViewModel: ViewModel {
|
||||||
.debounce(for: 0.25, scheduler: DispatchQueue.main)
|
.debounce(for: 0.25, scheduler: DispatchQueue.main)
|
||||||
.sink(receiveValue: search)
|
.sink(receiveValue: search)
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
setupPublishersForSupportedItemType()
|
||||||
|
|
||||||
|
requestSuggestions()
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupPublishersForSupportedItemType() {
|
||||||
|
|
||||||
let supportedItemTypeListPublishers = Publishers.CombineLatest3($movieItems, $showItems, $episodeItems)
|
let supportedItemTypeListPublishers = Publishers.CombineLatest3($movieItems, $showItems, $episodeItems)
|
||||||
|
.debounce(for: 0.25, scheduler: DispatchQueue.main)
|
||||||
.map { arg -> [ItemType] in
|
.map { arg -> [ItemType] in
|
||||||
var typeList = [ItemType]()
|
var typeList = [ItemType]()
|
||||||
if !arg.0.isEmpty {
|
if !arg.0.isEmpty {
|
||||||
|
@ -54,13 +62,18 @@ final class LibrarySearchViewModel: ViewModel {
|
||||||
supportedItemTypeListPublishers
|
supportedItemTypeListPublishers
|
||||||
.assign(to: \.supportedItemTypeList, on: self)
|
.assign(to: \.supportedItemTypeList, on: self)
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
supportedItemTypeListPublishers
|
supportedItemTypeListPublishers
|
||||||
.compactMap(\.first)
|
.withLatestFrom(supportedItemTypeListPublishers, $selectedItemType)
|
||||||
|
.compactMap { typeList, selectedItemType in
|
||||||
|
if typeList.contains(selectedItemType) {
|
||||||
|
return selectedItemType
|
||||||
|
} else {
|
||||||
|
return typeList.first
|
||||||
|
}
|
||||||
|
}
|
||||||
.assign(to: \.selectedItemType, on: self)
|
.assign(to: \.selectedItemType, on: self)
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
|
|
||||||
requestSuggestions()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func requestSuggestions() {
|
func requestSuggestions() {
|
||||||
|
|
Loading…
Reference in New Issue