2022-01-27 14:23:39 +01:00
|
|
|
//
|
|
|
|
// DataSourceFacade+Favorite.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by MainasuK on 2022-1-21.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import CoreData
|
|
|
|
import CoreDataStack
|
2022-10-08 07:43:06 +02:00
|
|
|
import MastodonCore
|
2022-01-27 14:23:39 +01:00
|
|
|
|
|
|
|
extension DataSourceFacade {
|
2022-10-08 07:43:06 +02:00
|
|
|
public static func responseToStatusFavoriteAction(
|
2022-10-09 14:07:57 +02:00
|
|
|
provider: DataSourceProvider & AuthContextProvider,
|
|
|
|
status: ManagedObjectRecord<Status>
|
2022-01-27 14:23:39 +01:00
|
|
|
) async throws {
|
2022-06-28 13:00:39 +02:00
|
|
|
let selectionFeedbackGenerator = await UISelectionFeedbackGenerator()
|
2022-01-27 14:23:39 +01:00
|
|
|
await selectionFeedbackGenerator.selectionChanged()
|
|
|
|
|
|
|
|
_ = try await provider.context.apiService.favorite(
|
|
|
|
record: status,
|
2022-10-09 14:07:57 +02:00
|
|
|
authenticationBox: provider.authContext.mastodonAuthenticationBox
|
2022-01-27 14:23:39 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|