ok lets ship for now
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/// Cloud-synced app preferences (Home sections + Look ahead).
|
||||
library;
|
||||
|
||||
import 'home_built_in_sections.dart';
|
||||
|
||||
/// One-per-user prefs row mirrored in PocketBase `app_prefs`.
|
||||
class AppCloudPrefs {
|
||||
const AppCloudPrefs({
|
||||
required this.homeBuiltInSections,
|
||||
required this.lookAheadMaxYears,
|
||||
});
|
||||
|
||||
final HomeBuiltInSections homeBuiltInSections;
|
||||
final int lookAheadMaxYears;
|
||||
|
||||
static const defaults = AppCloudPrefs(
|
||||
homeBuiltInSections: HomeBuiltInSections.defaults,
|
||||
lookAheadMaxYears: 5,
|
||||
);
|
||||
|
||||
AppCloudPrefs copyWith({
|
||||
HomeBuiltInSections? homeBuiltInSections,
|
||||
int? lookAheadMaxYears,
|
||||
}) {
|
||||
return AppCloudPrefs(
|
||||
homeBuiltInSections:
|
||||
homeBuiltInSections ?? this.homeBuiltInSections,
|
||||
lookAheadMaxYears: lookAheadMaxYears ?? this.lookAheadMaxYears,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Prefer local when the user has pending edits; otherwise take remote.
|
||||
AppCloudPrefs mergeAppCloudPrefs({
|
||||
required AppCloudPrefs local,
|
||||
required AppCloudPrefs? remote,
|
||||
required bool preferLocal,
|
||||
}) {
|
||||
if (preferLocal || remote == null) return local;
|
||||
return remote;
|
||||
}
|
||||
Reference in New Issue
Block a user