fix: небольшие фиксы от линуса торвальдса
This commit is contained in:
@@ -24,6 +24,8 @@ class SelfCheckService {
|
||||
_timer = Timer.periodic(interval, (_) => unawaited(_check()));
|
||||
}
|
||||
|
||||
void checkNow() => unawaited(_check());
|
||||
|
||||
Future<void> _check() async {
|
||||
final api = _api;
|
||||
if (api == null || api.state != SessionState.online) return;
|
||||
|
||||
Vendored
+4
@@ -11,6 +11,10 @@ class SelfPresence {
|
||||
isOnline.value = true;
|
||||
}
|
||||
|
||||
static void markOffline() {
|
||||
isOnline.value = false;
|
||||
}
|
||||
|
||||
static void markOfflineFromPing() {
|
||||
if (isOnline.value || lastSeenSeconds.value == null) {
|
||||
lastSeenSeconds.value = _nowSeconds;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../../main.dart' show api;
|
||||
import '../../../main.dart' show api, accountModule;
|
||||
import '../../../backend/api.dart';
|
||||
import '../../../backend/modules/account.dart';
|
||||
import '../../../core/storage/app_database.dart';
|
||||
import '../../../core/utils/format.dart';
|
||||
import '../../../backend/modules/calls.dart';
|
||||
@@ -17,11 +21,28 @@ class _CallsTabState extends State<CallsTab> {
|
||||
List<CallLogEntry> _calls = [];
|
||||
bool _isLoading = true;
|
||||
int _selectedTabIndex = 0; // 0 for 'Все', 1 for 'Пропущенные'
|
||||
StreamSubscription<LoginStatus>? _loginSub;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadHistory();
|
||||
if (api.state == SessionState.online) {
|
||||
_loadHistory();
|
||||
} else {
|
||||
_loginSub = accountModule.loginStatusStream.listen((status) {
|
||||
if (status == LoginStatus.success) {
|
||||
_loginSub?.cancel();
|
||||
_loginSub = null;
|
||||
_loadHistory();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_loginSub?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _loadHistory() async {
|
||||
|
||||
+2
-1
@@ -127,7 +127,7 @@ void main() async {
|
||||
await FileHistoryCache.load(prefs);
|
||||
await DraftStore.instance.load();
|
||||
await KometSettings.load();
|
||||
if (KometSettings.ghostMode.value) SelfPresence.markOfflineFromPing();
|
||||
if (KometSettings.ghostMode.value) SelfPresence.markOffline();
|
||||
await ContactCache.load();
|
||||
final initialFpsOverlay = prefs.getBool('dev_fps_overlay') ?? false;
|
||||
final initialVpnBypass = prefs.getBool(VpnBypassService.prefKey) ?? false;
|
||||
@@ -262,6 +262,7 @@ class KometAppState extends State<KometApp>
|
||||
CallController.instance.init(api);
|
||||
OutboxService.instance.init(api, messagesModule);
|
||||
SelfCheckService.instance.init(api);
|
||||
SelfCheckService.instance.checkNow();
|
||||
if (isOnemeFlavor) {
|
||||
await PushService.instance.init(api: api, account: accountModule);
|
||||
await PushService.instance.onLoginSuccess();
|
||||
|
||||
Reference in New Issue
Block a user