mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-22 08:20:59 +00:00
Lint
This commit is contained in:
parent
189e10f2b4
commit
a37316c56f
12 changed files with 103 additions and 102 deletions
|
@ -1,11 +1,10 @@
|
||||||
import AppIntents
|
|
||||||
import AppAccount
|
import AppAccount
|
||||||
|
import AppIntents
|
||||||
import Env
|
import Env
|
||||||
import Foundation
|
import Foundation
|
||||||
import Models
|
import Models
|
||||||
import Network
|
import Network
|
||||||
|
|
||||||
|
|
||||||
extension IntentDescription: @unchecked Sendable {}
|
extension IntentDescription: @unchecked Sendable {}
|
||||||
extension TypeDisplayRepresentation: @unchecked Sendable {}
|
extension TypeDisplayRepresentation: @unchecked Sendable {}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import AppIntents
|
|
||||||
import AppAccount
|
import AppAccount
|
||||||
|
import AppIntents
|
||||||
import Env
|
import Env
|
||||||
import Foundation
|
import Foundation
|
||||||
import Models
|
import Models
|
||||||
|
@ -23,7 +23,7 @@ public struct TimelineFilterEntity: Identifiable, AppEntity {
|
||||||
public struct DefaultTimelineEntityQuery: EntityQuery {
|
public struct DefaultTimelineEntityQuery: EntityQuery {
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
public func entities(for identifiers: [TimelineFilter.ID]) async throws -> [TimelineFilterEntity] {
|
public func entities(for _: [TimelineFilter.ID]) async throws -> [TimelineFilterEntity] {
|
||||||
[.home, .trending, .federated, .local].map { .init(timeline: $0) }
|
[.home, .trending, .federated, .local].map { .init(timeline: $0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import WidgetKit
|
|
||||||
import SwiftUI
|
|
||||||
import Network
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Models
|
import Models
|
||||||
|
import Network
|
||||||
|
import SwiftUI
|
||||||
import Timeline
|
import Timeline
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
struct HashtagPostsWidgetProvider: AppIntentTimelineProvider {
|
struct HashtagPostsWidgetProvider: AppIntentTimelineProvider {
|
||||||
func placeholder(in context: Context) -> PostsWidgetEntry {
|
func placeholder(in _: Context) -> PostsWidgetEntry {
|
||||||
.init(date: Date(),
|
.init(date: Date(),
|
||||||
title: "#Mastodon",
|
title: "#Mastodon",
|
||||||
statuses: [.placeholder()],
|
statuses: [.placeholder()],
|
||||||
|
@ -54,7 +54,8 @@ struct HashtagPostsWidget: Widget {
|
||||||
var body: some WidgetConfiguration {
|
var body: some WidgetConfiguration {
|
||||||
AppIntentConfiguration(kind: kind,
|
AppIntentConfiguration(kind: kind,
|
||||||
intent: HashtagPostsWidgetConfiguration.self,
|
intent: HashtagPostsWidgetConfiguration.self,
|
||||||
provider: HashtagPostsWidgetProvider()) { entry in
|
provider: HashtagPostsWidgetProvider())
|
||||||
|
{ entry in
|
||||||
PostsWidgetView(entry: entry)
|
PostsWidgetView(entry: entry)
|
||||||
.containerBackground(Color("WidgetBackground").gradient, for: .widget)
|
.containerBackground(Color("WidgetBackground").gradient, for: .widget)
|
||||||
}
|
}
|
||||||
|
@ -64,7 +65,6 @@ struct HashtagPostsWidget: Widget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Preview(as: .systemMedium) {
|
#Preview(as: .systemMedium) {
|
||||||
HashtagPostsWidget()
|
HashtagPostsWidget()
|
||||||
} timeline: {
|
} timeline: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import WidgetKit
|
|
||||||
import AppIntents
|
import AppIntents
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
struct HashtagPostsWidgetConfiguration: WidgetConfigurationIntent {
|
struct HashtagPostsWidgetConfiguration: WidgetConfigurationIntent {
|
||||||
static let title: LocalizedStringResource = "Configuration"
|
static let title: LocalizedStringResource = "Configuration"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import WidgetKit
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
@main
|
@main
|
||||||
struct IceCubesAppWidgetsExtensionBundle: WidgetBundle {
|
struct IceCubesAppWidgetsExtensionBundle: WidgetBundle {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import WidgetKit
|
|
||||||
import SwiftUI
|
|
||||||
import Network
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Models
|
import Models
|
||||||
|
import Network
|
||||||
|
import SwiftUI
|
||||||
import Timeline
|
import Timeline
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
struct LatestPostsWidgetProvider: AppIntentTimelineProvider {
|
struct LatestPostsWidgetProvider: AppIntentTimelineProvider {
|
||||||
func placeholder(in context: Context) -> PostsWidgetEntry {
|
func placeholder(in _: Context) -> PostsWidgetEntry {
|
||||||
.init(date: Date(),
|
.init(date: Date(),
|
||||||
title: "Home",
|
title: "Home",
|
||||||
statuses: [.placeholder()],
|
statuses: [.placeholder()],
|
||||||
|
@ -72,7 +72,8 @@ struct LatestPostsWidget: Widget {
|
||||||
var body: some WidgetConfiguration {
|
var body: some WidgetConfiguration {
|
||||||
AppIntentConfiguration(kind: kind,
|
AppIntentConfiguration(kind: kind,
|
||||||
intent: LatestPostsWidgetConfiguration.self,
|
intent: LatestPostsWidgetConfiguration.self,
|
||||||
provider: LatestPostsWidgetProvider()) { entry in
|
provider: LatestPostsWidgetProvider())
|
||||||
|
{ entry in
|
||||||
PostsWidgetView(entry: entry)
|
PostsWidgetView(entry: entry)
|
||||||
.containerBackground(Color("WidgetBackground").gradient, for: .widget)
|
.containerBackground(Color("WidgetBackground").gradient, for: .widget)
|
||||||
}
|
}
|
||||||
|
@ -82,7 +83,6 @@ struct LatestPostsWidget: Widget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Preview(as: .systemMedium) {
|
#Preview(as: .systemMedium) {
|
||||||
LatestPostsWidget()
|
LatestPostsWidget()
|
||||||
} timeline: {
|
} timeline: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import WidgetKit
|
|
||||||
import AppIntents
|
import AppIntents
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
struct LatestPostsWidgetConfiguration: WidgetConfigurationIntent {
|
struct LatestPostsWidgetConfiguration: WidgetConfigurationIntent {
|
||||||
static let title: LocalizedStringResource = "Configuration"
|
static let title: LocalizedStringResource = "Configuration"
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import WidgetKit
|
|
||||||
import SwiftUI
|
|
||||||
import Network
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Models
|
import Models
|
||||||
|
import Network
|
||||||
|
import SwiftUI
|
||||||
import Timeline
|
import Timeline
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
struct MentionsWidgetProvider: AppIntentTimelineProvider {
|
struct MentionsWidgetProvider: AppIntentTimelineProvider {
|
||||||
func placeholder(in context: Context) -> PostsWidgetEntry {
|
func placeholder(in _: Context) -> PostsWidgetEntry {
|
||||||
.init(date: Date(),
|
.init(date: Date(),
|
||||||
title: "Mentions",
|
title: "Mentions",
|
||||||
statuses: [.placeholder()],
|
statuses: [.placeholder()],
|
||||||
|
@ -27,7 +27,7 @@ struct MentionsWidgetProvider: AppIntentTimelineProvider {
|
||||||
await timeline(for: configuration, context: context)
|
await timeline(for: configuration, context: context)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func timeline(for configuration: MentionsWidgetConfiguration, context: Context) async -> Timeline<PostsWidgetEntry> {
|
private func timeline(for configuration: MentionsWidgetConfiguration, context _: Context) async -> Timeline<PostsWidgetEntry> {
|
||||||
do {
|
do {
|
||||||
let client = Client(server: configuration.account.account.server,
|
let client = Client(server: configuration.account.account.server,
|
||||||
oauthToken: configuration.account.account.oauthToken)
|
oauthToken: configuration.account.account.oauthToken)
|
||||||
|
@ -60,7 +60,8 @@ struct MentionsWidget: Widget {
|
||||||
var body: some WidgetConfiguration {
|
var body: some WidgetConfiguration {
|
||||||
AppIntentConfiguration(kind: kind,
|
AppIntentConfiguration(kind: kind,
|
||||||
intent: MentionsWidgetConfiguration.self,
|
intent: MentionsWidgetConfiguration.self,
|
||||||
provider: MentionsWidgetProvider()) { entry in
|
provider: MentionsWidgetProvider())
|
||||||
|
{ entry in
|
||||||
PostsWidgetView(entry: entry)
|
PostsWidgetView(entry: entry)
|
||||||
.containerBackground(Color("WidgetBackground").gradient, for: .widget)
|
.containerBackground(Color("WidgetBackground").gradient, for: .widget)
|
||||||
}
|
}
|
||||||
|
@ -70,7 +71,6 @@ struct MentionsWidget: Widget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#Preview(as: .systemMedium) {
|
#Preview(as: .systemMedium) {
|
||||||
MentionsWidget()
|
MentionsWidget()
|
||||||
} timeline: {
|
} timeline: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import WidgetKit
|
|
||||||
import AppIntents
|
import AppIntents
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
struct MentionsWidgetConfiguration: WidgetConfigurationIntent {
|
struct MentionsWidgetConfiguration: WidgetConfigurationIntent {
|
||||||
static let title: LocalizedStringResource = "Configuration"
|
static let title: LocalizedStringResource = "Configuration"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import WidgetKit
|
|
||||||
import SwiftUI
|
|
||||||
import Network
|
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Models
|
import Models
|
||||||
|
import Network
|
||||||
|
import SwiftUI
|
||||||
import Timeline
|
import Timeline
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
struct PostsWidgetEntry: TimelineEntry {
|
struct PostsWidgetEntry: TimelineEntry {
|
||||||
let date: Date
|
let date: Date
|
||||||
|
@ -26,6 +26,7 @@ struct PostsWidgetView : View {
|
||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
headerView
|
headerView
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import StatusKit
|
|
||||||
import WidgetKit
|
|
||||||
import Timeline
|
|
||||||
import Foundation
|
|
||||||
import UIKit
|
|
||||||
import AppAccount
|
import AppAccount
|
||||||
|
import Foundation
|
||||||
import Models
|
import Models
|
||||||
import Network
|
import Network
|
||||||
|
import StatusKit
|
||||||
|
import Timeline
|
||||||
|
import UIKit
|
||||||
|
import WidgetKit
|
||||||
|
|
||||||
func loadStatuses(for timeline: TimelineFilter,
|
func loadStatuses(for timeline: TimelineFilter,
|
||||||
account: AppAccountEntity,
|
account: AppAccountEntity,
|
||||||
widgetFamily: WidgetFamily) async -> [Status] {
|
widgetFamily: WidgetFamily) async -> [Status]
|
||||||
|
{
|
||||||
let client = Client(server: account.account.server, oauthToken: account.account.oauthToken)
|
let client = Client(server: account.account.server, oauthToken: account.account.oauthToken)
|
||||||
do {
|
do {
|
||||||
var statuses: [Status] = try await client.get(endpoint: timeline.endpoint(sinceId: nil,
|
var statuses: [Status] = try await client.get(endpoint: timeline.endpoint(sinceId: nil,
|
||||||
|
|
Loading…
Reference in a new issue