chore: update app version to 1.3.34+31, change build mode to release, and add permission for package installation; refactor AppInfoModel and Info models to include file and minVersion attributes

This commit is contained in:
2025-12-03 08:06:06 +03:30
parent 6861e873ba
commit d256477cb8
10 changed files with 63 additions and 54 deletions

View File

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

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AppInfoModel {
String? get key; String? get download_link; Info? get info;
String? get key; String? get file; Info? get info;
/// Create a copy of AppInfoModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,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.download_link, download_link) || other.download_link == download_link)&&(identical(other.info, info) || other.info == info));
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppInfoModel&&(identical(other.key, key) || other.key == key)&&(identical(other.file, file) || other.file == file)&&(identical(other.info, info) || other.info == info));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,download_link,info);
int get hashCode => Object.hash(runtimeType,key,file,info);
@override
String toString() {
return 'AppInfoModel(key: $key, download_link: $download_link, info: $info)';
return 'AppInfoModel(key: $key, file: $file, info: $info)';
}
@@ -48,7 +48,7 @@ abstract mixin class $AppInfoModelCopyWith<$Res> {
factory $AppInfoModelCopyWith(AppInfoModel value, $Res Function(AppInfoModel) _then) = _$AppInfoModelCopyWithImpl;
@useResult
$Res call({
String? key, String? download_link, Info? info
String? key, String? file, Info? info
});
@@ -65,10 +65,10 @@ 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 = freezed,Object? download_link = freezed,Object? info = freezed,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? key = freezed,Object? file = freezed,Object? info = freezed,}) {
return _then(_self.copyWith(
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?,file: freezed == file ? _self.file : file // ignore: cast_nullable_to_non_nullable
as String?,info: freezed == info ? _self.info : info // ignore: cast_nullable_to_non_nullable
as Info?,
));
@@ -167,10 +167,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, String? download_link, Info? info)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? key, String? file, 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 $default(_that.key,_that.file,_that.info);case _:
return orElse();
}
@@ -188,10 +188,10 @@ return $default(_that.key,_that.download_link,_that.info);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, String? download_link, Info? info) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? key, String? file, Info? info) $default,) {final _that = this;
switch (_that) {
case _AppInfoModel():
return $default(_that.key,_that.download_link,_that.info);case _:
return $default(_that.key,_that.file,_that.info);case _:
throw StateError('Unexpected subclass');
}
@@ -208,10 +208,10 @@ return $default(_that.key,_that.download_link,_that.info);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, String? download_link, Info? info)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? key, String? file, Info? info)? $default,) {final _that = this;
switch (_that) {
case _AppInfoModel() when $default != null:
return $default(_that.key,_that.download_link,_that.info);case _:
return $default(_that.key,_that.file,_that.info);case _:
return null;
}
@@ -223,11 +223,11 @@ return $default(_that.key,_that.download_link,_that.info);case _:
@JsonSerializable()
class _AppInfoModel implements AppInfoModel {
const _AppInfoModel({this.key, this.download_link, this.info});
const _AppInfoModel({this.key, this.file, this.info});
factory _AppInfoModel.fromJson(Map<String, dynamic> json) => _$AppInfoModelFromJson(json);
@override final String? key;
@override final String? download_link;
@override final String? file;
@override final Info? info;
/// Create a copy of AppInfoModel
@@ -243,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.download_link, download_link) || other.download_link == download_link)&&(identical(other.info, info) || other.info == info));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppInfoModel&&(identical(other.key, key) || other.key == key)&&(identical(other.file, file) || other.file == file)&&(identical(other.info, info) || other.info == info));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,key,download_link,info);
int get hashCode => Object.hash(runtimeType,key,file,info);
@override
String toString() {
return 'AppInfoModel(key: $key, download_link: $download_link, info: $info)';
return 'AppInfoModel(key: $key, file: $file, info: $info)';
}
@@ -263,7 +263,7 @@ abstract mixin class _$AppInfoModelCopyWith<$Res> implements $AppInfoModelCopyWi
factory _$AppInfoModelCopyWith(_AppInfoModel value, $Res Function(_AppInfoModel) _then) = __$AppInfoModelCopyWithImpl;
@override @useResult
$Res call({
String? key, String? download_link, Info? info
String? key, String? file, Info? info
});
@@ -280,10 +280,10 @@ 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 = freezed,Object? download_link = freezed,Object? info = freezed,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? key = freezed,Object? file = freezed,Object? info = freezed,}) {
return _then(_AppInfoModel(
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?,file: freezed == file ? _self.file : file // ignore: cast_nullable_to_non_nullable
as String?,info: freezed == info ? _self.info : info // ignore: cast_nullable_to_non_nullable
as Info?,
));
@@ -308,7 +308,7 @@ $InfoCopyWith<$Res>? get info {
/// @nodoc
mixin _$Info {
String? get version; String? get module; bool? get required;
String? get version; String? get minVersion; 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)
@@ -321,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.module, module) || other.module == module)&&(identical(other.required, required) || other.required == required));
return identical(this, other) || (other.runtimeType == runtimeType&&other is Info&&(identical(other.version, version) || other.version == version)&&(identical(other.minVersion, minVersion) || other.minVersion == minVersion)&&(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,module,required);
int get hashCode => Object.hash(runtimeType,version,minVersion,module,required);
@override
String toString() {
return 'Info(version: $version, module: $module, required: $required)';
return 'Info(version: $version, minVersion: $minVersion, module: $module, required: $required)';
}
@@ -341,7 +341,7 @@ abstract mixin class $InfoCopyWith<$Res> {
factory $InfoCopyWith(Info value, $Res Function(Info) _then) = _$InfoCopyWithImpl;
@useResult
$Res call({
String? version, String? module, bool? required
String? version, String? minVersion, String? module, bool? required
});
@@ -358,9 +358,10 @@ 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 = freezed,Object? module = freezed,Object? required = freezed,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? version = freezed,Object? minVersion = freezed,Object? module = freezed,Object? required = freezed,}) {
return _then(_self.copyWith(
version: freezed == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
as String?,minVersion: freezed == minVersion ? _self.minVersion : minVersion // 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?,
@@ -448,10 +449,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? version, String? module, bool? required)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? version, String? minVersion, 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 $default(_that.version,_that.minVersion,_that.module,_that.required);case _:
return orElse();
}
@@ -469,10 +470,10 @@ return $default(_that.version,_that.module,_that.required);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? version, String? module, bool? required) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? version, String? minVersion, String? module, bool? required) $default,) {final _that = this;
switch (_that) {
case _Info():
return $default(_that.version,_that.module,_that.required);case _:
return $default(_that.version,_that.minVersion,_that.module,_that.required);case _:
throw StateError('Unexpected subclass');
}
@@ -489,10 +490,10 @@ return $default(_that.version,_that.module,_that.required);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? version, String? module, bool? required)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? version, String? minVersion, 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 $default(_that.version,_that.minVersion,_that.module,_that.required);case _:
return null;
}
@@ -504,10 +505,11 @@ return $default(_that.version,_that.module,_that.required);case _:
@JsonSerializable()
class _Info implements Info {
const _Info({this.version, this.module, this.required});
const _Info({this.version, this.minVersion, this.module, this.required});
factory _Info.fromJson(Map<String, dynamic> json) => _$InfoFromJson(json);
@override final String? version;
@override final String? minVersion;
@override final String? module;
@override final bool? required;
@@ -524,16 +526,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.module, module) || other.module == module)&&(identical(other.required, required) || other.required == required));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Info&&(identical(other.version, version) || other.version == version)&&(identical(other.minVersion, minVersion) || other.minVersion == minVersion)&&(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,module,required);
int get hashCode => Object.hash(runtimeType,version,minVersion,module,required);
@override
String toString() {
return 'Info(version: $version, module: $module, required: $required)';
return 'Info(version: $version, minVersion: $minVersion, module: $module, required: $required)';
}
@@ -544,7 +546,7 @@ abstract mixin class _$InfoCopyWith<$Res> implements $InfoCopyWith<$Res> {
factory _$InfoCopyWith(_Info value, $Res Function(_Info) _then) = __$InfoCopyWithImpl;
@override @useResult
$Res call({
String? version, String? module, bool? required
String? version, String? minVersion, String? module, bool? required
});
@@ -561,9 +563,10 @@ 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 = freezed,Object? module = freezed,Object? required = freezed,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? version = freezed,Object? minVersion = freezed,Object? module = freezed,Object? required = freezed,}) {
return _then(_Info(
version: freezed == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
as String?,minVersion: freezed == minVersion ? _self.minVersion : minVersion // 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

@@ -9,7 +9,7 @@ part of 'app_info_model.dart';
_AppInfoModel _$AppInfoModelFromJson(Map<String, dynamic> json) =>
_AppInfoModel(
key: json['key'] as String?,
download_link: json['download_link'] as String?,
file: json['file'] as String?,
info: json['info'] == null
? null
: Info.fromJson(json['info'] as Map<String, dynamic>),
@@ -18,18 +18,20 @@ _AppInfoModel _$AppInfoModelFromJson(Map<String, dynamic> json) =>
Map<String, dynamic> _$AppInfoModelToJson(_AppInfoModel instance) =>
<String, dynamic>{
'key': instance.key,
'download_link': instance.download_link,
'file': instance.file,
'info': instance.info,
};
_Info _$InfoFromJson(Map<String, dynamic> json) => _Info(
version: json['version'] as String?,
minVersion: json['minVersion'] as String?,
module: json['module'] as String?,
required: json['required'] as bool?,
);
Map<String, dynamic> _$InfoToJson(_Info instance) => <String, dynamic>{
'version': instance.version,
'minVersion': instance.minVersion,
'module': instance.module,
'required': instance.required,
};

View File

@@ -185,7 +185,7 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
try {
final info = await PackageInfo.fromPlatform();
int version = info.version.versionNumber;
var res = await _dio.get("https://rsibackend.rasadyaar.ir/app/apk-info/");
var res = await _dio.get("https://rsibackend.rasadyar.com/app/rasadyar-app-info/");
appInfoModel = AppInfoModel.fromJson(res.data);
@@ -214,7 +214,7 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
while (attempts < retryCount && !success) {
try {
await _dio.download(
appInfoModel?.download_link ?? '',
appInfoModel?.file ?? '',
filePath,
onReceiveProgress: (count, total) {
if (total != -1 && total > 0) {