Merge branch 'krille/refactor-sharing-intent' into 'main'

refactor: Sharing intent

See merge request famedly/fluffychat!893
This commit is contained in:
Krille Fear 2022-05-29 09:54:34 +00:00
commit f3b8abd504
2 changed files with 12 additions and 12 deletions

View File

@ -142,8 +142,7 @@ class ChatListController extends State<ChatList> with TickerProviderStateMixin {
void _processIncomingSharedFiles(List<SharedMediaFile> files) { void _processIncomingSharedFiles(List<SharedMediaFile> files) {
if (files.isEmpty) return; if (files.isEmpty) return;
VRouter.of(context).to('/rooms'); final file = File(files.first.path.replaceFirst('file://', ''));
final file = File(files.first.path);
Matrix.of(context).shareContent = { Matrix.of(context).shareContent = {
'msgtype': 'chat.fluffy.shared_file', 'msgtype': 'chat.fluffy.shared_file',
@ -152,11 +151,11 @@ class ChatListController extends State<ChatList> with TickerProviderStateMixin {
name: file.path, name: file.path,
).detectFileType, ).detectFileType,
}; };
VRouter.of(context).to('/rooms');
} }
void _processIncomingSharedText(String? text) { void _processIncomingSharedText(String? text) {
if (text == null) return; if (text == null) return;
VRouter.of(context).to('/rooms');
if (text.toLowerCase().startsWith(AppConfig.deepLinkPrefix) || if (text.toLowerCase().startsWith(AppConfig.deepLinkPrefix) ||
text.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) || text.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
(text.toLowerCase().startsWith(AppConfig.schemePrefix) && (text.toLowerCase().startsWith(AppConfig.schemePrefix) &&
@ -167,6 +166,7 @@ class ChatListController extends State<ChatList> with TickerProviderStateMixin {
'msgtype': 'm.text', 'msgtype': 'm.text',
'body': text, 'body': text,
}; };
VRouter.of(context).to('/rooms');
} }
void _processIncomingUris(String? text) async { void _processIncomingUris(String? text) async {

View File

@ -266,17 +266,17 @@ class _StoryButton extends StatelessWidget {
), ),
), ),
), ),
const Spacer(), Center(
Text( child: Text(
profile.displayName ?? '', profile.displayName ?? '',
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: unread ? FontWeight.bold : null, fontWeight: unread ? FontWeight.bold : null,
),
), ),
), ),
const Spacer(),
], ],
), ),
), ),