kopia lustrzana https://gitlab.com/mysocialportal/relatica
Allow Bluesky post resharing for Friendica versions 2024.08 and higher
Fixes Issue #107merge-requests/67/merge
rodzic
683d9a84a5
commit
3555e9bb11
|
@ -98,7 +98,7 @@ class FriendicaVersion implements Comparable<FriendicaVersion> {
|
|||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FriendicaVersion{releaseDate: $releaseDate, extra: $extra}';
|
||||
return '${releaseDate.year}.${releaseDate.month}$extra';
|
||||
}
|
||||
|
||||
String toVersionString() {
|
||||
|
@ -156,6 +156,8 @@ final FriendicaVersion v2023_04_01 = FriendicaVersion(
|
|||
);
|
||||
final FriendicaVersion v2023_05 = FriendicaVersion(DateTime(2023, 05));
|
||||
final FriendicaVersion v2023_09 = FriendicaVersion(DateTime(2023, 09));
|
||||
final FriendicaVersion v2024_03 = FriendicaVersion(DateTime(2024, 03));
|
||||
final FriendicaVersion v2024_08 = FriendicaVersion(DateTime(2024, 08));
|
||||
|
||||
final knownFriendicaVersions = [
|
||||
// 2018 Versions
|
||||
|
@ -196,6 +198,10 @@ final knownFriendicaVersions = [
|
|||
v2023_04_01,
|
||||
v2023_05,
|
||||
v2023_09,
|
||||
|
||||
// 2024 Versions
|
||||
v2024_03,
|
||||
v2024_08,
|
||||
];
|
||||
|
||||
FriendicaVersion latestVersion() => knownFriendicaVersions.last;
|
||||
|
|
|
@ -44,7 +44,7 @@ class NetworkCapabilitiesSettings {
|
|||
KnownNetworks.bluesky => NetworkCapabilitiesItem(
|
||||
network: e,
|
||||
react: true,
|
||||
reshare: false,
|
||||
reshare: true,
|
||||
comment: true,
|
||||
),
|
||||
KnownNetworks.threads => NetworkCapabilitiesItem(
|
||||
|
|
|
@ -9,6 +9,7 @@ import '../models/friendica_version.dart';
|
|||
import '../models/friendica_version_requirement.dart';
|
||||
|
||||
enum RelaticaFeatures {
|
||||
blueskyReshare('Resharing Bluesky Posts'),
|
||||
diasporaReshare('Resharing Diaspora Posts'),
|
||||
directMessageCreation('Direct message creation with OAuth login'),
|
||||
postSpoilerText('Spoiler Text on Posts'),
|
||||
|
@ -73,6 +74,7 @@ class FriendicaVersionChecker {
|
|||
|
||||
static final featureVersionRequirement =
|
||||
<RelaticaFeatures, FriendicaVersionRequirement>{
|
||||
RelaticaFeatures.blueskyReshare: FriendicaVersionRequirement(v2024_08),
|
||||
RelaticaFeatures.diasporaReshare: FriendicaVersionRequirement(v2023_04),
|
||||
RelaticaFeatures.directMessageCreation: FriendicaVersionRequirement(
|
||||
v2023_04,
|
||||
|
|
|
@ -2,6 +2,7 @@ import '../globals.dart';
|
|||
import '../models/timeline_entry.dart';
|
||||
import '../models/timeline_network_info.dart';
|
||||
import '../models/visibility.dart';
|
||||
import '../services/feature_version_checker.dart';
|
||||
import '../services/setting_service.dart';
|
||||
import 'known_network_extensions.dart';
|
||||
|
||||
|
@ -61,11 +62,15 @@ extension InteractionAvailabilityExtension on TimelineEntry {
|
|||
}
|
||||
|
||||
if (networkInfo.network == KnownNetworks.bluesky) {
|
||||
return const InteractionCapabilityResult(
|
||||
canDo: false,
|
||||
reason:
|
||||
"Resharing of Bluesky posts through the API isn't supported by Friendica.",
|
||||
);
|
||||
final result = getIt<FriendicaVersionChecker>()
|
||||
.canUseFeatureResult(RelaticaFeatures.blueskyReshare);
|
||||
|
||||
if (result.isFailure) {
|
||||
return InteractionCapabilityResult(
|
||||
canDo: false,
|
||||
reason: result.error.message,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final settingsService = getIt<SettingsService>();
|
||||
|
|
Ładowanie…
Reference in New Issue