Settings
This commit is contained in:
parent
62ccec29f0
commit
632b8b99be
|
|
@ -50,6 +50,7 @@ abstract class CompanyEntity extends Object
|
|||
users: BuiltList<UserEntity>(),
|
||||
userMap: BuiltMap<String, UserEntity>(),
|
||||
customFields: BuiltMap<String, String>(),
|
||||
activities: BuiltList<ActivityEntity>(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -136,6 +137,8 @@ abstract class CompanyEntity extends Object
|
|||
|
||||
BuiltList<GroupEntity> get groups;
|
||||
|
||||
BuiltList<ActivityEntity> get activities;
|
||||
|
||||
// TODO remove this
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'tax_rates')
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
|
|||
serializers.serialize(object.groups,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(GroupEntity)])),
|
||||
'activities',
|
||||
serializers.serialize(object.activities,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(ActivityEntity)])),
|
||||
'taskStatusMap',
|
||||
serializers.serialize(object.taskStatusMap,
|
||||
specifiedType: const FullType(BuiltMap, const [
|
||||
|
|
@ -360,6 +364,12 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
|
|||
BuiltList, const [const FullType(GroupEntity)]))
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
case 'activities':
|
||||
result.activities.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(ActivityEntity)]))
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
case 'tax_rates':
|
||||
result.taxRates.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
|
|
@ -2367,6 +2377,8 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
@override
|
||||
final BuiltList<GroupEntity> groups;
|
||||
@override
|
||||
final BuiltList<ActivityEntity> activities;
|
||||
@override
|
||||
final BuiltList<TaxRateEntity> taxRates;
|
||||
@override
|
||||
final BuiltList<TaskStatusEntity> taskStatuses;
|
||||
|
|
@ -2431,6 +2443,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
this.firstDayOfWeek,
|
||||
this.firstMonthOfYear,
|
||||
this.groups,
|
||||
this.activities,
|
||||
this.taxRates,
|
||||
this.taskStatuses,
|
||||
this.taskStatusMap,
|
||||
|
|
@ -2483,6 +2496,9 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
if (groups == null) {
|
||||
throw new BuiltValueNullFieldError('CompanyEntity', 'groups');
|
||||
}
|
||||
if (activities == null) {
|
||||
throw new BuiltValueNullFieldError('CompanyEntity', 'activities');
|
||||
}
|
||||
if (taskStatusMap == null) {
|
||||
throw new BuiltValueNullFieldError('CompanyEntity', 'taskStatusMap');
|
||||
}
|
||||
|
|
@ -2527,6 +2543,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
firstDayOfWeek == other.firstDayOfWeek &&
|
||||
firstMonthOfYear == other.firstMonthOfYear &&
|
||||
groups == other.groups &&
|
||||
activities == other.activities &&
|
||||
taxRates == other.taxRates &&
|
||||
taskStatuses == other.taskStatuses &&
|
||||
taskStatusMap == other.taskStatusMap &&
|
||||
|
|
@ -2568,7 +2585,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, enableCustomSurchargeTaxes1.hashCode), enableCustomSurchargeTaxes2.hashCode), enableCustomSurchargeTaxes3.hashCode), enableCustomSurchargeTaxes4.hashCode), sizeId.hashCode), industryId.hashCode), subdomain.hashCode), portalMode.hashCode), portalDomain.hashCode), updateProducts.hashCode), convertProductExchangeRate.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), enableInvoiceQuantity.hashCode), defaultQuantity.hashCode), plan.hashCode), companyKey.hashCode), appUrl.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), groups.hashCode),
|
||||
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, enableCustomSurchargeTaxes1.hashCode), enableCustomSurchargeTaxes2.hashCode), enableCustomSurchargeTaxes3.hashCode), enableCustomSurchargeTaxes4.hashCode), sizeId.hashCode), industryId.hashCode), subdomain.hashCode), portalMode.hashCode), portalDomain.hashCode), updateProducts.hashCode), convertProductExchangeRate.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), enableInvoiceQuantity.hashCode), defaultQuantity.hashCode), plan.hashCode), companyKey.hashCode), appUrl.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), groups.hashCode), activities.hashCode),
|
||||
taxRates.hashCode),
|
||||
taskStatuses.hashCode),
|
||||
taskStatusMap.hashCode),
|
||||
|
|
@ -2615,6 +2632,7 @@ class _$CompanyEntity extends CompanyEntity {
|
|||
..add('firstDayOfWeek', firstDayOfWeek)
|
||||
..add('firstMonthOfYear', firstMonthOfYear)
|
||||
..add('groups', groups)
|
||||
..add('activities', activities)
|
||||
..add('taxRates', taxRates)
|
||||
..add('taskStatuses', taskStatuses)
|
||||
..add('taskStatusMap', taskStatusMap)
|
||||
|
|
@ -2743,6 +2761,12 @@ class CompanyEntityBuilder
|
|||
_$this._groups ??= new ListBuilder<GroupEntity>();
|
||||
set groups(ListBuilder<GroupEntity> groups) => _$this._groups = groups;
|
||||
|
||||
ListBuilder<ActivityEntity> _activities;
|
||||
ListBuilder<ActivityEntity> get activities =>
|
||||
_$this._activities ??= new ListBuilder<ActivityEntity>();
|
||||
set activities(ListBuilder<ActivityEntity> activities) =>
|
||||
_$this._activities = activities;
|
||||
|
||||
ListBuilder<TaxRateEntity> _taxRates;
|
||||
ListBuilder<TaxRateEntity> get taxRates =>
|
||||
_$this._taxRates ??= new ListBuilder<TaxRateEntity>();
|
||||
|
|
@ -2868,6 +2892,7 @@ class CompanyEntityBuilder
|
|||
_firstDayOfWeek = _$v.firstDayOfWeek;
|
||||
_firstMonthOfYear = _$v.firstMonthOfYear;
|
||||
_groups = _$v.groups?.toBuilder();
|
||||
_activities = _$v.activities?.toBuilder();
|
||||
_taxRates = _$v.taxRates?.toBuilder();
|
||||
_taskStatuses = _$v.taskStatuses?.toBuilder();
|
||||
_taskStatusMap = _$v.taskStatusMap?.toBuilder();
|
||||
|
|
@ -2933,6 +2958,7 @@ class CompanyEntityBuilder
|
|||
firstDayOfWeek: firstDayOfWeek,
|
||||
firstMonthOfYear: firstMonthOfYear,
|
||||
groups: groups.build(),
|
||||
activities: activities.build(),
|
||||
taxRates: _taxRates?.build(),
|
||||
taskStatuses: _taskStatuses?.build(),
|
||||
taskStatusMap: taskStatusMap.build(),
|
||||
|
|
@ -2957,6 +2983,8 @@ class CompanyEntityBuilder
|
|||
try {
|
||||
_$failedField = 'groups';
|
||||
groups.build();
|
||||
_$failedField = 'activities';
|
||||
activities.build();
|
||||
_$failedField = 'taxRates';
|
||||
_taxRates?.build();
|
||||
_$failedField = 'taskStatuses';
|
||||
|
|
|
|||
|
|
@ -274,19 +274,6 @@ abstract class LoginResponse
|
|||
static Serializer<LoginResponse> get serializer => _$loginResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class DashboardResponse
|
||||
implements Built<DashboardResponse, DashboardResponseBuilder> {
|
||||
factory DashboardResponse([void updates(DashboardResponseBuilder b)]) =
|
||||
_$DashboardResponse;
|
||||
|
||||
DashboardResponse._();
|
||||
|
||||
DashboardEntity get data;
|
||||
|
||||
static Serializer<DashboardResponse> get serializer =>
|
||||
_$dashboardResponseSerializer;
|
||||
}
|
||||
|
||||
class CustomFieldType {
|
||||
static const String company = 'company';
|
||||
static const String company1 = 'company1';
|
||||
|
|
@ -361,19 +348,6 @@ class CustomFieldType {
|
|||
static const String group4 = 'group4';
|
||||
}
|
||||
|
||||
abstract class DashboardEntity
|
||||
implements Built<DashboardEntity, DashboardEntityBuilder> {
|
||||
factory DashboardEntity([void updates(DashboardEntityBuilder b)]) =
|
||||
_$DashboardEntity;
|
||||
|
||||
DashboardEntity._();
|
||||
|
||||
BuiltList<ActivityEntity> get activities;
|
||||
|
||||
static Serializer<DashboardEntity> get serializer =>
|
||||
_$dashboardEntitySerializer;
|
||||
}
|
||||
|
||||
abstract class ActivityEntity
|
||||
implements Built<ActivityEntity, ActivityEntityBuilder> {
|
||||
factory ActivityEntity([void updates(ActivityEntityBuilder b)]) =
|
||||
|
|
@ -428,21 +402,21 @@ abstract class ActivityEntity
|
|||
String get taskId;
|
||||
|
||||
EntityType get entityType {
|
||||
if ([1, 2, 3, 26].contains(activityTypeId)) {
|
||||
if (['1', '2', '3', '26'].contains(activityTypeId)) {
|
||||
return EntityType.client;
|
||||
} else if ([4, 5, 6, 7, 8, 9, 25].contains(activityTypeId)) {
|
||||
} else if (['4', '5', '6', '7', '8', '9', '25'].contains(activityTypeId)) {
|
||||
return EntityType.invoice;
|
||||
} else if ([10, 11, 12, 13, 27].contains(activityTypeId)) {
|
||||
} else if (['10', '11', '12', '13', '27'].contains(activityTypeId)) {
|
||||
return EntityType.payment;
|
||||
} else if ([14, 15, 16, 17, 28, 39, 40, 41].contains(activityTypeId)) {
|
||||
} else if (['14', '15', '16', '17', '28', '39', '40', '41'].contains(activityTypeId)) {
|
||||
return EntityType.credit;
|
||||
} else if ([18, 19, 20, 21, 22, 23, 24, 29].contains(activityTypeId)) {
|
||||
} else if (['18', '19', '20', '21', '22', '23', '24', '29'].contains(activityTypeId)) {
|
||||
return EntityType.quote;
|
||||
} else if ([30, 31, 32, 33].contains(activityTypeId)) {
|
||||
} else if (['30', '31', '32', '33'].contains(activityTypeId)) {
|
||||
return EntityType.vendor;
|
||||
} else if ([34, 35, 36, 37, 47].contains(activityTypeId)) {
|
||||
} else if (['34', '35', '36', '37', '47'].contains(activityTypeId)) {
|
||||
return EntityType.expense;
|
||||
} else if ([42, 43, 44, 45, 46].contains(activityTypeId)) {
|
||||
} else if (['42', '43', '44', '45', '46'].contains(activityTypeId)) {
|
||||
return EntityType.task;
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -240,10 +240,6 @@ Serializer<ErrorMessage> _$errorMessageSerializer =
|
|||
new _$ErrorMessageSerializer();
|
||||
Serializer<LoginResponse> _$loginResponseSerializer =
|
||||
new _$LoginResponseSerializer();
|
||||
Serializer<DashboardResponse> _$dashboardResponseSerializer =
|
||||
new _$DashboardResponseSerializer();
|
||||
Serializer<DashboardEntity> _$dashboardEntitySerializer =
|
||||
new _$DashboardEntitySerializer();
|
||||
Serializer<ActivityEntity> _$activityEntitySerializer =
|
||||
new _$ActivityEntitySerializer();
|
||||
|
||||
|
|
@ -408,94 +404,6 @@ class _$LoginResponseSerializer implements StructuredSerializer<LoginResponse> {
|
|||
}
|
||||
}
|
||||
|
||||
class _$DashboardResponseSerializer
|
||||
implements StructuredSerializer<DashboardResponse> {
|
||||
@override
|
||||
final Iterable<Type> types = const [DashboardResponse, _$DashboardResponse];
|
||||
@override
|
||||
final String wireName = 'DashboardResponse';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, DashboardResponse object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
'data',
|
||||
serializers.serialize(object.data,
|
||||
specifiedType: const FullType(DashboardEntity)),
|
||||
];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
DashboardResponse deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new DashboardResponseBuilder();
|
||||
|
||||
final iterator = serialized.iterator;
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final dynamic value = iterator.current;
|
||||
switch (key) {
|
||||
case 'data':
|
||||
result.data.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(DashboardEntity))
|
||||
as DashboardEntity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
||||
class _$DashboardEntitySerializer
|
||||
implements StructuredSerializer<DashboardEntity> {
|
||||
@override
|
||||
final Iterable<Type> types = const [DashboardEntity, _$DashboardEntity];
|
||||
@override
|
||||
final String wireName = 'DashboardEntity';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, DashboardEntity object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
'activities',
|
||||
serializers.serialize(object.activities,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(ActivityEntity)])),
|
||||
];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
DashboardEntity deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new DashboardEntityBuilder();
|
||||
|
||||
final iterator = serialized.iterator;
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final dynamic value = iterator.current;
|
||||
switch (key) {
|
||||
case 'activities':
|
||||
result.activities.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(ActivityEntity)]))
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
||||
class _$ActivityEntitySerializer
|
||||
implements StructuredSerializer<ActivityEntity> {
|
||||
@override
|
||||
|
|
@ -833,193 +741,6 @@ class LoginResponseBuilder
|
|||
}
|
||||
}
|
||||
|
||||
class _$DashboardResponse extends DashboardResponse {
|
||||
@override
|
||||
final DashboardEntity data;
|
||||
|
||||
factory _$DashboardResponse(
|
||||
[void Function(DashboardResponseBuilder) updates]) =>
|
||||
(new DashboardResponseBuilder()..update(updates)).build();
|
||||
|
||||
_$DashboardResponse._({this.data}) : super._() {
|
||||
if (data == null) {
|
||||
throw new BuiltValueNullFieldError('DashboardResponse', 'data');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
DashboardResponse rebuild(void Function(DashboardResponseBuilder) updates) =>
|
||||
(toBuilder()..update(updates)).build();
|
||||
|
||||
@override
|
||||
DashboardResponseBuilder toBuilder() =>
|
||||
new DashboardResponseBuilder()..replace(this);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(other, this)) return true;
|
||||
return other is DashboardResponse && data == other.data;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return $jf($jc(0, data.hashCode));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (newBuiltValueToStringHelper('DashboardResponse')..add('data', data))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class DashboardResponseBuilder
|
||||
implements Builder<DashboardResponse, DashboardResponseBuilder> {
|
||||
_$DashboardResponse _$v;
|
||||
|
||||
DashboardEntityBuilder _data;
|
||||
DashboardEntityBuilder get data =>
|
||||
_$this._data ??= new DashboardEntityBuilder();
|
||||
set data(DashboardEntityBuilder data) => _$this._data = data;
|
||||
|
||||
DashboardResponseBuilder();
|
||||
|
||||
DashboardResponseBuilder get _$this {
|
||||
if (_$v != null) {
|
||||
_data = _$v.data?.toBuilder();
|
||||
_$v = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@override
|
||||
void replace(DashboardResponse other) {
|
||||
if (other == null) {
|
||||
throw new ArgumentError.notNull('other');
|
||||
}
|
||||
_$v = other as _$DashboardResponse;
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(DashboardResponseBuilder) updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_$DashboardResponse build() {
|
||||
_$DashboardResponse _$result;
|
||||
try {
|
||||
_$result = _$v ?? new _$DashboardResponse._(data: data.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
try {
|
||||
_$failedField = 'data';
|
||||
data.build();
|
||||
} catch (e) {
|
||||
throw new BuiltValueNestedFieldError(
|
||||
'DashboardResponse', _$failedField, e.toString());
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
replace(_$result);
|
||||
return _$result;
|
||||
}
|
||||
}
|
||||
|
||||
class _$DashboardEntity extends DashboardEntity {
|
||||
@override
|
||||
final BuiltList<ActivityEntity> activities;
|
||||
|
||||
factory _$DashboardEntity([void Function(DashboardEntityBuilder) updates]) =>
|
||||
(new DashboardEntityBuilder()..update(updates)).build();
|
||||
|
||||
_$DashboardEntity._({this.activities}) : super._() {
|
||||
if (activities == null) {
|
||||
throw new BuiltValueNullFieldError('DashboardEntity', 'activities');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
DashboardEntity rebuild(void Function(DashboardEntityBuilder) updates) =>
|
||||
(toBuilder()..update(updates)).build();
|
||||
|
||||
@override
|
||||
DashboardEntityBuilder toBuilder() =>
|
||||
new DashboardEntityBuilder()..replace(this);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(other, this)) return true;
|
||||
return other is DashboardEntity && activities == other.activities;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return $jf($jc(0, activities.hashCode));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (newBuiltValueToStringHelper('DashboardEntity')
|
||||
..add('activities', activities))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class DashboardEntityBuilder
|
||||
implements Builder<DashboardEntity, DashboardEntityBuilder> {
|
||||
_$DashboardEntity _$v;
|
||||
|
||||
ListBuilder<ActivityEntity> _activities;
|
||||
ListBuilder<ActivityEntity> get activities =>
|
||||
_$this._activities ??= new ListBuilder<ActivityEntity>();
|
||||
set activities(ListBuilder<ActivityEntity> activities) =>
|
||||
_$this._activities = activities;
|
||||
|
||||
DashboardEntityBuilder();
|
||||
|
||||
DashboardEntityBuilder get _$this {
|
||||
if (_$v != null) {
|
||||
_activities = _$v.activities?.toBuilder();
|
||||
_$v = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@override
|
||||
void replace(DashboardEntity other) {
|
||||
if (other == null) {
|
||||
throw new ArgumentError.notNull('other');
|
||||
}
|
||||
_$v = other as _$DashboardEntity;
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(DashboardEntityBuilder) updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_$DashboardEntity build() {
|
||||
_$DashboardEntity _$result;
|
||||
try {
|
||||
_$result = _$v ?? new _$DashboardEntity._(activities: activities.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
try {
|
||||
_$failedField = 'activities';
|
||||
activities.build();
|
||||
} catch (e) {
|
||||
throw new BuiltValueNestedFieldError(
|
||||
'DashboardEntity', _$failedField, e.toString());
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
replace(_$result);
|
||||
return _$result;
|
||||
}
|
||||
}
|
||||
|
||||
class _$ActivityEntity extends ActivityEntity {
|
||||
@override
|
||||
final String notes;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ part 'serializers.g.dart';
|
|||
LoginResponse,
|
||||
UserItemResponse,
|
||||
CompanyItemResponse,
|
||||
DashboardResponse,
|
||||
ProductListResponse,
|
||||
ProductItemResponse,
|
||||
ClientListResponse,
|
||||
|
|
|
|||
|
|
@ -35,9 +35,6 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
..add(CurrencyEntity.serializer)
|
||||
..add(CurrencyItemResponse.serializer)
|
||||
..add(CurrencyListResponse.serializer)
|
||||
..add(DashboardEntity.serializer)
|
||||
..add(DashboardResponse.serializer)
|
||||
..add(DashboardState.serializer)
|
||||
..add(DashboardUIState.serializer)
|
||||
..add(DateFormatEntity.serializer)
|
||||
..add(DateFormatItemResponse.serializer)
|
||||
|
|
@ -152,9 +149,6 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
..add(VendorListResponse.serializer)
|
||||
..add(VendorState.serializer)
|
||||
..add(VendorUIState.serializer)
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(ActivityEntity)]),
|
||||
() => new ListBuilder<ActivityEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(ClientEntity)]),
|
||||
() => new ListBuilder<ClientEntity>())
|
||||
|
|
@ -259,6 +253,9 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(GroupEntity)]),
|
||||
() => new ListBuilder<GroupEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(ActivityEntity)]),
|
||||
() => new ListBuilder<ActivityEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(TaxRateEntity)]),
|
||||
() => new ListBuilder<TaxRateEntity>())
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:core';
|
||||
import 'package:invoiceninja_flutter/.env.dart';
|
||||
import 'package:invoiceninja_flutter/data/mock/mock_dashboard.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/data/web_client.dart';
|
||||
|
||||
class DashboardRepository {
|
||||
const DashboardRepository({
|
||||
this.webClient = const WebClient(),
|
||||
});
|
||||
|
||||
final WebClient webClient;
|
||||
|
||||
Future<DashboardEntity> loadItem(Credentials connectionInfo) async {
|
||||
dynamic response;
|
||||
if (Config.DEMO_MODE) {
|
||||
response = json.decode(kMockDashboard);
|
||||
} else {
|
||||
response = await webClient.get(
|
||||
connectionInfo.url + '/dashboard?only_activity=true',
|
||||
connectionInfo.token);
|
||||
}
|
||||
|
||||
final DashboardResponse dashboardResponse =
|
||||
serializers.deserializeWith(DashboardResponse.serializer, response);
|
||||
|
||||
return dashboardResponse.data;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/expense/expense_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/invoice/invoice_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/payment/payment_actions.dart';
|
||||
|
|
@ -55,9 +54,6 @@ final lastErrorReducer = combineReducers<String>([
|
|||
TypedReducer<String, ClearLastError>((state, action) {
|
||||
return '';
|
||||
}),
|
||||
TypedReducer<String, LoadDashboardFailure>((state, action) {
|
||||
return '${action.error}';
|
||||
}),
|
||||
TypedReducer<String, LoadClientsFailure>((state, action) {
|
||||
return '${action.error}';
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -98,15 +98,12 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
userCompanyStates[uiState.selectedCompanyIndex];
|
||||
|
||||
bool get isLoaded {
|
||||
return dashboardState.isLoaded &&
|
||||
productState.isLoaded &&
|
||||
return productState.isLoaded &&
|
||||
clientState.isLoaded;
|
||||
}
|
||||
|
||||
CompanyEntity get company => userCompanyState.company;
|
||||
|
||||
DashboardState get dashboardState => userCompanyState.dashboardState;
|
||||
|
||||
DashboardUIState get dashboardUIState => uiState.dashboardUIState;
|
||||
|
||||
UserEntity get user => userCompanyState.user;
|
||||
|
|
@ -386,7 +383,8 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
//return 'resetCounterFrequencyId: ${settingsUIState.settings.resetCounterFrequencyId}';
|
||||
//return 'Fields: ${uiState.settingsUIState.company.customFields} - ${company.customFields}';
|
||||
//return 'Custom: ${uiState.settingsUIState.company.settings.customValue1} - ${company.settings.customValue1}';
|
||||
return 'Platform: ${userCompany.token.token}';
|
||||
//return 'Platform: ${userCompany.token.token}';
|
||||
return 'Activites: ${company.activities}';
|
||||
return 'Route: ${uiState.currentRoute} Prev: ${uiState.previousRoute}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import 'package:invoiceninja_flutter/redux/company/company_state.dart';
|
|||
import 'package:invoiceninja_flutter/redux/product/product_reducer.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_reducer.dart';
|
||||
import 'package:invoiceninja_flutter/redux/invoice/invoice_reducer.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_reducer.dart';
|
||||
import 'package:invoiceninja_flutter/redux/company/company_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/document/document_reducer.dart';
|
||||
import 'package:invoiceninja_flutter/redux/expense/expense_reducer.dart';
|
||||
|
|
@ -18,11 +17,8 @@ import 'package:invoiceninja_flutter/redux/payment/payment_reducer.dart';
|
|||
import 'package:invoiceninja_flutter/redux/quote/quote_reducer.dart';
|
||||
// STARTER: import - do not remove comment
|
||||
import 'package:invoiceninja_flutter/redux/user/user_reducer.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_reducer.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_reducer.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/group/group_reducer.dart';
|
||||
|
||||
UserCompanyState companyReducer(UserCompanyState state, dynamic action) {
|
||||
|
|
@ -34,7 +30,6 @@ UserCompanyState companyReducer(UserCompanyState state, dynamic action) {
|
|||
..userCompany.replace(userCompanyEntityReducer(state.userCompany, action))
|
||||
..documentState.replace(documentsReducer(state.documentState, action))
|
||||
..clientState.replace(clientsReducer(state.clientState, action))
|
||||
..dashboardState.replace(dashboardReducer(state.dashboardState, action))
|
||||
..productState.replace(productsReducer(state.productState, action))
|
||||
..invoiceState.replace(invoicesReducer(state.invoiceState, action))
|
||||
..expenseState.replace(expensesReducer(state.expenseState, action))
|
||||
|
|
|
|||
|
|
@ -3,32 +3,20 @@ import 'package:invoiceninja_flutter/data/models/group_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/client/client_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/invoice/invoice_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/product/product_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
// STARTER: import - do not remove comment
|
||||
import 'package:invoiceninja_flutter/redux/user/user_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/group/group_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/document/document_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/expense/expense_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/vendor/vendor_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/task/task_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/project/project_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/payment/payment_state.dart';
|
||||
|
||||
import 'package:invoiceninja_flutter/redux/quote/quote_state.dart';
|
||||
|
||||
part 'company_state.g.dart';
|
||||
|
|
@ -39,7 +27,6 @@ abstract class UserCompanyState
|
|||
return _$UserCompanyState._(
|
||||
userCompany: UserCompanyEntity(),
|
||||
documentState: DocumentState(),
|
||||
dashboardState: DashboardState(),
|
||||
productState: ProductState(),
|
||||
clientState: ClientState(),
|
||||
invoiceState: InvoiceState(),
|
||||
|
|
@ -64,8 +51,6 @@ abstract class UserCompanyState
|
|||
|
||||
DocumentState get documentState;
|
||||
|
||||
DashboardState get dashboardState;
|
||||
|
||||
ProductState get productState;
|
||||
|
||||
ClientState get clientState;
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ class _$UserCompanyStateSerializer
|
|||
'documentState',
|
||||
serializers.serialize(object.documentState,
|
||||
specifiedType: const FullType(DocumentState)),
|
||||
'dashboardState',
|
||||
serializers.serialize(object.dashboardState,
|
||||
specifiedType: const FullType(DashboardState)),
|
||||
'productState',
|
||||
serializers.serialize(object.productState,
|
||||
specifiedType: const FullType(ProductState)),
|
||||
|
|
@ -98,10 +95,6 @@ class _$UserCompanyStateSerializer
|
|||
result.documentState.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(DocumentState)) as DocumentState);
|
||||
break;
|
||||
case 'dashboardState':
|
||||
result.dashboardState.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(DashboardState)) as DashboardState);
|
||||
break;
|
||||
case 'productState':
|
||||
result.productState.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(ProductState)) as ProductState);
|
||||
|
|
@ -303,8 +296,6 @@ class _$UserCompanyState extends UserCompanyState {
|
|||
@override
|
||||
final DocumentState documentState;
|
||||
@override
|
||||
final DashboardState dashboardState;
|
||||
@override
|
||||
final ProductState productState;
|
||||
@override
|
||||
final ClientState clientState;
|
||||
|
|
@ -338,7 +329,6 @@ class _$UserCompanyState extends UserCompanyState {
|
|||
_$UserCompanyState._(
|
||||
{this.userCompany,
|
||||
this.documentState,
|
||||
this.dashboardState,
|
||||
this.productState,
|
||||
this.clientState,
|
||||
this.invoiceState,
|
||||
|
|
@ -356,9 +346,6 @@ class _$UserCompanyState extends UserCompanyState {
|
|||
if (documentState == null) {
|
||||
throw new BuiltValueNullFieldError('UserCompanyState', 'documentState');
|
||||
}
|
||||
if (dashboardState == null) {
|
||||
throw new BuiltValueNullFieldError('UserCompanyState', 'dashboardState');
|
||||
}
|
||||
if (productState == null) {
|
||||
throw new BuiltValueNullFieldError('UserCompanyState', 'productState');
|
||||
}
|
||||
|
|
@ -415,7 +402,6 @@ class _$UserCompanyState extends UserCompanyState {
|
|||
return other is UserCompanyState &&
|
||||
userCompany == other.userCompany &&
|
||||
documentState == other.documentState &&
|
||||
dashboardState == other.dashboardState &&
|
||||
productState == other.productState &&
|
||||
clientState == other.clientState &&
|
||||
invoiceState == other.invoiceState &&
|
||||
|
|
@ -446,7 +432,6 @@ class _$UserCompanyState extends UserCompanyState {
|
|||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
0,
|
||||
|
|
@ -454,8 +439,6 @@ class _$UserCompanyState extends UserCompanyState {
|
|||
.hashCode),
|
||||
documentState
|
||||
.hashCode),
|
||||
dashboardState
|
||||
.hashCode),
|
||||
productState.hashCode),
|
||||
clientState.hashCode),
|
||||
invoiceState.hashCode),
|
||||
|
|
@ -476,7 +459,6 @@ class _$UserCompanyState extends UserCompanyState {
|
|||
return (newBuiltValueToStringHelper('UserCompanyState')
|
||||
..add('userCompany', userCompany)
|
||||
..add('documentState', documentState)
|
||||
..add('dashboardState', dashboardState)
|
||||
..add('productState', productState)
|
||||
..add('clientState', clientState)
|
||||
..add('invoiceState', invoiceState)
|
||||
|
|
@ -510,12 +492,6 @@ class UserCompanyStateBuilder
|
|||
set documentState(DocumentStateBuilder documentState) =>
|
||||
_$this._documentState = documentState;
|
||||
|
||||
DashboardStateBuilder _dashboardState;
|
||||
DashboardStateBuilder get dashboardState =>
|
||||
_$this._dashboardState ??= new DashboardStateBuilder();
|
||||
set dashboardState(DashboardStateBuilder dashboardState) =>
|
||||
_$this._dashboardState = dashboardState;
|
||||
|
||||
ProductStateBuilder _productState;
|
||||
ProductStateBuilder get productState =>
|
||||
_$this._productState ??= new ProductStateBuilder();
|
||||
|
|
@ -598,7 +574,6 @@ class UserCompanyStateBuilder
|
|||
if (_$v != null) {
|
||||
_userCompany = _$v.userCompany?.toBuilder();
|
||||
_documentState = _$v.documentState?.toBuilder();
|
||||
_dashboardState = _$v.dashboardState?.toBuilder();
|
||||
_productState = _$v.productState?.toBuilder();
|
||||
_clientState = _$v.clientState?.toBuilder();
|
||||
_invoiceState = _$v.invoiceState?.toBuilder();
|
||||
|
|
@ -638,7 +613,6 @@ class UserCompanyStateBuilder
|
|||
new _$UserCompanyState._(
|
||||
userCompany: _userCompany?.build(),
|
||||
documentState: documentState.build(),
|
||||
dashboardState: dashboardState.build(),
|
||||
productState: productState.build(),
|
||||
clientState: clientState.build(),
|
||||
invoiceState: invoiceState.build(),
|
||||
|
|
@ -659,8 +633,6 @@ class UserCompanyStateBuilder
|
|||
_userCompany?.build();
|
||||
_$failedField = 'documentState';
|
||||
documentState.build();
|
||||
_$failedField = 'dashboardState';
|
||||
dashboardState.build();
|
||||
_$failedField = 'productState';
|
||||
productState.build();
|
||||
_$failedField = 'clientState';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/dashboard_model.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
|
||||
class ViewDashboard extends AbstractNavigatorAction implements PersistUI {
|
||||
|
|
@ -22,33 +19,3 @@ class UpdateDashboardSettings implements PersistUI {
|
|||
String currencyId;
|
||||
}
|
||||
|
||||
class LoadDashboard {
|
||||
LoadDashboard([this.completer, this.force = false]);
|
||||
|
||||
final Completer completer;
|
||||
final bool force;
|
||||
}
|
||||
|
||||
class LoadDashboardRequest implements StartLoading {}
|
||||
|
||||
class LoadDashboardFailure implements StopLoading {
|
||||
LoadDashboardFailure(this.error);
|
||||
|
||||
final dynamic error;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoadDashboardFailure{error: $error}';
|
||||
}
|
||||
}
|
||||
|
||||
class LoadDashboardSuccess implements StopLoading, PersistData {
|
||||
LoadDashboardSuccess(this.data);
|
||||
|
||||
final DashboardEntity data;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DashboardEntity{data: $data}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,17 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_middleware.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
||||
import 'package:invoiceninja_flutter/ui/dashboard/dashboard_screen_vm.dart';
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/repositories/dashboard_repository.dart';
|
||||
|
||||
List<Middleware<AppState>> createStoreDashboardMiddleware([
|
||||
DashboardRepository repository = const DashboardRepository(),
|
||||
]) {
|
||||
List<Middleware<AppState>> createStoreDashboardMiddleware() {
|
||||
final viewDashboard = _createViewDashboard();
|
||||
final loadDashboard = _createLoadDashboard(repository);
|
||||
|
||||
return [
|
||||
TypedMiddleware<AppState, ViewDashboard>(viewDashboard),
|
||||
TypedMiddleware<AppState, LoadDashboard>(loadDashboard),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -30,9 +24,11 @@ Middleware<AppState> _createViewDashboard() {
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (store.state.dashboardState.isStale) {
|
||||
store.dispatch(LoadDashboard());
|
||||
store.dispatch(LoadActivities());
|
||||
}
|
||||
*/
|
||||
|
||||
store.dispatch(UpdateCurrentRoute(DashboardScreenBuilder.route));
|
||||
|
||||
|
|
@ -44,39 +40,3 @@ Middleware<AppState> _createViewDashboard() {
|
|||
next(action);
|
||||
};
|
||||
}
|
||||
|
||||
Middleware<AppState> _createLoadDashboard(DashboardRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as LoadDashboard;
|
||||
final state = store.state;
|
||||
|
||||
if (!state.dashboardState.isStale && !action.force) {
|
||||
next(action);
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.isLoading) {
|
||||
next(action);
|
||||
return;
|
||||
}
|
||||
|
||||
store.dispatch(LoadDashboardRequest());
|
||||
repository.loadItem(state.credentials).then((data) {
|
||||
store.dispatch(LoadDashboardSuccess(data));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
if (state.clientState.isStale) {
|
||||
store.dispatch(LoadClients());
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
store.dispatch(LoadDashboardFailure(error));
|
||||
});
|
||||
|
||||
next(action);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,7 @@
|
|||
import 'package:invoiceninja_flutter/redux/company/company_actions.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_state.dart';
|
||||
|
||||
final dashboardReducer = combineReducers<DashboardState>([
|
||||
TypedReducer<DashboardState, LoadDashboardSuccess>(_setLoadedDashboards),
|
||||
]);
|
||||
|
||||
DashboardState _setLoadedDashboards(
|
||||
DashboardState dashboardState, LoadDashboardSuccess action) {
|
||||
return dashboardState.rebuild((b) => b
|
||||
..lastUpdated = DateTime.now().millisecondsSinceEpoch
|
||||
..data.replace(action.data));
|
||||
}
|
||||
|
||||
DashboardUIState dashboardUIReducer(DashboardUIState state, dynamic action) {
|
||||
if (action is UpdateDashboardSettings) {
|
||||
|
|
|
|||
|
|
@ -8,39 +8,6 @@ import 'package:invoiceninja_flutter/utils/formatting.dart';
|
|||
|
||||
part 'dashboard_state.g.dart';
|
||||
|
||||
abstract class DashboardState
|
||||
implements Built<DashboardState, DashboardStateBuilder> {
|
||||
factory DashboardState() {
|
||||
return _$DashboardState._(
|
||||
data: null,
|
||||
);
|
||||
}
|
||||
|
||||
DashboardState._();
|
||||
|
||||
@nullable
|
||||
int get lastUpdated;
|
||||
|
||||
@nullable
|
||||
DashboardEntity get data;
|
||||
|
||||
bool get isStale {
|
||||
if (!isLoaded) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated >
|
||||
kMillisecondsToRefreshData;
|
||||
}
|
||||
|
||||
bool get isLoaded {
|
||||
return lastUpdated != null && lastUpdated > 0;
|
||||
}
|
||||
|
||||
static Serializer<DashboardState> get serializer =>
|
||||
_$dashboardStateSerializer;
|
||||
}
|
||||
|
||||
abstract class DashboardUIState
|
||||
implements Built<DashboardUIState, DashboardUIStateBuilder> {
|
||||
factory DashboardUIState() {
|
||||
|
|
|
|||
|
|
@ -6,65 +6,9 @@ part of 'dashboard_state.dart';
|
|||
// BuiltValueGenerator
|
||||
// **************************************************************************
|
||||
|
||||
Serializer<DashboardState> _$dashboardStateSerializer =
|
||||
new _$DashboardStateSerializer();
|
||||
Serializer<DashboardUIState> _$dashboardUIStateSerializer =
|
||||
new _$DashboardUIStateSerializer();
|
||||
|
||||
class _$DashboardStateSerializer
|
||||
implements StructuredSerializer<DashboardState> {
|
||||
@override
|
||||
final Iterable<Type> types = const [DashboardState, _$DashboardState];
|
||||
@override
|
||||
final String wireName = 'DashboardState';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, DashboardState object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[];
|
||||
if (object.lastUpdated != null) {
|
||||
result
|
||||
..add('lastUpdated')
|
||||
..add(serializers.serialize(object.lastUpdated,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
if (object.data != null) {
|
||||
result
|
||||
..add('data')
|
||||
..add(serializers.serialize(object.data,
|
||||
specifiedType: const FullType(DashboardEntity)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
DashboardState deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new DashboardStateBuilder();
|
||||
|
||||
final iterator = serialized.iterator;
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final dynamic value = iterator.current;
|
||||
switch (key) {
|
||||
case 'lastUpdated':
|
||||
result.lastUpdated = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'data':
|
||||
result.data.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(DashboardEntity))
|
||||
as DashboardEntity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
||||
class _$DashboardUIStateSerializer
|
||||
implements StructuredSerializer<DashboardUIState> {
|
||||
@override
|
||||
|
|
@ -163,107 +107,6 @@ class _$DashboardUIStateSerializer
|
|||
}
|
||||
}
|
||||
|
||||
class _$DashboardState extends DashboardState {
|
||||
@override
|
||||
final int lastUpdated;
|
||||
@override
|
||||
final DashboardEntity data;
|
||||
|
||||
factory _$DashboardState([void Function(DashboardStateBuilder) updates]) =>
|
||||
(new DashboardStateBuilder()..update(updates)).build();
|
||||
|
||||
_$DashboardState._({this.lastUpdated, this.data}) : super._();
|
||||
|
||||
@override
|
||||
DashboardState rebuild(void Function(DashboardStateBuilder) updates) =>
|
||||
(toBuilder()..update(updates)).build();
|
||||
|
||||
@override
|
||||
DashboardStateBuilder toBuilder() =>
|
||||
new DashboardStateBuilder()..replace(this);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(other, this)) return true;
|
||||
return other is DashboardState &&
|
||||
lastUpdated == other.lastUpdated &&
|
||||
data == other.data;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return $jf($jc($jc(0, lastUpdated.hashCode), data.hashCode));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (newBuiltValueToStringHelper('DashboardState')
|
||||
..add('lastUpdated', lastUpdated)
|
||||
..add('data', data))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class DashboardStateBuilder
|
||||
implements Builder<DashboardState, DashboardStateBuilder> {
|
||||
_$DashboardState _$v;
|
||||
|
||||
int _lastUpdated;
|
||||
int get lastUpdated => _$this._lastUpdated;
|
||||
set lastUpdated(int lastUpdated) => _$this._lastUpdated = lastUpdated;
|
||||
|
||||
DashboardEntityBuilder _data;
|
||||
DashboardEntityBuilder get data =>
|
||||
_$this._data ??= new DashboardEntityBuilder();
|
||||
set data(DashboardEntityBuilder data) => _$this._data = data;
|
||||
|
||||
DashboardStateBuilder();
|
||||
|
||||
DashboardStateBuilder get _$this {
|
||||
if (_$v != null) {
|
||||
_lastUpdated = _$v.lastUpdated;
|
||||
_data = _$v.data?.toBuilder();
|
||||
_$v = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@override
|
||||
void replace(DashboardState other) {
|
||||
if (other == null) {
|
||||
throw new ArgumentError.notNull('other');
|
||||
}
|
||||
_$v = other as _$DashboardState;
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(DashboardStateBuilder) updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_$DashboardState build() {
|
||||
_$DashboardState _$result;
|
||||
try {
|
||||
_$result = _$v ??
|
||||
new _$DashboardState._(
|
||||
lastUpdated: lastUpdated, data: _data?.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
try {
|
||||
_$failedField = 'data';
|
||||
_data?.build();
|
||||
} catch (e) {
|
||||
throw new BuiltValueNestedFieldError(
|
||||
'DashboardState', _$failedField, e.toString());
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
replace(_$result);
|
||||
return _$result;
|
||||
}
|
||||
}
|
||||
|
||||
class _$DashboardUIState extends DashboardUIState {
|
||||
@override
|
||||
final DateRange dateRange;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
|
|
@ -245,8 +245,8 @@ Middleware<AppState> _loadDocuments(DocumentRepository repository) {
|
|||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
if (state.dashboardState.isStale) {
|
||||
store.dispatch(LoadDashboard());
|
||||
if (state.clientState.isStale) {
|
||||
store.dispatch(LoadClients());
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_middleware.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
|
@ -266,8 +266,8 @@ Middleware<AppState> _loadExpenses(ExpenseRepository repository) {
|
|||
store.dispatch(LoadDocuments());
|
||||
}
|
||||
} else {
|
||||
if (state.dashboardState.isStale) {
|
||||
store.dispatch(LoadDashboard());
|
||||
if (state.clientState.isStale) {
|
||||
store.dispatch(LoadClients());
|
||||
}
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
|
|
@ -276,12 +276,6 @@ Middleware<AppState> _loadExpenses(ExpenseRepository repository) {
|
|||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
||||
// Support selfhost users with older versions
|
||||
// TODO remove this in v2
|
||||
if (state.dashboardState.isStale) {
|
||||
store.dispatch(LoadDashboard());
|
||||
}
|
||||
});
|
||||
|
||||
next(action);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_middleware.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/task/task_actions.dart';
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
|
@ -231,8 +231,8 @@ Middleware<AppState> _loadProject(ProjectRepository repository) {
|
|||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
if (state.dashboardState.isStale) {
|
||||
store.dispatch(LoadDashboard());
|
||||
if (state.clientState.isStale) {
|
||||
store.dispatch(LoadClients());
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_middleware.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/project/project_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
||||
|
|
@ -358,8 +358,8 @@ Middleware<AppState> _loadQuotes(QuoteRepository repository) {
|
|||
store.dispatch(LoadProjects());
|
||||
}
|
||||
} else {
|
||||
if (state.dashboardState.isStale) {
|
||||
store.dispatch(LoadDashboard());
|
||||
if (state.clientState.isStale) {
|
||||
store.dispatch(LoadClients());
|
||||
}
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_middleware.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/expense/expense_actions.dart';
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
|
@ -228,18 +227,15 @@ Middleware<AppState> _loadVendor(VendorRepository repository) {
|
|||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
if (state.expenseState.isStale) {
|
||||
store.dispatch(LoadExpenses());
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(LoadVendorFailure(error));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
||||
// Support selfhost users with older versions
|
||||
// TODO remove this in v2
|
||||
if (state.dashboardState.isStale) {
|
||||
store.dispatch(LoadDashboard());
|
||||
}
|
||||
});
|
||||
|
||||
next(action);
|
||||
|
|
|
|||
|
|
@ -144,9 +144,6 @@ class _InvoiceEmailViewState extends State<InvoiceEmailView>
|
|||
return;
|
||||
}
|
||||
|
||||
final str =
|
||||
'<b>${_subjectController.text.trim()}</b><br/><br/>${_bodyController.text.trim()}';
|
||||
|
||||
final subject =_subjectController.text.trim();
|
||||
final body = _bodyController.text.trim();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/history_drawer_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/menu_drawer_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/help_text.dart';
|
||||
|
|
@ -19,7 +19,7 @@ class MainScreen extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StoreBuilder(
|
||||
onInit: (Store<AppState> store) => store.dispatch(LoadDashboard()),
|
||||
onInit: (Store<AppState> store) => store.dispatch(LoadClients()),
|
||||
builder: (BuildContext context, Store<AppState> store) {
|
||||
final uiState = store.state.uiState;
|
||||
final prefState = store.state.prefState;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/app_builder.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/menu_drawer.dart';
|
||||
|
|
@ -54,7 +54,7 @@ class MenuDrawerVM {
|
|||
// TODO re-enable
|
||||
//store.dispatch(SelectCompany(int.parse(companyIndex), company));
|
||||
|
||||
store.dispatch(LoadDashboard());
|
||||
store.dispatch(LoadClients());
|
||||
AppBuilder.of(context).rebuild();
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/lists/activity_list_tile.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/loading_indicator.dart';
|
||||
import 'package:invoiceninja_flutter/ui/dashboard/dashboard_screen_vm.dart';
|
||||
|
||||
class DashboardActivity extends StatelessWidget {
|
||||
|
|
@ -13,11 +12,8 @@ class DashboardActivity extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!viewModel.dashboardState.isLoaded) {
|
||||
return LoadingIndicator();
|
||||
}
|
||||
|
||||
final activities = viewModel.dashboardState.data.activities;
|
||||
final company = viewModel.state.company;
|
||||
final activities = company.activities;
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: activities.length,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/loading_indicator.dart';
|
||||
import 'package:invoiceninja_flutter/ui/dashboard/dashboard_screen_vm.dart';
|
||||
|
||||
class DashboardOverview extends StatelessWidget {
|
||||
|
|
@ -12,10 +11,6 @@ class DashboardOverview extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!viewModel.dashboardState.isLoaded) {
|
||||
return LoadingIndicator();
|
||||
}
|
||||
|
||||
return new Container();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ class DashboardVM {
|
|||
DashboardVM({
|
||||
@required this.state,
|
||||
@required this.dashboardUIState,
|
||||
@required this.dashboardState,
|
||||
@required this.currencyMap,
|
||||
@required this.isLoading,
|
||||
@required this.isNextEnabled,
|
||||
|
|
@ -56,7 +55,8 @@ class DashboardVM {
|
|||
}
|
||||
final completer = snackBarCompleter<Null>(
|
||||
context, AppLocalization.of(context).refreshComplete);
|
||||
store.dispatch(LoadDashboard(completer, true));
|
||||
// TODO implement
|
||||
//store.dispatch(LoadCompany(completer, true));
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,6 @@ class DashboardVM {
|
|||
return DashboardVM(
|
||||
state: state,
|
||||
dashboardUIState: state.dashboardUIState,
|
||||
dashboardState: state.dashboardState,
|
||||
currencyMap: state.staticState.currencyMap,
|
||||
isLoading: state.isLoading,
|
||||
isNextEnabled:
|
||||
|
|
@ -85,7 +84,6 @@ class DashboardVM {
|
|||
}
|
||||
|
||||
final AppState state;
|
||||
final DashboardState dashboardState;
|
||||
final DashboardUIState dashboardUIState;
|
||||
final BuiltMap<String, CurrencyEntity> currencyMap;
|
||||
final String filter;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'package:invoiceninja_flutter/constants.dart';
|
|||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/auth/auth_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/app_builder.dart';
|
||||
|
|
@ -68,7 +69,7 @@ class DeviceSettingsVM {
|
|||
));
|
||||
|
||||
AppBuilder.of(context).rebuild();
|
||||
store.dispatch(LoadDashboard());
|
||||
store.dispatch(LoadClients());
|
||||
}
|
||||
|
||||
return DeviceSettingsVM(
|
||||
|
|
|
|||
Loading…
Reference in New Issue