Теперь можно жаловаться на сообщения!!!
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:gwid/connection/connection_logger.dart';
|
|||||||
import 'package:gwid/connection/connection_state.dart' as conn_state;
|
import 'package:gwid/connection/connection_state.dart' as conn_state;
|
||||||
import 'package:gwid/connection/health_monitor.dart';
|
import 'package:gwid/connection/health_monitor.dart';
|
||||||
import 'package:gwid/image_cache_service.dart';
|
import 'package:gwid/image_cache_service.dart';
|
||||||
|
import 'package:gwid/models/complaint.dart';
|
||||||
import 'package:gwid/models/contact.dart';
|
import 'package:gwid/models/contact.dart';
|
||||||
import 'package:gwid/models/message.dart';
|
import 'package:gwid/models/message.dart';
|
||||||
import 'package:gwid/models/profile.dart';
|
import 'package:gwid/models/profile.dart';
|
||||||
@@ -31,6 +32,7 @@ part 'api_service_contacts.dart';
|
|||||||
part 'api_service_chats.dart';
|
part 'api_service_chats.dart';
|
||||||
part 'api_service_media.dart';
|
part 'api_service_media.dart';
|
||||||
part 'api_service_privacy.dart';
|
part 'api_service_privacy.dart';
|
||||||
|
part 'api_service_complaints.dart';
|
||||||
|
|
||||||
class ApiService {
|
class ApiService {
|
||||||
ApiService._privateConstructor();
|
ApiService._privateConstructor();
|
||||||
@@ -85,9 +87,7 @@ class ApiService {
|
|||||||
|
|
||||||
final Map<int, Contact> _contactCache = {};
|
final Map<int, Contact> _contactCache = {};
|
||||||
DateTime? _lastContactsUpdate;
|
DateTime? _lastContactsUpdate;
|
||||||
static const Duration _contactCacheExpiry = Duration(
|
static const Duration _contactCacheExpiry = Duration(minutes: 5);
|
||||||
minutes: 5,
|
|
||||||
);
|
|
||||||
|
|
||||||
final CacheService _cacheService = CacheService();
|
final CacheService _cacheService = CacheService();
|
||||||
final AvatarCacheService _avatarCacheService = AvatarCacheService();
|
final AvatarCacheService _avatarCacheService = AvatarCacheService();
|
||||||
@@ -295,4 +295,3 @@ class ApiService {
|
|||||||
_messageController.close();
|
_messageController.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
lib/api/api_service_complaints.dart
Normal file
18
lib/api/api_service_complaints.dart
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
part of 'api_service.dart';
|
||||||
|
|
||||||
|
extension ApiServiceComplaints on ApiService {
|
||||||
|
void getComplaints() {
|
||||||
|
final payload = {"complainSync": 0};
|
||||||
|
_sendMessage(162, payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendComplaint(int chatId, String messageId, int typeId, int reasonId) {
|
||||||
|
final payload = {
|
||||||
|
"reasonId": reasonId,
|
||||||
|
"parentId": chatId,
|
||||||
|
"typeId": 3,
|
||||||
|
"ids": [int.parse(messageId)], // Конвертируем в число
|
||||||
|
};
|
||||||
|
_sendMessage(161, payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -90,8 +90,8 @@ extension ApiServiceConnection on ApiService {
|
|||||||
print(
|
print(
|
||||||
'Используем ${proxySettings.protocol.name.toUpperCase()} прокси ${proxySettings.host}:${proxySettings.port}',
|
'Используем ${proxySettings.protocol.name.toUpperCase()} прокси ${proxySettings.host}:${proxySettings.port}',
|
||||||
);
|
);
|
||||||
final customHttpClient =
|
final customHttpClient = await ProxyService.instance
|
||||||
await ProxyService.instance.getHttpClientWithProxy();
|
.getHttpClientWithProxy();
|
||||||
_channel = IOWebSocketChannel.connect(
|
_channel = IOWebSocketChannel.connect(
|
||||||
uri,
|
uri,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
@@ -166,7 +166,8 @@ extension ApiServiceConnection on ApiService {
|
|||||||
final userAgentPayload = await _buildUserAgentPayload();
|
final userAgentPayload = await _buildUserAgentPayload();
|
||||||
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
final deviceId = prefs.getString('spoof_deviceid') ?? generateRandomDeviceId();
|
final deviceId =
|
||||||
|
prefs.getString('spoof_deviceid') ?? generateRandomDeviceId();
|
||||||
|
|
||||||
if (prefs.getString('spoof_deviceid') == null) {
|
if (prefs.getString('spoof_deviceid') == null) {
|
||||||
await prefs.setString('spoof_deviceid', deviceId);
|
await prefs.setString('spoof_deviceid', deviceId);
|
||||||
@@ -335,8 +336,9 @@ extension ApiServiceConnection on ApiService {
|
|||||||
_log(loggableMessage);
|
_log(loggableMessage);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final decodedMessage =
|
final decodedMessage = message is String
|
||||||
message is String ? jsonDecode(message) : message;
|
? jsonDecode(message)
|
||||||
|
: message;
|
||||||
|
|
||||||
if (decodedMessage is Map &&
|
if (decodedMessage is Map &&
|
||||||
decodedMessage['opcode'] == 97 &&
|
decodedMessage['opcode'] == 97 &&
|
||||||
@@ -588,6 +590,23 @@ extension ApiServiceConnection on ApiService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (decodedMessage is Map &&
|
||||||
|
decodedMessage['opcode'] == 162 &&
|
||||||
|
decodedMessage['cmd'] == 1) {
|
||||||
|
final payload = decodedMessage['payload'];
|
||||||
|
print('Получены данные жалоб: $payload');
|
||||||
|
|
||||||
|
try {
|
||||||
|
final complaintData = ComplaintData.fromJson(payload);
|
||||||
|
_messageController.add({
|
||||||
|
'type': 'complaints_data',
|
||||||
|
'complaintData': complaintData,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
print('Ошибка парсинга данных жалоб: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (decodedMessage is Map<String, dynamic>) {
|
if (decodedMessage is Map<String, dynamic>) {
|
||||||
_messageController.add(decodedMessage);
|
_messageController.add(decodedMessage);
|
||||||
}
|
}
|
||||||
@@ -783,4 +802,3 @@ extension ApiServiceConnection on ApiService {
|
|||||||
_connectionStatusController.add("disconnected");
|
_connectionStatusController.add("disconnected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:gwid/models/contact.dart';
|
import 'package:gwid/models/contact.dart';
|
||||||
import 'package:gwid/models/message.dart';
|
import 'package:gwid/models/message.dart';
|
||||||
import 'package:gwid/widgets/chat_message_bubble.dart';
|
import 'package:gwid/widgets/chat_message_bubble.dart';
|
||||||
|
import 'package:gwid/widgets/complaint_dialog.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:gwid/services/chat_cache_service.dart';
|
import 'package:gwid/services/chat_cache_service.dart';
|
||||||
import 'package:gwid/services/avatar_cache_service.dart';
|
import 'package:gwid/services/avatar_cache_service.dart';
|
||||||
@@ -1163,6 +1164,14 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showComplaintDialog(String messageId) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) =>
|
||||||
|
ComplaintDialog(messageId: messageId, chatId: widget.chatId),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void _showBlockDialog() {
|
void _showBlockDialog() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -1750,6 +1759,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
isGrouped: item.isGrouped,
|
isGrouped: item.isGrouped,
|
||||||
avatarVerticalOffset:
|
avatarVerticalOffset:
|
||||||
-8.0, // Смещение аватарки вверх на 8px
|
-8.0, // Смещение аватарки вверх на 8px
|
||||||
|
onComplain: () => _showComplaintDialog(item.message.id),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget finalMessageWidget = bubble as Widget;
|
Widget finalMessageWidget = bubble as Widget;
|
||||||
|
|||||||
45
lib/models/complaint.dart
Normal file
45
lib/models/complaint.dart
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
class ComplaintType {
|
||||||
|
final int typeId;
|
||||||
|
final List<ComplaintReason> reasons;
|
||||||
|
|
||||||
|
ComplaintType({required this.typeId, required this.reasons});
|
||||||
|
|
||||||
|
factory ComplaintType.fromJson(Map<String, dynamic> json) {
|
||||||
|
return ComplaintType(
|
||||||
|
typeId: json['typeId'],
|
||||||
|
reasons: (json['reasons'] as List)
|
||||||
|
.map((reason) => ComplaintReason.fromJson(reason))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ComplaintReason {
|
||||||
|
final String reasonTitle;
|
||||||
|
final int reasonId;
|
||||||
|
|
||||||
|
ComplaintReason({required this.reasonTitle, required this.reasonId});
|
||||||
|
|
||||||
|
factory ComplaintReason.fromJson(Map<String, dynamic> json) {
|
||||||
|
return ComplaintReason(
|
||||||
|
reasonTitle: json['reasonTitle'],
|
||||||
|
reasonId: json['reasonId'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ComplaintData {
|
||||||
|
final List<ComplaintType> complainTypes;
|
||||||
|
final int complainSync;
|
||||||
|
|
||||||
|
ComplaintData({required this.complainTypes, required this.complainSync});
|
||||||
|
|
||||||
|
factory ComplaintData.fromJson(Map<String, dynamic> json) {
|
||||||
|
return ComplaintData(
|
||||||
|
complainTypes: (json['complains'] as List)
|
||||||
|
.map((type) => ComplaintType.fromJson(type))
|
||||||
|
.toList(),
|
||||||
|
complainSync: json['complainSync'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -176,6 +176,7 @@ class ChatMessageBubble extends StatelessWidget {
|
|||||||
final VoidCallback? onRemoveReaction;
|
final VoidCallback? onRemoveReaction;
|
||||||
final VoidCallback? onReply;
|
final VoidCallback? onReply;
|
||||||
final VoidCallback? onForward;
|
final VoidCallback? onForward;
|
||||||
|
final VoidCallback? onComplain;
|
||||||
final int? myUserId;
|
final int? myUserId;
|
||||||
final bool? canEditMessage;
|
final bool? canEditMessage;
|
||||||
final bool isGroupChat;
|
final bool isGroupChat;
|
||||||
@@ -207,6 +208,7 @@ class ChatMessageBubble extends StatelessWidget {
|
|||||||
this.onRemoveReaction,
|
this.onRemoveReaction,
|
||||||
this.onReply,
|
this.onReply,
|
||||||
this.onForward,
|
this.onForward,
|
||||||
|
this.onComplain,
|
||||||
this.myUserId,
|
this.myUserId,
|
||||||
this.canEditMessage,
|
this.canEditMessage,
|
||||||
this.isGroupChat = false,
|
this.isGroupChat = false,
|
||||||
@@ -890,6 +892,7 @@ class ChatMessageBubble extends StatelessWidget {
|
|||||||
onReaction: onReaction,
|
onReaction: onReaction,
|
||||||
onRemoveReaction: onRemoveReaction,
|
onRemoveReaction: onRemoveReaction,
|
||||||
onForward: onForward,
|
onForward: onForward,
|
||||||
|
onComplain: onComplain,
|
||||||
canEditMessage: canEditMessage ?? false,
|
canEditMessage: canEditMessage ?? false,
|
||||||
hasUserReaction: hasUserReaction,
|
hasUserReaction: hasUserReaction,
|
||||||
isChannel: isChannel,
|
isChannel: isChannel,
|
||||||
@@ -1541,7 +1544,9 @@ class ChatMessageBubble extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPhotoOnlyMessage(BuildContext context) {
|
Widget _buildPhotoOnlyMessage(BuildContext context) {
|
||||||
final photos = message.attaches.where((a) => a['_type'] == 'PHOTO').toList();
|
final photos = message.attaches
|
||||||
|
.where((a) => a['_type'] == 'PHOTO')
|
||||||
|
.toList();
|
||||||
final themeProvider = Provider.of<ThemeProvider>(context);
|
final themeProvider = Provider.of<ThemeProvider>(context);
|
||||||
final isUltraOptimized = themeProvider.ultraOptimizeChats;
|
final isUltraOptimized = themeProvider.ultraOptimizeChats;
|
||||||
final messageOpacity = themeProvider.messageBubbleOpacity;
|
final messageOpacity = themeProvider.messageBubbleOpacity;
|
||||||
@@ -1586,7 +1591,12 @@ class ChatMessageBubble extends StatelessWidget {
|
|||||||
? CrossAxisAlignment.end
|
? CrossAxisAlignment.end
|
||||||
: CrossAxisAlignment.start,
|
: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildSmartPhotoGroup(context, photos, textColor, isUltraOptimized),
|
_buildSmartPhotoGroup(
|
||||||
|
context,
|
||||||
|
photos,
|
||||||
|
textColor,
|
||||||
|
isUltraOptimized,
|
||||||
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 4, right: 6),
|
padding: const EdgeInsets.only(top: 4, right: 6),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -1620,7 +1630,9 @@ class ChatMessageBubble extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildVideoOnlyMessage(BuildContext context) {
|
Widget _buildVideoOnlyMessage(BuildContext context) {
|
||||||
final videos = message.attaches.where((a) => a['_type'] == 'VIDEO').toList();
|
final videos = message.attaches
|
||||||
|
.where((a) => a['_type'] == 'VIDEO')
|
||||||
|
.toList();
|
||||||
|
|
||||||
final timeColor = Theme.of(context).brightness == Brightness.dark
|
final timeColor = Theme.of(context).brightness == Brightness.dark
|
||||||
? const Color(0xFF9bb5c7)
|
? const Color(0xFF9bb5c7)
|
||||||
@@ -1714,7 +1726,10 @@ class ChatMessageBubble extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
_formatMessageTime(context, message.time),
|
_formatMessageTime(context, message.time),
|
||||||
style: TextStyle(fontSize: 12, color: timeColor),
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: timeColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -3925,6 +3940,7 @@ class _MessageContextMenu extends StatefulWidget {
|
|||||||
final Function(String)? onReaction;
|
final Function(String)? onReaction;
|
||||||
final VoidCallback? onRemoveReaction;
|
final VoidCallback? onRemoveReaction;
|
||||||
final VoidCallback? onForward;
|
final VoidCallback? onForward;
|
||||||
|
final VoidCallback? onComplain;
|
||||||
final bool canEditMessage;
|
final bool canEditMessage;
|
||||||
final bool hasUserReaction;
|
final bool hasUserReaction;
|
||||||
final bool isChannel;
|
final bool isChannel;
|
||||||
@@ -3939,6 +3955,7 @@ class _MessageContextMenu extends StatefulWidget {
|
|||||||
this.onReaction,
|
this.onReaction,
|
||||||
this.onRemoveReaction,
|
this.onRemoveReaction,
|
||||||
this.onForward,
|
this.onForward,
|
||||||
|
this.onComplain,
|
||||||
required this.canEditMessage,
|
required this.canEditMessage,
|
||||||
required this.hasUserReaction,
|
required this.hasUserReaction,
|
||||||
this.isChannel = false,
|
this.isChannel = false,
|
||||||
@@ -4267,6 +4284,16 @@ class _MessageContextMenuState extends State<_MessageContextMenu>
|
|||||||
widget.onDeleteForAll!();
|
widget.onDeleteForAll!();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
if (widget.onComplain != null)
|
||||||
|
_buildActionButton(
|
||||||
|
icon: Icons.report_rounded,
|
||||||
|
text: 'Пожаловаться',
|
||||||
|
color: theme.colorScheme.error,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
widget.onComplain!();
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
173
lib/widgets/complaint_dialog.dart
Normal file
173
lib/widgets/complaint_dialog.dart
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gwid/models/complaint.dart';
|
||||||
|
import 'package:gwid/api/api_service.dart';
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
class ComplaintDialog extends StatefulWidget {
|
||||||
|
final String messageId;
|
||||||
|
final int chatId;
|
||||||
|
|
||||||
|
const ComplaintDialog({
|
||||||
|
super.key,
|
||||||
|
required this.messageId,
|
||||||
|
required this.chatId,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ComplaintDialog> createState() => _ComplaintDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ComplaintDialogState extends State<ComplaintDialog> {
|
||||||
|
ComplaintData? _complaintData;
|
||||||
|
bool _isLoading = true;
|
||||||
|
String? _error;
|
||||||
|
StreamSubscription? _messageSubscription;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_loadComplaints();
|
||||||
|
_listenForComplaintsData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_messageSubscription?.cancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _loadComplaints() {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
_error = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
ApiService.instance.getComplaints();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _listenForComplaintsData() {
|
||||||
|
_messageSubscription = ApiService.instance.messages.listen((message) {
|
||||||
|
if (message['type'] == 'complaints_data' && mounted) {
|
||||||
|
setState(() {
|
||||||
|
_complaintData = message['complaintData'] as ComplaintData?;
|
||||||
|
_isLoading = false;
|
||||||
|
_error = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _handleComplaintSelected(int typeId, int reasonId) {
|
||||||
|
ApiService.instance.sendComplaint(
|
||||||
|
widget.chatId,
|
||||||
|
widget.messageId,
|
||||||
|
typeId,
|
||||||
|
reasonId,
|
||||||
|
);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text('Жалоба отправлена'),
|
||||||
|
behavior: SnackBarBehavior.floating,
|
||||||
|
duration: Duration(seconds: 2),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('Жалоба на сообщение'),
|
||||||
|
content: SizedBox(
|
||||||
|
width: double.maxFinite,
|
||||||
|
child: _isLoading
|
||||||
|
? const Center(child: CircularProgressIndicator())
|
||||||
|
: _error != null
|
||||||
|
? Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text('Ошибка: $_error'),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: _loadComplaints,
|
||||||
|
child: const Text('Повторить'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: _complaintData == null
|
||||||
|
? const Center(child: Text('Нет данных о жалобах'))
|
||||||
|
: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: _getAllReasons().length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final reasonData = _getAllReasons()[index];
|
||||||
|
return ListTile(
|
||||||
|
leading: Icon(
|
||||||
|
reasonData['icon'] as IconData,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
title: Text(reasonData['title'] as String),
|
||||||
|
onTap: () => _handleComplaintSelected(
|
||||||
|
reasonData['typeId'] as int,
|
||||||
|
reasonData['reasonId'] as int,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: const Text('Отмена'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map<String, dynamic>> _getAllReasons() {
|
||||||
|
if (_complaintData == null) return [];
|
||||||
|
|
||||||
|
final uniqueReasons = <int, Map<String, dynamic>>{};
|
||||||
|
for (final complaintType in _complaintData!.complainTypes) {
|
||||||
|
for (final reason in complaintType.reasons) {
|
||||||
|
if (!uniqueReasons.containsKey(reason.reasonId)) {
|
||||||
|
String title = reason.reasonTitle;
|
||||||
|
// Забавный прикол для оскорблений
|
||||||
|
if (reason.reasonId == 11) {
|
||||||
|
// Оскорбления
|
||||||
|
title = 'Абзывательства матюки';
|
||||||
|
}
|
||||||
|
|
||||||
|
uniqueReasons[reason.reasonId] = {
|
||||||
|
'title': title,
|
||||||
|
'typeId': complaintType.typeId,
|
||||||
|
'reasonId': reason.reasonId,
|
||||||
|
'icon': _getReasonIcon(reason.reasonId),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return uniqueReasons.values.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
IconData _getReasonIcon(int reasonId) {
|
||||||
|
switch (reasonId) {
|
||||||
|
case 7: // Другое
|
||||||
|
return Icons.more_horiz;
|
||||||
|
case 8: // Мошенничество
|
||||||
|
return Icons.warning;
|
||||||
|
case 9: // Спам
|
||||||
|
return Icons.campaign;
|
||||||
|
case 10: // Шантаж
|
||||||
|
return Icons.gavel;
|
||||||
|
case 11: // Оскорбления
|
||||||
|
return Icons.sentiment_very_dissatisfied;
|
||||||
|
case 12: // Недостоверная информация
|
||||||
|
return Icons.help_outline;
|
||||||
|
default:
|
||||||
|
return Icons.report_problem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -809,10 +809,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
|
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.16.0"
|
version: "1.17.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1318,10 +1318,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
|
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.6"
|
version: "0.7.7"
|
||||||
timezone:
|
timezone:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
Reference in New Issue
Block a user