🐛 Fixes bugs and optimization
➕ Add app links
This commit is contained in:
@@ -120,7 +120,7 @@ class LevelingProgressCard extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Tooltip(
|
||||
message: '${progress.toStringAsFixed(1)}%',
|
||||
message: '${(progress * 100).toStringAsFixed(1)}%',
|
||||
child: LinearProgressIndicator(
|
||||
minHeight: progressHeight,
|
||||
value: progress,
|
||||
|
@@ -1,9 +1,11 @@
|
||||
import 'dart:async';
|
||||
import 'package:app_links/app_links.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:island/pods/activity/activity_rpc.dart';
|
||||
import 'package:island/pods/websocket.dart';
|
||||
import 'package:island/route.dart';
|
||||
import 'package:island/screens/tray_manager.dart';
|
||||
import 'package:island/services/notify.dart';
|
||||
import 'package:island/services/sharing_intent.dart';
|
||||
@@ -21,24 +23,37 @@ class AppWrapper extends HookConsumerWidget with TrayListener {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
useEffect(() {
|
||||
StreamSubscription? ntySubs;
|
||||
Future(() {
|
||||
StreamSubscription? appLinksSubs;
|
||||
Future(() async {
|
||||
final appLinks = AppLinks();
|
||||
|
||||
if (context.mounted) ntySubs = setupNotificationListener(context, ref);
|
||||
|
||||
final sharingService = SharingIntentService();
|
||||
if (context.mounted) sharingService.initialize(context);
|
||||
if (context.mounted) UpdateService().checkForUpdates(context);
|
||||
|
||||
TrayService.instance.initialize(this);
|
||||
|
||||
ref.read(rpcServerStateProvider.notifier).start();
|
||||
|
||||
final initialUri = await appLinks.getLatestLink();
|
||||
if (initialUri != null && context.mounted) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_handleDeepLink(initialUri, ref);
|
||||
});
|
||||
}
|
||||
|
||||
appLinksSubs = appLinks.uriLinkStream.listen((uri) {
|
||||
_handleDeepLink(uri, ref);
|
||||
});
|
||||
});
|
||||
|
||||
final sharingService = SharingIntentService();
|
||||
sharingService.initialize(context);
|
||||
|
||||
UpdateService().checkForUpdates(context);
|
||||
|
||||
TrayService.instance.initialize(this);
|
||||
|
||||
ref.read(rpcServerStateProvider.notifier).start();
|
||||
|
||||
return () {
|
||||
ref.read(rpcServerProvider).stop();
|
||||
TrayService.instance.dispose(this);
|
||||
sharingService.dispose();
|
||||
ntySubs?.cancel();
|
||||
appLinksSubs?.cancel();
|
||||
};
|
||||
}, const []);
|
||||
|
||||
@@ -88,4 +103,16 @@ class AppWrapper extends HookConsumerWidget with TrayListener {
|
||||
void onTrayMenuItemClick(MenuItem menuItem) {
|
||||
TrayService.instance.handleAction(menuItem);
|
||||
}
|
||||
|
||||
void _handleDeepLink(Uri uri, WidgetRef ref) {
|
||||
final router = ref.read(routerProvider);
|
||||
String path = '/${uri.path}';
|
||||
if (uri.queryParameters.isNotEmpty) {
|
||||
path =
|
||||
Uri.parse(
|
||||
path,
|
||||
).replace(queryParameters: uri.queryParameters).toString();
|
||||
}
|
||||
router.go(path);
|
||||
}
|
||||
}
|
||||
|
@@ -275,6 +275,7 @@ class ChatInput extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -353,6 +354,7 @@ class ChatInput extends HookConsumerWidget {
|
||||
controller: messageController,
|
||||
keyboardType: TextInputType.multiline,
|
||||
decoration: InputDecoration(
|
||||
hintMaxLines: 1,
|
||||
hintText:
|
||||
(chatRoom.type == 1 && chatRoom.name == null)
|
||||
? 'chatDirectMessageHint'.tr(
|
||||
@@ -367,7 +369,7 @@ class ChatInput extends HookConsumerWidget {
|
||||
isDense: true,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 4,
|
||||
vertical: 12,
|
||||
),
|
||||
counterText:
|
||||
messageController.text.length > 1024
|
||||
|
Reference in New Issue
Block a user