mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-30 09:42:50 +01:00
Also write to the user profile via powersync
This commit is contained in:
@@ -44,8 +44,7 @@ enum DeviceType {
|
||||
androidWear('wearScreenshots'),
|
||||
|
||||
iOSPhoneBig('iPhone 6.9', isAndroid: false),
|
||||
iOSPhoneSmall('iPhone 6.7', isAndroid: false)
|
||||
;
|
||||
iOSPhoneSmall('iPhone 6.7', isAndroid: false);
|
||||
|
||||
final String folderName;
|
||||
final bool isAndroid;
|
||||
|
||||
@@ -76,9 +76,11 @@ Widget createDashboardScreen({Locale? locale}) {
|
||||
).thenAnswer((_) => Stream<List<MeasurementCategory>>.value(getMeasurementCategories()));
|
||||
|
||||
final mockUserProfileRepo = weight.MockUserProfileRepository();
|
||||
when(mockUserProfileRepo.fetchProfile()).thenAnswer((_) async => tProfile1);
|
||||
when(
|
||||
mockUserProfileRepo.watchDrift(),
|
||||
).thenAnswer((_) => Stream.value(tUserProfile1));
|
||||
|
||||
final loggedInAuth = const AuthState(
|
||||
const loggedInAuth = AuthState(
|
||||
status: AuthStatus.loggedIn,
|
||||
token: 'test-token',
|
||||
serverUrl: 'http://localhost',
|
||||
|
||||
@@ -42,7 +42,9 @@ Widget createWeightScreen({Locale? locale}) {
|
||||
).thenAnswer((_) => Stream.value(getWeightEntries()));
|
||||
|
||||
final mockUserProfileRepository = MockUserProfileRepository();
|
||||
when(mockUserProfileRepository.fetchProfile()).thenAnswer((_) async => tProfile1);
|
||||
when(
|
||||
mockUserProfileRepository.watchDrift(),
|
||||
).thenAnswer((_) => Stream.value(tUserProfile1));
|
||||
|
||||
final mockNutritionRepo = MockNutritionRepository();
|
||||
final mockIngredientRepo = MockIngredientRepository();
|
||||
|
||||
@@ -44,6 +44,7 @@ import 'package:wger/models/nutrition/log.dart';
|
||||
import 'package:wger/models/nutrition/meal.dart';
|
||||
import 'package:wger/models/nutrition/meal_item.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
import 'package:wger/models/workouts/log.dart';
|
||||
import 'package:wger/models/workouts/repetition_unit.dart';
|
||||
import 'package:wger/models/workouts/routine.dart';
|
||||
@@ -59,6 +60,7 @@ import 'tables/license.dart';
|
||||
import 'tables/measurements.dart';
|
||||
import 'tables/nutrition.dart';
|
||||
import 'tables/routines.dart';
|
||||
import 'tables/user_profile.dart';
|
||||
import 'tables/weight.dart';
|
||||
|
||||
part 'database.g.dart';
|
||||
@@ -68,6 +70,7 @@ part 'database.g.dart';
|
||||
// Core
|
||||
LanguageTable,
|
||||
LicenseTable,
|
||||
UserProfileTable,
|
||||
|
||||
// Exercises
|
||||
ExerciseTable,
|
||||
|
||||
@@ -392,6 +392,153 @@ class LicenseTableCompanion extends UpdateCompanion<License> {
|
||||
}
|
||||
}
|
||||
|
||||
class $UserProfileTableTable extends UserProfileTable
|
||||
with TableInfo<$UserProfileTableTable, UserProfile> {
|
||||
@override
|
||||
final GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
$UserProfileTableTable(this.attachedDatabase, [this._alias]);
|
||||
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
||||
@override
|
||||
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||
'id',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.int,
|
||||
requiredDuringInsert: true,
|
||||
);
|
||||
static const VerificationMeta _weightUnitStrMeta = const VerificationMeta(
|
||||
'weightUnitStr',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<String> weightUnitStr = GeneratedColumn<String>(
|
||||
'weight_unit',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
);
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [id, weightUnitStr];
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'core_userprofile';
|
||||
@override
|
||||
VerificationContext validateIntegrity(
|
||||
Insertable<UserProfile> instance, {
|
||||
bool isInserting = false,
|
||||
}) {
|
||||
final context = VerificationContext();
|
||||
final data = instance.toColumns(true);
|
||||
if (data.containsKey('id')) {
|
||||
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
||||
} else if (isInserting) {
|
||||
context.missing(_idMeta);
|
||||
}
|
||||
if (data.containsKey('weight_unit')) {
|
||||
context.handle(
|
||||
_weightUnitStrMeta,
|
||||
weightUnitStr.isAcceptableOrUnknown(
|
||||
data['weight_unit']!,
|
||||
_weightUnitStrMeta,
|
||||
),
|
||||
);
|
||||
} else if (isInserting) {
|
||||
context.missing(_weightUnitStrMeta);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => const {};
|
||||
@override
|
||||
UserProfile map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return UserProfile(
|
||||
id: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}id'],
|
||||
)!,
|
||||
weightUnitStr: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}weight_unit'],
|
||||
)!,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
$UserProfileTableTable createAlias(String alias) {
|
||||
return $UserProfileTableTable(attachedDatabase, alias);
|
||||
}
|
||||
}
|
||||
|
||||
class UserProfileTableCompanion extends UpdateCompanion<UserProfile> {
|
||||
final Value<int> id;
|
||||
final Value<String> weightUnitStr;
|
||||
final Value<int> rowid;
|
||||
const UserProfileTableCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.weightUnitStr = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
UserProfileTableCompanion.insert({
|
||||
required int id,
|
||||
required String weightUnitStr,
|
||||
this.rowid = const Value.absent(),
|
||||
}) : id = Value(id),
|
||||
weightUnitStr = Value(weightUnitStr);
|
||||
static Insertable<UserProfile> custom({
|
||||
Expression<int>? id,
|
||||
Expression<String>? weightUnitStr,
|
||||
Expression<int>? rowid,
|
||||
}) {
|
||||
return RawValuesInsertable({
|
||||
if (id != null) 'id': id,
|
||||
if (weightUnitStr != null) 'weight_unit': weightUnitStr,
|
||||
if (rowid != null) 'rowid': rowid,
|
||||
});
|
||||
}
|
||||
|
||||
UserProfileTableCompanion copyWith({
|
||||
Value<int>? id,
|
||||
Value<String>? weightUnitStr,
|
||||
Value<int>? rowid,
|
||||
}) {
|
||||
return UserProfileTableCompanion(
|
||||
id: id ?? this.id,
|
||||
weightUnitStr: weightUnitStr ?? this.weightUnitStr,
|
||||
rowid: rowid ?? this.rowid,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
if (id.present) {
|
||||
map['id'] = Variable<int>(id.value);
|
||||
}
|
||||
if (weightUnitStr.present) {
|
||||
map['weight_unit'] = Variable<String>(weightUnitStr.value);
|
||||
}
|
||||
if (rowid.present) {
|
||||
map['rowid'] = Variable<int>(rowid.value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (StringBuffer('UserProfileTableCompanion(')
|
||||
..write('id: $id, ')
|
||||
..write('weightUnitStr: $weightUnitStr, ')
|
||||
..write('rowid: $rowid')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class $ExerciseCategoryTableTable extends ExerciseCategoryTable
|
||||
with TableInfo<$ExerciseCategoryTableTable, ExerciseCategory> {
|
||||
@override
|
||||
@@ -10007,6 +10154,9 @@ abstract class _$DriftPowersyncDatabase extends GeneratedDatabase {
|
||||
$DriftPowersyncDatabaseManager get managers => $DriftPowersyncDatabaseManager(this);
|
||||
late final $LanguageTableTable languageTable = $LanguageTableTable(this);
|
||||
late final $LicenseTableTable licenseTable = $LicenseTableTable(this);
|
||||
late final $UserProfileTableTable userProfileTable = $UserProfileTableTable(
|
||||
this,
|
||||
);
|
||||
late final $ExerciseCategoryTableTable exerciseCategoryTable = $ExerciseCategoryTableTable(this);
|
||||
late final $ExerciseTableTable exerciseTable = $ExerciseTableTable(this);
|
||||
late final $ExerciseTranslationTableTable exerciseTranslationTable =
|
||||
@@ -10055,6 +10205,7 @@ abstract class _$DriftPowersyncDatabase extends GeneratedDatabase {
|
||||
List<DatabaseSchemaEntity> get allSchemaEntities => [
|
||||
languageTable,
|
||||
licenseTable,
|
||||
userProfileTable,
|
||||
exerciseCategoryTable,
|
||||
exerciseTable,
|
||||
exerciseTranslationTable,
|
||||
@@ -10538,6 +10689,151 @@ typedef $$LicenseTableTableProcessedTableManager =
|
||||
License,
|
||||
PrefetchHooks Function()
|
||||
>;
|
||||
typedef $$UserProfileTableTableCreateCompanionBuilder =
|
||||
UserProfileTableCompanion Function({
|
||||
required int id,
|
||||
required String weightUnitStr,
|
||||
Value<int> rowid,
|
||||
});
|
||||
typedef $$UserProfileTableTableUpdateCompanionBuilder =
|
||||
UserProfileTableCompanion Function({
|
||||
Value<int> id,
|
||||
Value<String> weightUnitStr,
|
||||
Value<int> rowid,
|
||||
});
|
||||
|
||||
class $$UserProfileTableTableFilterComposer
|
||||
extends Composer<_$DriftPowersyncDatabase, $UserProfileTableTable> {
|
||||
$$UserProfileTableTableFilterComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnFilters<int> get id => $composableBuilder(
|
||||
column: $table.id,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get weightUnitStr => $composableBuilder(
|
||||
column: $table.weightUnitStr,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $$UserProfileTableTableOrderingComposer
|
||||
extends Composer<_$DriftPowersyncDatabase, $UserProfileTableTable> {
|
||||
$$UserProfileTableTableOrderingComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnOrderings<int> get id => $composableBuilder(
|
||||
column: $table.id,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get weightUnitStr => $composableBuilder(
|
||||
column: $table.weightUnitStr,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $$UserProfileTableTableAnnotationComposer
|
||||
extends Composer<_$DriftPowersyncDatabase, $UserProfileTableTable> {
|
||||
$$UserProfileTableTableAnnotationComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
GeneratedColumn<int> get id => $composableBuilder(column: $table.id, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get weightUnitStr => $composableBuilder(
|
||||
column: $table.weightUnitStr,
|
||||
builder: (column) => column,
|
||||
);
|
||||
}
|
||||
|
||||
class $$UserProfileTableTableTableManager
|
||||
extends
|
||||
RootTableManager<
|
||||
_$DriftPowersyncDatabase,
|
||||
$UserProfileTableTable,
|
||||
UserProfile,
|
||||
$$UserProfileTableTableFilterComposer,
|
||||
$$UserProfileTableTableOrderingComposer,
|
||||
$$UserProfileTableTableAnnotationComposer,
|
||||
$$UserProfileTableTableCreateCompanionBuilder,
|
||||
$$UserProfileTableTableUpdateCompanionBuilder,
|
||||
(
|
||||
UserProfile,
|
||||
BaseReferences<_$DriftPowersyncDatabase, $UserProfileTableTable, UserProfile>,
|
||||
),
|
||||
UserProfile,
|
||||
PrefetchHooks Function()
|
||||
> {
|
||||
$$UserProfileTableTableTableManager(
|
||||
_$DriftPowersyncDatabase db,
|
||||
$UserProfileTableTable table,
|
||||
) : super(
|
||||
TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer: () =>
|
||||
$$UserProfileTableTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
$$UserProfileTableTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
$$UserProfileTableTableAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
Value<int> id = const Value.absent(),
|
||||
Value<String> weightUnitStr = const Value.absent(),
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) => UserProfileTableCompanion(
|
||||
id: id,
|
||||
weightUnitStr: weightUnitStr,
|
||||
rowid: rowid,
|
||||
),
|
||||
createCompanionCallback:
|
||||
({
|
||||
required int id,
|
||||
required String weightUnitStr,
|
||||
Value<int> rowid = const Value.absent(),
|
||||
}) => UserProfileTableCompanion.insert(
|
||||
id: id,
|
||||
weightUnitStr: weightUnitStr,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper: (p0) =>
|
||||
p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(),
|
||||
prefetchHooksCallback: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
typedef $$UserProfileTableTableProcessedTableManager =
|
||||
ProcessedTableManager<
|
||||
_$DriftPowersyncDatabase,
|
||||
$UserProfileTableTable,
|
||||
UserProfile,
|
||||
$$UserProfileTableTableFilterComposer,
|
||||
$$UserProfileTableTableOrderingComposer,
|
||||
$$UserProfileTableTableAnnotationComposer,
|
||||
$$UserProfileTableTableCreateCompanionBuilder,
|
||||
$$UserProfileTableTableUpdateCompanionBuilder,
|
||||
(
|
||||
UserProfile,
|
||||
BaseReferences<_$DriftPowersyncDatabase, $UserProfileTableTable, UserProfile>,
|
||||
),
|
||||
UserProfile,
|
||||
PrefetchHooks Function()
|
||||
>;
|
||||
typedef $$ExerciseCategoryTableTableCreateCompanionBuilder =
|
||||
ExerciseCategoryTableCompanion Function({
|
||||
required int id,
|
||||
@@ -21821,6 +22117,8 @@ class $DriftPowersyncDatabaseManager {
|
||||
$$LanguageTableTableTableManager(_db, _db.languageTable);
|
||||
$$LicenseTableTableTableManager get licenseTable =>
|
||||
$$LicenseTableTableTableManager(_db, _db.licenseTable);
|
||||
$$UserProfileTableTableTableManager get userProfileTable =>
|
||||
$$UserProfileTableTableTableManager(_db, _db.userProfileTable);
|
||||
$$ExerciseCategoryTableTableTableManager get exerciseCategoryTable =>
|
||||
$$ExerciseCategoryTableTableTableManager(_db, _db.exerciseCategoryTable);
|
||||
$$ExerciseTableTableTableManager get exerciseTable =>
|
||||
|
||||
@@ -46,7 +46,7 @@ final class PowerSyncInstanceProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$powerSyncInstanceHash() => r'308719fe4d1af01353373f8dac86a2b64da840a7';
|
||||
String _$powerSyncInstanceHash() => r'594b672390250e0b65caf0ad5ada39b8c5853de0';
|
||||
|
||||
@ProviderFor(didCompleteSync)
|
||||
final didCompleteSyncProvider = DidCompleteSyncFamily._();
|
||||
|
||||
37
lib/database/powersync/tables/user_profile.dart
Normal file
37
lib/database/powersync/tables/user_profile.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:powersync/powersync.dart' as ps;
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
|
||||
@UseRowClass(UserProfile)
|
||||
class UserProfileTable extends Table {
|
||||
@override
|
||||
String get tableName => 'core_userprofile';
|
||||
|
||||
IntColumn get id => integer()();
|
||||
TextColumn get weightUnitStr => text().named('weight_unit')();
|
||||
}
|
||||
|
||||
const PowersyncUserProfileTable = ps.Table(
|
||||
'core_userprofile',
|
||||
[
|
||||
ps.Column.text('weight_unit'),
|
||||
],
|
||||
);
|
||||
@@ -25,8 +25,7 @@ enum ImageType {
|
||||
threeD(id: 2, label: '3D', icon: Icons.view_in_ar),
|
||||
line(id: 3, label: 'Line', icon: Icons.show_chart),
|
||||
lowPoly(id: 4, label: 'Low-Poly', icon: Icons.filter_vintage),
|
||||
other(id: 5, label: 'Other', icon: Icons.more_horiz)
|
||||
;
|
||||
other(id: 5, label: 'Other', icon: Icons.more_horiz);
|
||||
|
||||
const ImageType({required this.id, required this.label, required this.icon});
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@ enum ExerciseImageStyle {
|
||||
threeD('2'),
|
||||
lowPoly('3'),
|
||||
photo('4'),
|
||||
other('5')
|
||||
;
|
||||
other('5');
|
||||
|
||||
final String wireValue;
|
||||
const ExerciseImageStyle(this.wireValue);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wger Workout Manager is distributed in the hope that it will be useful,
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
@@ -18,37 +18,33 @@
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'profile.g.dart';
|
||||
part 'account.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Profile {
|
||||
/// Read-only account information fetched from the REST `userprofile` endpoint.
|
||||
///
|
||||
/// These fields live on Django's `User` model rather than `core_userprofile`,
|
||||
/// so they cannot travel through PowerSync. Editable preferences are kept
|
||||
/// separately in the synced `UserProfile`.
|
||||
@JsonSerializable(createToJson: false)
|
||||
class Account {
|
||||
@JsonKey(required: true)
|
||||
String username;
|
||||
final String username;
|
||||
|
||||
@JsonKey(required: true)
|
||||
final String email;
|
||||
|
||||
@JsonKey(required: true, name: 'email_verified')
|
||||
bool emailVerified;
|
||||
final bool emailVerified;
|
||||
|
||||
@JsonKey(required: true, name: 'is_trustworthy')
|
||||
bool isTrustworthy;
|
||||
final bool isTrustworthy;
|
||||
|
||||
@JsonKey(required: true, name: 'weight_unit')
|
||||
String weightUnitStr;
|
||||
|
||||
bool get isMetric => weightUnitStr == 'kg';
|
||||
|
||||
@JsonKey(required: true)
|
||||
String email;
|
||||
|
||||
Profile({
|
||||
const Account({
|
||||
required this.username,
|
||||
required this.email,
|
||||
required this.emailVerified,
|
||||
required this.isTrustworthy,
|
||||
required this.email,
|
||||
required this.weightUnitStr,
|
||||
});
|
||||
|
||||
// Boilerplate
|
||||
factory Profile.fromJson(Map<String, dynamic> json) => _$ProfileFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ProfileToJson(this);
|
||||
factory Account.fromJson(Map<String, dynamic> json) => _$AccountFromJson(json);
|
||||
}
|
||||
@@ -1,35 +1,25 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'profile.dart';
|
||||
part of 'account.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
Profile _$ProfileFromJson(Map<String, dynamic> json) {
|
||||
Account _$AccountFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(
|
||||
json,
|
||||
requiredKeys: const [
|
||||
'username',
|
||||
'email',
|
||||
'email_verified',
|
||||
'is_trustworthy',
|
||||
'weight_unit',
|
||||
'email',
|
||||
],
|
||||
);
|
||||
return Profile(
|
||||
return Account(
|
||||
username: json['username'] as String,
|
||||
email: json['email'] as String,
|
||||
emailVerified: json['email_verified'] as bool,
|
||||
isTrustworthy: json['is_trustworthy'] as bool,
|
||||
email: json['email'] as String,
|
||||
weightUnitStr: json['weight_unit'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$ProfileToJson(Profile instance) => <String, dynamic>{
|
||||
'username': instance.username,
|
||||
'email_verified': instance.emailVerified,
|
||||
'is_trustworthy': instance.isTrustworthy,
|
||||
'weight_unit': instance.weightUnitStr,
|
||||
'email': instance.email,
|
||||
};
|
||||
38
lib/models/user/user_profile.dart
Normal file
38
lib/models/user/user_profile.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 - 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:drift/drift.dart' as drift;
|
||||
import 'package:wger/database/powersync/database.dart';
|
||||
|
||||
/// The user's editable profile preferences.
|
||||
class UserProfile {
|
||||
final int id;
|
||||
String weightUnitStr;
|
||||
|
||||
UserProfile({required this.id, required this.weightUnitStr});
|
||||
|
||||
bool get isMetric => weightUnitStr == 'kg';
|
||||
|
||||
/// Drift companion for local UPDATE writes routed through PowerSync.
|
||||
UserProfileTableCompanion toCompanion() {
|
||||
return UserProfileTableCompanion(
|
||||
id: drift.Value(id),
|
||||
weightUnitStr: drift.Value(weightUnitStr),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,7 @@ import 'package:wger/models/workouts/log.dart';
|
||||
enum WorkoutImpression {
|
||||
bad('1'),
|
||||
neutral('2'),
|
||||
good('3')
|
||||
;
|
||||
good('3');
|
||||
|
||||
final String wireValue;
|
||||
const WorkoutImpression(this.wireValue);
|
||||
|
||||
@@ -25,6 +25,7 @@ import 'package:wger/database/powersync/tables/license.dart';
|
||||
import 'package:wger/database/powersync/tables/measurements.dart';
|
||||
import 'package:wger/database/powersync/tables/nutrition.dart';
|
||||
import 'package:wger/database/powersync/tables/routines.dart';
|
||||
import 'package:wger/database/powersync/tables/user_profile.dart';
|
||||
import 'package:wger/database/powersync/tables/weight.dart';
|
||||
|
||||
Schema schema = const Schema(
|
||||
@@ -32,6 +33,7 @@ Schema schema = const Schema(
|
||||
// Core
|
||||
PowersyncLanguageTable,
|
||||
PowersyncLicenseTable,
|
||||
PowersyncUserProfileTable,
|
||||
|
||||
// Exercises (large or wide tables live in the rawTables slot below)
|
||||
PowersyncExerciseAliasTable,
|
||||
|
||||
44
lib/providers/account_notifier.dart
Normal file
44
lib/providers/account_notifier.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:wger/models/user/account.dart';
|
||||
import 'package:wger/providers/account_repository.dart';
|
||||
|
||||
part 'account_notifier.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class AccountNotifier extends _$AccountNotifier {
|
||||
late AccountRepository _repo;
|
||||
|
||||
@override
|
||||
Future<Account?> build() async {
|
||||
_repo = ref.read(accountRepositoryProvider);
|
||||
return _repo.fetchAccount();
|
||||
}
|
||||
|
||||
/// Triggers the server's verification email flow.
|
||||
Future<void> verifyEmail() async {
|
||||
await _repo.verifyEmail();
|
||||
}
|
||||
|
||||
/// Clears the cached account (e.g. on logout).
|
||||
void clear() {
|
||||
state = const AsyncData(null);
|
||||
}
|
||||
}
|
||||
53
lib/providers/account_notifier.g.dart
Normal file
53
lib/providers/account_notifier.g.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'account_notifier.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint, type=warning
|
||||
|
||||
@ProviderFor(AccountNotifier)
|
||||
final accountProvider = AccountNotifierProvider._();
|
||||
|
||||
final class AccountNotifierProvider extends $AsyncNotifierProvider<AccountNotifier, Account?> {
|
||||
AccountNotifierProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'accountProvider',
|
||||
isAutoDispose: false,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@override
|
||||
String debugGetCreateSourceHash() => _$accountNotifierHash();
|
||||
|
||||
@$internal
|
||||
@override
|
||||
AccountNotifier create() => AccountNotifier();
|
||||
}
|
||||
|
||||
String _$accountNotifierHash() => r'c7b8d7ff24bf27f3977f2796166a2f624f442159';
|
||||
|
||||
abstract class _$AccountNotifier extends $AsyncNotifier<Account?> {
|
||||
FutureOr<Account?> build();
|
||||
@$mustCallSuper
|
||||
@override
|
||||
void runBuild() {
|
||||
final ref = this.ref as $Ref<AsyncValue<Account?>, Account?>;
|
||||
final element =
|
||||
ref.element
|
||||
as $ClassProviderElement<
|
||||
AnyNotifier<AsyncValue<Account?>, Account?>,
|
||||
AsyncValue<Account?>,
|
||||
Object?,
|
||||
Object?
|
||||
>;
|
||||
element.handleCreate(ref, build);
|
||||
}
|
||||
}
|
||||
54
lib/providers/account_repository.dart
Normal file
54
lib/providers/account_repository.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 - 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:wger/models/user/account.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
import 'package:wger/providers/wger_base.dart';
|
||||
|
||||
const _PROFILE_URL = 'userprofile';
|
||||
const _VERIFY_EMAIL = 'verify-email';
|
||||
|
||||
final accountRepositoryProvider = Provider<AccountRepository>((ref) {
|
||||
final base = ref.read(wgerBaseProvider);
|
||||
return AccountRepository(base);
|
||||
});
|
||||
|
||||
/// Read access to the user's account data (username, email, verification
|
||||
/// status). These fields live on Django's `User` model and stay on the REST
|
||||
/// API.
|
||||
class AccountRepository {
|
||||
final _logger = Logger('AccountRepository');
|
||||
final WgerBaseProvider _base;
|
||||
|
||||
AccountRepository(this._base);
|
||||
|
||||
/// Fetches the current user's account data from the server.
|
||||
Future<Account> fetchAccount() async {
|
||||
_logger.finer('Fetching user account');
|
||||
final data = await _base.fetch(_base.makeUrl(_PROFILE_URL));
|
||||
return Account.fromJson(data);
|
||||
}
|
||||
|
||||
/// Triggers the server's verification email flow.
|
||||
Future<void> verifyEmail() async {
|
||||
_logger.finer('Requesting email verification');
|
||||
await _base.fetch(_base.makeUrl(_PROFILE_URL, objectMethod: _VERIFY_EMAIL));
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,7 @@ enum DashboardWidget {
|
||||
nutrition('nutrition'),
|
||||
weight('weight'),
|
||||
measurements('measurements'),
|
||||
calendar('calendar')
|
||||
;
|
||||
calendar('calendar');
|
||||
|
||||
final String value;
|
||||
const DashboardWidget(this.value);
|
||||
|
||||
@@ -111,7 +111,7 @@ final class RoutinesRiverpodProvider
|
||||
RoutinesRiverpod create() => RoutinesRiverpod();
|
||||
}
|
||||
|
||||
String _$routinesRiverpodHash() => r'a1527aa3c9ad321e5b5882040b2ada0bc53f35f5';
|
||||
String _$routinesRiverpodHash() => r'eae2b0dea699fd964bc58b218121beaca2c4cb46';
|
||||
|
||||
abstract class _$RoutinesRiverpod extends $StreamNotifier<RoutinesState> {
|
||||
Stream<RoutinesState> build();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:wger/models/user/profile.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
import 'package:wger/providers/user_profile_repository.dart';
|
||||
|
||||
part 'user_profile_notifier.g.dart';
|
||||
@@ -27,33 +27,13 @@ class UserProfileNotifier extends _$UserProfileNotifier {
|
||||
late UserProfileRepository _repo;
|
||||
|
||||
@override
|
||||
Future<Profile?> build() async {
|
||||
Stream<UserProfile?> build() {
|
||||
_repo = ref.read(userProfileRepositoryProvider);
|
||||
return _repo.fetchProfile();
|
||||
return _repo.watchDrift();
|
||||
}
|
||||
|
||||
/// Saves the current profile to the server.
|
||||
Future<void> saveProfile() async {
|
||||
final profile = state.asData?.value;
|
||||
if (profile == null) {
|
||||
return;
|
||||
}
|
||||
await _repo.saveProfile(profile);
|
||||
}
|
||||
|
||||
/// Triggers the server's verification email flow.
|
||||
Future<void> verifyEmail() async {
|
||||
await _repo.verifyEmail();
|
||||
}
|
||||
|
||||
/// Replaces the in-memory profile. Used by forms that edit profile fields
|
||||
/// locally before saving.
|
||||
void setProfile(Profile profile) {
|
||||
state = AsyncData(profile);
|
||||
}
|
||||
|
||||
/// Clears the current profile (e.g. on logout).
|
||||
void clear() {
|
||||
state = const AsyncData(null);
|
||||
/// Persists the edited preferences locally; PowerSync syncs them upstream.
|
||||
Future<void> updateProfile(UserProfile profile) async {
|
||||
await _repo.editLocalDrift(profile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ part of 'user_profile_notifier.dart';
|
||||
final userProfileProvider = UserProfileNotifierProvider._();
|
||||
|
||||
final class UserProfileNotifierProvider
|
||||
extends $AsyncNotifierProvider<UserProfileNotifier, Profile?> {
|
||||
extends $StreamNotifierProvider<UserProfileNotifier, UserProfile?> {
|
||||
UserProfileNotifierProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
@@ -33,19 +33,19 @@ final class UserProfileNotifierProvider
|
||||
UserProfileNotifier create() => UserProfileNotifier();
|
||||
}
|
||||
|
||||
String _$userProfileNotifierHash() => r'15c6c0cdfa0e32d173b5f2b136c95ce7e3d6e9c2';
|
||||
String _$userProfileNotifierHash() => r'897debe60867477af257a298ffb465da8fb54749';
|
||||
|
||||
abstract class _$UserProfileNotifier extends $AsyncNotifier<Profile?> {
|
||||
FutureOr<Profile?> build();
|
||||
abstract class _$UserProfileNotifier extends $StreamNotifier<UserProfile?> {
|
||||
Stream<UserProfile?> build();
|
||||
@$mustCallSuper
|
||||
@override
|
||||
void runBuild() {
|
||||
final ref = this.ref as $Ref<AsyncValue<Profile?>, Profile?>;
|
||||
final ref = this.ref as $Ref<AsyncValue<UserProfile?>, UserProfile?>;
|
||||
final element =
|
||||
ref.element
|
||||
as $ClassProviderElement<
|
||||
AnyNotifier<AsyncValue<Profile?>, Profile?>,
|
||||
AsyncValue<Profile?>,
|
||||
AnyNotifier<AsyncValue<UserProfile?>, UserProfile?>,
|
||||
AsyncValue<UserProfile?>,
|
||||
Object?,
|
||||
Object?
|
||||
>;
|
||||
|
||||
@@ -18,37 +18,32 @@
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:wger/models/user/profile.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
import 'package:wger/providers/wger_base.dart';
|
||||
|
||||
const _PROFILE_URL = 'userprofile';
|
||||
const _VERIFY_EMAIL = 'verify-email';
|
||||
import 'package:wger/database/powersync/database.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
|
||||
final userProfileRepositoryProvider = Provider<UserProfileRepository>((ref) {
|
||||
final base = ref.read(wgerBaseProvider);
|
||||
return UserProfileRepository(base);
|
||||
final db = ref.read(driftPowerSyncDatabase);
|
||||
return UserProfileRepository(db);
|
||||
});
|
||||
|
||||
/// Local data access for the user's profile preferences
|
||||
class UserProfileRepository {
|
||||
final _logger = Logger('UserProfileRepository');
|
||||
final WgerBaseProvider _base;
|
||||
final DriftPowersyncDatabase _db;
|
||||
|
||||
UserProfileRepository(this._base);
|
||||
UserProfileRepository(this._db);
|
||||
|
||||
Future<Profile> fetchProfile() async {
|
||||
_logger.finer('Fetching user profile');
|
||||
final data = await _base.fetch(_base.makeUrl(_PROFILE_URL));
|
||||
return Profile.fromJson(data);
|
||||
/// Streams the synced profile row, or null until it has synced down.
|
||||
Stream<UserProfile?> watchDrift() {
|
||||
_logger.finer('Watching local user profile');
|
||||
return _db.select(_db.userProfileTable).watchSingleOrNull();
|
||||
}
|
||||
|
||||
Future<void> saveProfile(Profile profile) async {
|
||||
_logger.finer('Saving user profile');
|
||||
await _base.post(profile.toJson(), _base.makeUrl(_PROFILE_URL));
|
||||
}
|
||||
|
||||
Future<void> verifyEmail() async {
|
||||
_logger.finer('Requesting email verification');
|
||||
await _base.fetch(_base.makeUrl(_PROFILE_URL, objectMethod: _VERIFY_EMAIL));
|
||||
/// Writes the edited preferences locally; PowerSync pushes them upstream.
|
||||
Future<void> editLocalDrift(UserProfile profile) async {
|
||||
_logger.finer('Updating local user profile ${profile.id}');
|
||||
await (_db.update(
|
||||
_db.userProfileTable,
|
||||
)..where((t) => t.id.equals(profile.id))).write(profile.toCompanion());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ import 'package:wger/core/wide_screen_wrapper.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/providers/account_notifier.dart';
|
||||
import 'package:wger/providers/add_exercise_notifier.dart';
|
||||
import 'package:wger/providers/exercises_notifier.dart';
|
||||
import 'package:wger/providers/network_provider.dart';
|
||||
import 'package:wger/providers/user_profile_notifier.dart';
|
||||
import 'package:wger/screens/exercise_screen.dart';
|
||||
import 'package:wger/widgets/add_exercise/steps/step_1_basics.dart';
|
||||
import 'package:wger/widgets/add_exercise/steps/step_2_variations.dart';
|
||||
@@ -48,9 +48,9 @@ class AddExerciseScreen extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final profile = ref.watch(userProfileProvider).value;
|
||||
final account = ref.watch(accountProvider).value;
|
||||
final isOnline = ref.watch(networkStatusProvider);
|
||||
if (profile == null) {
|
||||
if (account == null) {
|
||||
return const Scaffold(body: Center(child: CircularProgressIndicator()));
|
||||
}
|
||||
if (!isOnline) {
|
||||
@@ -77,7 +77,7 @@ class AddExerciseScreen extends ConsumerWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
return profile.isTrustworthy ? const AddExerciseStepper() : const EmailNotVerified();
|
||||
return account.isTrustworthy ? const AddExerciseStepper() : const EmailNotVerified();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,11 +322,6 @@ class EmailNotVerified extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final user = ref.watch(userProfileProvider).value;
|
||||
if (user == null) {
|
||||
return const Scaffold(body: Center(child: CircularProgressIndicator()));
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: EmptyAppBar(AppLocalizations.of(context).unVerifiedEmail),
|
||||
body: Container(
|
||||
@@ -356,7 +351,7 @@ class EmailNotVerified extends ConsumerWidget {
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).userProfile,
|
||||
UserProfileForm(user),
|
||||
const UserProfileForm(),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -38,8 +38,9 @@ class RoutineEditScreen extends ConsumerWidget {
|
||||
value: ref.watch(routinesRiverpodProvider),
|
||||
loggerName: 'RoutineEditScreen',
|
||||
loading: const Scaffold(body: Center(child: CircularProgressIndicator())),
|
||||
errorBuilder: (e, st) =>
|
||||
Scaffold(body: Center(child: StreamErrorIndicator(e, stacktrace: st))),
|
||||
errorBuilder: (e, st) => Scaffold(
|
||||
body: Center(child: StreamErrorIndicator(e, stacktrace: st)),
|
||||
),
|
||||
data: (state) {
|
||||
final routine = state.findById(routineId);
|
||||
return Scaffold(
|
||||
|
||||
@@ -38,8 +38,9 @@ class WorkoutLogsScreen extends ConsumerWidget {
|
||||
value: ref.watch(routinesRiverpodProvider),
|
||||
loggerName: 'WorkoutLogsScreen',
|
||||
loading: const Scaffold(body: Center(child: CircularProgressIndicator())),
|
||||
errorBuilder: (e, st) =>
|
||||
Scaffold(body: Center(child: StreamErrorIndicator(e, stacktrace: st))),
|
||||
errorBuilder: (e, st) => Scaffold(
|
||||
body: Center(child: StreamErrorIndicator(e, stacktrace: st)),
|
||||
),
|
||||
data: (state) {
|
||||
final routine = state.findById(routineId);
|
||||
return Scaffold(
|
||||
|
||||
@@ -38,8 +38,9 @@ class RoutineScreen extends ConsumerWidget {
|
||||
value: ref.watch(routinesRiverpodProvider),
|
||||
loggerName: 'RoutineScreen',
|
||||
loading: const Scaffold(body: Center(child: CircularProgressIndicator())),
|
||||
errorBuilder: (e, st) =>
|
||||
Scaffold(body: Center(child: StreamErrorIndicator(e, stacktrace: st))),
|
||||
errorBuilder: (e, st) => Scaffold(
|
||||
body: Center(child: StreamErrorIndicator(e, stacktrace: st)),
|
||||
),
|
||||
data: (state) {
|
||||
final routine = state.findById(routineId);
|
||||
return Scaffold(
|
||||
|
||||
@@ -5,8 +5,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/models/exercises/exercise_submission_images.dart';
|
||||
import 'package:wger/providers/account_notifier.dart';
|
||||
import 'package:wger/providers/add_exercise_notifier.dart';
|
||||
import 'package:wger/providers/user_profile_notifier.dart';
|
||||
import 'package:wger/widgets/add_exercise/image_details_form.dart';
|
||||
import 'package:wger/widgets/add_exercise/mixins/image_picker_mixin.dart';
|
||||
import 'package:wger/widgets/add_exercise/preview_images.dart';
|
||||
@@ -76,7 +76,7 @@ class _Step5ImagesState extends ConsumerState<Step5Images> with ExerciseImagePic
|
||||
///
|
||||
/// [pickFromCamera] - If true, opens camera; otherwise opens gallery
|
||||
void _pickAndShowImageDetails(BuildContext context, {bool pickFromCamera = false}) async {
|
||||
final profile = ref.read(userProfileProvider).value;
|
||||
final account = ref.read(accountProvider).value;
|
||||
final imagePicker = ImagePicker();
|
||||
|
||||
XFile? selectedImage;
|
||||
@@ -118,7 +118,7 @@ class _Step5ImagesState extends ConsumerState<Step5Images> with ExerciseImagePic
|
||||
setState(() {
|
||||
_currentImageToAdd = ExerciseSubmissionImage(
|
||||
imageFile: imageFile,
|
||||
author: profile?.username ?? '',
|
||||
author: account?.username ?? '',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:wger/database/powersync/powersync.dart' show syncStatus;
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/providers/account_notifier.dart';
|
||||
import 'package:wger/providers/auth_notifier.dart';
|
||||
import 'package:wger/providers/user_profile_notifier.dart';
|
||||
import 'package:wger/screens/form_screen.dart';
|
||||
import 'package:wger/screens/settings_dashboard_widgets_screen.dart';
|
||||
import 'package:wger/widgets/core/about.dart';
|
||||
@@ -98,18 +98,12 @@ class MainSettingsDialog extends ConsumerWidget {
|
||||
leading: const Icon(Icons.person),
|
||||
title: Text(AppLocalizations.of(context).userProfile),
|
||||
onTap: () {
|
||||
// Only navigate once the profile is loaded; otherwise the form
|
||||
// would crash on a null user.
|
||||
final profile = ref.read(userProfileProvider).value;
|
||||
if (profile == null) {
|
||||
return;
|
||||
}
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).userProfile,
|
||||
UserProfileForm(profile),
|
||||
const UserProfileForm(),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -137,7 +131,7 @@ class MainSettingsDialog extends ConsumerWidget {
|
||||
// state lives in PowerSync now and gets cleared along with the
|
||||
// rest of the synced tables.
|
||||
await ref.read(authProvider.notifier).logout();
|
||||
ref.read(userProfileProvider.notifier).clear();
|
||||
ref.read(accountProvider.notifier).clear();
|
||||
|
||||
navigator.pop();
|
||||
navigator.pushReplacementNamed('/');
|
||||
|
||||
@@ -21,7 +21,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/models/body_weight/weight_entry.dart';
|
||||
import 'package:wger/models/user/profile.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
import 'package:wger/providers/body_weight_notifier.dart';
|
||||
import 'package:wger/providers/user_profile_notifier.dart';
|
||||
import 'package:wger/screens/form_screen.dart';
|
||||
@@ -92,7 +92,11 @@ class DashboardWeightWidget extends ConsumerWidget {
|
||||
return _shell(context, _buildContent(context, entriesAsync.value!, profile));
|
||||
}
|
||||
|
||||
Widget _buildContent(BuildContext context, List<WeightEntry> entriesList, Profile profile) {
|
||||
Widget _buildContent(
|
||||
BuildContext context,
|
||||
List<WeightEntry> entriesList,
|
||||
UserProfile profile,
|
||||
) {
|
||||
if (entriesList.isEmpty) {
|
||||
return NothingFound(
|
||||
AppLocalizations.of(context).noWeightEntries,
|
||||
|
||||
@@ -429,8 +429,7 @@ class IngredientFormState extends ConsumerState<IngredientForm> {
|
||||
enum GoalType {
|
||||
meals('From meals'),
|
||||
basic('Basic'),
|
||||
advanced('Advanced')
|
||||
;
|
||||
advanced('Advanced');
|
||||
|
||||
const GoalType(this.label);
|
||||
|
||||
|
||||
@@ -19,136 +19,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/models/user/profile.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
import 'package:wger/providers/account_notifier.dart';
|
||||
import 'package:wger/providers/network_provider.dart';
|
||||
import 'package:wger/providers/user_profile_notifier.dart';
|
||||
import 'package:wger/theme/theme.dart';
|
||||
|
||||
/// Shows the user's account data (read-only) and lets them edit the profile
|
||||
/// preferences. The weight-unit preference is persisted through PowerSync, so
|
||||
/// saving works offline; the e-mail verification action still needs the server.
|
||||
class UserProfileForm extends ConsumerStatefulWidget {
|
||||
late final Profile _profile;
|
||||
|
||||
UserProfileForm(Profile profile) {
|
||||
_profile = profile;
|
||||
}
|
||||
const UserProfileForm({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<UserProfileForm> createState() => _UserProfileFormState();
|
||||
}
|
||||
|
||||
class _UserProfileFormState extends ConsumerState<UserProfileForm> {
|
||||
final _form = GlobalKey<FormState>();
|
||||
|
||||
final emailController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
emailController.text = widget._profile.email;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
emailController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
/// Pending weight-unit edit, null while it still mirrors the synced value.
|
||||
String? _weightUnitStr;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = AppLocalizations.of(context);
|
||||
final isOnline = ref.watch(networkStatusProvider);
|
||||
return Form(
|
||||
key: _form,
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person, color: wgerPrimaryColor),
|
||||
title: Text(AppLocalizations.of(context).username),
|
||||
subtitle: Text(widget._profile.username),
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalizations.of(context).useMetric),
|
||||
subtitle: Text(widget._profile.weightUnitStr),
|
||||
value: widget._profile.isMetric,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
widget._profile.weightUnitStr = widget._profile.isMetric
|
||||
? AppLocalizations.of(context).lb
|
||||
: AppLocalizations.of(context).kg;
|
||||
});
|
||||
},
|
||||
dense: true,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.email_rounded, color: wgerPrimaryColor),
|
||||
title: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: widget._profile.emailVerified
|
||||
? AppLocalizations.of(context).verifiedEmail
|
||||
: AppLocalizations.of(context).unVerifiedEmail,
|
||||
suffixIcon: widget._profile.emailVerified
|
||||
? const Icon(Icons.check_circle, color: Colors.green)
|
||||
: null,
|
||||
),
|
||||
controller: emailController,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
onSaved: (newValue) {
|
||||
widget._profile.email = newValue!;
|
||||
},
|
||||
validator: (value) {
|
||||
if (value!.isNotEmpty && !value.contains('@')) {
|
||||
return AppLocalizations.of(context).invalidEmail;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
if (!widget._profile.emailVerified)
|
||||
OutlinedButton(
|
||||
onPressed: isOnline
|
||||
? () async {
|
||||
// Email is already verified
|
||||
if (widget._profile.emailVerified) {
|
||||
return;
|
||||
}
|
||||
final account = ref.watch(accountProvider).value;
|
||||
final profile = ref.watch(userProfileProvider).value;
|
||||
|
||||
// Verify
|
||||
await ref.read(userProfileProvider.notifier).verifyEmail();
|
||||
if (account == null || profile == null) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
final weightUnitStr = _weightUnitStr ?? profile.weightUnitStr;
|
||||
final isMetric = weightUnitStr == 'kg';
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person, color: wgerPrimaryColor),
|
||||
title: Text(i18n.username),
|
||||
subtitle: Text(account.username),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.email_rounded, color: wgerPrimaryColor),
|
||||
title: Text(
|
||||
account.emailVerified ? i18n.verifiedEmail : i18n.unVerifiedEmail,
|
||||
),
|
||||
subtitle: Text(account.email),
|
||||
trailing: account.emailVerified
|
||||
? const Icon(Icons.check_circle, color: Colors.green)
|
||||
: null,
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text(i18n.useMetric),
|
||||
subtitle: Text(weightUnitStr),
|
||||
value: isMetric,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
_weightUnitStr = isMetric ? i18n.lb : i18n.kg;
|
||||
});
|
||||
},
|
||||
dense: true,
|
||||
),
|
||||
if (!account.emailVerified)
|
||||
OutlinedButton(
|
||||
onPressed: isOnline
|
||||
? () async {
|
||||
await ref.read(accountProvider.notifier).verifyEmail();
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).verifiedEmailInfo(widget._profile.email),
|
||||
),
|
||||
content: Text(i18n.verifiedEmailInfo(account.email)),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: Text(AppLocalizations.of(context).verify),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: isOnline
|
||||
? () async {
|
||||
// Validate and save the current values to the weightEntry
|
||||
final isValid = _form.currentState!.validate();
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
|
||||
// Update profile
|
||||
ref.read(userProfileProvider.notifier).saveProfile();
|
||||
Navigator.of(context).pop();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context).successfullySaved),
|
||||
),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
child: Text(i18n.verify),
|
||||
),
|
||||
],
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(
|
||||
UserProfile(id: profile.id, weightUnitStr: weightUnitStr),
|
||||
);
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(i18n.successfullySaved)),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(i18n.save),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1717,17 +1717,6 @@ class MockAppLocalizations extends _i1.Mock implements _i2.AppLocalizations {
|
||||
)
|
||||
as String);
|
||||
|
||||
@override
|
||||
String get errorCouldNotConnectToServerDetails =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#errorCouldNotConnectToServerDetails),
|
||||
returnValue: _i3.dummyValue<String>(
|
||||
this,
|
||||
Invocation.getter(#errorCouldNotConnectToServerDetails),
|
||||
),
|
||||
)
|
||||
as String);
|
||||
|
||||
@override
|
||||
String get copyToClipboard =>
|
||||
(super.noSuchMethod(
|
||||
@@ -4327,6 +4316,17 @@ class MockAppLocalizations extends _i1.Mock implements _i2.AppLocalizations {
|
||||
)
|
||||
as String);
|
||||
|
||||
@override
|
||||
String get sessionExpired =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#sessionExpired),
|
||||
returnValue: _i3.dummyValue<String>(
|
||||
this,
|
||||
Invocation.getter(#sessionExpired),
|
||||
),
|
||||
)
|
||||
as String);
|
||||
|
||||
@override
|
||||
String exerciseNr(String? nr) =>
|
||||
(super.noSuchMethod(
|
||||
|
||||
@@ -27,37 +27,49 @@ import 'package:wger/models/exercises/category.dart';
|
||||
import 'package:wger/models/exercises/equipment.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/exercises/muscle.dart';
|
||||
import 'package:wger/models/user/account.dart';
|
||||
import 'package:wger/providers/account_repository.dart';
|
||||
import 'package:wger/providers/add_exercise_repository.dart';
|
||||
import 'package:wger/providers/exercise_repository.dart';
|
||||
import 'package:wger/providers/exercises_notifier.dart';
|
||||
import 'package:wger/providers/network_provider.dart';
|
||||
import 'package:wger/providers/user_profile_repository.dart';
|
||||
import 'package:wger/screens/add_exercise_screen.dart';
|
||||
|
||||
import '../../test_data/profile.dart';
|
||||
import '../fake_connectivity.dart';
|
||||
import 'contribute_exercise_test.mocks.dart';
|
||||
|
||||
/// Test suite for the exercise-contribution screen.
|
||||
///
|
||||
@GenerateMocks([AddExerciseRepository, UserProfileRepository, ExerciseRepository])
|
||||
@GenerateMocks([AddExerciseRepository, AccountRepository, ExerciseRepository])
|
||||
void main() {
|
||||
installFakeConnectivity();
|
||||
|
||||
late MockAddExerciseRepository mockAddExerciseRepository;
|
||||
late MockUserProfileRepository mockUserProfileRepository;
|
||||
late MockAccountRepository mockAccountRepository;
|
||||
late MockExerciseRepository mockExerciseRepository;
|
||||
|
||||
setUp(() {
|
||||
mockAddExerciseRepository = MockAddExerciseRepository();
|
||||
mockUserProfileRepository = MockUserProfileRepository();
|
||||
mockAccountRepository = MockAccountRepository();
|
||||
mockExerciseRepository = MockExerciseRepository();
|
||||
when(mockUserProfileRepository.fetchProfile()).thenAnswer((_) async => tProfile1);
|
||||
when(
|
||||
mockExerciseRepository.watchAllDrift(),
|
||||
).thenAnswer((_) => Stream.value(const ExerciseState(<Exercise>[])));
|
||||
});
|
||||
|
||||
/// Stubs the account fetch so the contribution gate sees a (non-)trustworthy
|
||||
/// user. The screen branches on [Account.isTrustworthy].
|
||||
void setTrustworthy(bool value) {
|
||||
when(mockAccountRepository.fetchAccount()).thenAnswer(
|
||||
(_) async => Account(
|
||||
username: 'test',
|
||||
email: 'test@example.com',
|
||||
emailVerified: value,
|
||||
isTrustworthy: value,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget createExerciseScreen({locale = 'en', bool isOnline = true}) {
|
||||
return ProviderScope(
|
||||
overrides: [
|
||||
@@ -70,7 +82,7 @@ void main() {
|
||||
exerciseEquipmentProvider.overrideWith(
|
||||
(ref) => Stream<List<Equipment>>.value(<Equipment>[]),
|
||||
),
|
||||
userProfileRepositoryProvider.overrideWithValue(mockUserProfileRepository),
|
||||
accountRepositoryProvider.overrideWithValue(mockAccountRepository),
|
||||
addExerciseRepositoryProvider.overrideWithValue(mockAddExerciseRepository),
|
||||
networkStatusProvider.overrideWithValue(isOnline),
|
||||
],
|
||||
@@ -89,7 +101,7 @@ void main() {
|
||||
|
||||
group('Form Field Validation Tests', () {
|
||||
testWidgets('Exercise name field is required and displays validation error', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -110,7 +122,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('User can enter exercise name in text field', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -124,7 +136,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Alternative names field accepts multiple lines of text', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -139,7 +151,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Category dropdown is required for form submission', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -168,7 +180,7 @@ void main() {
|
||||
|
||||
group('Form Navigation and Data Persistence Tests', () {
|
||||
testWidgets('Form data persists when navigating between steps', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -180,7 +192,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Previous button navigates back to previous step', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -204,7 +216,7 @@ void main() {
|
||||
|
||||
group('Dropdown Selection Tests', () {
|
||||
testWidgets('Category selection widgets exist in form', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -217,7 +229,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Form contains multiple selection fields', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -236,7 +248,7 @@ void main() {
|
||||
|
||||
group('Exercise Submission Tests', () {
|
||||
testWidgets('Submission flow structure', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
when(mockAddExerciseRepository.submit(any)).thenAnswer((_) async => 1);
|
||||
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
@@ -247,7 +259,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Form structure supports error handling', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
when(mockAddExerciseRepository.submit(any)).thenThrow(Exception('Bad request'));
|
||||
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
@@ -264,7 +276,7 @@ void main() {
|
||||
|
||||
group('Access Control Tests', () {
|
||||
testWidgets('Unverified users cannot access exercise form', (tester) async {
|
||||
tProfile1.isTrustworthy = false;
|
||||
setTrustworthy(false);
|
||||
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
@@ -275,7 +287,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Verified users can access all form fields', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
@@ -289,7 +301,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Email verification warning displays correct message', (tester) async {
|
||||
tProfile1.isTrustworthy = false;
|
||||
setTrustworthy(false);
|
||||
|
||||
await tester.pumpWidget(createExerciseScreen());
|
||||
await tester.pumpAndSettle();
|
||||
@@ -306,7 +318,7 @@ void main() {
|
||||
|
||||
group('Offline gating', () {
|
||||
testWidgets('Offline placeholder is shown instead of the wizard', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen(isOnline: false));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -317,7 +329,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Wizard is shown when online', (tester) async {
|
||||
tProfile1.isTrustworthy = true;
|
||||
setTrustworthy(true);
|
||||
await tester.pumpWidget(createExerciseScreen(isOnline: true));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ import 'package:wger/models/exercises/exercise_filters.dart' as _i10;
|
||||
import 'package:wger/models/exercises/exercise_submission.dart' as _i5;
|
||||
import 'package:wger/models/exercises/exercise_submission_images.dart' as _i6;
|
||||
import 'package:wger/models/exercises/muscle.dart' as _i14;
|
||||
import 'package:wger/models/user/profile.dart' as _i2;
|
||||
import 'package:wger/models/user/account.dart' as _i2;
|
||||
import 'package:wger/providers/account_repository.dart' as _i7;
|
||||
import 'package:wger/providers/add_exercise_repository.dart' as _i3;
|
||||
import 'package:wger/providers/exercise_repository.dart' as _i8;
|
||||
import 'package:wger/providers/exercises_notifier.dart' as _i12;
|
||||
import 'package:wger/providers/user_profile_repository.dart' as _i7;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
@@ -35,8 +35,8 @@ import 'package:wger/providers/user_profile_repository.dart' as _i7;
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeProfile_0 extends _i1.SmartFake implements _i2.Profile {
|
||||
_FakeProfile_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeAccount_0 extends _i1.SmartFake implements _i2.Account {
|
||||
_FakeAccount_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [AddExerciseRepository].
|
||||
@@ -81,32 +81,23 @@ class MockAddExerciseRepository extends _i1.Mock implements _i3.AddExerciseRepos
|
||||
as _i4.Future<String?>);
|
||||
}
|
||||
|
||||
/// A class which mocks [UserProfileRepository].
|
||||
/// A class which mocks [AccountRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockUserProfileRepository extends _i1.Mock implements _i7.UserProfileRepository {
|
||||
MockUserProfileRepository() {
|
||||
class MockAccountRepository extends _i1.Mock implements _i7.AccountRepository {
|
||||
MockAccountRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.Profile> fetchProfile() =>
|
||||
_i4.Future<_i2.Account> fetchAccount() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchProfile, []),
|
||||
returnValue: _i4.Future<_i2.Profile>.value(
|
||||
_FakeProfile_0(this, Invocation.method(#fetchProfile, [])),
|
||||
Invocation.method(#fetchAccount, []),
|
||||
returnValue: _i4.Future<_i2.Account>.value(
|
||||
_FakeAccount_0(this, Invocation.method(#fetchAccount, [])),
|
||||
),
|
||||
)
|
||||
as _i4.Future<_i2.Profile>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> saveProfile(_i2.Profile? profile) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#saveProfile, [profile]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i4.Future<_i2.Account>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> verifyEmail() =>
|
||||
|
||||
@@ -24,7 +24,7 @@ import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart';
|
||||
import 'package:wger/models/user/profile.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
import 'package:wger/providers/body_weight_repository.dart';
|
||||
import 'package:wger/providers/ingredient_repository.dart';
|
||||
import 'package:wger/providers/network_provider.dart';
|
||||
@@ -51,13 +51,7 @@ void main() {
|
||||
late MockIngredientRepository mockIngredientRepo;
|
||||
late MockUserProfileRepository mockUserProfileRepository;
|
||||
|
||||
final testProfile = Profile(
|
||||
username: 'test',
|
||||
emailVerified: true,
|
||||
isTrustworthy: true,
|
||||
email: 'test@example.com',
|
||||
weightUnitStr: 'kg',
|
||||
);
|
||||
final testProfile = UserProfile(id: 1, weightUnitStr: 'kg');
|
||||
|
||||
const planUuid1 = 'cc000000-0000-4000-8000-000000000001';
|
||||
const planUuid2 = 'cc000000-0000-4000-8000-000000000002';
|
||||
@@ -82,7 +76,9 @@ void main() {
|
||||
mockIngredientRepo = MockIngredientRepository();
|
||||
mockUserProfileRepository = MockUserProfileRepository();
|
||||
|
||||
when(mockUserProfileRepository.fetchProfile()).thenAnswer((_) async => testProfile);
|
||||
when(
|
||||
mockUserProfileRepository.watchDrift(),
|
||||
).thenAnswer((_) => Stream.value(testProfile));
|
||||
when(mockIngredientRepo.getById(any)).thenAnswer((_) async => null);
|
||||
|
||||
when(mockNutritionRepo.watchAllDrift()).thenAnswer((_) => Stream.value(plans));
|
||||
|
||||
@@ -3,25 +3,25 @@
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i5;
|
||||
import 'dart:convert' as _i13;
|
||||
import 'dart:typed_data' as _i15;
|
||||
import 'dart:async' as _i4;
|
||||
import 'dart:convert' as _i12;
|
||||
import 'dart:typed_data' as _i14;
|
||||
|
||||
import 'package:http/http.dart' as _i2;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:mockito/src/dummies.dart' as _i14;
|
||||
import 'package:wger/models/body_weight/weight_entry.dart' as _i17;
|
||||
import 'package:wger/models/core/search_options.dart' as _i12;
|
||||
import 'package:wger/models/nutrition/ingredient.dart' as _i11;
|
||||
import 'package:wger/models/nutrition/log.dart' as _i9;
|
||||
import 'package:wger/models/nutrition/meal.dart' as _i7;
|
||||
import 'package:wger/models/nutrition/meal_item.dart' as _i8;
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart' as _i6;
|
||||
import 'package:wger/models/user/profile.dart' as _i3;
|
||||
import 'package:wger/providers/body_weight_repository.dart' as _i16;
|
||||
import 'package:wger/providers/ingredient_repository.dart' as _i10;
|
||||
import 'package:wger/providers/nutrition_repository.dart' as _i4;
|
||||
import 'package:wger/providers/user_profile_repository.dart' as _i18;
|
||||
import 'package:mockito/src/dummies.dart' as _i13;
|
||||
import 'package:wger/models/body_weight/weight_entry.dart' as _i16;
|
||||
import 'package:wger/models/core/search_options.dart' as _i11;
|
||||
import 'package:wger/models/nutrition/ingredient.dart' as _i10;
|
||||
import 'package:wger/models/nutrition/log.dart' as _i8;
|
||||
import 'package:wger/models/nutrition/meal.dart' as _i6;
|
||||
import 'package:wger/models/nutrition/meal_item.dart' as _i7;
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart' as _i5;
|
||||
import 'package:wger/models/user/user_profile.dart' as _i18;
|
||||
import 'package:wger/providers/body_weight_repository.dart' as _i15;
|
||||
import 'package:wger/providers/ingredient_repository.dart' as _i9;
|
||||
import 'package:wger/providers/nutrition_repository.dart' as _i3;
|
||||
import 'package:wger/providers/user_profile_repository.dart' as _i17;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
@@ -47,172 +47,168 @@ class _FakeStreamedResponse_1 extends _i1.SmartFake implements _i2.StreamedRespo
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeProfile_2 extends _i1.SmartFake implements _i3.Profile {
|
||||
_FakeProfile_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [NutritionRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockNutritionRepository extends _i1.Mock implements _i4.NutritionRepository {
|
||||
class MockNutritionRepository extends _i1.Mock implements _i3.NutritionRepository {
|
||||
MockNutritionRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i5.Stream<List<_i6.NutritionalPlan>> watchAllDrift() =>
|
||||
_i4.Stream<List<_i5.NutritionalPlan>> watchAllDrift() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchAllDrift, []),
|
||||
returnValue: _i5.Stream<List<_i6.NutritionalPlan>>.empty(),
|
||||
returnValue: _i4.Stream<List<_i5.NutritionalPlan>>.empty(),
|
||||
)
|
||||
as _i5.Stream<List<_i6.NutritionalPlan>>);
|
||||
as _i4.Stream<List<_i5.NutritionalPlan>>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> addPlanLocalDrift(_i6.NutritionalPlan? plan) =>
|
||||
_i4.Future<void> addPlanLocalDrift(_i5.NutritionalPlan? plan) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addPlanLocalDrift, [plan]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> editLocalDrift(_i6.NutritionalPlan? plan) =>
|
||||
_i4.Future<void> editLocalDrift(_i5.NutritionalPlan? plan) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editLocalDrift, [plan]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> deleteLocalDrift(String? id) =>
|
||||
_i4.Future<void> deleteLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteLocalDrift, [id]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Stream<List<_i7.Meal>> watchAllMealsHydrated() =>
|
||||
_i4.Stream<List<_i6.Meal>> watchAllMealsHydrated() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchAllMealsHydrated, []),
|
||||
returnValue: _i5.Stream<List<_i7.Meal>>.empty(),
|
||||
returnValue: _i4.Stream<List<_i6.Meal>>.empty(),
|
||||
)
|
||||
as _i5.Stream<List<_i7.Meal>>);
|
||||
as _i4.Stream<List<_i6.Meal>>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> addMealLocalDrift(_i7.Meal? meal) =>
|
||||
_i4.Future<void> addMealLocalDrift(_i6.Meal? meal) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addMealLocalDrift, [meal]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> editMealLocalDrift(_i7.Meal? meal) =>
|
||||
_i4.Future<void> editMealLocalDrift(_i6.Meal? meal) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editMealLocalDrift, [meal]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> deleteMealLocalDrift(String? id) =>
|
||||
_i4.Future<void> deleteMealLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteMealLocalDrift, [id]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> addMealItemLocalDrift(_i8.MealItem? item) =>
|
||||
_i4.Future<void> addMealItemLocalDrift(_i7.MealItem? item) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addMealItemLocalDrift, [item]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> editMealItemLocalDrift(_i8.MealItem? item) =>
|
||||
_i4.Future<void> editMealItemLocalDrift(_i7.MealItem? item) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editMealItemLocalDrift, [item]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> deleteMealItemLocalDrift(String? id) =>
|
||||
_i4.Future<void> deleteMealItemLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteMealItemLocalDrift, [id]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Stream<List<_i9.LogItem>> watchAllLogsHydrated() =>
|
||||
_i4.Stream<List<_i8.LogItem>> watchAllLogsHydrated() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchAllLogsHydrated, []),
|
||||
returnValue: _i5.Stream<List<_i9.LogItem>>.empty(),
|
||||
returnValue: _i4.Stream<List<_i8.LogItem>>.empty(),
|
||||
)
|
||||
as _i5.Stream<List<_i9.LogItem>>);
|
||||
as _i4.Stream<List<_i8.LogItem>>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> addLogLocalDrift(_i9.LogItem? log) =>
|
||||
_i4.Future<void> addLogLocalDrift(_i8.LogItem? log) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addLogLocalDrift, [log]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> deleteLogLocalDrift(String? id) =>
|
||||
_i4.Future<void> deleteLogLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteLogLocalDrift, [id]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
}
|
||||
|
||||
/// A class which mocks [IngredientRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockIngredientRepository extends _i1.Mock implements _i10.IngredientRepository {
|
||||
class MockIngredientRepository extends _i1.Mock implements _i9.IngredientRepository {
|
||||
MockIngredientRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i5.Stream<_i11.Ingredient?> watchById(int? id) =>
|
||||
_i4.Stream<_i10.Ingredient?> watchById(int? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchById, [id]),
|
||||
returnValue: _i5.Stream<_i11.Ingredient?>.empty(),
|
||||
returnValue: _i4.Stream<_i10.Ingredient?>.empty(),
|
||||
)
|
||||
as _i5.Stream<_i11.Ingredient?>);
|
||||
as _i4.Stream<_i10.Ingredient?>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i11.Ingredient?> getById(int? id) =>
|
||||
_i4.Future<_i10.Ingredient?> getById(int? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getById, [id]),
|
||||
returnValue: _i5.Future<_i11.Ingredient?>.value(),
|
||||
returnValue: _i4.Future<_i10.Ingredient?>.value(),
|
||||
)
|
||||
as _i5.Future<_i11.Ingredient?>);
|
||||
as _i4.Future<_i10.Ingredient?>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<_i11.Ingredient>> searchIngredientLocal(
|
||||
_i4.Future<List<_i10.Ingredient>> searchIngredientLocal(
|
||||
String? term, {
|
||||
bool? isVegan = false,
|
||||
bool? isVegetarian = false,
|
||||
_i11.NutriScore? nutriscoreMax,
|
||||
_i10.NutriScore? nutriscoreMax,
|
||||
int? limit = 100,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -226,20 +222,20 @@ class MockIngredientRepository extends _i1.Mock implements _i10.IngredientReposi
|
||||
#limit: limit,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<List<_i11.Ingredient>>.value(
|
||||
<_i11.Ingredient>[],
|
||||
returnValue: _i4.Future<List<_i10.Ingredient>>.value(
|
||||
<_i10.Ingredient>[],
|
||||
),
|
||||
)
|
||||
as _i5.Future<List<_i11.Ingredient>>);
|
||||
as _i4.Future<List<_i10.Ingredient>>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<_i11.Ingredient>> searchIngredientServer(
|
||||
_i4.Future<List<_i10.Ingredient>> searchIngredientServer(
|
||||
String? name, {
|
||||
String? languageCode = 'en',
|
||||
_i12.SearchLanguage? searchLanguage = _i12.SearchLanguage.current,
|
||||
_i11.SearchLanguage? searchLanguage = _i11.SearchLanguage.current,
|
||||
bool? isVegan = false,
|
||||
bool? isVegetarian = false,
|
||||
_i11.NutriScore? nutriscoreMax,
|
||||
_i10.NutriScore? nutriscoreMax,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -253,19 +249,19 @@ class MockIngredientRepository extends _i1.Mock implements _i10.IngredientReposi
|
||||
#nutriscoreMax: nutriscoreMax,
|
||||
},
|
||||
),
|
||||
returnValue: _i5.Future<List<_i11.Ingredient>>.value(
|
||||
<_i11.Ingredient>[],
|
||||
returnValue: _i4.Future<List<_i10.Ingredient>>.value(
|
||||
<_i10.Ingredient>[],
|
||||
),
|
||||
)
|
||||
as _i5.Future<List<_i11.Ingredient>>);
|
||||
as _i4.Future<List<_i10.Ingredient>>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i11.Ingredient?> searchIngredientByBarcode(String? barcode) =>
|
||||
_i4.Future<_i10.Ingredient?> searchIngredientByBarcode(String? barcode) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#searchIngredientByBarcode, [barcode]),
|
||||
returnValue: _i5.Future<_i11.Ingredient?>.value(),
|
||||
returnValue: _i4.Future<_i10.Ingredient?>.value(),
|
||||
)
|
||||
as _i5.Future<_i11.Ingredient?>);
|
||||
as _i4.Future<_i10.Ingredient?>);
|
||||
}
|
||||
|
||||
/// A class which mocks [Client].
|
||||
@@ -277,37 +273,37 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
}
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.Response> head(Uri? url, {Map<String, String>? headers}) =>
|
||||
_i4.Future<_i2.Response> head(Uri? url, {Map<String, String>? headers}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#head, [url], {#headers: headers}),
|
||||
returnValue: _i5.Future<_i2.Response>.value(
|
||||
returnValue: _i4.Future<_i2.Response>.value(
|
||||
_FakeResponse_0(
|
||||
this,
|
||||
Invocation.method(#head, [url], {#headers: headers}),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.Response>);
|
||||
as _i4.Future<_i2.Response>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.Response> get(Uri? url, {Map<String, String>? headers}) =>
|
||||
_i4.Future<_i2.Response> get(Uri? url, {Map<String, String>? headers}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#get, [url], {#headers: headers}),
|
||||
returnValue: _i5.Future<_i2.Response>.value(
|
||||
returnValue: _i4.Future<_i2.Response>.value(
|
||||
_FakeResponse_0(
|
||||
this,
|
||||
Invocation.method(#get, [url], {#headers: headers}),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.Response>);
|
||||
as _i4.Future<_i2.Response>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.Response> post(
|
||||
_i4.Future<_i2.Response> post(
|
||||
Uri? url, {
|
||||
Map<String, String>? headers,
|
||||
Object? body,
|
||||
_i13.Encoding? encoding,
|
||||
_i12.Encoding? encoding,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -315,7 +311,7 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
[url],
|
||||
{#headers: headers, #body: body, #encoding: encoding},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.Response>.value(
|
||||
returnValue: _i4.Future<_i2.Response>.value(
|
||||
_FakeResponse_0(
|
||||
this,
|
||||
Invocation.method(
|
||||
@@ -326,14 +322,14 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.Response>);
|
||||
as _i4.Future<_i2.Response>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.Response> put(
|
||||
_i4.Future<_i2.Response> put(
|
||||
Uri? url, {
|
||||
Map<String, String>? headers,
|
||||
Object? body,
|
||||
_i13.Encoding? encoding,
|
||||
_i12.Encoding? encoding,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -341,7 +337,7 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
[url],
|
||||
{#headers: headers, #body: body, #encoding: encoding},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.Response>.value(
|
||||
returnValue: _i4.Future<_i2.Response>.value(
|
||||
_FakeResponse_0(
|
||||
this,
|
||||
Invocation.method(
|
||||
@@ -352,14 +348,14 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.Response>);
|
||||
as _i4.Future<_i2.Response>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.Response> patch(
|
||||
_i4.Future<_i2.Response> patch(
|
||||
Uri? url, {
|
||||
Map<String, String>? headers,
|
||||
Object? body,
|
||||
_i13.Encoding? encoding,
|
||||
_i12.Encoding? encoding,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -367,7 +363,7 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
[url],
|
||||
{#headers: headers, #body: body, #encoding: encoding},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.Response>.value(
|
||||
returnValue: _i4.Future<_i2.Response>.value(
|
||||
_FakeResponse_0(
|
||||
this,
|
||||
Invocation.method(
|
||||
@@ -378,14 +374,14 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.Response>);
|
||||
as _i4.Future<_i2.Response>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.Response> delete(
|
||||
_i4.Future<_i2.Response> delete(
|
||||
Uri? url, {
|
||||
Map<String, String>? headers,
|
||||
Object? body,
|
||||
_i13.Encoding? encoding,
|
||||
_i12.Encoding? encoding,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -393,7 +389,7 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
[url],
|
||||
{#headers: headers, #body: body, #encoding: encoding},
|
||||
),
|
||||
returnValue: _i5.Future<_i2.Response>.value(
|
||||
returnValue: _i4.Future<_i2.Response>.value(
|
||||
_FakeResponse_0(
|
||||
this,
|
||||
Invocation.method(
|
||||
@@ -404,44 +400,44 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.Response>);
|
||||
as _i4.Future<_i2.Response>);
|
||||
|
||||
@override
|
||||
_i5.Future<String> read(Uri? url, {Map<String, String>? headers}) =>
|
||||
_i4.Future<String> read(Uri? url, {Map<String, String>? headers}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#read, [url], {#headers: headers}),
|
||||
returnValue: _i5.Future<String>.value(
|
||||
_i14.dummyValue<String>(
|
||||
returnValue: _i4.Future<String>.value(
|
||||
_i13.dummyValue<String>(
|
||||
this,
|
||||
Invocation.method(#read, [url], {#headers: headers}),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<String>);
|
||||
as _i4.Future<String>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i15.Uint8List> readBytes(
|
||||
_i4.Future<_i14.Uint8List> readBytes(
|
||||
Uri? url, {
|
||||
Map<String, String>? headers,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#readBytes, [url], {#headers: headers}),
|
||||
returnValue: _i5.Future<_i15.Uint8List>.value(_i15.Uint8List(0)),
|
||||
returnValue: _i4.Future<_i14.Uint8List>.value(_i14.Uint8List(0)),
|
||||
)
|
||||
as _i5.Future<_i15.Uint8List>);
|
||||
as _i4.Future<_i14.Uint8List>);
|
||||
|
||||
@override
|
||||
_i5.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) =>
|
||||
_i4.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#send, [request]),
|
||||
returnValue: _i5.Future<_i2.StreamedResponse>.value(
|
||||
returnValue: _i4.Future<_i2.StreamedResponse>.value(
|
||||
_FakeStreamedResponse_1(
|
||||
this,
|
||||
Invocation.method(#send, [request]),
|
||||
),
|
||||
),
|
||||
)
|
||||
as _i5.Future<_i2.StreamedResponse>);
|
||||
as _i4.Future<_i2.StreamedResponse>);
|
||||
|
||||
@override
|
||||
void close() => super.noSuchMethod(
|
||||
@@ -453,80 +449,69 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
/// A class which mocks [BodyWeightRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockBodyWeightRepository extends _i1.Mock implements _i16.BodyWeightRepository {
|
||||
class MockBodyWeightRepository extends _i1.Mock implements _i15.BodyWeightRepository {
|
||||
MockBodyWeightRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i5.Stream<List<_i17.WeightEntry>> watchAllDrift() =>
|
||||
_i4.Stream<List<_i16.WeightEntry>> watchAllDrift() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchAllDrift, []),
|
||||
returnValue: _i5.Stream<List<_i17.WeightEntry>>.empty(),
|
||||
returnValue: _i4.Stream<List<_i16.WeightEntry>>.empty(),
|
||||
)
|
||||
as _i5.Stream<List<_i17.WeightEntry>>);
|
||||
as _i4.Stream<List<_i16.WeightEntry>>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> deleteLocalDrift(String? id) =>
|
||||
_i4.Future<void> deleteLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteLocalDrift, [id]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> updateLocalDrift(_i17.WeightEntry? entry) =>
|
||||
_i4.Future<void> updateLocalDrift(_i16.WeightEntry? entry) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#updateLocalDrift, [entry]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> addLocalDrift(_i17.WeightEntry? entry) =>
|
||||
_i4.Future<void> addLocalDrift(_i16.WeightEntry? entry) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addLocalDrift, [entry]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
}
|
||||
|
||||
/// A class which mocks [UserProfileRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockUserProfileRepository extends _i1.Mock implements _i18.UserProfileRepository {
|
||||
class MockUserProfileRepository extends _i1.Mock implements _i17.UserProfileRepository {
|
||||
MockUserProfileRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i5.Future<_i3.Profile> fetchProfile() =>
|
||||
_i4.Stream<_i18.UserProfile?> watchDrift() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchProfile, []),
|
||||
returnValue: _i5.Future<_i3.Profile>.value(
|
||||
_FakeProfile_2(this, Invocation.method(#fetchProfile, [])),
|
||||
),
|
||||
Invocation.method(#watchDrift, []),
|
||||
returnValue: _i4.Stream<_i18.UserProfile?>.empty(),
|
||||
)
|
||||
as _i5.Future<_i3.Profile>);
|
||||
as _i4.Stream<_i18.UserProfile?>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> saveProfile(_i3.Profile? profile) =>
|
||||
_i4.Future<void> editLocalDrift(_i18.UserProfile? profile) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#saveProfile, [profile]),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
Invocation.method(#editLocalDrift, [profile]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
|
||||
@override
|
||||
_i5.Future<void> verifyEmail() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#verifyEmail, []),
|
||||
returnValue: _i5.Future<void>.value(),
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
)
|
||||
as _i5.Future<void>);
|
||||
as _i4.Future<void>);
|
||||
}
|
||||
|
||||
@@ -63,261 +63,266 @@ class _Fake$LicenseTableTable_6 extends _i1.SmartFake implements _i4.$LicenseTab
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseCategoryTableTable_7 extends _i1.SmartFake
|
||||
class _Fake$UserProfileTableTable_7 extends _i1.SmartFake implements _i4.$UserProfileTableTable {
|
||||
_Fake$UserProfileTableTable_7(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseCategoryTableTable_8 extends _i1.SmartFake
|
||||
implements _i4.$ExerciseCategoryTableTable {
|
||||
_Fake$ExerciseCategoryTableTable_7(Object parent, Invocation parentInvocation)
|
||||
_Fake$ExerciseCategoryTableTable_8(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseTableTable_8 extends _i1.SmartFake implements _i4.$ExerciseTableTable {
|
||||
_Fake$ExerciseTableTable_8(Object parent, Invocation parentInvocation)
|
||||
class _Fake$ExerciseTableTable_9 extends _i1.SmartFake implements _i4.$ExerciseTableTable {
|
||||
_Fake$ExerciseTableTable_9(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseTranslationTableTable_9 extends _i1.SmartFake
|
||||
class _Fake$ExerciseTranslationTableTable_10 extends _i1.SmartFake
|
||||
implements _i4.$ExerciseTranslationTableTable {
|
||||
_Fake$ExerciseTranslationTableTable_9(
|
||||
_Fake$ExerciseTranslationTableTable_10(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseAliasTableTable_10 extends _i1.SmartFake
|
||||
class _Fake$ExerciseAliasTableTable_11 extends _i1.SmartFake
|
||||
implements _i4.$ExerciseAliasTableTable {
|
||||
_Fake$ExerciseAliasTableTable_10(Object parent, Invocation parentInvocation)
|
||||
_Fake$ExerciseAliasTableTable_11(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseCommentTableTable_11 extends _i1.SmartFake
|
||||
class _Fake$ExerciseCommentTableTable_12 extends _i1.SmartFake
|
||||
implements _i4.$ExerciseCommentTableTable {
|
||||
_Fake$ExerciseCommentTableTable_11(Object parent, Invocation parentInvocation)
|
||||
_Fake$ExerciseCommentTableTable_12(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$MuscleTableTable_12 extends _i1.SmartFake implements _i4.$MuscleTableTable {
|
||||
_Fake$MuscleTableTable_12(Object parent, Invocation parentInvocation)
|
||||
class _Fake$MuscleTableTable_13 extends _i1.SmartFake implements _i4.$MuscleTableTable {
|
||||
_Fake$MuscleTableTable_13(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseMuscleM2NTable_13 extends _i1.SmartFake implements _i4.$ExerciseMuscleM2NTable {
|
||||
_Fake$ExerciseMuscleM2NTable_13(Object parent, Invocation parentInvocation)
|
||||
class _Fake$ExerciseMuscleM2NTable_14 extends _i1.SmartFake implements _i4.$ExerciseMuscleM2NTable {
|
||||
_Fake$ExerciseMuscleM2NTable_14(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseSecondaryMuscleM2NTable_14 extends _i1.SmartFake
|
||||
class _Fake$ExerciseSecondaryMuscleM2NTable_15 extends _i1.SmartFake
|
||||
implements _i4.$ExerciseSecondaryMuscleM2NTable {
|
||||
_Fake$ExerciseSecondaryMuscleM2NTable_14(
|
||||
_Fake$ExerciseSecondaryMuscleM2NTable_15(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$EquipmentTableTable_15 extends _i1.SmartFake implements _i4.$EquipmentTableTable {
|
||||
_Fake$EquipmentTableTable_15(Object parent, Invocation parentInvocation)
|
||||
class _Fake$EquipmentTableTable_16 extends _i1.SmartFake implements _i4.$EquipmentTableTable {
|
||||
_Fake$EquipmentTableTable_16(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseEquipmentM2NTable_16 extends _i1.SmartFake
|
||||
class _Fake$ExerciseEquipmentM2NTable_17 extends _i1.SmartFake
|
||||
implements _i4.$ExerciseEquipmentM2NTable {
|
||||
_Fake$ExerciseEquipmentM2NTable_16(Object parent, Invocation parentInvocation)
|
||||
_Fake$ExerciseEquipmentM2NTable_17(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseImageTableTable_17 extends _i1.SmartFake
|
||||
class _Fake$ExerciseImageTableTable_18 extends _i1.SmartFake
|
||||
implements _i4.$ExerciseImageTableTable {
|
||||
_Fake$ExerciseImageTableTable_17(Object parent, Invocation parentInvocation)
|
||||
_Fake$ExerciseImageTableTable_18(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$ExerciseVideoTableTable_18 extends _i1.SmartFake
|
||||
class _Fake$ExerciseVideoTableTable_19 extends _i1.SmartFake
|
||||
implements _i4.$ExerciseVideoTableTable {
|
||||
_Fake$ExerciseVideoTableTable_18(Object parent, Invocation parentInvocation)
|
||||
_Fake$ExerciseVideoTableTable_19(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$WeightEntryTableTable_19 extends _i1.SmartFake implements _i4.$WeightEntryTableTable {
|
||||
_Fake$WeightEntryTableTable_19(Object parent, Invocation parentInvocation)
|
||||
class _Fake$WeightEntryTableTable_20 extends _i1.SmartFake implements _i4.$WeightEntryTableTable {
|
||||
_Fake$WeightEntryTableTable_20(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$MeasurementCategoryTableTable_20 extends _i1.SmartFake
|
||||
class _Fake$MeasurementCategoryTableTable_21 extends _i1.SmartFake
|
||||
implements _i4.$MeasurementCategoryTableTable {
|
||||
_Fake$MeasurementCategoryTableTable_20(
|
||||
_Fake$MeasurementCategoryTableTable_21(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$MeasurementEntryTableTable_21 extends _i1.SmartFake
|
||||
class _Fake$MeasurementEntryTableTable_22 extends _i1.SmartFake
|
||||
implements _i4.$MeasurementEntryTableTable {
|
||||
_Fake$MeasurementEntryTableTable_21(
|
||||
_Fake$MeasurementEntryTableTable_22(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$RoutineTableTable_22 extends _i1.SmartFake implements _i4.$RoutineTableTable {
|
||||
_Fake$RoutineTableTable_22(Object parent, Invocation parentInvocation)
|
||||
class _Fake$RoutineTableTable_23 extends _i1.SmartFake implements _i4.$RoutineTableTable {
|
||||
_Fake$RoutineTableTable_23(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$WorkoutLogTableTable_23 extends _i1.SmartFake implements _i4.$WorkoutLogTableTable {
|
||||
_Fake$WorkoutLogTableTable_23(Object parent, Invocation parentInvocation)
|
||||
class _Fake$WorkoutLogTableTable_24 extends _i1.SmartFake implements _i4.$WorkoutLogTableTable {
|
||||
_Fake$WorkoutLogTableTable_24(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$WorkoutSessionTableTable_24 extends _i1.SmartFake
|
||||
class _Fake$WorkoutSessionTableTable_25 extends _i1.SmartFake
|
||||
implements _i4.$WorkoutSessionTableTable {
|
||||
_Fake$WorkoutSessionTableTable_24(Object parent, Invocation parentInvocation)
|
||||
_Fake$WorkoutSessionTableTable_25(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$RoutineRepetitionUnitTableTable_25 extends _i1.SmartFake
|
||||
class _Fake$RoutineRepetitionUnitTableTable_26 extends _i1.SmartFake
|
||||
implements _i4.$RoutineRepetitionUnitTableTable {
|
||||
_Fake$RoutineRepetitionUnitTableTable_25(
|
||||
_Fake$RoutineRepetitionUnitTableTable_26(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$RoutineWeightUnitTableTable_26 extends _i1.SmartFake
|
||||
class _Fake$RoutineWeightUnitTableTable_27 extends _i1.SmartFake
|
||||
implements _i4.$RoutineWeightUnitTableTable {
|
||||
_Fake$RoutineWeightUnitTableTable_26(
|
||||
_Fake$RoutineWeightUnitTableTable_27(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$NutritionalPlanTableTable_27 extends _i1.SmartFake
|
||||
class _Fake$NutritionalPlanTableTable_28 extends _i1.SmartFake
|
||||
implements _i4.$NutritionalPlanTableTable {
|
||||
_Fake$NutritionalPlanTableTable_27(Object parent, Invocation parentInvocation)
|
||||
_Fake$NutritionalPlanTableTable_28(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$IngredientTableTable_28 extends _i1.SmartFake implements _i4.$IngredientTableTable {
|
||||
_Fake$IngredientTableTable_28(Object parent, Invocation parentInvocation)
|
||||
class _Fake$IngredientTableTable_29 extends _i1.SmartFake implements _i4.$IngredientTableTable {
|
||||
_Fake$IngredientTableTable_29(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$IngredientImageTableTable_29 extends _i1.SmartFake
|
||||
class _Fake$IngredientImageTableTable_30 extends _i1.SmartFake
|
||||
implements _i4.$IngredientImageTableTable {
|
||||
_Fake$IngredientImageTableTable_29(Object parent, Invocation parentInvocation)
|
||||
_Fake$IngredientImageTableTable_30(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$IngredientWeightUnitTableTable_30 extends _i1.SmartFake
|
||||
class _Fake$IngredientWeightUnitTableTable_31 extends _i1.SmartFake
|
||||
implements _i4.$IngredientWeightUnitTableTable {
|
||||
_Fake$IngredientWeightUnitTableTable_30(
|
||||
_Fake$IngredientWeightUnitTableTable_31(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$MealTableTable_31 extends _i1.SmartFake implements _i4.$MealTableTable {
|
||||
_Fake$MealTableTable_31(Object parent, Invocation parentInvocation)
|
||||
class _Fake$MealTableTable_32 extends _i1.SmartFake implements _i4.$MealTableTable {
|
||||
_Fake$MealTableTable_32(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$MealItemTableTable_32 extends _i1.SmartFake implements _i4.$MealItemTableTable {
|
||||
_Fake$MealItemTableTable_32(Object parent, Invocation parentInvocation)
|
||||
class _Fake$MealItemTableTable_33 extends _i1.SmartFake implements _i4.$MealItemTableTable {
|
||||
_Fake$MealItemTableTable_33(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$LogItemTableTable_33 extends _i1.SmartFake implements _i4.$LogItemTableTable {
|
||||
_Fake$LogItemTableTable_33(Object parent, Invocation parentInvocation)
|
||||
class _Fake$LogItemTableTable_34 extends _i1.SmartFake implements _i4.$LogItemTableTable {
|
||||
_Fake$LogItemTableTable_34(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _Fake$GalleryImageTableTable_34 extends _i1.SmartFake implements _i4.$GalleryImageTableTable {
|
||||
_Fake$GalleryImageTableTable_34(Object parent, Invocation parentInvocation)
|
||||
class _Fake$GalleryImageTableTable_35 extends _i1.SmartFake implements _i4.$GalleryImageTableTable {
|
||||
_Fake$GalleryImageTableTable_35(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeDriftDatabaseOptions_35 extends _i1.SmartFake implements _i3.DriftDatabaseOptions {
|
||||
_FakeDriftDatabaseOptions_35(Object parent, Invocation parentInvocation)
|
||||
class _FakeDriftDatabaseOptions_36 extends _i1.SmartFake implements _i3.DriftDatabaseOptions {
|
||||
_FakeDriftDatabaseOptions_36(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeGeneratedDatabase_36 extends _i1.SmartFake implements _i3.GeneratedDatabase {
|
||||
_FakeGeneratedDatabase_36(Object parent, Invocation parentInvocation)
|
||||
class _FakeGeneratedDatabase_37 extends _i1.SmartFake implements _i3.GeneratedDatabase {
|
||||
_FakeGeneratedDatabase_37(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeStreamQueryUpdateRules_37 extends _i1.SmartFake implements _i3.StreamQueryUpdateRules {
|
||||
_FakeStreamQueryUpdateRules_37(Object parent, Invocation parentInvocation)
|
||||
class _FakeStreamQueryUpdateRules_38 extends _i1.SmartFake implements _i3.StreamQueryUpdateRules {
|
||||
_FakeStreamQueryUpdateRules_38(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeDatabaseConnection_38 extends _i1.SmartFake implements _i3.DatabaseConnection {
|
||||
_FakeDatabaseConnection_38(Object parent, Invocation parentInvocation)
|
||||
class _FakeDatabaseConnection_39 extends _i1.SmartFake implements _i3.DatabaseConnection {
|
||||
_FakeDatabaseConnection_39(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeQueryExecutor_39 extends _i1.SmartFake implements _i3.QueryExecutor {
|
||||
_FakeQueryExecutor_39(Object parent, Invocation parentInvocation)
|
||||
class _FakeQueryExecutor_40 extends _i1.SmartFake implements _i3.QueryExecutor {
|
||||
_FakeQueryExecutor_40(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeStreamQueryStore_40 extends _i1.SmartFake implements _i5.StreamQueryStore {
|
||||
_FakeStreamQueryStore_40(Object parent, Invocation parentInvocation)
|
||||
class _FakeStreamQueryStore_41 extends _i1.SmartFake implements _i5.StreamQueryStore {
|
||||
_FakeStreamQueryStore_41(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeDatabaseConnectionUser_41 extends _i1.SmartFake implements _i3.DatabaseConnectionUser {
|
||||
_FakeDatabaseConnectionUser_41(Object parent, Invocation parentInvocation)
|
||||
class _FakeDatabaseConnectionUser_42 extends _i1.SmartFake implements _i3.DatabaseConnectionUser {
|
||||
_FakeDatabaseConnectionUser_42(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeMigrator_42 extends _i1.SmartFake implements _i3.Migrator {
|
||||
_FakeMigrator_42(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeMigrator_43 extends _i1.SmartFake implements _i3.Migrator {
|
||||
_FakeMigrator_43(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeFuture_43<T> extends _i1.SmartFake implements _i6.Future<T> {
|
||||
_FakeFuture_43(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeFuture_44<T> extends _i1.SmartFake implements _i6.Future<T> {
|
||||
_FakeFuture_44(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeInsertStatement_44<T1 extends _i3.Table, D1> extends _i1.SmartFake
|
||||
class _FakeInsertStatement_45<T1 extends _i3.Table, D1> extends _i1.SmartFake
|
||||
implements _i3.InsertStatement<T1, D1> {
|
||||
_FakeInsertStatement_44(Object parent, Invocation parentInvocation)
|
||||
_FakeInsertStatement_45(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeUpdateStatement_45<T extends _i3.Table, D> extends _i1.SmartFake
|
||||
class _FakeUpdateStatement_46<T extends _i3.Table, D> extends _i1.SmartFake
|
||||
implements _i3.UpdateStatement<T, D> {
|
||||
_FakeUpdateStatement_45(Object parent, Invocation parentInvocation)
|
||||
_FakeUpdateStatement_46(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeSimpleSelectStatement_46<T1 extends _i3.HasResultSet, D> extends _i1.SmartFake
|
||||
class _FakeSimpleSelectStatement_47<T1 extends _i3.HasResultSet, D> extends _i1.SmartFake
|
||||
implements _i3.SimpleSelectStatement<T1, D> {
|
||||
_FakeSimpleSelectStatement_46(Object parent, Invocation parentInvocation)
|
||||
_FakeSimpleSelectStatement_47(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeJoinedSelectStatement_47<FirstT extends _i3.HasResultSet, FirstD> extends _i1.SmartFake
|
||||
class _FakeJoinedSelectStatement_48<FirstT extends _i3.HasResultSet, FirstD> extends _i1.SmartFake
|
||||
implements _i3.JoinedSelectStatement<FirstT, FirstD> {
|
||||
_FakeJoinedSelectStatement_47(Object parent, Invocation parentInvocation)
|
||||
_FakeJoinedSelectStatement_48(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeBaseSelectStatement_48<Row> extends _i1.SmartFake
|
||||
class _FakeBaseSelectStatement_49<Row> extends _i1.SmartFake
|
||||
implements _i3.BaseSelectStatement<Row> {
|
||||
_FakeBaseSelectStatement_48(Object parent, Invocation parentInvocation)
|
||||
_FakeBaseSelectStatement_49(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeDeleteStatement_49<T1 extends _i3.Table, D1> extends _i1.SmartFake
|
||||
class _FakeDeleteStatement_50<T1 extends _i3.Table, D1> extends _i1.SmartFake
|
||||
implements _i3.DeleteStatement<T1, D1> {
|
||||
_FakeDeleteStatement_49(Object parent, Invocation parentInvocation)
|
||||
_FakeDeleteStatement_50(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeSelectable_50<T> extends _i1.SmartFake implements _i3.Selectable<T> {
|
||||
_FakeSelectable_50(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeSelectable_51<T> extends _i1.SmartFake implements _i3.Selectable<T> {
|
||||
_FakeSelectable_51(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
class _FakeGenerationContext_51 extends _i1.SmartFake implements _i3.GenerationContext {
|
||||
_FakeGenerationContext_51(Object parent, Invocation parentInvocation)
|
||||
class _FakeGenerationContext_52 extends _i1.SmartFake implements _i3.GenerationContext {
|
||||
_FakeGenerationContext_52(Object parent, Invocation parentInvocation)
|
||||
: super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
@@ -524,11 +529,22 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
)
|
||||
as _i4.$LicenseTableTable);
|
||||
|
||||
@override
|
||||
_i4.$UserProfileTableTable get userProfileTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#userProfileTable),
|
||||
returnValue: _Fake$UserProfileTableTable_7(
|
||||
this,
|
||||
Invocation.getter(#userProfileTable),
|
||||
),
|
||||
)
|
||||
as _i4.$UserProfileTableTable);
|
||||
|
||||
@override
|
||||
_i4.$ExerciseCategoryTableTable get exerciseCategoryTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseCategoryTable),
|
||||
returnValue: _Fake$ExerciseCategoryTableTable_7(
|
||||
returnValue: _Fake$ExerciseCategoryTableTable_8(
|
||||
this,
|
||||
Invocation.getter(#exerciseCategoryTable),
|
||||
),
|
||||
@@ -539,7 +555,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$ExerciseTableTable get exerciseTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseTable),
|
||||
returnValue: _Fake$ExerciseTableTable_8(
|
||||
returnValue: _Fake$ExerciseTableTable_9(
|
||||
this,
|
||||
Invocation.getter(#exerciseTable),
|
||||
),
|
||||
@@ -550,7 +566,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$ExerciseTranslationTableTable get exerciseTranslationTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseTranslationTable),
|
||||
returnValue: _Fake$ExerciseTranslationTableTable_9(
|
||||
returnValue: _Fake$ExerciseTranslationTableTable_10(
|
||||
this,
|
||||
Invocation.getter(#exerciseTranslationTable),
|
||||
),
|
||||
@@ -561,7 +577,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$ExerciseAliasTableTable get exerciseAliasTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseAliasTable),
|
||||
returnValue: _Fake$ExerciseAliasTableTable_10(
|
||||
returnValue: _Fake$ExerciseAliasTableTable_11(
|
||||
this,
|
||||
Invocation.getter(#exerciseAliasTable),
|
||||
),
|
||||
@@ -572,7 +588,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$ExerciseCommentTableTable get exerciseCommentTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseCommentTable),
|
||||
returnValue: _Fake$ExerciseCommentTableTable_11(
|
||||
returnValue: _Fake$ExerciseCommentTableTable_12(
|
||||
this,
|
||||
Invocation.getter(#exerciseCommentTable),
|
||||
),
|
||||
@@ -583,7 +599,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$MuscleTableTable get muscleTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#muscleTable),
|
||||
returnValue: _Fake$MuscleTableTable_12(
|
||||
returnValue: _Fake$MuscleTableTable_13(
|
||||
this,
|
||||
Invocation.getter(#muscleTable),
|
||||
),
|
||||
@@ -594,7 +610,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$ExerciseMuscleM2NTable get exerciseMuscleM2N =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseMuscleM2N),
|
||||
returnValue: _Fake$ExerciseMuscleM2NTable_13(
|
||||
returnValue: _Fake$ExerciseMuscleM2NTable_14(
|
||||
this,
|
||||
Invocation.getter(#exerciseMuscleM2N),
|
||||
),
|
||||
@@ -605,7 +621,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$ExerciseSecondaryMuscleM2NTable get exerciseSecondaryMuscleM2N =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseSecondaryMuscleM2N),
|
||||
returnValue: _Fake$ExerciseSecondaryMuscleM2NTable_14(
|
||||
returnValue: _Fake$ExerciseSecondaryMuscleM2NTable_15(
|
||||
this,
|
||||
Invocation.getter(#exerciseSecondaryMuscleM2N),
|
||||
),
|
||||
@@ -616,7 +632,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$EquipmentTableTable get equipmentTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#equipmentTable),
|
||||
returnValue: _Fake$EquipmentTableTable_15(
|
||||
returnValue: _Fake$EquipmentTableTable_16(
|
||||
this,
|
||||
Invocation.getter(#equipmentTable),
|
||||
),
|
||||
@@ -627,7 +643,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$ExerciseEquipmentM2NTable get exerciseEquipmentM2N =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseEquipmentM2N),
|
||||
returnValue: _Fake$ExerciseEquipmentM2NTable_16(
|
||||
returnValue: _Fake$ExerciseEquipmentM2NTable_17(
|
||||
this,
|
||||
Invocation.getter(#exerciseEquipmentM2N),
|
||||
),
|
||||
@@ -638,7 +654,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$ExerciseImageTableTable get exerciseImageTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseImageTable),
|
||||
returnValue: _Fake$ExerciseImageTableTable_17(
|
||||
returnValue: _Fake$ExerciseImageTableTable_18(
|
||||
this,
|
||||
Invocation.getter(#exerciseImageTable),
|
||||
),
|
||||
@@ -649,7 +665,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$ExerciseVideoTableTable get exerciseVideoTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseVideoTable),
|
||||
returnValue: _Fake$ExerciseVideoTableTable_18(
|
||||
returnValue: _Fake$ExerciseVideoTableTable_19(
|
||||
this,
|
||||
Invocation.getter(#exerciseVideoTable),
|
||||
),
|
||||
@@ -660,7 +676,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$WeightEntryTableTable get weightEntryTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#weightEntryTable),
|
||||
returnValue: _Fake$WeightEntryTableTable_19(
|
||||
returnValue: _Fake$WeightEntryTableTable_20(
|
||||
this,
|
||||
Invocation.getter(#weightEntryTable),
|
||||
),
|
||||
@@ -671,7 +687,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$MeasurementCategoryTableTable get measurementCategoryTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#measurementCategoryTable),
|
||||
returnValue: _Fake$MeasurementCategoryTableTable_20(
|
||||
returnValue: _Fake$MeasurementCategoryTableTable_21(
|
||||
this,
|
||||
Invocation.getter(#measurementCategoryTable),
|
||||
),
|
||||
@@ -682,7 +698,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$MeasurementEntryTableTable get measurementEntryTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#measurementEntryTable),
|
||||
returnValue: _Fake$MeasurementEntryTableTable_21(
|
||||
returnValue: _Fake$MeasurementEntryTableTable_22(
|
||||
this,
|
||||
Invocation.getter(#measurementEntryTable),
|
||||
),
|
||||
@@ -693,7 +709,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$RoutineTableTable get routineTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#routineTable),
|
||||
returnValue: _Fake$RoutineTableTable_22(
|
||||
returnValue: _Fake$RoutineTableTable_23(
|
||||
this,
|
||||
Invocation.getter(#routineTable),
|
||||
),
|
||||
@@ -704,7 +720,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$WorkoutLogTableTable get workoutLogTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#workoutLogTable),
|
||||
returnValue: _Fake$WorkoutLogTableTable_23(
|
||||
returnValue: _Fake$WorkoutLogTableTable_24(
|
||||
this,
|
||||
Invocation.getter(#workoutLogTable),
|
||||
),
|
||||
@@ -715,7 +731,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$WorkoutSessionTableTable get workoutSessionTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#workoutSessionTable),
|
||||
returnValue: _Fake$WorkoutSessionTableTable_24(
|
||||
returnValue: _Fake$WorkoutSessionTableTable_25(
|
||||
this,
|
||||
Invocation.getter(#workoutSessionTable),
|
||||
),
|
||||
@@ -726,7 +742,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$RoutineRepetitionUnitTableTable get routineRepetitionUnitTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#routineRepetitionUnitTable),
|
||||
returnValue: _Fake$RoutineRepetitionUnitTableTable_25(
|
||||
returnValue: _Fake$RoutineRepetitionUnitTableTable_26(
|
||||
this,
|
||||
Invocation.getter(#routineRepetitionUnitTable),
|
||||
),
|
||||
@@ -737,7 +753,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$RoutineWeightUnitTableTable get routineWeightUnitTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#routineWeightUnitTable),
|
||||
returnValue: _Fake$RoutineWeightUnitTableTable_26(
|
||||
returnValue: _Fake$RoutineWeightUnitTableTable_27(
|
||||
this,
|
||||
Invocation.getter(#routineWeightUnitTable),
|
||||
),
|
||||
@@ -748,7 +764,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$NutritionalPlanTableTable get nutritionalPlanTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#nutritionalPlanTable),
|
||||
returnValue: _Fake$NutritionalPlanTableTable_27(
|
||||
returnValue: _Fake$NutritionalPlanTableTable_28(
|
||||
this,
|
||||
Invocation.getter(#nutritionalPlanTable),
|
||||
),
|
||||
@@ -759,7 +775,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$IngredientTableTable get ingredientTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#ingredientTable),
|
||||
returnValue: _Fake$IngredientTableTable_28(
|
||||
returnValue: _Fake$IngredientTableTable_29(
|
||||
this,
|
||||
Invocation.getter(#ingredientTable),
|
||||
),
|
||||
@@ -770,7 +786,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$IngredientImageTableTable get ingredientImageTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#ingredientImageTable),
|
||||
returnValue: _Fake$IngredientImageTableTable_29(
|
||||
returnValue: _Fake$IngredientImageTableTable_30(
|
||||
this,
|
||||
Invocation.getter(#ingredientImageTable),
|
||||
),
|
||||
@@ -781,7 +797,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$IngredientWeightUnitTableTable get ingredientWeightUnitTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#ingredientWeightUnitTable),
|
||||
returnValue: _Fake$IngredientWeightUnitTableTable_30(
|
||||
returnValue: _Fake$IngredientWeightUnitTableTable_31(
|
||||
this,
|
||||
Invocation.getter(#ingredientWeightUnitTable),
|
||||
),
|
||||
@@ -792,7 +808,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$MealTableTable get mealTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#mealTable),
|
||||
returnValue: _Fake$MealTableTable_31(
|
||||
returnValue: _Fake$MealTableTable_32(
|
||||
this,
|
||||
Invocation.getter(#mealTable),
|
||||
),
|
||||
@@ -803,7 +819,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$MealItemTableTable get mealItemTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#mealItemTable),
|
||||
returnValue: _Fake$MealItemTableTable_32(
|
||||
returnValue: _Fake$MealItemTableTable_33(
|
||||
this,
|
||||
Invocation.getter(#mealItemTable),
|
||||
),
|
||||
@@ -814,7 +830,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$LogItemTableTable get logItemTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#logItemTable),
|
||||
returnValue: _Fake$LogItemTableTable_33(
|
||||
returnValue: _Fake$LogItemTableTable_34(
|
||||
this,
|
||||
Invocation.getter(#logItemTable),
|
||||
),
|
||||
@@ -825,7 +841,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i4.$GalleryImageTableTable get galleryImageTable =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#galleryImageTable),
|
||||
returnValue: _Fake$GalleryImageTableTable_34(
|
||||
returnValue: _Fake$GalleryImageTableTable_35(
|
||||
this,
|
||||
Invocation.getter(#galleryImageTable),
|
||||
),
|
||||
@@ -852,7 +868,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i3.DriftDatabaseOptions get options =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#options),
|
||||
returnValue: _FakeDriftDatabaseOptions_35(
|
||||
returnValue: _FakeDriftDatabaseOptions_36(
|
||||
this,
|
||||
Invocation.getter(#options),
|
||||
),
|
||||
@@ -863,7 +879,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i3.GeneratedDatabase get attachedDatabase =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#attachedDatabase),
|
||||
returnValue: _FakeGeneratedDatabase_36(
|
||||
returnValue: _FakeGeneratedDatabase_37(
|
||||
this,
|
||||
Invocation.getter(#attachedDatabase),
|
||||
),
|
||||
@@ -874,7 +890,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i3.StreamQueryUpdateRules get streamUpdateRules =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#streamUpdateRules),
|
||||
returnValue: _FakeStreamQueryUpdateRules_37(
|
||||
returnValue: _FakeStreamQueryUpdateRules_38(
|
||||
this,
|
||||
Invocation.getter(#streamUpdateRules),
|
||||
),
|
||||
@@ -885,7 +901,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i3.DatabaseConnection get connection =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#connection),
|
||||
returnValue: _FakeDatabaseConnection_38(
|
||||
returnValue: _FakeDatabaseConnection_39(
|
||||
this,
|
||||
Invocation.getter(#connection),
|
||||
),
|
||||
@@ -907,7 +923,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i3.QueryExecutor get executor =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#executor),
|
||||
returnValue: _FakeQueryExecutor_39(
|
||||
returnValue: _FakeQueryExecutor_40(
|
||||
this,
|
||||
Invocation.getter(#executor),
|
||||
),
|
||||
@@ -918,7 +934,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i5.StreamQueryStore get streamQueries =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#streamQueries),
|
||||
returnValue: _FakeStreamQueryStore_40(
|
||||
returnValue: _FakeStreamQueryStore_41(
|
||||
this,
|
||||
Invocation.getter(#streamQueries),
|
||||
),
|
||||
@@ -929,7 +945,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i3.DatabaseConnectionUser get resolvedEngine =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#resolvedEngine),
|
||||
returnValue: _FakeDatabaseConnectionUser_41(
|
||||
returnValue: _FakeDatabaseConnectionUser_42(
|
||||
this,
|
||||
Invocation.getter(#resolvedEngine),
|
||||
),
|
||||
@@ -940,7 +956,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
_i3.Migrator createMigrator() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#createMigrator, []),
|
||||
returnValue: _FakeMigrator_42(
|
||||
returnValue: _FakeMigrator_43(
|
||||
this,
|
||||
Invocation.method(#createMigrator, []),
|
||||
),
|
||||
@@ -989,7 +1005,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
),
|
||||
(Ret v) => _i6.Future<Ret>.value(v),
|
||||
) ??
|
||||
_FakeFuture_43<Ret>(
|
||||
_FakeFuture_44<Ret>(
|
||||
this,
|
||||
Invocation.method(#computeWithDatabase, [], {
|
||||
#computation: computation,
|
||||
@@ -1056,7 +1072,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
),
|
||||
(T v) => _i6.Future<T>.value(v),
|
||||
) ??
|
||||
_FakeFuture_43<T>(this, Invocation.method(#doWhenOpened, [fn])),
|
||||
_FakeFuture_44<T>(this, Invocation.method(#doWhenOpened, [fn])),
|
||||
)
|
||||
as _i6.Future<T>);
|
||||
|
||||
@@ -1066,7 +1082,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#into, [table]),
|
||||
returnValue: _FakeInsertStatement_44<T, D>(
|
||||
returnValue: _FakeInsertStatement_45<T, D>(
|
||||
this,
|
||||
Invocation.method(#into, [table]),
|
||||
),
|
||||
@@ -1079,7 +1095,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#update, [table]),
|
||||
returnValue: _FakeUpdateStatement_45<Tbl, R>(
|
||||
returnValue: _FakeUpdateStatement_46<Tbl, R>(
|
||||
this,
|
||||
Invocation.method(#update, [table]),
|
||||
),
|
||||
@@ -1093,7 +1109,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#select, [table], {#distinct: distinct}),
|
||||
returnValue: _FakeSimpleSelectStatement_46<T, R>(
|
||||
returnValue: _FakeSimpleSelectStatement_47<T, R>(
|
||||
this,
|
||||
Invocation.method(#select, [table], {#distinct: distinct}),
|
||||
),
|
||||
@@ -1107,7 +1123,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#selectOnly, [table], {#distinct: distinct}),
|
||||
returnValue: _FakeJoinedSelectStatement_47<T, R>(
|
||||
returnValue: _FakeJoinedSelectStatement_48<T, R>(
|
||||
this,
|
||||
Invocation.method(#selectOnly, [table], {#distinct: distinct}),
|
||||
),
|
||||
@@ -1120,7 +1136,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#selectExpressions, [columns]),
|
||||
returnValue: _FakeBaseSelectStatement_48<_i3.TypedResult>(
|
||||
returnValue: _FakeBaseSelectStatement_49<_i3.TypedResult>(
|
||||
this,
|
||||
Invocation.method(#selectExpressions, [columns]),
|
||||
),
|
||||
@@ -1133,7 +1149,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#delete, [table]),
|
||||
returnValue: _FakeDeleteStatement_49<T, D>(
|
||||
returnValue: _FakeDeleteStatement_50<T, D>(
|
||||
this,
|
||||
Invocation.method(#delete, [table]),
|
||||
),
|
||||
@@ -1210,7 +1226,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
[query],
|
||||
{#variables: variables, #readsFrom: readsFrom},
|
||||
),
|
||||
returnValue: _FakeSelectable_50<_i3.QueryRow>(
|
||||
returnValue: _FakeSelectable_51<_i3.QueryRow>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#customSelect,
|
||||
@@ -1233,7 +1249,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
[query],
|
||||
{#variables: variables, #readsFrom: readsFrom},
|
||||
),
|
||||
returnValue: _FakeSelectable_50<_i3.QueryRow>(
|
||||
returnValue: _FakeSelectable_51<_i3.QueryRow>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#customSelectQuery,
|
||||
@@ -1276,7 +1292,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
),
|
||||
(T v) => _i6.Future<T>.value(v),
|
||||
) ??
|
||||
_FakeFuture_43<T>(
|
||||
_FakeFuture_44<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#transaction,
|
||||
@@ -1299,7 +1315,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
),
|
||||
(T v) => _i6.Future<T>.value(v),
|
||||
) ??
|
||||
_FakeFuture_43<T>(
|
||||
_FakeFuture_44<T>(
|
||||
this,
|
||||
Invocation.method(#exclusively, [action]),
|
||||
),
|
||||
@@ -1338,7 +1354,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
),
|
||||
(T v) => _i6.Future<T>.value(v),
|
||||
) ??
|
||||
_FakeFuture_43<T>(
|
||||
_FakeFuture_44<T>(
|
||||
this,
|
||||
Invocation.method(
|
||||
#runWithInterceptor,
|
||||
@@ -1361,7 +1377,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
[component],
|
||||
{#hasMultipleTables: hasMultipleTables, #startIndex: startIndex},
|
||||
),
|
||||
returnValue: _FakeGenerationContext_51(
|
||||
returnValue: _FakeGenerationContext_52(
|
||||
this,
|
||||
Invocation.method(
|
||||
#$write,
|
||||
@@ -1387,7 +1403,7 @@ class MockDriftPowersyncDatabase extends _i1.Mock implements _i4.DriftPowersyncD
|
||||
[table, insertable],
|
||||
{#startIndex: startIndex},
|
||||
),
|
||||
returnValue: _FakeGenerationContext_51(
|
||||
returnValue: _FakeGenerationContext_52(
|
||||
this,
|
||||
Invocation.method(
|
||||
#$writeInsertable,
|
||||
|
||||
79
test/user/account_notifier_test.dart
Normal file
79
test/user/account_notifier_test.dart
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:wger/models/user/account.dart';
|
||||
import 'package:wger/providers/account_notifier.dart';
|
||||
import 'package:wger/providers/account_repository.dart';
|
||||
|
||||
import 'account_notifier_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([AccountRepository])
|
||||
void main() {
|
||||
late MockAccountRepository mockRepo;
|
||||
|
||||
const tAccount = Account(
|
||||
username: 'admin',
|
||||
email: 'me@example.com',
|
||||
emailVerified: true,
|
||||
isTrustworthy: true,
|
||||
);
|
||||
|
||||
setUp(() {
|
||||
mockRepo = MockAccountRepository();
|
||||
when(mockRepo.fetchAccount()).thenAnswer((_) async => tAccount);
|
||||
});
|
||||
|
||||
ProviderContainer makeContainer() => ProviderContainer.test(
|
||||
overrides: [accountRepositoryProvider.overrideWithValue(mockRepo)],
|
||||
);
|
||||
|
||||
test('build fetches the account from the repository', () async {
|
||||
final container = makeContainer();
|
||||
|
||||
final account = await container.read(accountProvider.future);
|
||||
|
||||
expect(account, isNotNull);
|
||||
expect(account!.username, 'admin');
|
||||
expect(account.isTrustworthy, true);
|
||||
verify(mockRepo.fetchAccount()).called(1);
|
||||
});
|
||||
|
||||
test('clear() resets the account to null', () async {
|
||||
final container = makeContainer();
|
||||
await container.read(accountProvider.future);
|
||||
expect(container.read(accountProvider).value, isNotNull);
|
||||
|
||||
container.read(accountProvider.notifier).clear();
|
||||
|
||||
expect(container.read(accountProvider).value, isNull);
|
||||
});
|
||||
|
||||
test('verifyEmail delegates to the repository', () async {
|
||||
final container = makeContainer();
|
||||
await container.read(accountProvider.future);
|
||||
when(mockRepo.verifyEmail()).thenAnswer((_) async {});
|
||||
|
||||
await container.read(accountProvider.notifier).verifyEmail();
|
||||
|
||||
verify(mockRepo.verifyEmail()).called(1);
|
||||
});
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
// Mocks generated by Mockito 5.4.6 from annotations
|
||||
// in wger/test/user/provider_test.dart.
|
||||
// in wger/test/user/account_notifier_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i4;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:wger/models/user/profile.dart' as _i2;
|
||||
import 'package:wger/providers/user_profile_repository.dart' as _i3;
|
||||
import 'package:wger/models/user/account.dart' as _i2;
|
||||
import 'package:wger/providers/account_repository.dart' as _i3;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
@@ -24,36 +24,27 @@ import 'package:wger/providers/user_profile_repository.dart' as _i3;
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeProfile_0 extends _i1.SmartFake implements _i2.Profile {
|
||||
_FakeProfile_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
class _FakeAccount_0 extends _i1.SmartFake implements _i2.Account {
|
||||
_FakeAccount_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [UserProfileRepository].
|
||||
/// A class which mocks [AccountRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockUserProfileRepository extends _i1.Mock implements _i3.UserProfileRepository {
|
||||
MockUserProfileRepository() {
|
||||
class MockAccountRepository extends _i1.Mock implements _i3.AccountRepository {
|
||||
MockAccountRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.Profile> fetchProfile() =>
|
||||
_i4.Future<_i2.Account> fetchAccount() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchProfile, []),
|
||||
returnValue: _i4.Future<_i2.Profile>.value(
|
||||
_FakeProfile_0(this, Invocation.method(#fetchProfile, [])),
|
||||
Invocation.method(#fetchAccount, []),
|
||||
returnValue: _i4.Future<_i2.Account>.value(
|
||||
_FakeAccount_0(this, Invocation.method(#fetchAccount, [])),
|
||||
),
|
||||
)
|
||||
as _i4.Future<_i2.Profile>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> saveProfile(_i2.Profile? profile) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#saveProfile, [profile]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i4.Future<_i2.Account>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> verifyEmail() =>
|
||||
72
test/user/account_repository_test.dart
Normal file
72
test/user/account_repository_test.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:wger/providers/account_repository.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
|
||||
import 'account_repository_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([WgerBaseProvider])
|
||||
void main() {
|
||||
late MockWgerBaseProvider mockBase;
|
||||
late AccountRepository repo;
|
||||
|
||||
setUp(() {
|
||||
mockBase = MockWgerBaseProvider();
|
||||
repo = AccountRepository(mockBase);
|
||||
});
|
||||
|
||||
group('fetchAccount', () {
|
||||
test('parses the API response into an Account', () async {
|
||||
final uri = Uri.https('localhost', 'api/v2/userprofile/');
|
||||
when(mockBase.makeUrl('userprofile')).thenReturn(uri);
|
||||
when(mockBase.fetch(uri)).thenAnswer(
|
||||
(_) async => {
|
||||
'username': 'admin',
|
||||
'email': 'me@example.com',
|
||||
'email_verified': true,
|
||||
'is_trustworthy': true,
|
||||
},
|
||||
);
|
||||
|
||||
final account = await repo.fetchAccount();
|
||||
|
||||
expect(account.username, 'admin');
|
||||
expect(account.email, 'me@example.com');
|
||||
expect(account.emailVerified, true);
|
||||
expect(account.isTrustworthy, true);
|
||||
});
|
||||
});
|
||||
|
||||
group('verifyEmail', () {
|
||||
test('hits the verify-email subpath of userprofile', () async {
|
||||
final uri = Uri.https('localhost', 'api/v2/userprofile/verify-email/');
|
||||
when(
|
||||
mockBase.makeUrl('userprofile', objectMethod: 'verify-email'),
|
||||
).thenReturn(uri);
|
||||
when(mockBase.fetch(uri)).thenAnswer((_) async => {});
|
||||
|
||||
await repo.verifyEmail();
|
||||
|
||||
verify(mockBase.fetch(uri)).called(1);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// Mocks generated by Mockito 5.4.6 from annotations
|
||||
// in wger/test/user/user_profile_repository_test.dart.
|
||||
// in wger/test/user/account_repository_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
@@ -21,86 +21,26 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
|
||||
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/models/user/profile.dart';
|
||||
import 'package:wger/providers/app_settings_notifier.dart';
|
||||
import 'package:wger/providers/user_profile_notifier.dart';
|
||||
import 'package:wger/providers/user_profile_repository.dart';
|
||||
|
||||
import '../fixtures/fixture_reader.dart';
|
||||
import 'provider_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([UserProfileRepository])
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
final Profile tProfile = Profile.fromJson(
|
||||
jsonDecode(fixture('user/userprofile_response.json')) as Map<String, dynamic>,
|
||||
);
|
||||
|
||||
late MockUserProfileRepository mockRepo;
|
||||
late ProviderContainer container;
|
||||
|
||||
setUp(() {
|
||||
SharedPreferencesAsyncPlatform.instance = InMemorySharedPreferencesAsync.empty();
|
||||
mockRepo = MockUserProfileRepository();
|
||||
when(mockRepo.fetchProfile()).thenAnswer((_) async => tProfile);
|
||||
|
||||
container = ProviderContainer(
|
||||
overrides: [
|
||||
userProfileRepositoryProvider.overrideWithValue(mockRepo),
|
||||
],
|
||||
);
|
||||
container = ProviderContainer();
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
container.dispose();
|
||||
});
|
||||
|
||||
group('profile', () {
|
||||
test('build fetches the profile from the repository', () async {
|
||||
final profile = await container.read(userProfileProvider.future);
|
||||
|
||||
expect(profile, isNotNull);
|
||||
expect(profile!.username, 'admin');
|
||||
expect(profile.emailVerified, true);
|
||||
expect(profile.email, 'me@example.com');
|
||||
expect(profile.isTrustworthy, true);
|
||||
verify(mockRepo.fetchProfile()).called(1);
|
||||
});
|
||||
|
||||
test('clear() resets the profile to null', () async {
|
||||
await container.read(userProfileProvider.future);
|
||||
expect(container.read(userProfileProvider).value, isNotNull);
|
||||
|
||||
container.read(userProfileProvider.notifier).clear();
|
||||
expect(container.read(userProfileProvider).value, isNull);
|
||||
});
|
||||
|
||||
test('saveProfile delegates to the repository', () async {
|
||||
await container.read(userProfileProvider.future);
|
||||
when(mockRepo.saveProfile(any)).thenAnswer((_) async {});
|
||||
|
||||
await container.read(userProfileProvider.notifier).saveProfile();
|
||||
|
||||
verify(mockRepo.saveProfile(tProfile)).called(1);
|
||||
});
|
||||
|
||||
test('verifyEmail delegates to the repository', () async {
|
||||
await container.read(userProfileProvider.future);
|
||||
when(mockRepo.verifyEmail()).thenAnswer((_) async {});
|
||||
|
||||
await container.read(userProfileProvider.notifier).verifyEmail();
|
||||
|
||||
verify(mockRepo.verifyEmail()).called(1);
|
||||
});
|
||||
});
|
||||
|
||||
group('dashboard config', () {
|
||||
test('initial config is default (all visible, default order)', () async {
|
||||
final settings = await container.read(appSettingsProvider.future);
|
||||
@@ -172,10 +112,7 @@ void main() {
|
||||
// Fresh container so the keepAlive notifier builds with the just-written prefs.
|
||||
container.dispose();
|
||||
container = ProviderContainer(
|
||||
overrides: [
|
||||
userProfileRepositoryProvider.overrideWithValue(mockRepo),
|
||||
appSettingsPrefsProvider.overrideWithValue(prefs),
|
||||
],
|
||||
overrides: [appSettingsPrefsProvider.overrideWithValue(prefs)],
|
||||
);
|
||||
|
||||
final settings = await container.read(appSettingsProvider.future);
|
||||
@@ -209,10 +146,7 @@ void main() {
|
||||
|
||||
container.dispose();
|
||||
container = ProviderContainer(
|
||||
overrides: [
|
||||
userProfileRepositoryProvider.overrideWithValue(mockRepo),
|
||||
appSettingsPrefsProvider.overrideWithValue(prefs),
|
||||
],
|
||||
overrides: [appSettingsPrefsProvider.overrideWithValue(prefs)],
|
||||
);
|
||||
return prefs;
|
||||
}
|
||||
|
||||
77
test/user/user_profile_notifier_test.dart
Normal file
77
test/user/user_profile_notifier_test.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
import 'package:wger/providers/user_profile_notifier.dart';
|
||||
import 'package:wger/providers/user_profile_repository.dart';
|
||||
|
||||
import 'user_profile_notifier_test.mocks.dart';
|
||||
|
||||
@GenerateMocks([UserProfileRepository])
|
||||
void main() {
|
||||
late MockUserProfileRepository mockRepo;
|
||||
|
||||
setUp(() {
|
||||
mockRepo = MockUserProfileRepository();
|
||||
// Default: empty stream that never emits. Tests that need a value seed it
|
||||
// through [containerWithProfile].
|
||||
when(mockRepo.watchDrift()).thenAnswer((_) => const Stream.empty());
|
||||
when(mockRepo.editLocalDrift(any)).thenAnswer((_) async {});
|
||||
});
|
||||
|
||||
ProviderContainer makeContainer() => ProviderContainer.test(
|
||||
overrides: [userProfileRepositoryProvider.overrideWithValue(mockRepo)],
|
||||
);
|
||||
|
||||
Future<ProviderContainer> containerWithProfile(UserProfile? profile) async {
|
||||
when(mockRepo.watchDrift()).thenAnswer((_) => Stream.value(profile));
|
||||
final container = makeContainer();
|
||||
container.listen(userProfileProvider, (_, _) {});
|
||||
await pumpEventQueue();
|
||||
return container;
|
||||
}
|
||||
|
||||
test('build streams the profile from the repository', () async {
|
||||
final container = await containerWithProfile(
|
||||
UserProfile(id: 1, weightUnitStr: 'kg'),
|
||||
);
|
||||
|
||||
final profile = container.read(userProfileProvider).requireValue;
|
||||
expect(profile!.weightUnitStr, 'kg');
|
||||
verify(mockRepo.watchDrift()).called(1);
|
||||
});
|
||||
|
||||
test('build emits null until the profile has synced', () async {
|
||||
final container = await containerWithProfile(null);
|
||||
|
||||
expect(container.read(userProfileProvider).requireValue, isNull);
|
||||
});
|
||||
|
||||
test('updateProfile forwards to the repository', () async {
|
||||
final container = makeContainer();
|
||||
final profile = UserProfile(id: 1, weightUnitStr: 'lb');
|
||||
|
||||
await container.read(userProfileProvider.notifier).updateProfile(profile);
|
||||
|
||||
verify(mockRepo.editLocalDrift(profile)).called(1);
|
||||
});
|
||||
}
|
||||
51
test/user/user_profile_notifier_test.mocks.dart
Normal file
51
test/user/user_profile_notifier_test.mocks.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
// Mocks generated by Mockito 5.4.6 from annotations
|
||||
// in wger/test/user/user_profile_notifier_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i3;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:wger/models/user/user_profile.dart' as _i4;
|
||||
import 'package:wger/providers/user_profile_repository.dart' as _i2;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
// ignore_for_file: avoid_setters_without_getters
|
||||
// ignore_for_file: comment_references
|
||||
// ignore_for_file: deprecated_member_use
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
// ignore_for_file: implementation_imports
|
||||
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||
// ignore_for_file: must_be_immutable
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
/// A class which mocks [UserProfileRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockUserProfileRepository extends _i1.Mock implements _i2.UserProfileRepository {
|
||||
MockUserProfileRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i3.Stream<_i4.UserProfile?> watchDrift() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchDrift, []),
|
||||
returnValue: _i3.Stream<_i4.UserProfile?>.empty(),
|
||||
)
|
||||
as _i3.Stream<_i4.UserProfile?>);
|
||||
|
||||
@override
|
||||
_i3.Future<void> editLocalDrift(_i4.UserProfile? profile) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editLocalDrift, [profile]),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i3.Future<void>);
|
||||
}
|
||||
@@ -16,62 +16,73 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
import 'package:wger/database/powersync/database.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
import 'package:wger/providers/user_profile_repository.dart';
|
||||
|
||||
import '../../test_data/profile.dart';
|
||||
import 'user_profile_repository_test.mocks.dart';
|
||||
import '../helpers/in_memory_drift.dart';
|
||||
|
||||
@GenerateMocks([WgerBaseProvider])
|
||||
void main() {
|
||||
late MockWgerBaseProvider mockBase;
|
||||
late DriftPowersyncDatabase db;
|
||||
late UserProfileRepository repo;
|
||||
|
||||
setUp(() {
|
||||
mockBase = MockWgerBaseProvider();
|
||||
repo = UserProfileRepository(mockBase);
|
||||
setUp(() async {
|
||||
db = await openTestDatabase();
|
||||
repo = UserProfileRepository(db);
|
||||
});
|
||||
|
||||
group('fetchProfile', () {
|
||||
test('parses the API response into a Profile', () async {
|
||||
final uri = Uri.https('localhost', 'api/v2/userprofile/');
|
||||
when(mockBase.makeUrl('userprofile')).thenReturn(uri);
|
||||
when(mockBase.fetch(uri)).thenAnswer((_) async => tProfile1.toJson());
|
||||
tearDown(() async {
|
||||
await db.close();
|
||||
});
|
||||
|
||||
final profile = await repo.fetchProfile();
|
||||
Future<void> seed({int id = 1, String weightUnit = 'kg'}) async {
|
||||
await db
|
||||
.into(db.userProfileTable)
|
||||
.insert(UserProfileTableCompanion.insert(id: id, weightUnitStr: weightUnit));
|
||||
}
|
||||
|
||||
expect(profile.username, tProfile1.username);
|
||||
expect(profile.email, tProfile1.email);
|
||||
expect(profile.emailVerified, tProfile1.emailVerified);
|
||||
group('watchDrift', () {
|
||||
test('emits null until a row has synced down', () async {
|
||||
expect(await repo.watchDrift().first, isNull);
|
||||
});
|
||||
|
||||
test('emits the synced profile row', () async {
|
||||
await seed(weightUnit: 'lb');
|
||||
|
||||
final profile = await repo.watchDrift().first;
|
||||
|
||||
expect(profile, isNotNull);
|
||||
expect(profile!.id, 1);
|
||||
expect(profile.weightUnitStr, 'lb');
|
||||
});
|
||||
|
||||
test('re-emits after the row changes', () async {
|
||||
await seed();
|
||||
final iter = StreamIterator(repo.watchDrift());
|
||||
|
||||
await iter.moveNext();
|
||||
expect(iter.current!.weightUnitStr, 'kg');
|
||||
|
||||
await repo.editLocalDrift(UserProfile(id: 1, weightUnitStr: 'lb'));
|
||||
|
||||
await iter.moveNext();
|
||||
expect(iter.current!.weightUnitStr, 'lb');
|
||||
|
||||
await iter.cancel();
|
||||
});
|
||||
});
|
||||
|
||||
group('saveProfile', () {
|
||||
test('POSTs the serialized profile to the userprofile endpoint', () async {
|
||||
final uri = Uri.https('localhost', 'api/v2/userprofile/');
|
||||
when(mockBase.makeUrl('userprofile')).thenReturn(uri);
|
||||
when(mockBase.post(any, uri)).thenAnswer((_) async => {});
|
||||
group('editLocalDrift', () {
|
||||
test('overwrites the weight unit for the row with matching id', () async {
|
||||
await seed();
|
||||
|
||||
await repo.saveProfile(tProfile1);
|
||||
await repo.editLocalDrift(UserProfile(id: 1, weightUnitStr: 'lb'));
|
||||
|
||||
verify(mockBase.post(tProfile1.toJson(), uri)).called(1);
|
||||
});
|
||||
});
|
||||
|
||||
group('verifyEmail', () {
|
||||
test('hits the verify-email subpath of userprofile', () async {
|
||||
final uri = Uri.https('localhost', 'api/v2/userprofile/verify-email/');
|
||||
when(
|
||||
mockBase.makeUrl('userprofile', objectMethod: 'verify-email'),
|
||||
).thenReturn(uri);
|
||||
when(mockBase.fetch(uri)).thenAnswer((_) async => {});
|
||||
|
||||
await repo.verifyEmail();
|
||||
|
||||
verify(mockBase.fetch(uri)).called(1);
|
||||
final row = await db.select(db.userProfileTable).getSingle();
|
||||
expect(row.weightUnitStr, 'lb');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -53,7 +53,9 @@ void main() {
|
||||
when(mockIngredientRepo.getById(any)).thenAnswer((_) async => null);
|
||||
|
||||
mockUserProfileRepository = MockUserProfileRepository();
|
||||
when(mockUserProfileRepository.fetchProfile()).thenAnswer((_) async => tProfile1);
|
||||
when(
|
||||
mockUserProfileRepository.watchDrift(),
|
||||
).thenAnswer((_) => Stream.value(tUserProfile1));
|
||||
|
||||
mockBodyWeightRepository = MockBodyWeightRepository();
|
||||
when(
|
||||
|
||||
@@ -3,21 +3,21 @@
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'dart:async' as _i4;
|
||||
import 'dart:async' as _i3;
|
||||
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:wger/models/body_weight/weight_entry.dart' as _i13;
|
||||
import 'package:wger/models/core/search_options.dart' as _i11;
|
||||
import 'package:wger/models/nutrition/ingredient.dart' as _i10;
|
||||
import 'package:wger/models/nutrition/log.dart' as _i8;
|
||||
import 'package:wger/models/nutrition/meal.dart' as _i6;
|
||||
import 'package:wger/models/nutrition/meal_item.dart' as _i7;
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart' as _i5;
|
||||
import 'package:wger/models/user/profile.dart' as _i2;
|
||||
import 'package:wger/providers/body_weight_repository.dart' as _i12;
|
||||
import 'package:wger/providers/ingredient_repository.dart' as _i9;
|
||||
import 'package:wger/providers/nutrition_repository.dart' as _i3;
|
||||
import 'package:wger/providers/user_profile_repository.dart' as _i14;
|
||||
import 'package:wger/models/body_weight/weight_entry.dart' as _i12;
|
||||
import 'package:wger/models/core/search_options.dart' as _i10;
|
||||
import 'package:wger/models/nutrition/ingredient.dart' as _i9;
|
||||
import 'package:wger/models/nutrition/log.dart' as _i7;
|
||||
import 'package:wger/models/nutrition/meal.dart' as _i5;
|
||||
import 'package:wger/models/nutrition/meal_item.dart' as _i6;
|
||||
import 'package:wger/models/nutrition/nutritional_plan.dart' as _i4;
|
||||
import 'package:wger/models/user/user_profile.dart' as _i14;
|
||||
import 'package:wger/providers/body_weight_repository.dart' as _i11;
|
||||
import 'package:wger/providers/ingredient_repository.dart' as _i8;
|
||||
import 'package:wger/providers/nutrition_repository.dart' as _i2;
|
||||
import 'package:wger/providers/user_profile_repository.dart' as _i13;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
@@ -34,172 +34,168 @@ import 'package:wger/providers/user_profile_repository.dart' as _i14;
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
// ignore_for_file: invalid_use_of_internal_member
|
||||
|
||||
class _FakeProfile_0 extends _i1.SmartFake implements _i2.Profile {
|
||||
_FakeProfile_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation);
|
||||
}
|
||||
|
||||
/// A class which mocks [NutritionRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockNutritionRepository extends _i1.Mock implements _i3.NutritionRepository {
|
||||
class MockNutritionRepository extends _i1.Mock implements _i2.NutritionRepository {
|
||||
MockNutritionRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.Stream<List<_i5.NutritionalPlan>> watchAllDrift() =>
|
||||
_i3.Stream<List<_i4.NutritionalPlan>> watchAllDrift() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchAllDrift, []),
|
||||
returnValue: _i4.Stream<List<_i5.NutritionalPlan>>.empty(),
|
||||
returnValue: _i3.Stream<List<_i4.NutritionalPlan>>.empty(),
|
||||
)
|
||||
as _i4.Stream<List<_i5.NutritionalPlan>>);
|
||||
as _i3.Stream<List<_i4.NutritionalPlan>>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> addPlanLocalDrift(_i5.NutritionalPlan? plan) =>
|
||||
_i3.Future<void> addPlanLocalDrift(_i4.NutritionalPlan? plan) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addPlanLocalDrift, [plan]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> editLocalDrift(_i5.NutritionalPlan? plan) =>
|
||||
_i3.Future<void> editLocalDrift(_i4.NutritionalPlan? plan) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editLocalDrift, [plan]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> deleteLocalDrift(String? id) =>
|
||||
_i3.Future<void> deleteLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteLocalDrift, [id]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Stream<List<_i6.Meal>> watchAllMealsHydrated() =>
|
||||
_i3.Stream<List<_i5.Meal>> watchAllMealsHydrated() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchAllMealsHydrated, []),
|
||||
returnValue: _i4.Stream<List<_i6.Meal>>.empty(),
|
||||
returnValue: _i3.Stream<List<_i5.Meal>>.empty(),
|
||||
)
|
||||
as _i4.Stream<List<_i6.Meal>>);
|
||||
as _i3.Stream<List<_i5.Meal>>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> addMealLocalDrift(_i6.Meal? meal) =>
|
||||
_i3.Future<void> addMealLocalDrift(_i5.Meal? meal) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addMealLocalDrift, [meal]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> editMealLocalDrift(_i6.Meal? meal) =>
|
||||
_i3.Future<void> editMealLocalDrift(_i5.Meal? meal) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editMealLocalDrift, [meal]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> deleteMealLocalDrift(String? id) =>
|
||||
_i3.Future<void> deleteMealLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteMealLocalDrift, [id]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> addMealItemLocalDrift(_i7.MealItem? item) =>
|
||||
_i3.Future<void> addMealItemLocalDrift(_i6.MealItem? item) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addMealItemLocalDrift, [item]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> editMealItemLocalDrift(_i7.MealItem? item) =>
|
||||
_i3.Future<void> editMealItemLocalDrift(_i6.MealItem? item) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#editMealItemLocalDrift, [item]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> deleteMealItemLocalDrift(String? id) =>
|
||||
_i3.Future<void> deleteMealItemLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteMealItemLocalDrift, [id]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Stream<List<_i8.LogItem>> watchAllLogsHydrated() =>
|
||||
_i3.Stream<List<_i7.LogItem>> watchAllLogsHydrated() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchAllLogsHydrated, []),
|
||||
returnValue: _i4.Stream<List<_i8.LogItem>>.empty(),
|
||||
returnValue: _i3.Stream<List<_i7.LogItem>>.empty(),
|
||||
)
|
||||
as _i4.Stream<List<_i8.LogItem>>);
|
||||
as _i3.Stream<List<_i7.LogItem>>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> addLogLocalDrift(_i8.LogItem? log) =>
|
||||
_i3.Future<void> addLogLocalDrift(_i7.LogItem? log) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addLogLocalDrift, [log]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> deleteLogLocalDrift(String? id) =>
|
||||
_i3.Future<void> deleteLogLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteLogLocalDrift, [id]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
}
|
||||
|
||||
/// A class which mocks [IngredientRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockIngredientRepository extends _i1.Mock implements _i9.IngredientRepository {
|
||||
class MockIngredientRepository extends _i1.Mock implements _i8.IngredientRepository {
|
||||
MockIngredientRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.Stream<_i10.Ingredient?> watchById(int? id) =>
|
||||
_i3.Stream<_i9.Ingredient?> watchById(int? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchById, [id]),
|
||||
returnValue: _i4.Stream<_i10.Ingredient?>.empty(),
|
||||
returnValue: _i3.Stream<_i9.Ingredient?>.empty(),
|
||||
)
|
||||
as _i4.Stream<_i10.Ingredient?>);
|
||||
as _i3.Stream<_i9.Ingredient?>);
|
||||
|
||||
@override
|
||||
_i4.Future<_i10.Ingredient?> getById(int? id) =>
|
||||
_i3.Future<_i9.Ingredient?> getById(int? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getById, [id]),
|
||||
returnValue: _i4.Future<_i10.Ingredient?>.value(),
|
||||
returnValue: _i3.Future<_i9.Ingredient?>.value(),
|
||||
)
|
||||
as _i4.Future<_i10.Ingredient?>);
|
||||
as _i3.Future<_i9.Ingredient?>);
|
||||
|
||||
@override
|
||||
_i4.Future<List<_i10.Ingredient>> searchIngredientLocal(
|
||||
_i3.Future<List<_i9.Ingredient>> searchIngredientLocal(
|
||||
String? term, {
|
||||
bool? isVegan = false,
|
||||
bool? isVegetarian = false,
|
||||
_i10.NutriScore? nutriscoreMax,
|
||||
_i9.NutriScore? nutriscoreMax,
|
||||
int? limit = 100,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -213,20 +209,20 @@ class MockIngredientRepository extends _i1.Mock implements _i9.IngredientReposit
|
||||
#limit: limit,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<List<_i10.Ingredient>>.value(
|
||||
<_i10.Ingredient>[],
|
||||
returnValue: _i3.Future<List<_i9.Ingredient>>.value(
|
||||
<_i9.Ingredient>[],
|
||||
),
|
||||
)
|
||||
as _i4.Future<List<_i10.Ingredient>>);
|
||||
as _i3.Future<List<_i9.Ingredient>>);
|
||||
|
||||
@override
|
||||
_i4.Future<List<_i10.Ingredient>> searchIngredientServer(
|
||||
_i3.Future<List<_i9.Ingredient>> searchIngredientServer(
|
||||
String? name, {
|
||||
String? languageCode = 'en',
|
||||
_i11.SearchLanguage? searchLanguage = _i11.SearchLanguage.current,
|
||||
_i10.SearchLanguage? searchLanguage = _i10.SearchLanguage.current,
|
||||
bool? isVegan = false,
|
||||
bool? isVegetarian = false,
|
||||
_i10.NutriScore? nutriscoreMax,
|
||||
_i9.NutriScore? nutriscoreMax,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -240,98 +236,87 @@ class MockIngredientRepository extends _i1.Mock implements _i9.IngredientReposit
|
||||
#nutriscoreMax: nutriscoreMax,
|
||||
},
|
||||
),
|
||||
returnValue: _i4.Future<List<_i10.Ingredient>>.value(
|
||||
<_i10.Ingredient>[],
|
||||
returnValue: _i3.Future<List<_i9.Ingredient>>.value(
|
||||
<_i9.Ingredient>[],
|
||||
),
|
||||
)
|
||||
as _i4.Future<List<_i10.Ingredient>>);
|
||||
as _i3.Future<List<_i9.Ingredient>>);
|
||||
|
||||
@override
|
||||
_i4.Future<_i10.Ingredient?> searchIngredientByBarcode(String? barcode) =>
|
||||
_i3.Future<_i9.Ingredient?> searchIngredientByBarcode(String? barcode) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#searchIngredientByBarcode, [barcode]),
|
||||
returnValue: _i4.Future<_i10.Ingredient?>.value(),
|
||||
returnValue: _i3.Future<_i9.Ingredient?>.value(),
|
||||
)
|
||||
as _i4.Future<_i10.Ingredient?>);
|
||||
as _i3.Future<_i9.Ingredient?>);
|
||||
}
|
||||
|
||||
/// A class which mocks [BodyWeightRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockBodyWeightRepository extends _i1.Mock implements _i12.BodyWeightRepository {
|
||||
class MockBodyWeightRepository extends _i1.Mock implements _i11.BodyWeightRepository {
|
||||
MockBodyWeightRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.Stream<List<_i13.WeightEntry>> watchAllDrift() =>
|
||||
_i3.Stream<List<_i12.WeightEntry>> watchAllDrift() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#watchAllDrift, []),
|
||||
returnValue: _i4.Stream<List<_i13.WeightEntry>>.empty(),
|
||||
returnValue: _i3.Stream<List<_i12.WeightEntry>>.empty(),
|
||||
)
|
||||
as _i4.Stream<List<_i13.WeightEntry>>);
|
||||
as _i3.Stream<List<_i12.WeightEntry>>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> deleteLocalDrift(String? id) =>
|
||||
_i3.Future<void> deleteLocalDrift(String? id) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#deleteLocalDrift, [id]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> updateLocalDrift(_i13.WeightEntry? entry) =>
|
||||
_i3.Future<void> updateLocalDrift(_i12.WeightEntry? entry) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#updateLocalDrift, [entry]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> addLocalDrift(_i13.WeightEntry? entry) =>
|
||||
_i3.Future<void> addLocalDrift(_i12.WeightEntry? entry) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#addLocalDrift, [entry]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
}
|
||||
|
||||
/// A class which mocks [UserProfileRepository].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockUserProfileRepository extends _i1.Mock implements _i14.UserProfileRepository {
|
||||
class MockUserProfileRepository extends _i1.Mock implements _i13.UserProfileRepository {
|
||||
MockUserProfileRepository() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_i4.Future<_i2.Profile> fetchProfile() =>
|
||||
_i3.Stream<_i14.UserProfile?> watchDrift() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchProfile, []),
|
||||
returnValue: _i4.Future<_i2.Profile>.value(
|
||||
_FakeProfile_0(this, Invocation.method(#fetchProfile, [])),
|
||||
),
|
||||
Invocation.method(#watchDrift, []),
|
||||
returnValue: _i3.Stream<_i14.UserProfile?>.empty(),
|
||||
)
|
||||
as _i4.Future<_i2.Profile>);
|
||||
as _i3.Stream<_i14.UserProfile?>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> saveProfile(_i2.Profile? profile) =>
|
||||
_i3.Future<void> editLocalDrift(_i14.UserProfile? profile) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#saveProfile, [profile]),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
Invocation.method(#editLocalDrift, [profile]),
|
||||
returnValue: _i3.Future<void>.value(),
|
||||
returnValueForMissingStub: _i3.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
|
||||
@override
|
||||
_i4.Future<void> verifyEmail() =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#verifyEmail, []),
|
||||
returnValue: _i4.Future<void>.value(),
|
||||
returnValueForMissingStub: _i4.Future<void>.value(),
|
||||
)
|
||||
as _i4.Future<void>);
|
||||
as _i3.Future<void>);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import 'package:wger/models/user/profile.dart';
|
||||
import 'package:wger/models/user/account.dart';
|
||||
import 'package:wger/models/user/user_profile.dart';
|
||||
|
||||
final tProfile1 = Profile(
|
||||
final tAccount1 = Account(
|
||||
username: 'super root',
|
||||
email: 'admin@google.com',
|
||||
emailVerified: true,
|
||||
isTrustworthy: true,
|
||||
email: 'admin@google.com',
|
||||
weightUnitStr: 'kg',
|
||||
);
|
||||
|
||||
final tUserProfile1 = UserProfile(id: 1, weightUnitStr: 'kg');
|
||||
|
||||
Reference in New Issue
Block a user