🐛 Bug fixes and optimization

This commit is contained in:
LittleSheep 2024-06-09 23:00:11 +08:00
parent 0f24ac03f7
commit 88c99b7467
14 changed files with 63 additions and 26 deletions

View File

@ -133,6 +133,9 @@ PODS:
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.25.2)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
@ -162,6 +165,7 @@ DEPENDENCIES:
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
@ -216,6 +220,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler_apple/ios"
sentry_flutter:
:path: ".symlinks/plugins/sentry_flutter/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
url_launcher_ios:
@ -254,6 +260,7 @@ SPEC CHECKSUMS:
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
Sentry: 51b056d96914a741f63eca774d118678b1eb05a1
sentry_flutter: e8397d13e297a5d4b6be8a752e33140b21c5cc97
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

View File

@ -54,7 +54,7 @@ class AccountProvider extends GetxController {
}
final AuthProvider auth = Get.find();
auth.ensureCredentials();
await auth.ensureCredentials();
if (auth.credentials == null) await auth.loadCredentials();
@ -185,7 +185,7 @@ class AccountProvider extends GetxController {
late final String provider;
final deviceUuid = await _getDeviceUuid();
if (deviceUuid == null) {
if (deviceUuid == null || deviceUuid.isEmpty) {
log("Unable to active push notifications, couldn't get device uuid");
}

View File

@ -24,7 +24,7 @@ class ChatProvider extends GetxController {
}
final AuthProvider auth = Get.find();
auth.ensureCredentials();
await auth.ensureCredentials();
final uri = Uri.parse(
'${ServiceFinder.services['messaging']}/api/ws?tk=${auth.credentials!.accessToken}'

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:developer';
import 'dart:ui';
import 'package:flutter/material.dart';

View File

@ -81,8 +81,8 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
final client = auth.configureClient(service: 'messaging');
final resp = await client
.put('/api/channels/${widget.realm}/${widget.channel.alias}/members/me', {
final resp = await client.put(
'/api/channels/${widget.realm}/${widget.channel.alias}/members/me', {
'nick': null,
'notify_level': _notifyLevel,
});
@ -112,14 +112,17 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
final ownerActions = [
ListTile(
leading: const Icon(Icons.edit),
leading: const Icon(Icons.settings),
trailing: const Icon(Icons.chevron_right),
title: Text('channelAdjust'.tr.capitalize!),
title: Text('channelSettings'.tr.capitalize!),
onTap: () async {
AppRouter.instance
.pushNamed(
'channelOrganizing',
extra: ChannelOrganizeArguments(edit: widget.channel),
extra: ChannelOrganizeArguments(
edit: widget.channel,
realm: widget.channel.realm,
),
)
.then((resp) {
if (resp != null) {

View File

@ -132,7 +132,7 @@ class _ChannelOrganizeScreenState extends State<ChannelOrganizeScreen> {
),
actions: notifyBannerActions,
).paddingOnly(bottom: 6),
if (widget.realm != null)
if (widget.realm != null && widget.edit == null)
MaterialBanner(
leading: const Icon(Icons.group),
leadingPadding: const EdgeInsets.only(left: 10, right: 20),

View File

@ -67,9 +67,9 @@ class _RealmDetailScreenState extends State<RealmDetailScreen> {
Widget build(BuildContext context) {
final ownerActions = [
ListTile(
leading: const Icon(Icons.edit),
leading: const Icon(Icons.settings),
trailing: const Icon(Icons.chevron_right),
title: Text('realmAdjust'.tr.capitalize!),
title: Text('realmSettings'.tr.capitalize!),
onTap: () async {
AppRouter.instance
.pushNamed(
@ -119,11 +119,6 @@ class _RealmDetailScreenState extends State<RealmDetailScreen> {
Expanded(
child: ListView(
children: [
ListTile(
leading: const Icon(Icons.settings),
trailing: const Icon(Icons.chevron_right),
title: Text('realmSettings'.tr.capitalize!),
),
ListTile(
leading: const Icon(Icons.supervisor_account),
trailing: const Icon(Icons.chevron_right),

View File

@ -94,7 +94,6 @@ class _AttachmentListState extends State<AttachmentList> {
@override
void initState() {
super.initState();
getMetadataList();
}

View File

@ -100,7 +100,17 @@ class ChatMessage extends StatelessWidget {
if (isContentPreviewing) {
widget = buildContent();
} else if (isMerged) {
widget = buildContent().paddingOnly(left: 52);
widget = Column(
children: [
buildContent().paddingOnly(left: 52),
if (item.attachments?.isNotEmpty ?? false)
AttachmentList(
key: Key('m${item.uuid}attachments'),
parentId: item.uuid,
attachmentsId: item.attachments ?? List.empty(),
).paddingSymmetric(vertical: 4),
],
);
} else if (isReply) {
widget = Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -149,6 +159,7 @@ class ChatMessage extends StatelessWidget {
).paddingSymmetric(horizontal: 12),
if (item.attachments?.isNotEmpty ?? false)
AttachmentList(
key: Key('m${item.uuid}attachments'),
parentId: item.uuid,
attachmentsId: item.attachments ?? List.empty(),
).paddingSymmetric(vertical: 4),

View File

@ -75,7 +75,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
'uuid': const Uuid().v4(),
'type': 'm.text',
'content': encodeMessage(_textController.value.text),
'attachments': _attachments,
'attachments': List.from(_attachments),
'reply_to': _replyTo?.id,
};
@ -96,6 +96,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
updatedAt: DateTime.now(),
content: payload['content'] as Map<String, dynamic>,
type: payload['type'] as String,
attachments: _attachments,
sender: sender,
replyId: _replyTo?.id,
replyTo: _replyTo,

View File

@ -95,6 +95,9 @@ PODS:
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.25.2)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
@ -121,6 +124,7 @@ DEPENDENCIES:
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`)
@ -167,6 +171,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
sentry_flutter:
:path: Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
sqflite:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin
url_launcher_macos:
@ -200,6 +206,7 @@ SPEC CHECKSUMS:
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
Sentry: 51b056d96914a741f63eca774d118678b1eb05a1
sentry_flutter: e8397d13e297a5d4b6be8a752e33140b21c5cc97
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3

View File

@ -2,10 +2,20 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.aps-environment</key>
<string>development</string>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>

View File

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
@ -24,13 +22,12 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict/>
</dict>
<key>NSHumanReadableCopyright</key>
<string>$(PRODUCT_COPYRIGHT)</string>
<key>NSMainNibFile</key>

View File

@ -2,10 +2,16 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.aps-environment</key>
<string>development</string>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>com.apple.security.device.camera</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>