diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 770eb5c..174e028 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -73,6 +73,8 @@ PODS: - GoogleUtilities/UserDefaults (~> 8.1) - nanopb (~> 3.30910.0) - Flutter (1.0.0) + - flutter_app_update (0.0.1): + - Flutter - flutter_inappwebview_ios (0.0.1): - Flutter - flutter_inappwebview_ios/Core (= 0.0.1) @@ -223,6 +225,7 @@ DEPENDENCIES: - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) + - flutter_app_update (from `.symlinks/plugins/flutter_app_update/ios`) - flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`) - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) @@ -293,6 +296,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/firebase_messaging/ios" Flutter: :path: Flutter + flutter_app_update: + :path: ".symlinks/plugins/flutter_app_update/ios" flutter_inappwebview_ios: :path: ".symlinks/plugins/flutter_inappwebview_ios/ios" flutter_keyboard_visibility: @@ -372,6 +377,7 @@ SPEC CHECKSUMS: FirebaseInstallations: d4c7c958f99c8860d7fcece786314ae790e2f988 FirebaseMessaging: af49f8d7c0a3d2a017d9302c80946f45a7777dde Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + flutter_app_update: 816fdb2e30e4832a7c45e3f108d391c42ef040a9 flutter_inappwebview_ios: b89ba3482b96fb25e00c967aae065701b66e9b99 flutter_keyboard_visibility: 4625131e43015dbbe759d9b20daaf77e0e3f6619 flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf diff --git a/lib/models/user.dart b/lib/models/user.dart index 1b0b1f2..3ae76fc 100644 --- a/lib/models/user.dart +++ b/lib/models/user.dart @@ -34,6 +34,23 @@ sealed class ProfileLink with _$ProfileLink { _$ProfileLinkFromJson(json); } +class ProfileLinkConverter + implements JsonConverter, dynamic> { + const ProfileLinkConverter(); + + @override + List fromJson(dynamic json) { + return json is List + ? json.map((e) => ProfileLink.fromJson(e)).cast().toList() + : []; + } + + @override + List toJson(List object) { + return object.map((e) => e.toJson()).toList(); + } +} + @freezed sealed class SnAccountProfile with _$SnAccountProfile { const factory SnAccountProfile({ @@ -47,7 +64,7 @@ sealed class SnAccountProfile with _$SnAccountProfile { @Default('') String location, @Default('') String timeZone, DateTime? birthday, - @Default([]) List links, + @ProfileLinkConverter() @Default([]) List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, required int experience, diff --git a/lib/models/user.freezed.dart b/lib/models/user.freezed.dart index 4e21529..6d43b05 100644 --- a/lib/models/user.freezed.dart +++ b/lib/models/user.freezed.dart @@ -610,7 +610,7 @@ as String, /// @nodoc mixin _$SnAccountProfile { - String get id; String get firstName; String get middleName; String get lastName; String get bio; String get gender; String get pronouns; String get location; String get timeZone; DateTime? get birthday; List get links; DateTime? get lastSeenAt; SnAccountBadge? get activeBadge; int get experience; int get level; double get levelingProgress; SnCloudFile? get picture; SnCloudFile? get background; SnVerificationMark? get verification; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; + String get id; String get firstName; String get middleName; String get lastName; String get bio; String get gender; String get pronouns; String get location; String get timeZone; DateTime? get birthday;@ProfileLinkConverter() List get links; DateTime? get lastSeenAt; SnAccountBadge? get activeBadge; int get experience; int get level; double get levelingProgress; SnCloudFile? get picture; SnCloudFile? get background; SnVerificationMark? get verification; DateTime get createdAt; DateTime get updatedAt; DateTime? get deletedAt; /// Create a copy of SnAccountProfile /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -643,7 +643,7 @@ abstract mixin class $SnAccountProfileCopyWith<$Res> { factory $SnAccountProfileCopyWith(SnAccountProfile value, $Res Function(SnAccountProfile) _then) = _$SnAccountProfileCopyWithImpl; @useResult $Res call({ - String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday, List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt + String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday,@ProfileLinkConverter() List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt }); @@ -814,7 +814,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday, List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday, @ProfileLinkConverter() List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _SnAccountProfile() when $default != null: return $default(_that.id,_that.firstName,_that.middleName,_that.lastName,_that.bio,_that.gender,_that.pronouns,_that.location,_that.timeZone,_that.birthday,_that.links,_that.lastSeenAt,_that.activeBadge,_that.experience,_that.level,_that.levelingProgress,_that.picture,_that.background,_that.verification,_that.createdAt,_that.updatedAt,_that.deletedAt);case _: @@ -835,7 +835,7 @@ return $default(_that.id,_that.firstName,_that.middleName,_that.lastName,_that.b /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday, List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday, @ProfileLinkConverter() List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt) $default,) {final _that = this; switch (_that) { case _SnAccountProfile(): return $default(_that.id,_that.firstName,_that.middleName,_that.lastName,_that.bio,_that.gender,_that.pronouns,_that.location,_that.timeZone,_that.birthday,_that.links,_that.lastSeenAt,_that.activeBadge,_that.experience,_that.level,_that.levelingProgress,_that.picture,_that.background,_that.verification,_that.createdAt,_that.updatedAt,_that.deletedAt);} @@ -852,7 +852,7 @@ return $default(_that.id,_that.firstName,_that.middleName,_that.lastName,_that.b /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday, List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday, @ProfileLinkConverter() List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt)? $default,) {final _that = this; switch (_that) { case _SnAccountProfile() when $default != null: return $default(_that.id,_that.firstName,_that.middleName,_that.lastName,_that.bio,_that.gender,_that.pronouns,_that.location,_that.timeZone,_that.birthday,_that.links,_that.lastSeenAt,_that.activeBadge,_that.experience,_that.level,_that.levelingProgress,_that.picture,_that.background,_that.verification,_that.createdAt,_that.updatedAt,_that.deletedAt);case _: @@ -867,7 +867,7 @@ return $default(_that.id,_that.firstName,_that.middleName,_that.lastName,_that.b @JsonSerializable() class _SnAccountProfile implements SnAccountProfile { - const _SnAccountProfile({required this.id, this.firstName = '', this.middleName = '', this.lastName = '', this.bio = '', this.gender = '', this.pronouns = '', this.location = '', this.timeZone = '', this.birthday, final List links = const [], this.lastSeenAt, this.activeBadge, required this.experience, required this.level, required this.levelingProgress, required this.picture, required this.background, required this.verification, required this.createdAt, required this.updatedAt, required this.deletedAt}): _links = links; + const _SnAccountProfile({required this.id, this.firstName = '', this.middleName = '', this.lastName = '', this.bio = '', this.gender = '', this.pronouns = '', this.location = '', this.timeZone = '', this.birthday, @ProfileLinkConverter() final List links = const [], this.lastSeenAt, this.activeBadge, required this.experience, required this.level, required this.levelingProgress, required this.picture, required this.background, required this.verification, required this.createdAt, required this.updatedAt, required this.deletedAt}): _links = links; factory _SnAccountProfile.fromJson(Map json) => _$SnAccountProfileFromJson(json); @override final String id; @@ -881,7 +881,7 @@ class _SnAccountProfile implements SnAccountProfile { @override@JsonKey() final String timeZone; @override final DateTime? birthday; final List _links; -@override@JsonKey() List get links { +@override@JsonKey()@ProfileLinkConverter() List get links { if (_links is EqualUnmodifiableListView) return _links; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(_links); @@ -932,7 +932,7 @@ abstract mixin class _$SnAccountProfileCopyWith<$Res> implements $SnAccountProfi factory _$SnAccountProfileCopyWith(_SnAccountProfile value, $Res Function(_SnAccountProfile) _then) = __$SnAccountProfileCopyWithImpl; @override @useResult $Res call({ - String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday, List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt + String id, String firstName, String middleName, String lastName, String bio, String gender, String pronouns, String location, String timeZone, DateTime? birthday,@ProfileLinkConverter() List links, DateTime? lastSeenAt, SnAccountBadge? activeBadge, int experience, int level, double levelingProgress, SnCloudFile? picture, SnCloudFile? background, SnVerificationMark? verification, DateTime createdAt, DateTime updatedAt, DateTime? deletedAt }); diff --git a/lib/models/user.g.dart b/lib/models/user.g.dart index 2967516..7a00d19 100644 --- a/lib/models/user.g.dart +++ b/lib/models/user.g.dart @@ -69,10 +69,9 @@ _SnAccountProfile _$SnAccountProfileFromJson(Map json) => ? null : DateTime.parse(json['birthday'] as String), links: - (json['links'] as List?) - ?.map((e) => ProfileLink.fromJson(e as Map)) - .toList() ?? - const [], + json['links'] == null + ? const [] + : const ProfileLinkConverter().fromJson(json['links']), lastSeenAt: json['last_seen_at'] == null ? null @@ -122,7 +121,7 @@ Map _$SnAccountProfileToJson(_SnAccountProfile instance) => 'location': instance.location, 'time_zone': instance.timeZone, 'birthday': instance.birthday?.toIso8601String(), - 'links': instance.links.map((e) => e.toJson()).toList(), + 'links': const ProfileLinkConverter().toJson(instance.links), 'last_seen_at': instance.lastSeenAt?.toIso8601String(), 'active_badge': instance.activeBadge?.toJson(), 'experience': instance.experience, diff --git a/pubspec.lock b/pubspec.lock index 353e3b1..a5343dd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -662,6 +662,14 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_app_update: + dependency: "direct main" + description: + name: flutter_app_update + sha256: "09290240949c4651581cd6fc535e52d019e189e694d6019c56b5a56c2e69ba65" + url: "https://pub.dev" + source: hosted + version: "3.2.2" flutter_blurhash: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index f4ace88..c474e15 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 3.1.0+120 +version: 3.1.0+121 environment: sdk: ^3.7.2 @@ -133,6 +133,7 @@ dependencies: flutter_typeahead: ^5.2.0 flutter_langdetect: ^0.0.2 waveform_flutter: ^1.2.0 + flutter_app_update: ^3.2.2 dev_dependencies: flutter_test: