diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 315825c..92046af 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -3,12 +3,15 @@
+
+
+ android:usesCleartextTraffic="true"
+ android:enableOnBackInvokedCallback="true">
+
+
+
+
+
+
+
+
diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html
new file mode 100644
index 0000000..8854391
--- /dev/null
+++ b/android/build/reports/problems/problems-report.html
@@ -0,0 +1,663 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Gradle Configuration Cache
+
+
+
+
+
+
+ Loading...
+
+
+
+
+
+
+
diff --git a/lib/core/app_colors.dart b/lib/core/app_colors.dart
deleted file mode 100644
index e1e60d0..0000000
--- a/lib/core/app_colors.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-import 'package:flutter/material.dart';
-
-class AppColors {
- // --- Основные цвета акцентов ---
- static const Color primary = Color(0xFF24A1DE); // Яркий синий (кнопки, активные элементы)
- static const Color primaryDark = Color(0xFF1D84B5); // Темно-синий (для нажатых кнопок)
- static const Color accent = Color(0xFF50B5E8); // Светло-синий (второстепенные элементы)
-
- // --- Фоны ---
- static const Color background = Color(0xFFFFFFFF); // Чистый белый (основной фон)
- static const Color surface = Color(0xFFF1F1F1); // Светло-серый (поля ввода, фон пузырей)
-
- // --- Текст ---
- static const Color textMain = Color(0xFF1F1F1F); // Почти черный (основной текст)
- static const Color textSecondary = Color(0xFF707579);// Серый (подписи, время, хинты)
- static const Color textOnPrimary = Color(0xFFFFFFFF);// Белый (текст на синих кнопках)
-
- // --- Статусы ---
- static const Color error = Color(0xFFE53935); // Красный (ошибки валидации)
- static const Color success = Color(0xFF4CAF50); // Зеленый (статус "онлайн" или "доставлено")
-
- // --- Цвета чата (Пузыри) ---
- static const Color bubbleMe = Color(0xFFEFFDDE); // Нежно-зеленый (мои сообщения, как в TG)
- static const Color bubblePartner = Color(0xFFFFFFFF);// Белый (сообщения собеседника)
-}
\ No newline at end of file
diff --git a/lib/core/constants.dart b/lib/core/constants.dart
index 759edbf..f25435d 100644
--- a/lib/core/constants.dart
+++ b/lib/core/constants.dart
@@ -1,4 +1,5 @@
class AppConstants {
//static const baseUrl = '192.168.0.180:8000';
static const baseUrl = 'https://api.chepuhagram.ru';
-}
\ No newline at end of file
+ static const wsUrl = 'wss://api.chepuhagram.ru';
+}
diff --git a/lib/core/theme_manager.dart b/lib/core/theme_manager.dart
index 0eeb67e..d99a510 100644
--- a/lib/core/theme_manager.dart
+++ b/lib/core/theme_manager.dart
@@ -10,6 +10,8 @@ class ThemeProvider extends ChangeNotifier {
ThemeMode get themeMode => _themeMode;
Color get accentColor => _accentColor;
+ bool isLight = false;
+
ThemeProvider() {
_loadSettings();
}
@@ -21,6 +23,7 @@ class ThemeProvider extends ChangeNotifier {
if (mode != null) {
_themeMode = mode == 'dark' ? ThemeMode.dark : ThemeMode.light;
+ isLight = mode == 'light';
}
if (color != null) _accentColor = Color(int.parse(color));
notifyListeners();
@@ -28,6 +31,7 @@ class ThemeProvider extends ChangeNotifier {
void toggleTheme(bool isDark) {
_themeMode = isDark ? ThemeMode.dark : ThemeMode.light;
+ isLight = !isDark;
_storage.write(key: 'theme_mode', value: isDark ? 'dark' : 'light');
notifyListeners();
}
diff --git a/lib/data/datasources/local_db_service.dart b/lib/data/datasources/local_db_service.dart
index 8cc717e..66a71d3 100644
--- a/lib/data/datasources/local_db_service.dart
+++ b/lib/data/datasources/local_db_service.dart
@@ -19,7 +19,7 @@ class LocalDbService {
String path = join(await getDatabasesPath(), 'chat_app.db');
return await openDatabase(
path,
- version: 3,
+ version: 4,
onCreate: (db, version) async {
await db.execute('''
CREATE TABLE messages(
@@ -31,7 +31,8 @@ class LocalDbService {
delivered_at TEXT,
read_at TEXT,
reply_to_id INTEGER,
- reply_to_text TEXT
+ reply_to_text TEXT,
+ edited_at TEXT
)
''');
},
@@ -41,8 +42,15 @@ class LocalDbService {
await db.execute('ALTER TABLE messages ADD COLUMN read_at TEXT');
}
if (oldVersion < 3) {
- await db.execute('ALTER TABLE messages ADD COLUMN reply_to_id INTEGER');
- await db.execute('ALTER TABLE messages ADD COLUMN reply_to_text TEXT');
+ await db.execute(
+ 'ALTER TABLE messages ADD COLUMN reply_to_id INTEGER',
+ );
+ await db.execute(
+ 'ALTER TABLE messages ADD COLUMN reply_to_text TEXT',
+ );
+ }
+ if (oldVersion < 4) {
+ await db.execute('ALTER TABLE messages ADD COLUMN edited_at TEXT');
}
},
);
@@ -62,19 +70,24 @@ class LocalDbService {
'timestamp': msg.createdAt.toIso8601String(),
'delivered_at': null,
'read_at': null,
+ 'reply_to_id': msg.replyToId,
+ 'reply_to_text': msg.replyToText,
+ 'edited_at': msg.editedAt?.toIso8601String(),
}, conflictAlgorithm: ConflictAlgorithm.replace);
} else {
// Если это Map из API
batch.insert('messages', {
'id': msg['id'],
'sender_id': msg['sender_id'],
- 'receiver_id': msg['receiver_id'], // Убедись, что ключ совпадает с API
+ 'receiver_id':
+ msg['receiver_id'], // Убедись, что ключ совпадает с API
'content': msg['content'],
'timestamp': msg['timestamp'],
'delivered_at': msg['delivered_at'],
'read_at': msg['read_at'],
'reply_to_id': msg['reply_to_id'],
'reply_to_text': msg['reply_to_text'],
+ 'edited_at': msg['edited_at'],
}, conflictAlgorithm: ConflictAlgorithm.replace);
}
}
@@ -96,6 +109,16 @@ class LocalDbService {
);
}
+ Future deleteChatHistory(int contactId, int myId) async {
+ final db = await database;
+ return await db.delete(
+ 'messages',
+ where:
+ '(sender_id = ? AND receiver_id = ?) OR (sender_id = ? AND receiver_id = ?)',
+ whereArgs: [contactId, myId, myId, contactId],
+ );
+ }
+
Future