Skip to content

An open-source cross-platform alternative to AirDrop

feat: show white screen when no session is active

Tien Do Nam884bbbe9c457
diff --git a/app/lib/pages/receive_page.dart b/app/lib/pages/receive_page.dart
index c9303c2e..7b12a791 100644
--- a/app/lib/pages/receive_page.dart
+++ b/app/lib/pages/receive_page.dart
@@ -41,6 +41,12 @@ class _ReceivePageState extends State<ReceivePage> with Refena {
@override
Widget build(BuildContext context) {
final vm = context.watch(receivePageControllerProvider);
+ if (vm.status == null && vm.message == null) {
+ return const Scaffold(
+ body: SizedBox(),
+ );
+ }
+
final senderFavoriteEntry = ref.watch(favoritesProvider.select((state) => state.findDevice(vm.sender)));
if (vm.status == SessionStatus.canceledBySender) {
unawaited(TaskbarHelper.setProgressBarMode(TaskbarProgressMode.error));
diff --git a/app/lib/pages/receive_page_controller.dart b/app/lib/pages/receive_page_controller.dart
index f28f10a0..3efdb825 100644
--- a/app/lib/pages/receive_page_controller.dart
+++ b/app/lib/pages/receive_page_controller.dart
@@ -12,7 +12,7 @@ part 'receive_page_controller.mapper.dart';
@MappableClass()
class ReceivePageVm with ReceivePageVmMappable {
- final SessionStatus status;
+ final SessionStatus? status;
final Device sender;
/// Show hashtag and device model.
@@ -90,7 +90,7 @@ class _WatchStatusAction extends WatchAction<ReceivePageController, ReceivePageV
@override
ReceivePageVm reduce() {
return state.copyWith(
- status: ref.watch(serverProvider.select((state) => state?.session?.status ?? SessionStatus.waiting)),
+ status: ref.watch(serverProvider.select((state) => state?.session?.status)),
);
}
}
diff --git a/app/lib/pages/receive_page_controller.mapper.dart b/app/lib/pages/receive_page_controller.mapper.dart
index a82a2f78..edd486de 100644
--- a/app/lib/pages/receive_page_controller.mapper.dart
+++ b/app/lib/pages/receive_page_controller.mapper.dart
@@ -21,7 +21,7 @@ class ReceivePageVmMapper extends ClassMapperBase<ReceivePageVm> {
@override
final String id = 'ReceivePageVm';
- static SessionStatus _$status(ReceivePageVm v) => v.status;
+ static SessionStatus? _$status(ReceivePageVm v) => v.status;
static const Field<ReceivePageVm, SessionStatus> _f$status = Field('status', _$status);
static Device _$sender(ReceivePageVm v) => v.sender;
static const Field<ReceivePageVm, Device> _f$sender = Field('sender', _$sender);
@@ -139,7 +139,7 @@ class _ReceivePageVmCopyWithImpl<$R, $Out> extends ClassCopyWithBase<$R, Receive
DeviceCopyWith<$R, Device, Device> get sender => $value.sender.copyWith.$chain((v) => call(sender: v));
@override
$R call(
- {SessionStatus? status,
+ {Object? status = $none,
Device? sender,
bool? showSenderInfo,
int? fileCount,
@@ -150,7 +150,7 @@ class _ReceivePageVmCopyWithImpl<$R, $Out> extends ClassCopyWithBase<$R, Receive
void Function()? onDecline,
void Function()? onClose}) =>
$apply(FieldCopyWithData({
- if (status != null) #status: status,
+ if (status != $none) #status: status,
if (sender != null) #sender: sender,
if (showSenderInfo != null) #showSenderInfo: showSenderInfo,
if (fileCount != null) #fileCount: fileCount,