Merge pull request #3668 from omnivore-app/fix/ios-fetch-content
Add fetch content to iOS, fix Transmission version
This commit is contained in:
@ -98,11 +98,11 @@ typealias OperationStatusHandler = (_: OperationStatus) -> Void
|
||||
}
|
||||
}
|
||||
|
||||
func updateSubscription(dataService: DataService, subscription: Subscription, folder: String? = nil, fetchContent: Bool? = nil) async {
|
||||
func updateSubscription(dataService: DataService, subscription: Subscription, folder: String? = nil, fetchContentType: FetchContentType? = nil) async {
|
||||
operationMessage = "Updating subscription..."
|
||||
operationStatus = .isPerforming
|
||||
do {
|
||||
try await dataService.updateSubscription(subscription.subscriptionID, folder: folder, fetchContent: fetchContent)
|
||||
try await dataService.updateSubscription(subscription.subscriptionID, folder: folder, fetchContentType: fetchContentType)
|
||||
operationMessage = "Subscription updated"
|
||||
operationStatus = .success
|
||||
} catch {
|
||||
@ -240,23 +240,27 @@ struct SubscriptionsView: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
private var emptyView: some View {
|
||||
VStack(alignment: .center, spacing: 20) {
|
||||
Text("You don't have any Feed items.")
|
||||
.font(Font.system(size: 18, weight: .bold))
|
||||
|
||||
Text("Add an RSS/Atom feed")
|
||||
.foregroundColor(Color.blue)
|
||||
.onTapGesture {
|
||||
showAddFeedView = true
|
||||
}
|
||||
}
|
||||
.frame(minHeight: 80)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
}
|
||||
|
||||
private var innerBody: some View {
|
||||
Group {
|
||||
List {
|
||||
Section("Feeds") {
|
||||
if viewModel.feeds.count <= 0, !viewModel.isLoading {
|
||||
VStack(alignment: .center, spacing: 20) {
|
||||
Text("You don't have any Feed items.")
|
||||
.font(Font.system(size: 18, weight: .bold))
|
||||
|
||||
Text("Add an RSS/Atom feed")
|
||||
.foregroundColor(Color.blue)
|
||||
.onTapGesture {
|
||||
showAddFeedView = true
|
||||
}
|
||||
}
|
||||
.frame(minHeight: 80)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
emptyView
|
||||
} else {
|
||||
ForEach(viewModel.feeds, id: \.subscriptionID) { subscription in
|
||||
PresentationLink(transition: UIDevice.isIPad ? .popover : .sheet(detents: [.medium])) {
|
||||
@ -264,7 +268,7 @@ struct SubscriptionsView: View {
|
||||
subscription: subscription,
|
||||
viewModel: viewModel,
|
||||
dataService: dataService,
|
||||
prefetchContent: subscription.fetchContent,
|
||||
fetchContentType: subscription.fetchContentType,
|
||||
folderSelection: subscription.folder,
|
||||
unsubscribe: { _ in
|
||||
viewModel.operationStatus = .isPerforming
|
||||
@ -296,7 +300,7 @@ struct SubscriptionsView: View {
|
||||
subscription: subscription,
|
||||
viewModel: viewModel,
|
||||
dataService: dataService,
|
||||
prefetchContent: subscription.fetchContent,
|
||||
fetchContentType: subscription.fetchContentType,
|
||||
folderSelection: subscription.folder,
|
||||
unsubscribe: { _ in
|
||||
viewModel.operationStatus = .isPerforming
|
||||
@ -389,7 +393,7 @@ struct SubscriptionSettingsView: View {
|
||||
let viewModel: SubscriptionsViewModel
|
||||
let dataService: DataService
|
||||
|
||||
@State var prefetchContent = false
|
||||
@State var fetchContentType: FetchContentType
|
||||
@State var deleteConfirmationShown = false
|
||||
@State var showDeleteCompleted = false
|
||||
@State var folderSelection: String = ""
|
||||
@ -428,6 +432,28 @@ struct SubscriptionSettingsView: View {
|
||||
return nil
|
||||
}
|
||||
|
||||
var fetchContentRow: some View {
|
||||
Picker(selection: $fetchContentType, content: {
|
||||
Text("Always").tag(FetchContentType.always)
|
||||
Text("Never").tag(FetchContentType.never)
|
||||
Text("When empty").tag(FetchContentType.whenEmpty)
|
||||
}, label: { Text("Fetch link") })
|
||||
.pickerStyle(MenuPickerStyle())
|
||||
.onChange(of: fetchContentType) { newValue in
|
||||
Task {
|
||||
viewModel.showOperationToast = true
|
||||
await viewModel.updateSubscription(
|
||||
dataService: dataService,
|
||||
subscription: subscription,
|
||||
fetchContentType: newValue
|
||||
)
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1500)) {
|
||||
viewModel.showOperationToast = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var folderRow: some View {
|
||||
HStack {
|
||||
Picker("Destination Folder", selection: $folderSelection) {
|
||||
@ -444,19 +470,6 @@ struct SubscriptionSettingsView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.onChange(of: prefetchContent) { newValue in
|
||||
Task {
|
||||
viewModel.showOperationToast = true
|
||||
await viewModel.updateSubscription(
|
||||
dataService: dataService,
|
||||
subscription: subscription,
|
||||
fetchContent: newValue
|
||||
)
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1500)) {
|
||||
viewModel.showOperationToast = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -570,12 +583,10 @@ struct SubscriptionSettingsView: View {
|
||||
.padding(.horizontal, 15)
|
||||
|
||||
List {
|
||||
// if subscription.type != .newsletter {
|
||||
// Toggle(isOn: $prefetchContent, label: { Text("Prefetch Content:") })
|
||||
// .onAppear {
|
||||
// prefetchContent = subscription.fetchContent
|
||||
// }
|
||||
// }
|
||||
if subscription.type != .newsletter {
|
||||
fetchContentRow
|
||||
}
|
||||
|
||||
folderRow
|
||||
labelRuleRow
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ public struct Subscription {
|
||||
public let name: String
|
||||
public let type: SubscriptionType
|
||||
public let folder: String
|
||||
public let fetchContent: Bool
|
||||
public let fetchContentType: FetchContentType
|
||||
public let newsletterEmailAddress: String?
|
||||
public let status: SubscriptionStatus
|
||||
public let unsubscribeHttpUrl: String?
|
||||
@ -24,7 +24,7 @@ public struct Subscription {
|
||||
name: String,
|
||||
type: SubscriptionType,
|
||||
folder: String,
|
||||
fetchContent: Bool,
|
||||
fetchContentType: FetchContentType,
|
||||
newsletterEmailAddress: String?,
|
||||
status: SubscriptionStatus,
|
||||
unsubscribeHttpUrl: String?,
|
||||
@ -39,7 +39,7 @@ public struct Subscription {
|
||||
self.name = name
|
||||
self.type = type
|
||||
self.folder = folder
|
||||
self.fetchContent = fetchContent
|
||||
self.fetchContentType = fetchContentType
|
||||
self.newsletterEmailAddress = newsletterEmailAddress
|
||||
self.status = status
|
||||
self.unsubscribeHttpUrl = unsubscribeHttpUrl
|
||||
@ -60,3 +60,9 @@ public enum SubscriptionType {
|
||||
case newsletter
|
||||
case feed
|
||||
}
|
||||
|
||||
public enum FetchContentType {
|
||||
case always
|
||||
case never
|
||||
case whenEmpty
|
||||
}
|
||||
|
||||
@ -667,6 +667,8 @@ extension Objects {
|
||||
let contentReader: [String: Enums.ContentReader]
|
||||
let createdAt: [String: DateTime]
|
||||
let description: [String: String]
|
||||
let directionality: [String: Enums.DirectionalityType]
|
||||
let feedContent: [String: String]
|
||||
let folder: [String: String]
|
||||
let hasContent: [String: Bool]
|
||||
let hash: [String: String]
|
||||
@ -742,6 +744,14 @@ extension Objects.Article: Decodable {
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "directionality":
|
||||
if let value = try container.decode(Enums.DirectionalityType?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "feedContent":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "folder":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
@ -901,6 +911,8 @@ extension Objects.Article: Decodable {
|
||||
contentReader = map["contentReader"]
|
||||
createdAt = map["createdAt"]
|
||||
description = map["description"]
|
||||
directionality = map["directionality"]
|
||||
feedContent = map["feedContent"]
|
||||
folder = map["folder"]
|
||||
hasContent = map["hasContent"]
|
||||
hash = map["hash"]
|
||||
@ -1025,6 +1037,36 @@ extension Fields where TypeLock == Objects.Article {
|
||||
}
|
||||
}
|
||||
|
||||
func directionality() throws -> Enums.DirectionalityType? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "directionality",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.directionality[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func feedContent() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "feedContent",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.feedContent[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func folder() throws -> String {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "folder",
|
||||
@ -8127,6 +8169,7 @@ extension Objects {
|
||||
let quote: [String: String]
|
||||
let reactions: [String: [Objects.Reaction]]
|
||||
let replies: [String: [Objects.HighlightReply]]
|
||||
let representation: [String: Enums.RepresentationType]
|
||||
let sharedAt: [String: DateTime]
|
||||
let shortId: [String: String]
|
||||
let suffix: [String: String]
|
||||
@ -8208,6 +8251,10 @@ extension Objects.Highlight: Decodable {
|
||||
if let value = try container.decode([Objects.HighlightReply]?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "representation":
|
||||
if let value = try container.decode(Enums.RepresentationType?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "sharedAt":
|
||||
if let value = try container.decode(DateTime?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
@ -8256,6 +8303,7 @@ extension Objects.Highlight: Decodable {
|
||||
quote = map["quote"]
|
||||
reactions = map["reactions"]
|
||||
replies = map["replies"]
|
||||
representation = map["representation"]
|
||||
sharedAt = map["sharedAt"]
|
||||
shortId = map["shortId"]
|
||||
suffix = map["suffix"]
|
||||
@ -8494,6 +8542,24 @@ extension Fields where TypeLock == Objects.Highlight {
|
||||
}
|
||||
}
|
||||
|
||||
func representation() throws -> Enums.RepresentationType {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "representation",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
if let data = data.representation[field.alias!] {
|
||||
return data
|
||||
}
|
||||
throw HttpError.badpayload
|
||||
case .mocking:
|
||||
return Enums.RepresentationType.allCases.first!
|
||||
}
|
||||
}
|
||||
|
||||
func sharedAt() throws -> DateTime? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "sharedAt",
|
||||
@ -8985,6 +9051,7 @@ extension Objects {
|
||||
let enabled: [String: Bool]
|
||||
let id: [String: String]
|
||||
let name: [String: String]
|
||||
let settings: [String: String]
|
||||
let taskName: [String: String]
|
||||
let token: [String: String]
|
||||
let type: [String: Enums.IntegrationType]
|
||||
@ -9024,6 +9091,10 @@ extension Objects.Integration: Decodable {
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "settings":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "taskName":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
@ -9054,6 +9125,7 @@ extension Objects.Integration: Decodable {
|
||||
enabled = map["enabled"]
|
||||
id = map["id"]
|
||||
name = map["name"]
|
||||
settings = map["settings"]
|
||||
taskName = map["taskName"]
|
||||
token = map["token"]
|
||||
type = map["type"]
|
||||
@ -9134,6 +9206,21 @@ extension Fields where TypeLock == Objects.Integration {
|
||||
}
|
||||
}
|
||||
|
||||
func settings() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "settings",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.settings[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func taskName() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "taskName",
|
||||
@ -18126,6 +18213,7 @@ extension Selection where TypeLock == Never, Type == Never {
|
||||
extension Objects {
|
||||
struct SearchItem {
|
||||
let __typename: TypeName = .searchItem
|
||||
let aiSummary: [String: String]
|
||||
let annotation: [String: String]
|
||||
let archivedAt: [String: DateTime]
|
||||
let author: [String: String]
|
||||
@ -18134,6 +18222,8 @@ extension Objects {
|
||||
let contentReader: [String: Enums.ContentReader]
|
||||
let createdAt: [String: DateTime]
|
||||
let description: [String: String]
|
||||
let directionality: [String: Enums.DirectionalityType]
|
||||
let feedContent: [String: String]
|
||||
let folder: [String: String]
|
||||
let highlights: [String: [Objects.Highlight]]
|
||||
let id: [String: String]
|
||||
@ -18146,7 +18236,6 @@ extension Objects {
|
||||
let ownedByViewer: [String: Bool]
|
||||
let pageId: [String: String]
|
||||
let pageType: [String: Enums.PageType]
|
||||
let previewContent: [String: String]
|
||||
let previewContentType: [String: String]
|
||||
let publishedAt: [String: DateTime]
|
||||
let quote: [String: String]
|
||||
@ -18188,6 +18277,10 @@ extension Objects.SearchItem: Decodable {
|
||||
let field = GraphQLField.getFieldNameFromAlias(alias)
|
||||
|
||||
switch field {
|
||||
case "aiSummary":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "annotation":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
@ -18220,6 +18313,14 @@ extension Objects.SearchItem: Decodable {
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "directionality":
|
||||
if let value = try container.decode(Enums.DirectionalityType?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "feedContent":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "folder":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
@ -18268,10 +18369,6 @@ extension Objects.SearchItem: Decodable {
|
||||
if let value = try container.decode(Enums.PageType?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "previewContent":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "previewContentType":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
@ -18370,6 +18467,7 @@ extension Objects.SearchItem: Decodable {
|
||||
}
|
||||
}
|
||||
|
||||
aiSummary = map["aiSummary"]
|
||||
annotation = map["annotation"]
|
||||
archivedAt = map["archivedAt"]
|
||||
author = map["author"]
|
||||
@ -18378,6 +18476,8 @@ extension Objects.SearchItem: Decodable {
|
||||
contentReader = map["contentReader"]
|
||||
createdAt = map["createdAt"]
|
||||
description = map["description"]
|
||||
directionality = map["directionality"]
|
||||
feedContent = map["feedContent"]
|
||||
folder = map["folder"]
|
||||
highlights = map["highlights"]
|
||||
id = map["id"]
|
||||
@ -18390,7 +18490,6 @@ extension Objects.SearchItem: Decodable {
|
||||
ownedByViewer = map["ownedByViewer"]
|
||||
pageId = map["pageId"]
|
||||
pageType = map["pageType"]
|
||||
previewContent = map["previewContent"]
|
||||
previewContentType = map["previewContentType"]
|
||||
publishedAt = map["publishedAt"]
|
||||
quote = map["quote"]
|
||||
@ -18417,6 +18516,21 @@ extension Objects.SearchItem: Decodable {
|
||||
}
|
||||
|
||||
extension Fields where TypeLock == Objects.SearchItem {
|
||||
func aiSummary() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "aiSummary",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.aiSummary[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func annotation() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "annotation",
|
||||
@ -18543,6 +18657,36 @@ extension Fields where TypeLock == Objects.SearchItem {
|
||||
}
|
||||
}
|
||||
|
||||
func directionality() throws -> Enums.DirectionalityType? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "directionality",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.directionality[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func feedContent() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "feedContent",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.feedContent[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func folder() throws -> String {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "folder",
|
||||
@ -18737,21 +18881,6 @@ extension Fields where TypeLock == Objects.SearchItem {
|
||||
}
|
||||
}
|
||||
|
||||
func previewContent() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "previewContent",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.previewContent[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func previewContentType() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "previewContentType",
|
||||
@ -21284,6 +21413,7 @@ extension Objects {
|
||||
let description: [String: String]
|
||||
let failedAt: [String: DateTime]
|
||||
let fetchContent: [String: Bool]
|
||||
let fetchContentType: [String: Enums.FetchContentType]
|
||||
let folder: [String: String]
|
||||
let icon: [String: String]
|
||||
let id: [String: String]
|
||||
@ -21342,6 +21472,10 @@ extension Objects.Subscription: Decodable {
|
||||
if let value = try container.decode(Bool?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "fetchContentType":
|
||||
if let value = try container.decode(Enums.FetchContentType?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "folder":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
@ -21418,6 +21552,7 @@ extension Objects.Subscription: Decodable {
|
||||
description = map["description"]
|
||||
failedAt = map["failedAt"]
|
||||
fetchContent = map["fetchContent"]
|
||||
fetchContentType = map["fetchContentType"]
|
||||
folder = map["folder"]
|
||||
icon = map["icon"]
|
||||
id = map["id"]
|
||||
@ -21536,6 +21671,24 @@ extension Fields where TypeLock == Objects.Subscription {
|
||||
}
|
||||
}
|
||||
|
||||
func fetchContentType() throws -> Enums.FetchContentType {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "fetchContentType",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
if let data = data.fetchContentType[field.alias!] {
|
||||
return data
|
||||
}
|
||||
throw HttpError.badpayload
|
||||
case .mocking:
|
||||
return Enums.FetchContentType.allCases.first!
|
||||
}
|
||||
}
|
||||
|
||||
func folder() throws -> String {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "folder",
|
||||
@ -24692,6 +24845,7 @@ extension Objects {
|
||||
struct User {
|
||||
let __typename: TypeName = .user
|
||||
let email: [String: String]
|
||||
let features: [String: [String?]]
|
||||
let followersCount: [String: Int]
|
||||
let friendsCount: [String: Int]
|
||||
let id: [String: String]
|
||||
@ -24730,6 +24884,10 @@ extension Objects.User: Decodable {
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "features":
|
||||
if let value = try container.decode([String?]?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "followersCount":
|
||||
if let value = try container.decode(Int?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
@ -24801,6 +24959,7 @@ extension Objects.User: Decodable {
|
||||
}
|
||||
|
||||
email = map["email"]
|
||||
features = map["features"]
|
||||
followersCount = map["followersCount"]
|
||||
friendsCount = map["friendsCount"]
|
||||
id = map["id"]
|
||||
@ -24835,6 +24994,21 @@ extension Fields where TypeLock == Objects.User {
|
||||
}
|
||||
}
|
||||
|
||||
func features() throws -> [String?]? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "features",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.features[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func followersCount() throws -> Int? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "followersCount",
|
||||
@ -34148,6 +34322,15 @@ extension Enums {
|
||||
}
|
||||
}
|
||||
|
||||
extension Enums {
|
||||
/// DirectionalityType
|
||||
enum DirectionalityType: String, CaseIterable, Codable {
|
||||
case ltr = "LTR"
|
||||
|
||||
case rtl = "RTL"
|
||||
}
|
||||
}
|
||||
|
||||
extension Enums {
|
||||
/// EmptyTrashErrorCode
|
||||
enum EmptyTrashErrorCode: String, CaseIterable, Codable {
|
||||
@ -34180,6 +34363,17 @@ extension Enums {
|
||||
}
|
||||
}
|
||||
|
||||
extension Enums {
|
||||
/// FetchContentType
|
||||
enum FetchContentType: String, CaseIterable, Codable {
|
||||
case always = "ALWAYS"
|
||||
|
||||
case never = "NEVER"
|
||||
|
||||
case whenEmpty = "WHEN_EMPTY"
|
||||
}
|
||||
}
|
||||
|
||||
extension Enums {
|
||||
/// FiltersErrorCode
|
||||
enum FiltersErrorCode: String, CaseIterable, Codable {
|
||||
@ -34521,6 +34715,15 @@ extension Enums {
|
||||
}
|
||||
}
|
||||
|
||||
extension Enums {
|
||||
/// RepresentationType
|
||||
enum RepresentationType: String, CaseIterable, Codable {
|
||||
case content = "CONTENT"
|
||||
|
||||
case feedContent = "FEED_CONTENT"
|
||||
}
|
||||
}
|
||||
|
||||
extension Enums {
|
||||
/// RevokeApiKeyErrorCode
|
||||
enum RevokeApiKeyErrorCode: String, CaseIterable, Codable {
|
||||
@ -34539,6 +34742,8 @@ extension Enums {
|
||||
|
||||
case archive = "ARCHIVE"
|
||||
|
||||
case delete = "DELETE"
|
||||
|
||||
case markAsRead = "MARK_AS_READ"
|
||||
|
||||
case sendNotification = "SEND_NOTIFICATION"
|
||||
@ -35306,6 +35511,8 @@ extension InputObjects {
|
||||
|
||||
var quote: OptionalArgument<String> = .absent()
|
||||
|
||||
var representation: OptionalArgument<Enums.RepresentationType> = .absent()
|
||||
|
||||
var sharedAt: OptionalArgument<DateTime> = .absent()
|
||||
|
||||
var shortId: String
|
||||
@ -35326,6 +35533,7 @@ extension InputObjects {
|
||||
if patch.hasValue { try container.encode(patch, forKey: .patch) }
|
||||
if prefix.hasValue { try container.encode(prefix, forKey: .prefix) }
|
||||
if quote.hasValue { try container.encode(quote, forKey: .quote) }
|
||||
if representation.hasValue { try container.encode(representation, forKey: .representation) }
|
||||
if sharedAt.hasValue { try container.encode(sharedAt, forKey: .sharedAt) }
|
||||
try container.encode(shortId, forKey: .shortId)
|
||||
if suffix.hasValue { try container.encode(suffix, forKey: .suffix) }
|
||||
@ -35343,6 +35551,7 @@ extension InputObjects {
|
||||
case patch
|
||||
case prefix
|
||||
case quote
|
||||
case representation
|
||||
case sharedAt
|
||||
case shortId
|
||||
case suffix
|
||||
@ -35602,6 +35811,8 @@ extension InputObjects {
|
||||
|
||||
var quote: String
|
||||
|
||||
var representation: OptionalArgument<Enums.RepresentationType> = .absent()
|
||||
|
||||
var shortId: String
|
||||
|
||||
var suffix: OptionalArgument<String> = .absent()
|
||||
@ -35619,6 +35830,7 @@ extension InputObjects {
|
||||
try container.encode(patch, forKey: .patch)
|
||||
if prefix.hasValue { try container.encode(prefix, forKey: .prefix) }
|
||||
try container.encode(quote, forKey: .quote)
|
||||
if representation.hasValue { try container.encode(representation, forKey: .representation) }
|
||||
try container.encode(shortId, forKey: .shortId)
|
||||
if suffix.hasValue { try container.encode(suffix, forKey: .suffix) }
|
||||
}
|
||||
@ -35635,6 +35847,7 @@ extension InputObjects {
|
||||
case patch
|
||||
case prefix
|
||||
case quote
|
||||
case representation
|
||||
case shortId
|
||||
case suffix
|
||||
}
|
||||
@ -36228,6 +36441,8 @@ extension InputObjects {
|
||||
|
||||
var name: String
|
||||
|
||||
var settings: OptionalArgument<String> = .absent()
|
||||
|
||||
var syncedAt: OptionalArgument<DateTime> = .absent()
|
||||
|
||||
var taskName: OptionalArgument<String> = .absent()
|
||||
@ -36242,6 +36457,7 @@ extension InputObjects {
|
||||
if id.hasValue { try container.encode(id, forKey: .id) }
|
||||
if importItemState.hasValue { try container.encode(importItemState, forKey: .importItemState) }
|
||||
try container.encode(name, forKey: .name)
|
||||
if settings.hasValue { try container.encode(settings, forKey: .settings) }
|
||||
if syncedAt.hasValue { try container.encode(syncedAt, forKey: .syncedAt) }
|
||||
if taskName.hasValue { try container.encode(taskName, forKey: .taskName) }
|
||||
try container.encode(token, forKey: .token)
|
||||
@ -36253,6 +36469,7 @@ extension InputObjects {
|
||||
case id
|
||||
case importItemState
|
||||
case name
|
||||
case settings
|
||||
case syncedAt
|
||||
case taskName
|
||||
case token
|
||||
@ -36511,6 +36728,8 @@ extension InputObjects {
|
||||
|
||||
var fetchContent: OptionalArgument<Bool> = .absent()
|
||||
|
||||
var fetchContentType: OptionalArgument<Enums.FetchContentType> = .absent()
|
||||
|
||||
var folder: OptionalArgument<String> = .absent()
|
||||
|
||||
var isPrivate: OptionalArgument<Bool> = .absent()
|
||||
@ -36523,6 +36742,7 @@ extension InputObjects {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
if autoAddToLibrary.hasValue { try container.encode(autoAddToLibrary, forKey: .autoAddToLibrary) }
|
||||
if fetchContent.hasValue { try container.encode(fetchContent, forKey: .fetchContent) }
|
||||
if fetchContentType.hasValue { try container.encode(fetchContentType, forKey: .fetchContentType) }
|
||||
if folder.hasValue { try container.encode(folder, forKey: .folder) }
|
||||
if isPrivate.hasValue { try container.encode(isPrivate, forKey: .isPrivate) }
|
||||
if subscriptionType.hasValue { try container.encode(subscriptionType, forKey: .subscriptionType) }
|
||||
@ -36532,6 +36752,7 @@ extension InputObjects {
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case autoAddToLibrary
|
||||
case fetchContent
|
||||
case fetchContentType
|
||||
case folder
|
||||
case isPrivate
|
||||
case subscriptionType
|
||||
@ -36828,6 +37049,8 @@ extension InputObjects {
|
||||
|
||||
var fetchContent: OptionalArgument<Bool> = .absent()
|
||||
|
||||
var fetchContentType: OptionalArgument<Enums.FetchContentType> = .absent()
|
||||
|
||||
var folder: OptionalArgument<String> = .absent()
|
||||
|
||||
var id: String
|
||||
@ -36852,6 +37075,7 @@ extension InputObjects {
|
||||
if description.hasValue { try container.encode(description, forKey: .description) }
|
||||
if failedAt.hasValue { try container.encode(failedAt, forKey: .failedAt) }
|
||||
if fetchContent.hasValue { try container.encode(fetchContent, forKey: .fetchContent) }
|
||||
if fetchContentType.hasValue { try container.encode(fetchContentType, forKey: .fetchContentType) }
|
||||
if folder.hasValue { try container.encode(folder, forKey: .folder) }
|
||||
try container.encode(id, forKey: .id)
|
||||
if isPrivate.hasValue { try container.encode(isPrivate, forKey: .isPrivate) }
|
||||
@ -36868,6 +37092,7 @@ extension InputObjects {
|
||||
case description
|
||||
case failedAt
|
||||
case fetchContent
|
||||
case fetchContentType
|
||||
case folder
|
||||
case id
|
||||
case isPrivate
|
||||
|
||||
@ -12,6 +12,7 @@ public struct Rule {
|
||||
public enum RuleActionType {
|
||||
case addLabel
|
||||
case archive
|
||||
case delete
|
||||
case markAsRead
|
||||
case sendNotification
|
||||
|
||||
@ -25,6 +26,8 @@ public enum RuleActionType {
|
||||
return .markAsRead
|
||||
case Enums.RuleActionType.sendNotification:
|
||||
return .sendNotification
|
||||
case .delete:
|
||||
return .delete
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import Models
|
||||
import SwiftGraphQL
|
||||
|
||||
public extension DataService {
|
||||
func updateSubscription(_ subscriptionID: String, folder: String? = nil, fetchContent: Bool? = nil) async throws {
|
||||
func updateSubscription(_ subscriptionID: String, folder: String? = nil, fetchContentType: FetchContentType? = nil) async throws {
|
||||
enum MutationResult {
|
||||
case success(subscriptionID: String)
|
||||
case error(errorMessage: String)
|
||||
@ -20,7 +20,7 @@ public extension DataService {
|
||||
let mutation = Selection.Mutation {
|
||||
try $0.updateSubscription(
|
||||
input: InputObjects.UpdateSubscriptionInput(
|
||||
fetchContent: OptionalArgument(fetchContent),
|
||||
fetchContentType: OptionalArgument(fetchContentType?.toGQLType()),
|
||||
folder: OptionalArgument(folder),
|
||||
id: subscriptionID
|
||||
),
|
||||
|
||||
@ -11,7 +11,7 @@ let subscriptionSelection = Selection.Subscription {
|
||||
name: try $0.name(),
|
||||
type: try SubscriptionType.from($0.type()),
|
||||
folder: try $0.folder(),
|
||||
fetchContent: try $0.fetchContent(),
|
||||
fetchContentType: try FetchContentType.from($0.fetchContentType()),
|
||||
newsletterEmailAddress: try $0.newsletterEmail(),
|
||||
status: try SubscriptionStatus.make(from: $0.status()),
|
||||
unsubscribeHttpUrl: try $0.unsubscribeHttpUrl(),
|
||||
@ -45,3 +45,26 @@ extension SubscriptionType {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension FetchContentType {
|
||||
static func from(_ other: Enums.FetchContentType) -> FetchContentType {
|
||||
switch other {
|
||||
case .always:
|
||||
return .always
|
||||
case .never:
|
||||
return .never
|
||||
case .whenEmpty:
|
||||
return .whenEmpty
|
||||
}
|
||||
}
|
||||
func toGQLType() -> Enums.FetchContentType {
|
||||
switch self {
|
||||
case .always:
|
||||
return .always
|
||||
case .never:
|
||||
return .never
|
||||
case .whenEmpty:
|
||||
return .whenEmpty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user