Settings
This commit is contained in:
parent
6f21735fd5
commit
47d4757b03
|
|
@ -3,6 +3,7 @@ import 'package:built_value/built_value.dart';
|
|||
import 'package:built_value/serializer.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/group_model.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/task_model.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
|
|
@ -23,6 +24,7 @@ abstract class CompanyEntity extends Object
|
|||
enabledModules: 0,
|
||||
financialYearStart: 1,
|
||||
startOfWeek: 1,
|
||||
groups: BuiltList<GroupEntity>(),
|
||||
taxRates: BuiltList<TaxRateEntity>(),
|
||||
taskStatuses: BuiltList<TaskStatusEntity>(),
|
||||
taskStatusMap: BuiltMap<String, TaskStatusEntity>(),
|
||||
|
|
@ -66,6 +68,8 @@ abstract class CompanyEntity extends Object
|
|||
@BuiltValueField(wireName: 'financial_year_start')
|
||||
int get financialYearStart;
|
||||
|
||||
BuiltList<GroupEntity> get groups;
|
||||
|
||||
// TODO remove this
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'tax_rates')
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
|
|||
'company_key',
|
||||
serializers.serialize(object.companyKey,
|
||||
specifiedType: const FullType(String)),
|
||||
'groups',
|
||||
serializers.serialize(object.groups,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(GroupEntity)])),
|
||||
'taskStatusMap',
|
||||
serializers.serialize(object.taskStatusMap,
|
||||
specifiedType: const FullType(BuiltMap, const [
|
||||
|
|
@ -224,6 +228,12 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
|
|||
result.financialYearStart = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'groups':
|
||||
result.groups.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(GroupEntity)]))
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
case 'tax_rates':
|
||||
result.taxRates.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
|
|
@ -1388,6 +1398,8 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
@override
|
||||
final int financialYearStart;
|
||||
@override
|
||||
final BuiltList<GroupEntity> groups;
|
||||
@override
|
||||
final BuiltList<TaxRateEntity> taxRates;
|
||||
@override
|
||||
final BuiltList<TaskStatusEntity> taskStatuses;
|
||||
|
|
@ -1433,6 +1445,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
this.appUrl,
|
||||
this.startOfWeek,
|
||||
this.financialYearStart,
|
||||
this.groups,
|
||||
this.taxRates,
|
||||
this.taskStatuses,
|
||||
this.taskStatusMap,
|
||||
|
|
@ -1454,6 +1467,9 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
if (companyKey == null) {
|
||||
throw new BuiltValueNullFieldError('CompanyEntity', 'companyKey');
|
||||
}
|
||||
if (groups == null) {
|
||||
throw new BuiltValueNullFieldError('CompanyEntity', 'groups');
|
||||
}
|
||||
if (taskStatusMap == null) {
|
||||
throw new BuiltValueNullFieldError('CompanyEntity', 'taskStatusMap');
|
||||
}
|
||||
|
|
@ -1480,6 +1496,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
appUrl == other.appUrl &&
|
||||
startOfWeek == other.startOfWeek &&
|
||||
financialYearStart == other.financialYearStart &&
|
||||
groups == other.groups &&
|
||||
taxRates == other.taxRates &&
|
||||
taskStatuses == other.taskStatuses &&
|
||||
taskStatusMap == other.taskStatusMap &&
|
||||
|
|
@ -1519,9 +1536,9 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc($jc($jc($jc($jc($jc(0, sizeId.hashCode), industryId.hashCode), plan.hashCode), companyKey.hashCode), appUrl.hashCode),
|
||||
startOfWeek.hashCode),
|
||||
$jc($jc($jc($jc($jc($jc($jc(0, sizeId.hashCode), industryId.hashCode), plan.hashCode), companyKey.hashCode), appUrl.hashCode), startOfWeek.hashCode),
|
||||
financialYearStart.hashCode),
|
||||
groups.hashCode),
|
||||
taxRates.hashCode),
|
||||
taskStatuses.hashCode),
|
||||
taskStatusMap.hashCode),
|
||||
|
|
@ -1551,6 +1568,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
..add('appUrl', appUrl)
|
||||
..add('startOfWeek', startOfWeek)
|
||||
..add('financialYearStart', financialYearStart)
|
||||
..add('groups', groups)
|
||||
..add('taxRates', taxRates)
|
||||
..add('taskStatuses', taskStatuses)
|
||||
..add('taskStatusMap', taskStatusMap)
|
||||
|
|
@ -1605,6 +1623,11 @@ class CompanyEntityBuilder
|
|||
set financialYearStart(int financialYearStart) =>
|
||||
_$this._financialYearStart = financialYearStart;
|
||||
|
||||
ListBuilder<GroupEntity> _groups;
|
||||
ListBuilder<GroupEntity> get groups =>
|
||||
_$this._groups ??= new ListBuilder<GroupEntity>();
|
||||
set groups(ListBuilder<GroupEntity> groups) => _$this._groups = groups;
|
||||
|
||||
ListBuilder<TaxRateEntity> _taxRates;
|
||||
ListBuilder<TaxRateEntity> get taxRates =>
|
||||
_$this._taxRates ??= new ListBuilder<TaxRateEntity>();
|
||||
|
|
@ -1703,6 +1726,7 @@ class CompanyEntityBuilder
|
|||
_appUrl = _$v.appUrl;
|
||||
_startOfWeek = _$v.startOfWeek;
|
||||
_financialYearStart = _$v.financialYearStart;
|
||||
_groups = _$v.groups?.toBuilder();
|
||||
_taxRates = _$v.taxRates?.toBuilder();
|
||||
_taskStatuses = _$v.taskStatuses?.toBuilder();
|
||||
_taskStatusMap = _$v.taskStatusMap?.toBuilder();
|
||||
|
|
@ -1751,6 +1775,7 @@ class CompanyEntityBuilder
|
|||
appUrl: appUrl,
|
||||
startOfWeek: startOfWeek,
|
||||
financialYearStart: financialYearStart,
|
||||
groups: groups.build(),
|
||||
taxRates: _taxRates?.build(),
|
||||
taskStatuses: _taskStatuses?.build(),
|
||||
taskStatusMap: taskStatusMap.build(),
|
||||
|
|
@ -1771,6 +1796,8 @@ class CompanyEntityBuilder
|
|||
} catch (_) {
|
||||
String _$failedField;
|
||||
try {
|
||||
_$failedField = 'groups';
|
||||
groups.build();
|
||||
_$failedField = 'taxRates';
|
||||
_taxRates?.build();
|
||||
_$failedField = 'taskStatuses';
|
||||
|
|
|
|||
|
|
@ -65,9 +65,11 @@ abstract class GroupEntity extends Object
|
|||
String get customValue1;
|
||||
|
||||
// TODO remove this
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'custom_value2')
|
||||
String get customValue2;
|
||||
|
||||
@BuiltValueField(serialize: false)
|
||||
SettingsEntity get settings;
|
||||
|
||||
int compareTo(GroupEntity group, String sortField, bool sortAscending) {
|
||||
|
|
|
|||
|
|
@ -111,12 +111,6 @@ class _$GroupEntitySerializer implements StructuredSerializer<GroupEntity> {
|
|||
final result = <Object>[
|
||||
'name',
|
||||
serializers.serialize(object.name, specifiedType: const FullType(String)),
|
||||
'custom_value2',
|
||||
serializers.serialize(object.customValue2,
|
||||
specifiedType: const FullType(String)),
|
||||
'settings',
|
||||
serializers.serialize(object.settings,
|
||||
specifiedType: const FullType(SettingsEntity)),
|
||||
];
|
||||
if (object.customValue1 != null) {
|
||||
result
|
||||
|
|
@ -124,6 +118,12 @@ class _$GroupEntitySerializer implements StructuredSerializer<GroupEntity> {
|
|||
..add(serializers.serialize(object.customValue1,
|
||||
specifiedType: const FullType(String)));
|
||||
}
|
||||
if (object.customValue2 != null) {
|
||||
result
|
||||
..add('custom_value2')
|
||||
..add(serializers.serialize(object.customValue2,
|
||||
specifiedType: const FullType(String)));
|
||||
}
|
||||
if (object.isChanged != null) {
|
||||
result
|
||||
..add('isChanged')
|
||||
|
|
@ -192,10 +192,6 @@ class _$GroupEntitySerializer implements StructuredSerializer<GroupEntity> {
|
|||
result.customValue2 = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String;
|
||||
break;
|
||||
case 'settings':
|
||||
result.settings.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(SettingsEntity)) as SettingsEntity);
|
||||
break;
|
||||
case 'isChanged':
|
||||
result.isChanged = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
|
|
@ -459,9 +455,6 @@ class _$GroupEntity extends GroupEntity {
|
|||
if (name == null) {
|
||||
throw new BuiltValueNullFieldError('GroupEntity', 'name');
|
||||
}
|
||||
if (customValue2 == null) {
|
||||
throw new BuiltValueNullFieldError('GroupEntity', 'customValue2');
|
||||
}
|
||||
if (settings == null) {
|
||||
throw new BuiltValueNullFieldError('GroupEntity', 'settings');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,6 +219,40 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(FrequencyEntity)]),
|
||||
() => new ListBuilder<FrequencyEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(GroupEntity)]),
|
||||
() => new ListBuilder<GroupEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(TaxRateEntity)]),
|
||||
() => new ListBuilder<TaxRateEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(TaskStatusEntity)]),
|
||||
() => new ListBuilder<TaskStatusEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap,
|
||||
const [const FullType(String), const FullType(TaskStatusEntity)]),
|
||||
() => new MapBuilder<String, TaskStatusEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(
|
||||
BuiltList, const [const FullType(ExpenseCategoryEntity)]),
|
||||
() => new ListBuilder<ExpenseCategoryEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap, const [
|
||||
const FullType(String),
|
||||
const FullType(ExpenseCategoryEntity)
|
||||
]),
|
||||
() => new MapBuilder<String, ExpenseCategoryEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(UserEntity)]),
|
||||
() => new ListBuilder<UserEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap,
|
||||
const [const FullType(String), const FullType(UserEntity)]),
|
||||
() => new MapBuilder<String, UserEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(
|
||||
BuiltMap, const [const FullType(String), const FullType(String)]),
|
||||
() => new MapBuilder<String, String>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(IndustryEntity)]),
|
||||
() => new ListBuilder<IndustryEntity>())
|
||||
|
|
@ -259,35 +293,6 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(TaskEntity)]),
|
||||
() => new ListBuilder<TaskEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(TaxRateEntity)]),
|
||||
() => new ListBuilder<TaxRateEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(TaskStatusEntity)]),
|
||||
() => new ListBuilder<TaskStatusEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap,
|
||||
const [const FullType(String), const FullType(TaskStatusEntity)]),
|
||||
() => new MapBuilder<String, TaskStatusEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(
|
||||
BuiltList, const [const FullType(ExpenseCategoryEntity)]),
|
||||
() => new ListBuilder<ExpenseCategoryEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap,
|
||||
const [const FullType(String), const FullType(ExpenseCategoryEntity)]),
|
||||
() => new MapBuilder<String, ExpenseCategoryEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(UserEntity)]),
|
||||
() => new ListBuilder<UserEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap,
|
||||
const [const FullType(String), const FullType(UserEntity)]),
|
||||
() => new MapBuilder<String, UserEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(
|
||||
BuiltMap, const [const FullType(String), const FullType(String)]),
|
||||
() => new MapBuilder<String, String>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(TimezoneEntity)]),
|
||||
() => new ListBuilder<TimezoneEntity>())
|
||||
|
|
@ -302,24 +307,11 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
const FullType(BuiltList, const [const FullType(VendorEntity)]),
|
||||
() => new ListBuilder<VendorEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap,
|
||||
const [const FullType(String), const FullType(ClientEntity)]),
|
||||
() => new MapBuilder<String, ClientEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(String)]),
|
||||
() => new ListBuilder<String>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap,
|
||||
const [const FullType(String), const FullType(CurrencyEntity)]),
|
||||
() => new MapBuilder<String, CurrencyEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap,
|
||||
const [const FullType(String), const FullType(SizeEntity)]),
|
||||
() => new MapBuilder<String, SizeEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltMap,
|
||||
const [const FullType(String), const FullType(IndustryEntity)]),
|
||||
() => new MapBuilder<String, IndustryEntity>())
|
||||
const FullType(BuiltMap, const [const FullType(String), const FullType(ClientEntity)]), () => new MapBuilder<String, ClientEntity>())
|
||||
..addBuilderFactory(const FullType(BuiltList, const [const FullType(String)]), () => new ListBuilder<String>())
|
||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(CurrencyEntity)]), () => new MapBuilder<String, CurrencyEntity>())
|
||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(SizeEntity)]), () => new MapBuilder<String, SizeEntity>())
|
||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(IndustryEntity)]), () => new MapBuilder<String, IndustryEntity>())
|
||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(TimezoneEntity)]), () => new MapBuilder<String, TimezoneEntity>())
|
||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(DateFormatEntity)]), () => new MapBuilder<String, DateFormatEntity>())
|
||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(DatetimeFormatEntity)]), () => new MapBuilder<String, DatetimeFormatEntity>())
|
||||
|
|
|
|||
|
|
@ -189,7 +189,9 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
|
||||
// STARTER: state getters - do not remove comment
|
||||
GroupState get groupState => selectedCompanyState.groupState;
|
||||
|
||||
ListUIState get groupListState => uiState.groupUIState.listUIState;
|
||||
|
||||
GroupUIState get groupUIState => uiState.groupUIState;
|
||||
|
||||
DocumentState get documentState => selectedCompanyState.documentState;
|
||||
|
|
@ -302,7 +304,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
String toString() {
|
||||
//return 'Settings: ${selectedCompanyState.company.settings}';
|
||||
//return 'URL: ${authState.url}, ${selectedCompany.plan}';
|
||||
return 'Route: ${uiState.currentRoute}, settings: ${uiState.settingsUIState.userCompany.company.settings.logoUrl}';
|
||||
return 'Route: ${uiState.currentRoute}';
|
||||
//return 'Route: ${uiState.currentRoute}, Previous: ${uiState.previousRoute}, Layout: ${uiState.layout}, Menu: ${uiState.isMenuVisible}, History: ${uiState.isHistoryVisible}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue