From 4a96dbe2b888347e3a2e76c7e66c27ff49456ae2 Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Mon, 29 Dec 2025 16:23:19 +0330 Subject: [PATCH] chore: update app version to 1.9.0, change Flutter build mode to debug, and add changes field to app info model for update dialogs --- android/local.properties | 2 +- lib/data/model/app_info_model.dart | 1 + lib/data/model/app_info_model.freezed.dart | 51 +++++++++++-------- lib/data/model/app_info_model.g.dart | 4 ++ lib/presentation/pages/splash/logic.dart | 1 + .../widget/dialog/update_dialog.dart | 33 ++++++++++-- pubspec.lock | 2 +- 7 files changed, 68 insertions(+), 26 deletions(-) diff --git a/android/local.properties b/android/local.properties index 860d261..7bd99d4 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,5 +1,5 @@ sdk.dir=C:\\Users\\Housh11\\AppData\\Local\\Android\\sdk flutter.sdk=C:\\src\\flutter -flutter.buildMode=release +flutter.buildMode=debug flutter.versionName=1.3.43 flutter.versionCode=39 \ No newline at end of file diff --git a/lib/data/model/app_info_model.dart b/lib/data/model/app_info_model.dart index e7b6d15..11ddde1 100644 --- a/lib/data/model/app_info_model.dart +++ b/lib/data/model/app_info_model.dart @@ -19,6 +19,7 @@ abstract class Info with _$Info { String? minVersion, String? module, bool? required, + List? changes, }) = _Info; factory Info.fromJson(Map json) => _$InfoFromJson(json); diff --git a/lib/data/model/app_info_model.freezed.dart b/lib/data/model/app_info_model.freezed.dart index 05bf09d..373a991 100644 --- a/lib/data/model/app_info_model.freezed.dart +++ b/lib/data/model/app_info_model.freezed.dart @@ -308,7 +308,7 @@ $InfoCopyWith<$Res>? get info { /// @nodoc mixin _$Info { - String? get version; String? get minVersion; String? get module; bool? get required; + String? get version; String? get minVersion; String? get module; bool? get required; List? get changes; /// 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 get copyWith => _$InfoCopyWithImpl(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.minVersion, minVersion) || other.minVersion == minVersion)&&(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)&&const DeepCollectionEquality().equals(other.changes, changes)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,version,minVersion,module,required); +int get hashCode => Object.hash(runtimeType,version,minVersion,module,required,const DeepCollectionEquality().hash(changes)); @override String toString() { - return 'Info(version: $version, minVersion: $minVersion, module: $module, required: $required)'; + return 'Info(version: $version, minVersion: $minVersion, module: $module, required: $required, changes: $changes)'; } @@ -341,7 +341,7 @@ abstract mixin class $InfoCopyWith<$Res> { factory $InfoCopyWith(Info value, $Res Function(Info) _then) = _$InfoCopyWithImpl; @useResult $Res call({ - String? version, String? minVersion, String? module, bool? required + String? version, String? minVersion, String? module, bool? required, List? changes }); @@ -358,13 +358,14 @@ 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? minVersion = 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,Object? changes = 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?, +as bool?,changes: freezed == changes ? _self.changes : changes // ignore: cast_nullable_to_non_nullable +as List?, )); } @@ -449,10 +450,10 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String? version, String? minVersion, String? module, bool? required)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String? version, String? minVersion, String? module, bool? required, List? changes)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _Info() when $default != null: -return $default(_that.version,_that.minVersion,_that.module,_that.required);case _: +return $default(_that.version,_that.minVersion,_that.module,_that.required,_that.changes);case _: return orElse(); } @@ -470,10 +471,10 @@ return $default(_that.version,_that.minVersion,_that.module,_that.required);case /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String? version, String? minVersion, String? module, bool? required) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String? version, String? minVersion, String? module, bool? required, List? changes) $default,) {final _that = this; switch (_that) { case _Info(): -return $default(_that.version,_that.minVersion,_that.module,_that.required);case _: +return $default(_that.version,_that.minVersion,_that.module,_that.required,_that.changes);case _: throw StateError('Unexpected subclass'); } @@ -490,10 +491,10 @@ return $default(_that.version,_that.minVersion,_that.module,_that.required);case /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? version, String? minVersion, String? module, bool? required)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String? version, String? minVersion, String? module, bool? required, List? changes)? $default,) {final _that = this; switch (_that) { case _Info() when $default != null: -return $default(_that.version,_that.minVersion,_that.module,_that.required);case _: +return $default(_that.version,_that.minVersion,_that.module,_that.required,_that.changes);case _: return null; } @@ -505,13 +506,22 @@ return $default(_that.version,_that.minVersion,_that.module,_that.required);case @JsonSerializable() class _Info implements Info { - const _Info({this.version, this.minVersion, this.module, this.required}); + const _Info({this.version, this.minVersion, this.module, this.required, final List? changes}): _changes = changes; factory _Info.fromJson(Map json) => _$InfoFromJson(json); @override final String? version; @override final String? minVersion; @override final String? module; @override final bool? required; + final List? _changes; +@override List? get changes { + final value = _changes; + if (value == null) return null; + if (_changes is EqualUnmodifiableListView) return _changes; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); +} + /// Create a copy of Info /// with the given fields replaced by the non-null parameter values. @@ -526,16 +536,16 @@ Map 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.minVersion, minVersion) || other.minVersion == minVersion)&&(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)&&const DeepCollectionEquality().equals(other._changes, _changes)); } @JsonKey(includeFromJson: false, includeToJson: false) @override -int get hashCode => Object.hash(runtimeType,version,minVersion,module,required); +int get hashCode => Object.hash(runtimeType,version,minVersion,module,required,const DeepCollectionEquality().hash(_changes)); @override String toString() { - return 'Info(version: $version, minVersion: $minVersion, module: $module, required: $required)'; + return 'Info(version: $version, minVersion: $minVersion, module: $module, required: $required, changes: $changes)'; } @@ -546,7 +556,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? minVersion, String? module, bool? required + String? version, String? minVersion, String? module, bool? required, List? changes }); @@ -563,13 +573,14 @@ 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? minVersion = 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,Object? changes = 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?, +as bool?,changes: freezed == changes ? _self._changes : changes // ignore: cast_nullable_to_non_nullable +as List?, )); } diff --git a/lib/data/model/app_info_model.g.dart b/lib/data/model/app_info_model.g.dart index 3619ebe..3148a07 100644 --- a/lib/data/model/app_info_model.g.dart +++ b/lib/data/model/app_info_model.g.dart @@ -27,6 +27,9 @@ _Info _$InfoFromJson(Map json) => _Info( minVersion: json['minVersion'] as String?, module: json['module'] as String?, required: json['required'] as bool?, + changes: (json['changes'] as List?) + ?.map((e) => e as String) + .toList(), ); Map _$InfoToJson(_Info instance) => { @@ -34,4 +37,5 @@ Map _$InfoToJson(_Info instance) => { 'minVersion': instance.minVersion, 'module': instance.module, 'required': instance.required, + 'changes': instance.changes, }; diff --git a/lib/presentation/pages/splash/logic.dart b/lib/presentation/pages/splash/logic.dart index ffe9268..fc253f7 100644 --- a/lib/presentation/pages/splash/logic.dart +++ b/lib/presentation/pages/splash/logic.dart @@ -70,6 +70,7 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin { onConfirm: () async { await fileDownload(); }, + changes: appInfoModel?.info?.changes, ); } else if (!data && Get.isDialogOpen == true) { Get.back(); diff --git a/packages/core/lib/presentation/widget/dialog/update_dialog.dart b/packages/core/lib/presentation/widget/dialog/update_dialog.dart index 0b4e748..f58546d 100644 --- a/packages/core/lib/presentation/widget/dialog/update_dialog.dart +++ b/packages/core/lib/presentation/widget/dialog/update_dialog.dart @@ -1,13 +1,35 @@ import 'dart:io'; +import 'package:flutter/material.dart'; import 'package:rasadyar_core/core.dart'; -Future requiredUpdateDialog({required Future Function() onConfirm}) async { +Future requiredUpdateDialog({ + required Future Function() onConfirm, + required List? changes, +}) async { await Get.defaultDialog( barrierDismissible: false, onWillPop: () async => false, title: 'بروزرسانی', - middleText: 'برای استفاده از امکانات برنامه لطفا برنامه را بروز رسانی نمایید.', + content: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 8.h, + children: + changes + ?.map( + (e) => Text( + e, + + style: AppFonts.yekan14.copyWith(color: AppColor.textColor), + ), + ) + .toList() ?? + [], + ), + ), + middleText: + 'برای استفاده از امکانات برنامه لطفا برنامه را بروز رسانی نمایید.', confirm: RElevated( height: 40.h, width: 150.w, @@ -28,12 +50,15 @@ Future requiredUpdateDialog({required Future Function() onConfirm}) ); } -Future optionalUpdateDialog({required Future Function() onConfirm}) async { +Future optionalUpdateDialog({ + required Future Function() onConfirm, +}) async { await Get.defaultDialog( barrierDismissible: false, onWillPop: () async => false, title: 'بروزرسانی', - middleText: 'برای استفاده از امکانات جدید برنامه می توانید آن را بروزرسانی نمایید.', + middleText: + 'برای استفاده از امکانات جدید برنامه می توانید آن را بروزرسانی نمایید.', confirm: RElevated( height: 40.h, width: 150.w, diff --git a/pubspec.lock b/pubspec.lock index 71dc334..a5b32aa 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1394,7 +1394,7 @@ packages: path: "packages/chicken" relative: true source: path - version: "1.8.0" + version: "1.9.0" rasadyar_core: dependency: "direct main" description: