Merge branch 'krille/minor-fixes' into 'main'

Krille/minor fixes

See merge request famedly/fluffychat!571
This commit is contained in:
Krille Fear 2021-11-23 07:58:39 +00:00
commit f6699bf87f
6 changed files with 38 additions and 26 deletions

View File

@ -43,6 +43,7 @@ abstract class AppConfig {
static const bool hideTypingUsernames = false;
static const bool hideAllStateEvents = false;
static const String inviteLinkPrefix = 'https://matrix.to/#/';
static const String deepLinkPrefix = 'im.fluffychat://chat/';
static const String schemePrefix = 'matrix:';
static const String pushNotificationsChannelId = 'fluffychat_push';
static const String pushNotificationsChannelName = 'FluffyChat push channel';

View File

@ -135,7 +135,7 @@ abstract class FluffyThemes {
primary: FluffyThemes.lighten(AppConfig.chatColor, 0.33),
secondary: FluffyThemes.lighten(AppConfig.chatColor, 0.33),
secondaryVariant: AppConfig.secondaryColor,
surface: FluffyThemes.darken(AppConfig.chatColor, 0.4),
surface: FluffyThemes.darken(AppConfig.chatColor, 0.35),
),
secondaryHeaderColor: Colors.blueGrey.shade900,
textTheme: Typography.material2018().white.merge(fallbackTextTheme),

View File

@ -83,7 +83,10 @@ class ChatView extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.report_outlined),
const Icon(
Icons.shield_outlined,
color: Colors.red,
),
const SizedBox(width: 12),
Text(L10n.of(context).reportMessage),
],
@ -331,7 +334,7 @@ class ChatView extends StatelessWidget {
.secondaryHeaderColor
.withAlpha(100),
clipBehavior: Clip.hardEdge,
color: Theme.of(context).backgroundColor,
color: Theme.of(context).appBarTheme.backgroundColor,
child: SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,

View File

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/widgets/avatar.dart';
@ -27,7 +28,7 @@ class EventInfoDialog extends StatelessWidget {
String get prettyJson {
const JsonDecoder decoder = JsonDecoder();
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
final object = decoder.convert(jsonEncode(event.toJson()));
return encoder.convert(object);
}
@ -52,7 +53,7 @@ class EventInfoDialog extends StatelessWidget {
),
title: Text(L10n.of(context).sender),
subtitle:
Text('${event.sender.calcDisplayname()} <${event.senderId}>'),
Text('${event.sender.calcDisplayname()} [${event.senderId}]'),
),
ListTile(
title: Text(L10n.of(context).time),
@ -62,14 +63,17 @@ class EventInfoDialog extends StatelessWidget {
title: Text(L10n.of(context).messageType),
subtitle: Text(event.humanreadableType),
),
ListTile(
title: Text(L10n.of(context).sourceCode),
),
ListTile(title: Text('${L10n.of(context).sourceCode}:')),
Padding(
padding: const EdgeInsets.all(12.0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Text(prettyJson),
child: Material(
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
color: Theme.of(context).colorScheme.surface,
child: SingleChildScrollView(
padding: const EdgeInsets.all(8),
scrollDirection: Axis.horizontal,
child: SelectableText(prettyJson),
),
),
),
],

View File

@ -220,22 +220,25 @@ class Message extends StatelessWidget {
),
if (event.hasAggregatedEvents(
timeline, RelationshipTypes.edit))
Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.edit_outlined,
color: textColor.withAlpha(164),
size: 14,
),
Text(
' - ${displayEvent.originServerTs.localizedTimeShort(context)}',
style: TextStyle(
Padding(
padding: const EdgeInsets.only(top: 4.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.edit_outlined,
color: textColor.withAlpha(164),
fontSize: 12,
size: 14,
),
),
],
Text(
' - ${displayEvent.originServerTs.localizedTimeShort(context)}',
style: TextStyle(
color: textColor.withAlpha(164),
fontSize: 12,
),
),
],
),
),
],
),

View File

@ -20,7 +20,8 @@ class UrlLauncher {
const UrlLauncher(this.context, this.url);
void launchUrl() {
if (url.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
if (url.toLowerCase().startsWith(AppConfig.deepLinkPrefix) ||
url.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
{'#', '@', '!', '+', '\$'}.contains(url[0]) ||
url.toLowerCase().startsWith(AppConfig.schemePrefix)) {
return openMatrixToUrl();