mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-20 02:59:26 +01:00
chore: enhance stories
This commit is contained in:
parent
888bb91d9d
commit
b8dc6c1e14
@ -2684,5 +2684,6 @@
|
|||||||
"date": {},
|
"date": {},
|
||||||
"body": {}
|
"body": {}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"whoCanSeeMyStoriesDesc": "Please note that people can see and contact each other in your story."
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,12 @@ class AppRoutes {
|
|||||||
VWidget(
|
VWidget(
|
||||||
path: '/stories/:roomid',
|
path: '/stories/:roomid',
|
||||||
widget: const StoryPage(),
|
widget: const StoryPage(),
|
||||||
|
stackedRoutes: [
|
||||||
|
VWidget(
|
||||||
|
path: 'share',
|
||||||
|
widget: const AddStoryPage(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
VWidget(
|
VWidget(
|
||||||
path: '/spaces/:roomid',
|
path: '/spaces/:roomid',
|
||||||
@ -133,6 +139,12 @@ class AppRoutes {
|
|||||||
path: '/stories/:roomid',
|
path: '/stories/:roomid',
|
||||||
buildTransition: _fadeTransition,
|
buildTransition: _fadeTransition,
|
||||||
widget: const StoryPage(),
|
widget: const StoryPage(),
|
||||||
|
stackedRoutes: [
|
||||||
|
VWidget(
|
||||||
|
path: 'share',
|
||||||
|
widget: const AddStoryPage(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
VWidget(
|
VWidget(
|
||||||
path: '/spaces/:roomid',
|
path: '/spaces/:roomid',
|
||||||
|
@ -142,7 +142,7 @@ class AddStoryController extends State<AddStoryPage> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (postResult.error == null) {
|
if (postResult.error == null) {
|
||||||
VRouter.of(context).to('/rooms');
|
VRouter.of(context).pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,17 @@ class _InviteStoryPageState extends State<InviteStoryPage> {
|
|||||||
onPressed: () => Navigator.of(context).pop<bool>(false),
|
onPressed: () => Navigator.of(context).pop<bool>(false),
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context)!.whoCanSeeMyStories),
|
title: Text(L10n.of(context)!.whoCanSeeMyStories),
|
||||||
|
bottom: PreferredSize(
|
||||||
|
preferredSize: const Size.fromHeight(56),
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(L10n.of(context)!.whoCanSeeMyStoriesDesc),
|
||||||
|
leading: CircleAvatar(
|
||||||
|
backgroundColor: Theme.of(context).secondaryHeaderColor,
|
||||||
|
foregroundColor: Theme.of(context).colorScheme.secondary,
|
||||||
|
child: const Icon(Icons.lock),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
body: FutureBuilder<List<User>>(
|
body: FutureBuilder<List<User>>(
|
||||||
future: loadContacts,
|
future: loadContacts,
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/settings_stories/settings_stories.dart';
|
import 'package:fluffychat/pages/settings_stories/settings_stories.dart';
|
||||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
@ -13,7 +15,20 @@ class SettingsStoriesView extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(),
|
appBar: AppBar(
|
||||||
|
title: Text(L10n.of(context)!.whoCanSeeMyStories),
|
||||||
|
bottom: PreferredSize(
|
||||||
|
preferredSize: const Size.fromHeight(56),
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(L10n.of(context)!.whoCanSeeMyStoriesDesc),
|
||||||
|
leading: CircleAvatar(
|
||||||
|
backgroundColor: Theme.of(context).secondaryHeaderColor,
|
||||||
|
foregroundColor: Theme.of(context).colorScheme.secondary,
|
||||||
|
child: const Icon(Icons.lock),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
body: FutureBuilder(
|
body: FutureBuilder(
|
||||||
future: controller.loadUsers,
|
future: controller.loadUsers,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
@ -112,6 +112,12 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
[];
|
[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void share() async {
|
||||||
|
Matrix.of(context).shareContent = currentEvent?.content;
|
||||||
|
hold();
|
||||||
|
VRouter.of(context).to('share');
|
||||||
|
}
|
||||||
|
|
||||||
void displaySeenByUsers() async {
|
void displaySeenByUsers() async {
|
||||||
_modalOpened = true;
|
_modalOpened = true;
|
||||||
await showModalBottomSheet(
|
await showModalBottomSheet(
|
||||||
@ -241,7 +247,30 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
|
|
||||||
final Map<String, Future<MatrixFile>> _fileCache = {};
|
final Map<String, Future<MatrixFile>> _fileCache = {};
|
||||||
|
|
||||||
void report(_) async {
|
void _delete() async {
|
||||||
|
final event = currentEvent;
|
||||||
|
if (event == null) return;
|
||||||
|
_modalOpened = true;
|
||||||
|
if (await showOkCancelAlertDialog(
|
||||||
|
context: context,
|
||||||
|
title: L10n.of(context)!.deleteMessage,
|
||||||
|
message: L10n.of(context)!.areYouSure,
|
||||||
|
okLabel: L10n.of(context)!.yes,
|
||||||
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
|
) !=
|
||||||
|
OkCancelResult.ok) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await showFutureLoadingDialog(
|
||||||
|
context: context,
|
||||||
|
future: event.redactEvent,
|
||||||
|
);
|
||||||
|
setState(() {
|
||||||
|
_modalOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _report() async {
|
||||||
_modalOpened = true;
|
_modalOpened = true;
|
||||||
final event = currentEvent;
|
final event = currentEvent;
|
||||||
if (event == null) return;
|
if (event == null) return;
|
||||||
@ -406,6 +435,17 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onPopupStoryAction(PopupStoryAction action) async {
|
||||||
|
switch (action) {
|
||||||
|
case PopupStoryAction.report:
|
||||||
|
_report();
|
||||||
|
break;
|
||||||
|
case PopupStoryAction.delete:
|
||||||
|
_delete();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
loadStory ??= _loadStory();
|
loadStory ??= _loadStory();
|
||||||
@ -428,5 +468,5 @@ extension on List<Event> {
|
|||||||
|
|
||||||
enum PopupStoryAction {
|
enum PopupStoryAction {
|
||||||
report,
|
report,
|
||||||
message,
|
delete,
|
||||||
}
|
}
|
||||||
|
@ -72,14 +72,27 @@ class StoryView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
if (!controller.isOwnStory)
|
||||||
|
AnimatedOpacity(
|
||||||
|
duration: const Duration(seconds: 1),
|
||||||
|
opacity: controller.isHold ? 0 : 1,
|
||||||
|
child: IconButton(
|
||||||
|
icon: Icon(Icons.adaptive.share_outlined),
|
||||||
|
onPressed: controller.share,
|
||||||
|
),
|
||||||
|
),
|
||||||
AnimatedOpacity(
|
AnimatedOpacity(
|
||||||
duration: const Duration(seconds: 1),
|
duration: const Duration(seconds: 1),
|
||||||
opacity: controller.isHold ? 0 : 1,
|
opacity: controller.isHold ? 0 : 1,
|
||||||
child: PopupMenuButton<bool>(
|
child: PopupMenuButton<PopupStoryAction>(
|
||||||
onSelected: controller.report,
|
onSelected: controller.onPopupStoryAction,
|
||||||
itemBuilder: (context) => [
|
itemBuilder: (context) => [
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: true,
|
value: PopupStoryAction.delete,
|
||||||
|
child: Text(L10n.of(context)!.delete),
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
value: PopupStoryAction.report,
|
||||||
child: Text(L10n.of(context)!.reportMessage),
|
child: Text(L10n.of(context)!.reportMessage),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user