-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Room Preview facilities #2373
base: main
Are you sure you want to change the base?
Changes from 27 commits
99b5caf
bc11c77
8d6c425
83783fb
81944e0
db8e099
19bfd33
c298c3f
4f0b82f
62e5577
b6ab9a0
43d5ccb
f4aebfc
55a420a
8ab10ee
bed4c20
0b5f89a
76c3b8a
753abc4
9b57e61
f2036f9
26f9214
7842344
703d7f6
d3e9516
6f967c8
018d2d6
013111b
97ec8e1
5bce726
2d5d2cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- Will we now show you a preview of the space when you try to access an object you don't have access to you yet with the ability to let you quickly join the space and interact with the object | ||
- We are now showing a Room Preview with additional information when you click on the title in an invite | ||
- the QR Code for objects now shows you the details that will be shared with the reader | ||
- A fix has been made when joining required to go through more than one server | ||
- We are now sharing our own target server in the via-parameter of shared links |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// AllHashed is a helper for record-types to ensure they are cached | ||
/// properly by riverpod. | ||
/// | ||
/// When giving a record e.g. `typedef query = ({String roomIdOrAlias, List<String> serverNames});` | ||
/// as the parameter to a riverpod provider, the latter `List<String>` will | ||
/// have different hashes for every instance created. This means that even if | ||
/// both are `List.empty()` riverpod doesn't recognise them as the same and will | ||
/// run the provider again, cluttering up memory as well as unnecessary computation | ||
/// | ||
/// This type, given a list of items `T` will always return the same hash for the | ||
/// same items. | ||
class AllHashed<T> { | ||
final List<T> items; | ||
|
||
AllHashed(this.items); | ||
|
||
@override | ||
int get hashCode => Object.hashAll(items); | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (other is AllHashed<T>) { | ||
return items == other.items; | ||
} else if (other is List<T>) { | ||
return items == other; | ||
} | ||
return false; | ||
} | ||
} | ||
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
typedef ErrorTextBuilder = String Function(Object error, ErrorCode code); | ||
|
||
enum ErrorCode { | ||
notFound, | ||
forbidden, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extended the Error types to be more specific and more precise and allow us to show a different error depending on the underlying code we were given by the server: most notably if we were forbidden access. |
||
unknown, | ||
other; | ||
|
||
static ErrorCode guessFromError(Object error) { | ||
final errorStr = error.toString(); | ||
// yay, string-based error guessing! | ||
if (errorStr.contains('not found')) { | ||
return ErrorCode.notFound; | ||
} else if (errorStr.contains('[400 / UNKNOWN]')) { | ||
return ErrorCode.unknown; | ||
} else if (errorStr.contains('[403 / M_FORBIDDEN]')) { | ||
return ErrorCode.forbidden; | ||
Comment on lines
+14
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If not then how about making condition like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, this is exact on purpose. |
||
} | ||
return ErrorCode.other; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,10 @@ List<String> asDartStringList(FfiListFfiString data) { | |
return data.toList().map((e) => e.toDartString()).toList(); | ||
} | ||
|
||
extension FfiListFfiStringtoDart on FfiListFfiString { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. made this more accessible via helper extension |
||
List<String> toDart() => asDartStringList(this); | ||
} | ||
|
||
double? calcGap(BuildContext context) { | ||
// ignore: deprecated_member_use | ||
final double scale = MediaQuery.textScalerOf(context).textScaleFactor; | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import 'package:acter/common/providers/room_providers.dart'; | |
import 'package:acter/common/providers/space_providers.dart'; | ||
import 'package:acter/common/skeletons/general_list_skeleton_widget.dart'; | ||
import 'package:acter/common/utils/routes.dart'; | ||
import 'package:acter/common/utils/utils.dart'; | ||
import 'package:acter/common/widgets/room/room_card.dart'; | ||
import 'package:acter/common/widgets/room/room_hierarchy_card.dart'; | ||
import 'package:acter/common/widgets/room/room_hierarchy_join_button.dart'; | ||
|
@@ -11,6 +12,7 @@ import 'package:acter/features/categories/providers/categories_providers.dart'; | |
import 'package:acter/features/categories/widgets/category_header_view.dart'; | ||
import 'package:acter/features/chat/providers/chat_providers.dart'; | ||
import 'package:acter/router/utils.dart'; | ||
import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/l10n.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
@@ -167,7 +169,7 @@ class SubChatsPage extends ConsumerWidget { | |
[]; | ||
final remoteSubchats = | ||
ref.watch(remoteChatRelationsProvider(spaceId)).valueOrNull ?? []; | ||
final entries = []; | ||
final List<(SpaceHierarchyRoomInfo?, String)> entries = []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. being specific in types allows the dart compiler to figure out the type below isn't correct. |
||
|
||
for (final subId in categoryModelLocal.entries) { | ||
if (knownChats.contains(subId)) { | ||
|
@@ -229,7 +231,7 @@ class SubChatsPage extends ConsumerWidget { | |
joinRule: roomInfo.joinRuleStr().toLowerCase(), | ||
roomId: roomId, | ||
roomName: roomInfo.name() ?? roomId, | ||
viaServerName: roomInfo.viaServerName(), | ||
viaServerName: roomInfo.viaServerNames().toDart(), | ||
forward: (spaceId) { | ||
goToChat(context, spaceId); | ||
ref.invalidate(spaceRelationsProvider(parentId)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not understanding this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two list of items, even if they are all the same, will come out as "different" if they are different instances. This is used to ensure that https://github.com/acterglobal/a3/pull/2373/files#diff-b2a403334550e3f97cc376cf1228271526121ca2ecf70cf62e6c50ba41e69289R14 caches the input value and not keeps triggering for every render.