Skip to content

Commit

Permalink
Fix dialog overlap when resizing screen
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev committed Jun 4, 2024
1 parent ff1bf74 commit fa69932
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
16 changes: 10 additions & 6 deletions lib/pages/chat_list/chat_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ class ChatListController extends State<ChatList>

bool isTorBrowser = false;

bool waitForFirstSync = false;

bool scrolledToTop = true;

Client get activeClient => matrixState.client;
Expand Down Expand Up @@ -419,14 +417,18 @@ class ChatListController extends State<ChatList>

Future<void> _waitForFirstSyncAfterLogin() async {
WidgetsBinding.instance.addPostFrameCallback((_) async {
await TomBootstrapDialog(
final result = await TomBootstrapDialog(
client: activeClient,
).show();

if (result != null) {
setState(() {});
}
});

if (!mounted) return;
setState(() {
waitForFirstSync = true;
matrixState.waitForFirstSync = true;
});
}

Expand All @@ -438,7 +440,7 @@ class ChatListController extends State<ChatList>
}
if (!mounted) return;
setState(() {
waitForFirstSync = true;
matrixState.waitForFirstSync = true;
});
}

Expand Down Expand Up @@ -755,7 +757,9 @@ class ChatListController extends State<ChatList>
}
activeRoomIdNotifier.value = widget.activeRoomIdNotifier.value;
scrollController.addListener(_onScroll);
_trySync();
if (!matrixState.waitForFirstSync) {
_trySync();
}
_hackyWebRTCFixForWeb();
// TODO: 28Dec2023 Disable callkeep for util we support audio/video calls
// CallKeepManager().initialize();
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/chat_list/chat_list_body_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ChatListBodyView extends StatelessWidget {
key: Key(controller.activeSpaceId ?? 'Spaces'),
);
}
if (controller.waitForFirstSync &&
if (controller.matrixState.waitForFirstSync &&
controller.activeClient.prevBatch != null) {
if (controller.chatListBodyIsEmpty) {
return Column(
Expand Down
4 changes: 4 additions & 0 deletions lib/widgets/matrix.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class MatrixState extends State<Matrix>
LoginType? loginType;
bool? loginRegistrationSupported;

bool waitForFirstSync = false;

bool get twakeSupported {
final tomServerUrlInterceptor = getIt.get<DynamicUrlInterceptors>(
instanceName: NetworkDI.tomServerUrlInterceptorName,
Expand Down Expand Up @@ -418,6 +420,7 @@ class MatrixState extends State<Matrix>
Client newActiveClient,
LoginState loginState,
) async {
waitForFirstSync = false;
await setUpToMServicesInLogin(newActiveClient);
await _storePersistActiveAccount(newActiveClient);
onClientLoginStateChanged.add(
Expand Down Expand Up @@ -446,6 +449,7 @@ class MatrixState extends State<Matrix>
_loginClientCandidate!.clientName,
);
if (activeClient == null) return;
waitForFirstSync = false;
await setUpToMServicesInLogin(activeClient);
final result = await setActiveClient(activeClient);
if (result.isSuccess) {
Expand Down

0 comments on commit fa69932

Please sign in to comment.