mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-03 19:54:12 +00:00 
			
		
		
		
	Start to build report dialog
This commit is contained in:
		
							
								
								
									
										8
									
								
								lib/models/report_target.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								lib/models/report_target.dart
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
import 'package:comunic/enums/report_target_type.dart';
 | 
			
		||||
 | 
			
		||||
class ReportTarget {
 | 
			
		||||
  final ReportTargetType type;
 | 
			
		||||
  final int targetId;
 | 
			
		||||
 | 
			
		||||
  const ReportTarget(this.type, this.targetId);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
import 'package:comunic/utils/date_utils.dart';
 | 
			
		||||
import 'package:comunic/utils/intl_utils.dart';
 | 
			
		||||
import 'package:version/version.dart';
 | 
			
		||||
 | 
			
		||||
/// Server static configuration
 | 
			
		||||
@@ -137,6 +138,23 @@ class Banner {
 | 
			
		||||
  bool get visible => enabled && (expire == null || expire! > time());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ReportCause {
 | 
			
		||||
  final String id;
 | 
			
		||||
  final Map<String, String> label;
 | 
			
		||||
 | 
			
		||||
  const ReportCause({required this.id, required this.label});
 | 
			
		||||
 | 
			
		||||
  String get localeLabel =>
 | 
			
		||||
      label.containsKey(shortLang) ? label[shortLang]! : label["en"]!;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ReportPolicy {
 | 
			
		||||
  final List<ReportCause> causes;
 | 
			
		||||
  final int maxCommentLength;
 | 
			
		||||
 | 
			
		||||
  const ReportPolicy({required this.causes, required this.maxCommentLength});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ServerConfig {
 | 
			
		||||
  final Version minSupportedMobileVersion;
 | 
			
		||||
  final String termsURL;
 | 
			
		||||
@@ -150,6 +168,7 @@ class ServerConfig {
 | 
			
		||||
  final ServerDataConservationPolicy dataConservationPolicy;
 | 
			
		||||
  final ConversationsPolicy conversationsPolicy;
 | 
			
		||||
  final AccountInformationPolicy accountInformationPolicy;
 | 
			
		||||
  final ReportPolicy? reportPolicy;
 | 
			
		||||
 | 
			
		||||
  const ServerConfig({
 | 
			
		||||
    required this.minSupportedMobileVersion,
 | 
			
		||||
@@ -164,5 +183,8 @@ class ServerConfig {
 | 
			
		||||
    required this.dataConservationPolicy,
 | 
			
		||||
    required this.conversationsPolicy,
 | 
			
		||||
    required this.accountInformationPolicy,
 | 
			
		||||
    required this.reportPolicy,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  bool get isReportingEnabled => this.reportPolicy != null;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user