feat : privacyPolicyWidget

This commit is contained in:
2025-07-23 14:41:05 +03:30
parent 93294dcfc1
commit 297c3659ea
35 changed files with 10368 additions and 275 deletions

View File

@@ -5,24 +5,14 @@ part 'app_info_model.g.dart';
@freezed
abstract class AppInfoModel with _$AppInfoModel {
const factory AppInfoModel({
required String key,
required Info info,
required String downloadLink,
}) = _AppInfoModel;
const factory AppInfoModel({String? key, String? download_link, Info? info}) = _AppInfoModel;
factory AppInfoModel.fromJson(Map<String, dynamic> json) =>
_$AppInfoModelFromJson(json);
factory AppInfoModel.fromJson(Map<String, dynamic> json) => _$AppInfoModelFromJson(json);
}
@freezed
abstract class Info with _$Info {
const factory Info({
required String version,
required bool required,
required String module,
}) = _Info;
const factory Info({String? version, String? module, bool? required}) = _Info;
factory Info.fromJson(Map<String, dynamic> json) => _$InfoFromJson(json);
}

View File

@@ -1,6 +1,5 @@
// dart format width=80
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
@@ -16,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AppInfoModel {
String get key; Info get info; String get downloadLink;
String? get key; String? get download_link; Info? get info;
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -29,16 +28,16 @@ $AppInfoModelCopyWith<AppInfoModel> get copyWith => _$AppInfoModelCopyWithImpl<A
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppInfoModel&&(identical(other.key, key) || other.key == key)&&(identical(other.info, info) || other.info == info)&&(identical(other.downloadLink, downloadLink) || other.downloadLink == downloadLink));
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppInfoModel&&(identical(other.key, key) || other.key == key)&&(identical(other.download_link, download_link) || other.download_link == download_link)&&(identical(other.info, info) || other.info == info));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,info,downloadLink);
int get hashCode => Object.hash(runtimeType,key,download_link,info);
@override
String toString() {
return 'AppInfoModel(key: $key, info: $info, downloadLink: $downloadLink)';
return 'AppInfoModel(key: $key, download_link: $download_link, info: $info)';
}
@@ -49,11 +48,11 @@ abstract mixin class $AppInfoModelCopyWith<$Res> {
factory $AppInfoModelCopyWith(AppInfoModel value, $Res Function(AppInfoModel) _then) = _$AppInfoModelCopyWithImpl;
@useResult
$Res call({
String key, Info info, String downloadLink
String? key, String? download_link, Info? info
});
$InfoCopyWith<$Res> get info;
$InfoCopyWith<$Res>? get info;
}
/// @nodoc
@@ -66,37 +65,170 @@ class _$AppInfoModelCopyWithImpl<$Res>
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? key = null,Object? info = null,Object? downloadLink = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? download_link = freezed,Object? info = freezed,}) {
return _then(_self.copyWith(
key: null == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String,info: null == info ? _self.info : info // ignore: cast_nullable_to_non_nullable
as Info,downloadLink: null == downloadLink ? _self.downloadLink : downloadLink // ignore: cast_nullable_to_non_nullable
as String,
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,download_link: freezed == download_link ? _self.download_link : download_link // ignore: cast_nullable_to_non_nullable
as String?,info: freezed == info ? _self.info : info // ignore: cast_nullable_to_non_nullable
as Info?,
));
}
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$InfoCopyWith<$Res> get info {
return $InfoCopyWith<$Res>(_self.info, (value) {
$InfoCopyWith<$Res>? get info {
if (_self.info == null) {
return null;
}
return $InfoCopyWith<$Res>(_self.info!, (value) {
return _then(_self.copyWith(info: value));
});
}
}
/// Adds pattern-matching-related methods to [AppInfoModel].
extension AppInfoModelPatterns on AppInfoModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AppInfoModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _AppInfoModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AppInfoModel value) $default,){
final _that = this;
switch (_that) {
case _AppInfoModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AppInfoModel value)? $default,){
final _that = this;
switch (_that) {
case _AppInfoModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, String? download_link, Info? info)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AppInfoModel() when $default != null:
return $default(_that.key,_that.download_link,_that.info);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, String? download_link, Info? info) $default,) {final _that = this;
switch (_that) {
case _AppInfoModel():
return $default(_that.key,_that.download_link,_that.info);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, String? download_link, Info? info)? $default,) {final _that = this;
switch (_that) {
case _AppInfoModel() when $default != null:
return $default(_that.key,_that.download_link,_that.info);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _AppInfoModel implements AppInfoModel {
const _AppInfoModel({required this.key, required this.info, required this.downloadLink});
const _AppInfoModel({this.key, this.download_link, this.info});
factory _AppInfoModel.fromJson(Map<String, dynamic> json) => _$AppInfoModelFromJson(json);
@override final String key;
@override final Info info;
@override final String downloadLink;
@override final String? key;
@override final String? download_link;
@override final Info? info;
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@@ -111,16 +243,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppInfoModel&&(identical(other.key, key) || other.key == key)&&(identical(other.info, info) || other.info == info)&&(identical(other.downloadLink, downloadLink) || other.downloadLink == downloadLink));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppInfoModel&&(identical(other.key, key) || other.key == key)&&(identical(other.download_link, download_link) || other.download_link == download_link)&&(identical(other.info, info) || other.info == info));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,info,downloadLink);
int get hashCode => Object.hash(runtimeType,key,download_link,info);
@override
String toString() {
return 'AppInfoModel(key: $key, info: $info, downloadLink: $downloadLink)';
return 'AppInfoModel(key: $key, download_link: $download_link, info: $info)';
}
@@ -131,11 +263,11 @@ abstract mixin class _$AppInfoModelCopyWith<$Res> implements $AppInfoModelCopyWi
factory _$AppInfoModelCopyWith(_AppInfoModel value, $Res Function(_AppInfoModel) _then) = __$AppInfoModelCopyWithImpl;
@override @useResult
$Res call({
String key, Info info, String downloadLink
String? key, String? download_link, Info? info
});
@override $InfoCopyWith<$Res> get info;
@override $InfoCopyWith<$Res>? get info;
}
/// @nodoc
@@ -148,12 +280,12 @@ class __$AppInfoModelCopyWithImpl<$Res>
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? key = null,Object? info = null,Object? downloadLink = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? download_link = freezed,Object? info = freezed,}) {
return _then(_AppInfoModel(
key: null == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String,info: null == info ? _self.info : info // ignore: cast_nullable_to_non_nullable
as Info,downloadLink: null == downloadLink ? _self.downloadLink : downloadLink // ignore: cast_nullable_to_non_nullable
as String,
key: freezed == key ? _self.key : key // ignore: cast_nullable_to_non_nullable
as String?,download_link: freezed == download_link ? _self.download_link : download_link // ignore: cast_nullable_to_non_nullable
as String?,info: freezed == info ? _self.info : info // ignore: cast_nullable_to_non_nullable
as Info?,
));
}
@@ -161,9 +293,12 @@ as String,
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$InfoCopyWith<$Res> get info {
return $InfoCopyWith<$Res>(_self.info, (value) {
$InfoCopyWith<$Res>? get info {
if (_self.info == null) {
return null;
}
return $InfoCopyWith<$Res>(_self.info!, (value) {
return _then(_self.copyWith(info: value));
});
}
@@ -173,7 +308,7 @@ $InfoCopyWith<$Res> get info {
/// @nodoc
mixin _$Info {
String get version; bool get required; String get module;
String? get version; String? get module; bool? get required;
/// Create a copy of Info
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -186,16 +321,16 @@ $InfoCopyWith<Info> get copyWith => _$InfoCopyWithImpl<Info>(this as Info, _$ide
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is Info&&(identical(other.version, version) || other.version == version)&&(identical(other.required, required) || other.required == required)&&(identical(other.module, module) || other.module == module));
return identical(this, other) || (other.runtimeType == runtimeType&&other is Info&&(identical(other.version, version) || other.version == version)&&(identical(other.module, module) || other.module == module)&&(identical(other.required, required) || other.required == required));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,version,required,module);
int get hashCode => Object.hash(runtimeType,version,module,required);
@override
String toString() {
return 'Info(version: $version, required: $required, module: $module)';
return 'Info(version: $version, module: $module, required: $required)';
}
@@ -206,7 +341,7 @@ abstract mixin class $InfoCopyWith<$Res> {
factory $InfoCopyWith(Info value, $Res Function(Info) _then) = _$InfoCopyWithImpl;
@useResult
$Res call({
String version, bool required, String module
String? version, String? module, bool? required
});
@@ -223,28 +358,158 @@ class _$InfoCopyWithImpl<$Res>
/// Create a copy of Info
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? version = null,Object? required = null,Object? module = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? version = freezed,Object? module = freezed,Object? required = freezed,}) {
return _then(_self.copyWith(
version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
as String,required: null == required ? _self.required : required // ignore: cast_nullable_to_non_nullable
as bool,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
as String,
version: freezed == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
as String?,module: freezed == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
as String?,required: freezed == required ? _self.required : required // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
/// Adds pattern-matching-related methods to [Info].
extension InfoPatterns on Info {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _Info value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _Info() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _Info value) $default,){
final _that = this;
switch (_that) {
case _Info():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _Info value)? $default,){
final _that = this;
switch (_that) {
case _Info() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? version, String? module, bool? required)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Info() when $default != null:
return $default(_that.version,_that.module,_that.required);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? version, String? module, bool? required) $default,) {final _that = this;
switch (_that) {
case _Info():
return $default(_that.version,_that.module,_that.required);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? version, String? module, bool? required)? $default,) {final _that = this;
switch (_that) {
case _Info() when $default != null:
return $default(_that.version,_that.module,_that.required);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _Info implements Info {
const _Info({required this.version, required this.required, required this.module});
const _Info({this.version, this.module, this.required});
factory _Info.fromJson(Map<String, dynamic> json) => _$InfoFromJson(json);
@override final String version;
@override final bool required;
@override final String module;
@override final String? version;
@override final String? module;
@override final bool? required;
/// Create a copy of Info
/// with the given fields replaced by the non-null parameter values.
@@ -259,16 +524,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Info&&(identical(other.version, version) || other.version == version)&&(identical(other.required, required) || other.required == required)&&(identical(other.module, module) || other.module == module));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Info&&(identical(other.version, version) || other.version == version)&&(identical(other.module, module) || other.module == module)&&(identical(other.required, required) || other.required == required));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,version,required,module);
int get hashCode => Object.hash(runtimeType,version,module,required);
@override
String toString() {
return 'Info(version: $version, required: $required, module: $module)';
return 'Info(version: $version, module: $module, required: $required)';
}
@@ -279,7 +544,7 @@ abstract mixin class _$InfoCopyWith<$Res> implements $InfoCopyWith<$Res> {
factory _$InfoCopyWith(_Info value, $Res Function(_Info) _then) = __$InfoCopyWithImpl;
@override @useResult
$Res call({
String version, bool required, String module
String? version, String? module, bool? required
});
@@ -296,12 +561,12 @@ class __$InfoCopyWithImpl<$Res>
/// Create a copy of Info
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? version = null,Object? required = null,Object? module = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? version = freezed,Object? module = freezed,Object? required = freezed,}) {
return _then(_Info(
version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
as String,required: null == required ? _self.required : required // ignore: cast_nullable_to_non_nullable
as bool,module: null == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
as String,
version: freezed == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
as String?,module: freezed == module ? _self.module : module // ignore: cast_nullable_to_non_nullable
as String?,required: freezed == required ? _self.required : required // ignore: cast_nullable_to_non_nullable
as bool?,
));
}

View File

@@ -151,8 +151,8 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
Future.delayed(const Duration(milliseconds: 250), () async {
try {
final isUpdateNeeded = await checkVersion();
if (isUpdateNeeded) return;
/* final isUpdateNeeded = await checkVersion();
if (isUpdateNeeded) return;*/
final module = tokenService.appModule.value;
final target = getTargetPage(module);
@@ -178,7 +178,7 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
appInfoModel = AppInfoModel.fromJson(res.data);
if ((appInfoModel?.info.version.versionNumber ?? 0) > version) {
if ((appInfoModel?.info?.version?.versionNumber ?? 0) > version) {
hasUpdated.value = !hasUpdated.value;
return true;
}
@@ -191,7 +191,7 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
Future<void> fileDownload() async {
onUpdateDownload.value = true;
final dir = await getApplicationDocumentsDirectory();
final filePath = "${dir.path}/app-release.apk";
final filePath = "${dir.path}/rasadyar.apk";
final file = File(filePath);
if (await file.exists()) {
await file.delete();
@@ -203,7 +203,7 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
while (attempts < retryCount && !success) {
try {
await _dio.download(
appInfoModel?.downloadLink ?? '',
appInfoModel?.download_link ?? '',
filePath,
onReceiveProgress: (count, total) {
if (total != -1 && total > 0) {
@@ -226,8 +226,6 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
if (success) {
_updateFilePath.value = filePath;
tLog(filePath);
fLog(_updateFilePath.value);
}
onUpdateDownload.value = false;