kopia lustrzana https://gitlab.com/mysocialportal/relatica
Add support for unlisted post creation/editing
rodzic
b54dc152b5
commit
b978b44201
|
@ -129,9 +129,11 @@ class StatusHeaderControl extends StatelessWidget {
|
||||||
await showVisibilityDialog(context, manager, entry.visibility);
|
await showVisibilityDialog(context, manager, entry.visibility);
|
||||||
},
|
},
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
entry.visibility.type == v.VisibilityType.public
|
switch (entry.visibility.type) {
|
||||||
? Icons.public
|
v.VisibilityType.public => Icons.public,
|
||||||
: Icons.lock,
|
v.VisibilityType.private => Icons.lock,
|
||||||
|
v.VisibilityType.unlisted => Icons.not_interested,
|
||||||
|
},
|
||||||
color: Theme.of(context).hintColor,
|
color: Theme.of(context).hintColor,
|
||||||
size: Theme.of(context).textTheme.bodySmall?.fontSize,
|
size: Theme.of(context).textTheme.bodySmall?.fontSize,
|
||||||
),
|
),
|
||||||
|
|
|
@ -66,6 +66,9 @@ Future<bool?> showVisibilityDialog(
|
||||||
if (visibility.type == v.VisibilityType.public) ...[
|
if (visibility.type == v.VisibilityType.public) ...[
|
||||||
const Text('Public')
|
const Text('Public')
|
||||||
],
|
],
|
||||||
|
if (visibility.type == v.VisibilityType.unlisted) ...[
|
||||||
|
const Text('Unlisted')
|
||||||
|
],
|
||||||
if (visibility.type != v.VisibilityType.public) ...[
|
if (visibility.type != v.VisibilityType.public) ...[
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
enum VisibilityType {
|
enum VisibilityType {
|
||||||
public,
|
public,
|
||||||
private,
|
private,
|
||||||
|
unlisted,
|
||||||
;
|
;
|
||||||
|
|
||||||
String toLabel() {
|
String toLabel() {
|
||||||
|
@ -9,6 +10,8 @@ enum VisibilityType {
|
||||||
return 'Public';
|
return 'Public';
|
||||||
case VisibilityType.private:
|
case VisibilityType.private:
|
||||||
return 'Private';
|
return 'Private';
|
||||||
|
case VisibilityType.unlisted:
|
||||||
|
return 'Unlisted';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +49,10 @@ class Visibility {
|
||||||
type: VisibilityType.private,
|
type: VisibilityType.private,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
factory Visibility.unlisted() => const Visibility(
|
||||||
|
type: VisibilityType.unlisted,
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) =>
|
bool operator ==(Object other) =>
|
||||||
identical(this, other) ||
|
identical(this, other) ||
|
||||||
|
|
|
@ -583,10 +583,11 @@ class _EditorScreenState extends State<EditorScreen> {
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await showVisibilityDialog(context, cm, visibility);
|
await showVisibilityDialog(context, cm, visibility);
|
||||||
},
|
},
|
||||||
icon: visibility.type == VisibilityType.public
|
icon: Icon(switch (visibility.type) {
|
||||||
? const Icon(Icons.public)
|
VisibilityType.public => Icons.public,
|
||||||
: const Icon(Icons.lock),
|
VisibilityType.private => Icons.lock,
|
||||||
)
|
VisibilityType.unlisted => Icons.not_interested,
|
||||||
|
}))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -632,6 +633,12 @@ class _EditorScreenState extends State<EditorScreen> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value == VisibilityType.unlisted &&
|
||||||
|
currentCircle == null) {
|
||||||
|
visibility = Visibility.unlisted();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
visibility = Visibility(
|
visibility = Visibility(
|
||||||
type: VisibilityType.private,
|
type: VisibilityType.private,
|
||||||
allowedCircleIds: [currentCircle!.id],
|
allowedCircleIds: [currentCircle!.id],
|
||||||
|
|
|
@ -78,6 +78,8 @@ extension TimelineEntryMastodonExtensions on TimelineEntry {
|
||||||
final visibilityString = json['visibility'];
|
final visibilityString = json['visibility'];
|
||||||
if (visibilityString == 'public') {
|
if (visibilityString == 'public') {
|
||||||
visibility = Visibility.public();
|
visibility = Visibility.public();
|
||||||
|
} else if (visibilityString == 'unlisted') {
|
||||||
|
visibility = Visibility.unlisted();
|
||||||
} else if (visibilityString == 'private') {
|
} else if (visibilityString == 'private') {
|
||||||
final allowedUserIds =
|
final allowedUserIds =
|
||||||
json['friendica']?['visibility']?['allow_cid'] as List<dynamic>? ??
|
json['friendica']?['visibility']?['allow_cid'] as List<dynamic>? ??
|
||||||
|
@ -96,8 +98,6 @@ extension TimelineEntryMastodonExtensions on TimelineEntry {
|
||||||
allowedCircleIds: allowedCircleIds.map((e) => e.toString()).toList(),
|
allowedCircleIds: allowedCircleIds.map((e) => e.toString()).toList(),
|
||||||
excludedCircleIds: excludedCircleIds.map((e) => e.toString()).toList(),
|
excludedCircleIds: excludedCircleIds.map((e) => e.toString()).toList(),
|
||||||
);
|
);
|
||||||
} else if (visibilityString == 'unlisted') {
|
|
||||||
visibility = Visibility.private();
|
|
||||||
} else {
|
} else {
|
||||||
visibility = Visibility.private();
|
visibility = Visibility.private();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,10 @@ extension VisibilityMastodonExtensions on Visibility {
|
||||||
return 'public';
|
return 'public';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == VisibilityType.unlisted) {
|
||||||
|
return 'unlisted';
|
||||||
|
}
|
||||||
|
|
||||||
if (!onComment && hasDetails) {
|
if (!onComment && hasDetails) {
|
||||||
final circleId =
|
final circleId =
|
||||||
allowedCircleIds.firstOrNull ?? allowedUserIds.firstOrNull;
|
allowedCircleIds.firstOrNull ?? allowedUserIds.firstOrNull;
|
||||||
|
|
26
pubspec.lock
26
pubspec.lock
|
@ -181,10 +181,10 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
|
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.17.2"
|
version: "1.18.0"
|
||||||
color_blindness:
|
color_blindness:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -849,10 +849,10 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.1"
|
version: "1.10.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1279,18 +1279,18 @@ packages:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
|
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.11.0"
|
version: "1.11.1"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
|
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.2"
|
||||||
stream_transform:
|
stream_transform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1335,10 +1335,10 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
|
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.0"
|
version: "0.6.1"
|
||||||
time_machine:
|
time_machine:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -1559,10 +1559,10 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: web
|
name: web
|
||||||
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
|
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.4-beta"
|
version: "0.3.0"
|
||||||
web_socket_channel:
|
web_socket_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1620,5 +1620,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.2"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.1.0-185.0.dev <4.0.0"
|
dart: ">=3.2.0-194.0.dev <4.0.0"
|
||||||
flutter: ">=3.10.0"
|
flutter: ">=3.10.0"
|
||||||
|
|
Ładowanie…
Reference in New Issue