Merge branch 'feature/FullStack' of https://github.com/KometTeam/Komet into feature/FullStack

This commit is contained in:
klockky
2026-05-14 13:16:50 +03:00
23 changed files with 1087 additions and 202 deletions
+6
View File
@@ -170,6 +170,10 @@ abstract class Opcode {
static const int notifBanners = 292; // Баннеры
static const int notifFolders = 277; // Обновление папок
// ── Transcription ───────────────────────────────────────────────────
static const int audioTranscription = 202; // Запрос транскрибации аудио
static const int transcriptionResult = 293; // Результат транскрибации (push)
// ── Misc ───────────────────────────────────────────────────────────
static const int okToken = 158; // OK-токен
static const int webAppInitData = 160; // Данные WebApp
@@ -332,6 +336,8 @@ abstract class Opcode {
notifProfile: 'NOTIF_PROFILE',
notifBanners: 'NOTIF_BANNERS',
notifFolders: 'NOTIF_FOLDERS',
audioTranscription: 'AUDIO_TRANSCRIPTION',
transcriptionResult: 'TRANSCRIPTION_RESULT',
okToken: 'OK_TOKEN',
webAppInitData: 'WEB_APP_INIT_DATA',
complain: 'COMPLAIN',
+4 -3
View File
@@ -98,7 +98,7 @@ class ProfileData {
);
}
Map<String, dynamic> toDbRow() => {
Map<String, dynamic> toDbRow({bool isActive = false}) => {
'id': id,
'first_name': firstName,
'last_name': lastName,
@@ -109,6 +109,7 @@ class ProfileData {
'country': country,
'account_status': accountStatus,
'update_time': updateTime,
'is_active': isActive ? 1 : 0,
'profile_options': profileOptions?.join(','),
};
}
@@ -280,11 +281,11 @@ class AppDatabase {
)
''';
static Future<void> saveProfile(ProfileData profile) async {
static Future<void> saveProfile(ProfileData profile, {bool isActive = true}) async {
final db = await _instance;
await db.insert(
'profile',
profile.toDbRow(),
profile.toDbRow(isActive: isActive),
conflictAlgorithm: ConflictAlgorithm.replace,
);
}
+5 -1
View File
@@ -53,8 +53,12 @@ class PacketDispatcher {
if (packet.cmd == CmdType.ok ||
packet.cmd == CmdType.error ||
packet.cmd == CmdType.notFound) {
final payloadStr = packet.payload.toString();
final displayPayload = packet.opcode == Opcode.login && payloadStr.length > 50
? '${payloadStr.substring(0, 50)}...'
: payloadStr;
logger.i(
'<= {ver: ${packet.api}, cmd: ${packet.cmd}, seq: ${packet.seq}, opcode: ${packet.opcode}, payload: ${packet.payload}}',
'<= {ver: ${packet.api}, cmd: ${packet.cmd}, seq: ${packet.seq}, opcode: ${packet.opcode}, payload: $displayPayload}',
);
final completer = _pendingRequests.remove(packet.seq);