Skip to content

Commit

Permalink
Merge pull request #263 from astubenbord/bugfix/262
Browse files Browse the repository at this point in the history
fix: Fix parsing error in user model
  • Loading branch information
astubenbord authored Oct 7, 2023
2 parents 9021b31 + 93d7a36 commit a17b041
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/de-DE/changelogs/49.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Beheben eines Fehlers, durch welchen die App bei Paperless Versionen vor 1.14.0 nicht mehr startete
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/en-US/changelogs/49.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where app would not login with paperless versions before 1.14.0
34 changes: 22 additions & 12 deletions packages/paperless_api/lib/src/models/user_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,30 @@ import 'package:paperless_api/config/hive/hive_type_ids.dart';
part 'user_model.g.dart';

sealed class UserModel {
@HiveField(0)
final int id;
@HiveField(1)
final String username;
const UserModel({
required this.id,
required this.username,
});
int get id;

String get username;

const UserModel();

String? get fullName;
}

@JsonSerializable(fieldRename: FieldRename.snake)
@HiveType(typeId: PaperlessApiHiveTypeIds.userModelv2)
class UserModelV2 extends UserModel {
@override
@HiveField(0)
@JsonKey(name: 'user_id')
final int id;
@override
@HiveField(1)
final String username;
@HiveField(2)
final String? displayName;
const UserModelV2({
required super.id,
required super.username,
required this.id,
required this.username,
this.displayName,
});
Map<String, dynamic> toJson() => _$UserModelV2ToJson(this);
Expand All @@ -40,6 +44,12 @@ class UserModelV2 extends UserModel {
@JsonSerializable(fieldRename: FieldRename.snake)
@HiveType(typeId: PaperlessApiHiveTypeIds.userModelv3)
class UserModelV3 extends UserModel {
@override
@HiveField(0)
final int id;
@override
@HiveField(1)
final String username;
@HiveField(2)
final String? email;
@HiveField(3)
Expand Down Expand Up @@ -76,8 +86,8 @@ class UserModelV3 extends UserModel {
}

const UserModelV3({
required super.id,
required super.username,
required this.id,
required this.username,
this.email,
this.firstName,
this.lastName,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ packages:
description:
path: "."
ref: master
resolved-ref: "2e6c7396e13c2c6ecd0a704d2322b349a7a21584"
resolved-ref: "8eae877b37d4634f1b636e48ebffd9066b0cb47d"
url: "https://github.com/sawankumarbundelkhandi/edge_detection"
source: git
version: "1.1.2"
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.0.1+48
version: 3.0.2+49

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down Expand Up @@ -97,6 +97,7 @@ dependencies:
transparent_image: ^2.0.1
flutter_animate: ^4.2.0+1
shared_preferences: ^2.2.1
# camerawesome: ^2.0.0-dev.1

dependency_overrides:
intl: ^0.18.1
Expand Down

0 comments on commit a17b041

Please sign in to comment.