Merge pull request #1202 from mastodon/1201-fix-widgets

Restore credentials for widgets (#1201)
This commit is contained in:
Nathan Mattes 2024-01-01 14:59:52 +01:00 committed by GitHub
commit ed01435f2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import WidgetKit
import SwiftUI
import Intents
import MastodonSDK
import MastodonCore
import MastodonLocalization
struct FollowersCountWidgetProvider: IntentTimelineProvider {
@ -70,6 +71,9 @@ struct FollowersCountWidget: Widget {
private extension FollowersCountWidgetProvider {
func loadCurrentEntry(for configuration: FollowersCountIntent, in context: Context, completion: @escaping (FollowersCountEntry) -> Void) {
Task {
AuthenticationServiceProvider.shared.restore()
guard
let authBox = WidgetExtension.appContext
.authenticationService

View File

@ -4,6 +4,7 @@ import WidgetKit
import SwiftUI
import MastodonSDK
import MastodonLocalization
import MastodonCore
struct HashtagWidgetProvider: IntentTimelineProvider {
func placeholder(in context: Context) -> HashtagWidgetTimelineEntry {
@ -24,6 +25,8 @@ struct HashtagWidgetProvider: IntentTimelineProvider {
extension HashtagWidgetProvider {
func loadMostRecentHashtag(for configuration: HashtagIntent, in context: Context, completion: @escaping (HashtagWidgetTimelineEntry) -> Void ) {
AuthenticationServiceProvider.shared.restore()
guard
let authBox = WidgetExtension.appContext
.authenticationService

View File

@ -5,6 +5,7 @@ import SwiftUI
import Intents
import MastodonSDK
import MastodonLocalization
import MastodonCore
struct LatestFollowersWidgetProvider: IntentTimelineProvider {
func placeholder(in context: Context) -> LatestFollowersEntry {
@ -77,6 +78,9 @@ struct LatestFollowersWidget: Widget {
private extension LatestFollowersWidgetProvider {
func loadCurrentEntry(for configuration: LatestFollowersIntent, in context: Context, completion: @escaping (LatestFollowersEntry) -> Void) {
Task { @MainActor in
AuthenticationServiceProvider.shared.restore()
guard
let authBox = WidgetExtension.appContext
.authenticationService

View File

@ -4,6 +4,7 @@ import WidgetKit
import SwiftUI
import Intents
import MastodonSDK
import MastodonCore
import MastodonLocalization
struct MultiFollowersCountWidgetProvider: IntentTimelineProvider {
@ -70,6 +71,9 @@ struct MultiFollowersCountWidget: Widget {
private extension MultiFollowersCountWidgetProvider {
func loadCurrentEntry(for configuration: MultiFollowersCountIntent, in context: Context, completion: @escaping (MultiFollowersCountEntry) -> Void) {
Task {
AuthenticationServiceProvider.shared.restore()
guard
let authBox = WidgetExtension.appContext
.authenticationService