feat: New navigation design
This commit is contained in:
parent
32cc2415b3
commit
e71dabca6e
23 changed files with 1024 additions and 1442 deletions
|
|
@ -16,14 +16,8 @@ extension ClientStoriesExtension on Client {
|
|||
room.unsafeGetUserFromMemoryOrFallback(room.directChatMatrixID!))
|
||||
.toList();
|
||||
|
||||
List<Room> get storiesRooms => rooms
|
||||
.where((room) =>
|
||||
room
|
||||
.getState(EventTypes.RoomCreate)
|
||||
?.content
|
||||
.tryGet<String>('type') ==
|
||||
storiesRoomType)
|
||||
.toList();
|
||||
List<Room> get storiesRooms =>
|
||||
rooms.where((room) => room.isStoryRoom).toList();
|
||||
|
||||
Future<List<User>> getUndecidedContactsForStories(Room? storiesRoom) async {
|
||||
if (storiesRoom == null) return contacts;
|
||||
|
|
@ -96,3 +90,9 @@ extension ClientStoriesExtension on Client {
|
|||
.toList());
|
||||
}
|
||||
}
|
||||
|
||||
extension StoryRoom on Room {
|
||||
bool get isStoryRoom =>
|
||||
getState(EventTypes.RoomCreate)?.content.tryGet<String>('type') ==
|
||||
ClientStoriesExtension.storiesRoomType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// this is a workaround to allow navigation of spaces out from any widget.
|
||||
/// Reason is that we have no reliable way to listen on *query* changes of
|
||||
/// VRouter.
|
||||
///
|
||||
/// Time wasted: 3h
|
||||
abstract class SpaceNavigator {
|
||||
const SpaceNavigator._();
|
||||
|
||||
// TODO(TheOneWithTheBraid): adjust routing table in order to represent spaces
|
||||
// ... in any present path
|
||||
static final routeObserver = RouteObserver();
|
||||
|
||||
static final StreamController<String?> _controller =
|
||||
StreamController.broadcast();
|
||||
|
||||
static Stream<String?> get stream => _controller.stream;
|
||||
|
||||
static void navigateToSpace(String? spaceId) => _controller.add(spaceId);
|
||||
}
|
||||
|
|
@ -10,7 +10,6 @@ import 'package:url_launcher/url_launcher.dart';
|
|||
import 'package:vrouter/vrouter.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/utils/space_navigator.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:fluffychat/widgets/profile_bottom_sheet.dart';
|
||||
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
||||
|
|
@ -133,7 +132,7 @@ class UrlLauncher {
|
|||
servers.addAll(identityParts.via);
|
||||
if (room != null) {
|
||||
if (room.isSpace) {
|
||||
SpaceNavigator.navigateToSpace(room.id);
|
||||
// TODO: Implement navigate to space
|
||||
VRouter.of(context).toSegments(['rooms']);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue