chore: Improve stories

This commit is contained in:
Christian Pauly 2021-12-25 14:42:48 +01:00
parent 48a5c52a94
commit fb856930ef
3 changed files with 13 additions and 2 deletions

View File

@ -136,7 +136,10 @@ class StoryPageController extends State<StoryPage> {
Future<void>? loadStory; Future<void>? loadStory;
Future<void> _loadStory() async { Future<void> _loadStory() async {
final room = Matrix.of(context).client.getRoomById(roomId); final client = Matrix.of(context).client;
await client.roomsLoading;
await client.accountDataLoading;
final room = client.getRoomById(roomId);
if (room == null) return; if (room == null) return;
if (room.membership != Membership.join) { if (room.membership != Membership.join) {
final joinedFuture = room.client.onSync.stream final joinedFuture = room.client.onSync.stream

View File

@ -23,6 +23,7 @@ class StoryView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final currentEvent = controller.currentEvent; final currentEvent = controller.currentEvent;
return Scaffold( return Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar( appBar: AppBar(
titleSpacing: 0, titleSpacing: 0,
title: ListTile( title: ListTile(

View File

@ -33,6 +33,7 @@ import 'package:matrix/matrix.dart';
import 'package:unifiedpush/unifiedpush.dart' hide Message; import 'package:unifiedpush/unifiedpush.dart' hide Message;
import 'package:vrouter/vrouter.dart'; import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/client_stories_extension.dart';
import '../config/app_config.dart'; import '../config/app_config.dart';
import '../config/setting_keys.dart'; import '../config/setting_keys.dart';
import 'famedlysdk_store.dart'; import 'famedlysdk_store.dart';
@ -296,7 +297,13 @@ class BackgroundPush {
if (router == null) { if (router == null) {
return; return;
} }
router.currentState.toSegments(['rooms', roomId]); final isStory = client
?.getRoomById(roomId)
?.getState(EventTypes.RoomCreate)
?.content
?.tryGet<String>('type') ==
ClientStoriesExtension.storiesRoomType;
router.currentState.toSegments([isStory ? 'stories' : 'rooms', roomId]);
} catch (e, s) { } catch (e, s) {
Logs().e('[Push] Failed to open room', e, s); Logs().e('[Push] Failed to open room', e, s);
} }