Statics
This commit is contained in:
parent
6f46b232de
commit
27dbb69e8a
|
|
@ -11,6 +11,7 @@ import 'package:invoiceninja/data/models/project_model.dart';
|
|||
import 'package:invoiceninja/data/models/task_model.dart';
|
||||
import 'package:invoiceninja/data/models/vendor_model.dart';
|
||||
import 'package:invoiceninja/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja/redux/static/static_state.dart';
|
||||
import 'package:invoiceninja/redux/auth/auth_state.dart';
|
||||
import 'package:invoiceninja/redux/company/company_state.dart';
|
||||
import 'package:invoiceninja/redux/dashboard/dashboard_state.dart';
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
..add(StaticData.serializer)
|
||||
..add(StaticDataEntity.serializer)
|
||||
..add(StaticDataItemResponse.serializer)
|
||||
..add(StaticState.serializer)
|
||||
..add(TaskEntity.serializer)
|
||||
..add(TaskItemResponse.serializer)
|
||||
..add(TaskListResponse.serializer)
|
||||
|
|
@ -195,6 +196,41 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(FrequencyEntity)]),
|
||||
() => new ListBuilder<FrequencyEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(CurrencyEntity)]),
|
||||
() => new ListBuilder<CurrencyEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(SizeEntity)]),
|
||||
() => new ListBuilder<SizeEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(IndustryEntity)]),
|
||||
() => new ListBuilder<IndustryEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(TimezoneEntity)]),
|
||||
() => new ListBuilder<TimezoneEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(DateFormatEntity)]),
|
||||
() => new ListBuilder<DateFormatEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(
|
||||
BuiltList, const [const FullType(DatetimeFormatEntity)]),
|
||||
() => new ListBuilder<DatetimeFormatEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(LanguageEntity)]),
|
||||
() => new ListBuilder<LanguageEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(PaymentTypeEntity)]),
|
||||
() => new ListBuilder<PaymentTypeEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(CountryEntity)]),
|
||||
() => new ListBuilder<CountryEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(
|
||||
BuiltList, const [const FullType(InvoiceStatusEntity)]),
|
||||
() => new ListBuilder<InvoiceStatusEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(FrequencyEntity)]),
|
||||
() => new ListBuilder<FrequencyEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(DateFormatEntity)]),
|
||||
() => new ListBuilder<DateFormatEntity>())
|
||||
|
|
@ -284,6 +320,5 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
|||
const [const FullType(int), const FullType(ProductEntity)]),
|
||||
() => new MapBuilder<int, ProductEntity>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(int)]),
|
||||
() => new ListBuilder<int>()))
|
||||
const FullType(BuiltList, const [const FullType(int)]), () => new ListBuilder<int>()))
|
||||
.build();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
|||
import 'dart:core';
|
||||
import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:invoiceninja/redux/static/static_state.dart';
|
||||
import 'package:invoiceninja/redux/auth/auth_state.dart';
|
||||
import 'package:invoiceninja/redux/company/company_state.dart';
|
||||
import 'package:invoiceninja/redux/ui/ui_state.dart';
|
||||
|
|
@ -41,6 +42,17 @@ class PersistenceRepository {
|
|||
}
|
||||
|
||||
|
||||
Future<File> saveStaticState(StaticState state) async {
|
||||
var data = serializers.serializeWith(StaticState.serializer, state);
|
||||
return await fileStorage.save(json.encode(data));
|
||||
}
|
||||
|
||||
Future<StaticState> loadStaticState() async {
|
||||
String data = await fileStorage.load();
|
||||
return serializers.deserializeWith(StaticState.serializer, json.decode(data));
|
||||
}
|
||||
|
||||
|
||||
Future<File> saveUIState(UIState state) async {
|
||||
var data = serializers.serializeWith(UIState.serializer, state);
|
||||
return await fileStorage.save(json.encode(data));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
import 'package:invoiceninja/data/models/entities.dart';
|
||||
|
||||
class PersistData {}
|
||||
class PersistUI {}
|
||||
|
||||
class StartLoading {}
|
||||
class StopLoading {}
|
||||
class StopLoading {}
|
||||
|
||||
class LoadStaticSuccess {
|
||||
final StaticData data;
|
||||
|
||||
LoadStaticSuccess(this.data);
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ import 'package:invoiceninja/redux/auth/auth_actions.dart';
|
|||
import 'package:invoiceninja/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja/redux/app/loading_reducer.dart';
|
||||
import 'package:invoiceninja/redux/auth/auth_reducer.dart';
|
||||
import 'package:invoiceninja/redux/static/static_reducer.dart';
|
||||
import 'package:invoiceninja/redux/company/company_reducer.dart';
|
||||
|
||||
// We create the State reducer by combining many smaller reducers into one!
|
||||
|
|
@ -16,6 +17,7 @@ AppState appReducer(AppState state, action) {
|
|||
return state.rebuild((b) => b
|
||||
..isLoading = loadingReducer(state.isLoading, action)
|
||||
..authState.replace(authReducer(state.authState, action))
|
||||
..staticState.replace(staticReducer(state.staticState, action))
|
||||
..companyState1.replace(state.uiState.selectedCompanyIndex == 1
|
||||
? companyReducer(state.companyState1, action) : state.companyState1)
|
||||
..companyState2.replace(state.uiState.selectedCompanyIndex == 2
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:invoiceninja/data/models/models.dart';
|
||||
import 'package:invoiceninja/redux/static/static_state.dart';
|
||||
import 'package:invoiceninja/redux/client/client_state.dart';
|
||||
import 'package:invoiceninja/redux/invoice/invoice_state.dart';
|
||||
import 'package:invoiceninja/redux/ui/entity_ui_state.dart';
|
||||
|
|
@ -16,6 +17,7 @@ part 'app_state.g.dart';
|
|||
abstract class AppState implements Built<AppState, AppStateBuilder> {
|
||||
bool get isLoading;
|
||||
AuthState get authState;
|
||||
StaticState get staticState;
|
||||
UIState get uiState;
|
||||
CompanyState get companyState1;
|
||||
CompanyState get companyState2;
|
||||
|
|
@ -27,6 +29,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
return _$AppState._(
|
||||
isLoading: false,
|
||||
authState: AuthState(),
|
||||
staticState: StaticState(),
|
||||
companyState1: CompanyState(),
|
||||
companyState2: CompanyState(),
|
||||
companyState3: CompanyState(),
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ class _$AppStateSerializer implements StructuredSerializer<AppState> {
|
|||
'authState',
|
||||
serializers.serialize(object.authState,
|
||||
specifiedType: const FullType(AuthState)),
|
||||
'staticState',
|
||||
serializers.serialize(object.staticState,
|
||||
specifiedType: const FullType(StaticState)),
|
||||
'uiState',
|
||||
serializers.serialize(object.uiState,
|
||||
specifiedType: const FullType(UIState)),
|
||||
|
|
@ -74,6 +77,10 @@ class _$AppStateSerializer implements StructuredSerializer<AppState> {
|
|||
result.authState.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(AuthState)) as AuthState);
|
||||
break;
|
||||
case 'staticState':
|
||||
result.staticState.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(StaticState)) as StaticState);
|
||||
break;
|
||||
case 'uiState':
|
||||
result.uiState.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(UIState)) as UIState);
|
||||
|
|
@ -111,6 +118,8 @@ class _$AppState extends AppState {
|
|||
@override
|
||||
final AuthState authState;
|
||||
@override
|
||||
final StaticState staticState;
|
||||
@override
|
||||
final UIState uiState;
|
||||
@override
|
||||
final CompanyState companyState1;
|
||||
|
|
@ -129,6 +138,7 @@ class _$AppState extends AppState {
|
|||
_$AppState._(
|
||||
{this.isLoading,
|
||||
this.authState,
|
||||
this.staticState,
|
||||
this.uiState,
|
||||
this.companyState1,
|
||||
this.companyState2,
|
||||
|
|
@ -140,6 +150,8 @@ class _$AppState extends AppState {
|
|||
throw new BuiltValueNullFieldError('AppState', 'isLoading');
|
||||
if (authState == null)
|
||||
throw new BuiltValueNullFieldError('AppState', 'authState');
|
||||
if (staticState == null)
|
||||
throw new BuiltValueNullFieldError('AppState', 'staticState');
|
||||
if (uiState == null)
|
||||
throw new BuiltValueNullFieldError('AppState', 'uiState');
|
||||
if (companyState1 == null)
|
||||
|
|
@ -167,6 +179,7 @@ class _$AppState extends AppState {
|
|||
if (other is! AppState) return false;
|
||||
return isLoading == other.isLoading &&
|
||||
authState == other.authState &&
|
||||
staticState == other.staticState &&
|
||||
uiState == other.uiState &&
|
||||
companyState1 == other.companyState1 &&
|
||||
companyState2 == other.companyState2 &&
|
||||
|
|
@ -182,7 +195,11 @@ class _$AppState extends AppState {
|
|||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc($jc($jc(0, isLoading.hashCode), authState.hashCode),
|
||||
$jc(
|
||||
$jc(
|
||||
$jc($jc(0, isLoading.hashCode),
|
||||
authState.hashCode),
|
||||
staticState.hashCode),
|
||||
uiState.hashCode),
|
||||
companyState1.hashCode),
|
||||
companyState2.hashCode),
|
||||
|
|
@ -204,6 +221,12 @@ class AppStateBuilder implements Builder<AppState, AppStateBuilder> {
|
|||
_$this._authState ??= new AuthStateBuilder();
|
||||
set authState(AuthStateBuilder authState) => _$this._authState = authState;
|
||||
|
||||
StaticStateBuilder _staticState;
|
||||
StaticStateBuilder get staticState =>
|
||||
_$this._staticState ??= new StaticStateBuilder();
|
||||
set staticState(StaticStateBuilder staticState) =>
|
||||
_$this._staticState = staticState;
|
||||
|
||||
UIStateBuilder _uiState;
|
||||
UIStateBuilder get uiState => _$this._uiState ??= new UIStateBuilder();
|
||||
set uiState(UIStateBuilder uiState) => _$this._uiState = uiState;
|
||||
|
|
@ -244,6 +267,7 @@ class AppStateBuilder implements Builder<AppState, AppStateBuilder> {
|
|||
if (_$v != null) {
|
||||
_isLoading = _$v.isLoading;
|
||||
_authState = _$v.authState?.toBuilder();
|
||||
_staticState = _$v.staticState?.toBuilder();
|
||||
_uiState = _$v.uiState?.toBuilder();
|
||||
_companyState1 = _$v.companyState1?.toBuilder();
|
||||
_companyState2 = _$v.companyState2?.toBuilder();
|
||||
|
|
@ -274,6 +298,7 @@ class AppStateBuilder implements Builder<AppState, AppStateBuilder> {
|
|||
new _$AppState._(
|
||||
isLoading: isLoading,
|
||||
authState: authState.build(),
|
||||
staticState: staticState.build(),
|
||||
uiState: uiState.build(),
|
||||
companyState1: companyState1.build(),
|
||||
companyState2: companyState2.build(),
|
||||
|
|
@ -285,6 +310,8 @@ class AppStateBuilder implements Builder<AppState, AppStateBuilder> {
|
|||
try {
|
||||
_$failedField = 'authState';
|
||||
authState.build();
|
||||
_$failedField = 'staticState';
|
||||
staticState.build();
|
||||
_$failedField = 'uiState';
|
||||
uiState.build();
|
||||
_$failedField = 'companyState1';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja/ui/auth/login_vm.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:invoiceninja/redux/auth/auth_actions.dart';
|
||||
|
|
@ -60,6 +61,8 @@ Middleware<AppState> _createLoginRequest(AuthRepository repository) {
|
|||
_saveAuthLocal(action);
|
||||
|
||||
if (_isVersionSupported(data.version)) {
|
||||
store.dispatch(LoadStaticSuccess(data.static));
|
||||
|
||||
for (int i = 0; i < data.accounts.length; i++) {
|
||||
store.dispatch(SelectCompany(i + 1));
|
||||
store.dispatch(LoadCompanySuccess(data.accounts[i]));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:redux/redux.dart';
|
||||
|
||||
import 'package:invoiceninja/redux/auth/auth_actions.dart';
|
||||
import 'package:invoiceninja/redux/auth/auth_state.dart';
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
import 'package:invoiceninja/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja/redux/static/static_state.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
||||
Reducer<StaticState> staticReducer = combineReducers([
|
||||
TypedReducer<StaticState, LoadStaticSuccess>(staticLoadedReducer),
|
||||
]);
|
||||
|
||||
StaticState staticLoadedReducer(StaticState staticState, LoadStaticSuccess action) {
|
||||
return StaticState().rebuild((b) => b
|
||||
..currencies.replace(action.data.currencies)
|
||||
..sizes.replace(action.data.sizes)
|
||||
..industries.replace(action.data.industries)
|
||||
..timezones.replace(action.data.timezones)
|
||||
..dateFormats.replace(action.data.dateFormats)
|
||||
..datetimeFormats.replace(action.data.datetimeFormats)
|
||||
..languages.replace(action.data.languages)
|
||||
..paymentTypes.replace(action.data.paymentTypes)
|
||||
..countries.replace(action.data.countries)
|
||||
..invoiceStatus.replace(action.data.invoiceStatus)
|
||||
..frequencies.replace(action.data.frequencies)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
import 'package:invoiceninja/data/models/models.dart';
|
||||
|
||||
part 'static_state.g.dart';
|
||||
|
||||
abstract class StaticState implements Built<StaticState, StaticStateBuilder> {
|
||||
|
||||
BuiltList<CurrencyEntity> get currencies;
|
||||
BuiltList<SizeEntity> get sizes;
|
||||
BuiltList<IndustryEntity> get industries;
|
||||
BuiltList<TimezoneEntity> get timezones;
|
||||
BuiltList<DateFormatEntity> get dateFormats;
|
||||
BuiltList<DatetimeFormatEntity> get datetimeFormats;
|
||||
BuiltList<LanguageEntity> get languages;
|
||||
BuiltList<PaymentTypeEntity> get paymentTypes;
|
||||
BuiltList<CountryEntity> get countries;
|
||||
BuiltList<InvoiceStatusEntity> get invoiceStatus;
|
||||
BuiltList<FrequencyEntity> get frequencies;
|
||||
|
||||
factory StaticState() {
|
||||
return _$StaticState._(
|
||||
currencies: BuiltList<CurrencyEntity>(),
|
||||
sizes: BuiltList<SizeEntity>(),
|
||||
industries: BuiltList<IndustryEntity>(),
|
||||
timezones: BuiltList<TimezoneEntity>(),
|
||||
dateFormats: BuiltList<DateFormatEntity>(),
|
||||
datetimeFormats: BuiltList<DatetimeFormatEntity>(),
|
||||
languages: BuiltList<LanguageEntity>(),
|
||||
paymentTypes: BuiltList<PaymentTypeEntity>(),
|
||||
countries: BuiltList<CountryEntity>(),
|
||||
invoiceStatus: BuiltList<InvoiceStatusEntity>(),
|
||||
frequencies: BuiltList<FrequencyEntity>(),
|
||||
);
|
||||
}
|
||||
|
||||
StaticState._();
|
||||
static Serializer<StaticState> get serializer => _$staticStateSerializer;
|
||||
}
|
||||
|
|
@ -0,0 +1,441 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'static_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// Generator: BuiltValueGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: always_put_control_body_on_new_line
|
||||
// ignore_for_file: annotate_overrides
|
||||
// ignore_for_file: avoid_annotating_with_dynamic
|
||||
// ignore_for_file: avoid_returning_this
|
||||
// ignore_for_file: omit_local_variable_types
|
||||
// ignore_for_file: prefer_expression_function_bodies
|
||||
// ignore_for_file: sort_constructors_first
|
||||
|
||||
Serializer<StaticState> _$staticStateSerializer = new _$StaticStateSerializer();
|
||||
|
||||
class _$StaticStateSerializer implements StructuredSerializer<StaticState> {
|
||||
@override
|
||||
final Iterable<Type> types = const [StaticState, _$StaticState];
|
||||
@override
|
||||
final String wireName = 'StaticState';
|
||||
|
||||
@override
|
||||
Iterable serialize(Serializers serializers, StaticState object,
|
||||
{FullType specifiedType: FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
'currencies',
|
||||
serializers.serialize(object.currencies,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(CurrencyEntity)])),
|
||||
'sizes',
|
||||
serializers.serialize(object.sizes,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(SizeEntity)])),
|
||||
'industries',
|
||||
serializers.serialize(object.industries,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(IndustryEntity)])),
|
||||
'timezones',
|
||||
serializers.serialize(object.timezones,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(TimezoneEntity)])),
|
||||
'dateFormats',
|
||||
serializers.serialize(object.dateFormats,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(DateFormatEntity)])),
|
||||
'datetimeFormats',
|
||||
serializers.serialize(object.datetimeFormats,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(DatetimeFormatEntity)])),
|
||||
'languages',
|
||||
serializers.serialize(object.languages,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(LanguageEntity)])),
|
||||
'paymentTypes',
|
||||
serializers.serialize(object.paymentTypes,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(PaymentTypeEntity)])),
|
||||
'countries',
|
||||
serializers.serialize(object.countries,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(CountryEntity)])),
|
||||
'invoiceStatus',
|
||||
serializers.serialize(object.invoiceStatus,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(InvoiceStatusEntity)])),
|
||||
'frequencies',
|
||||
serializers.serialize(object.frequencies,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(FrequencyEntity)])),
|
||||
];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
StaticState deserialize(Serializers serializers, Iterable serialized,
|
||||
{FullType specifiedType: FullType.unspecified}) {
|
||||
final result = new StaticStateBuilder();
|
||||
|
||||
final iterator = serialized.iterator;
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final dynamic value = iterator.current;
|
||||
switch (key) {
|
||||
case 'currencies':
|
||||
result.currencies.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(CurrencyEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
case 'sizes':
|
||||
result.sizes.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(SizeEntity)])) as BuiltList);
|
||||
break;
|
||||
case 'industries':
|
||||
result.industries.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(IndustryEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
case 'timezones':
|
||||
result.timezones.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(TimezoneEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
case 'dateFormats':
|
||||
result.dateFormats.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(DateFormatEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
case 'datetimeFormats':
|
||||
result.datetimeFormats.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(DatetimeFormatEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
case 'languages':
|
||||
result.languages.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(LanguageEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
case 'paymentTypes':
|
||||
result.paymentTypes.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(PaymentTypeEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
case 'countries':
|
||||
result.countries.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(CountryEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
case 'invoiceStatus':
|
||||
result.invoiceStatus.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(InvoiceStatusEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
case 'frequencies':
|
||||
result.frequencies.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(FrequencyEntity)]))
|
||||
as BuiltList);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result.build();
|
||||
}
|
||||
}
|
||||
|
||||
class _$StaticState extends StaticState {
|
||||
@override
|
||||
final BuiltList<CurrencyEntity> currencies;
|
||||
@override
|
||||
final BuiltList<SizeEntity> sizes;
|
||||
@override
|
||||
final BuiltList<IndustryEntity> industries;
|
||||
@override
|
||||
final BuiltList<TimezoneEntity> timezones;
|
||||
@override
|
||||
final BuiltList<DateFormatEntity> dateFormats;
|
||||
@override
|
||||
final BuiltList<DatetimeFormatEntity> datetimeFormats;
|
||||
@override
|
||||
final BuiltList<LanguageEntity> languages;
|
||||
@override
|
||||
final BuiltList<PaymentTypeEntity> paymentTypes;
|
||||
@override
|
||||
final BuiltList<CountryEntity> countries;
|
||||
@override
|
||||
final BuiltList<InvoiceStatusEntity> invoiceStatus;
|
||||
@override
|
||||
final BuiltList<FrequencyEntity> frequencies;
|
||||
|
||||
factory _$StaticState([void updates(StaticStateBuilder b)]) =>
|
||||
(new StaticStateBuilder()..update(updates)).build();
|
||||
|
||||
_$StaticState._(
|
||||
{this.currencies,
|
||||
this.sizes,
|
||||
this.industries,
|
||||
this.timezones,
|
||||
this.dateFormats,
|
||||
this.datetimeFormats,
|
||||
this.languages,
|
||||
this.paymentTypes,
|
||||
this.countries,
|
||||
this.invoiceStatus,
|
||||
this.frequencies})
|
||||
: super._() {
|
||||
if (currencies == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'currencies');
|
||||
if (sizes == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'sizes');
|
||||
if (industries == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'industries');
|
||||
if (timezones == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'timezones');
|
||||
if (dateFormats == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'dateFormats');
|
||||
if (datetimeFormats == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'datetimeFormats');
|
||||
if (languages == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'languages');
|
||||
if (paymentTypes == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'paymentTypes');
|
||||
if (countries == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'countries');
|
||||
if (invoiceStatus == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'invoiceStatus');
|
||||
if (frequencies == null)
|
||||
throw new BuiltValueNullFieldError('StaticState', 'frequencies');
|
||||
}
|
||||
|
||||
@override
|
||||
StaticState rebuild(void updates(StaticStateBuilder b)) =>
|
||||
(toBuilder()..update(updates)).build();
|
||||
|
||||
@override
|
||||
StaticStateBuilder toBuilder() => new StaticStateBuilder()..replace(this);
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
if (identical(other, this)) return true;
|
||||
if (other is! StaticState) return false;
|
||||
return currencies == other.currencies &&
|
||||
sizes == other.sizes &&
|
||||
industries == other.industries &&
|
||||
timezones == other.timezones &&
|
||||
dateFormats == other.dateFormats &&
|
||||
datetimeFormats == other.datetimeFormats &&
|
||||
languages == other.languages &&
|
||||
paymentTypes == other.paymentTypes &&
|
||||
countries == other.countries &&
|
||||
invoiceStatus == other.invoiceStatus &&
|
||||
frequencies == other.frequencies;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return $jf($jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc(
|
||||
$jc($jc(0, currencies.hashCode),
|
||||
sizes.hashCode),
|
||||
industries.hashCode),
|
||||
timezones.hashCode),
|
||||
dateFormats.hashCode),
|
||||
datetimeFormats.hashCode),
|
||||
languages.hashCode),
|
||||
paymentTypes.hashCode),
|
||||
countries.hashCode),
|
||||
invoiceStatus.hashCode),
|
||||
frequencies.hashCode));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (newBuiltValueToStringHelper('StaticState')
|
||||
..add('currencies', currencies)
|
||||
..add('sizes', sizes)
|
||||
..add('industries', industries)
|
||||
..add('timezones', timezones)
|
||||
..add('dateFormats', dateFormats)
|
||||
..add('datetimeFormats', datetimeFormats)
|
||||
..add('languages', languages)
|
||||
..add('paymentTypes', paymentTypes)
|
||||
..add('countries', countries)
|
||||
..add('invoiceStatus', invoiceStatus)
|
||||
..add('frequencies', frequencies))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class StaticStateBuilder implements Builder<StaticState, StaticStateBuilder> {
|
||||
_$StaticState _$v;
|
||||
|
||||
ListBuilder<CurrencyEntity> _currencies;
|
||||
ListBuilder<CurrencyEntity> get currencies =>
|
||||
_$this._currencies ??= new ListBuilder<CurrencyEntity>();
|
||||
set currencies(ListBuilder<CurrencyEntity> currencies) =>
|
||||
_$this._currencies = currencies;
|
||||
|
||||
ListBuilder<SizeEntity> _sizes;
|
||||
ListBuilder<SizeEntity> get sizes =>
|
||||
_$this._sizes ??= new ListBuilder<SizeEntity>();
|
||||
set sizes(ListBuilder<SizeEntity> sizes) => _$this._sizes = sizes;
|
||||
|
||||
ListBuilder<IndustryEntity> _industries;
|
||||
ListBuilder<IndustryEntity> get industries =>
|
||||
_$this._industries ??= new ListBuilder<IndustryEntity>();
|
||||
set industries(ListBuilder<IndustryEntity> industries) =>
|
||||
_$this._industries = industries;
|
||||
|
||||
ListBuilder<TimezoneEntity> _timezones;
|
||||
ListBuilder<TimezoneEntity> get timezones =>
|
||||
_$this._timezones ??= new ListBuilder<TimezoneEntity>();
|
||||
set timezones(ListBuilder<TimezoneEntity> timezones) =>
|
||||
_$this._timezones = timezones;
|
||||
|
||||
ListBuilder<DateFormatEntity> _dateFormats;
|
||||
ListBuilder<DateFormatEntity> get dateFormats =>
|
||||
_$this._dateFormats ??= new ListBuilder<DateFormatEntity>();
|
||||
set dateFormats(ListBuilder<DateFormatEntity> dateFormats) =>
|
||||
_$this._dateFormats = dateFormats;
|
||||
|
||||
ListBuilder<DatetimeFormatEntity> _datetimeFormats;
|
||||
ListBuilder<DatetimeFormatEntity> get datetimeFormats =>
|
||||
_$this._datetimeFormats ??= new ListBuilder<DatetimeFormatEntity>();
|
||||
set datetimeFormats(ListBuilder<DatetimeFormatEntity> datetimeFormats) =>
|
||||
_$this._datetimeFormats = datetimeFormats;
|
||||
|
||||
ListBuilder<LanguageEntity> _languages;
|
||||
ListBuilder<LanguageEntity> get languages =>
|
||||
_$this._languages ??= new ListBuilder<LanguageEntity>();
|
||||
set languages(ListBuilder<LanguageEntity> languages) =>
|
||||
_$this._languages = languages;
|
||||
|
||||
ListBuilder<PaymentTypeEntity> _paymentTypes;
|
||||
ListBuilder<PaymentTypeEntity> get paymentTypes =>
|
||||
_$this._paymentTypes ??= new ListBuilder<PaymentTypeEntity>();
|
||||
set paymentTypes(ListBuilder<PaymentTypeEntity> paymentTypes) =>
|
||||
_$this._paymentTypes = paymentTypes;
|
||||
|
||||
ListBuilder<CountryEntity> _countries;
|
||||
ListBuilder<CountryEntity> get countries =>
|
||||
_$this._countries ??= new ListBuilder<CountryEntity>();
|
||||
set countries(ListBuilder<CountryEntity> countries) =>
|
||||
_$this._countries = countries;
|
||||
|
||||
ListBuilder<InvoiceStatusEntity> _invoiceStatus;
|
||||
ListBuilder<InvoiceStatusEntity> get invoiceStatus =>
|
||||
_$this._invoiceStatus ??= new ListBuilder<InvoiceStatusEntity>();
|
||||
set invoiceStatus(ListBuilder<InvoiceStatusEntity> invoiceStatus) =>
|
||||
_$this._invoiceStatus = invoiceStatus;
|
||||
|
||||
ListBuilder<FrequencyEntity> _frequencies;
|
||||
ListBuilder<FrequencyEntity> get frequencies =>
|
||||
_$this._frequencies ??= new ListBuilder<FrequencyEntity>();
|
||||
set frequencies(ListBuilder<FrequencyEntity> frequencies) =>
|
||||
_$this._frequencies = frequencies;
|
||||
|
||||
StaticStateBuilder();
|
||||
|
||||
StaticStateBuilder get _$this {
|
||||
if (_$v != null) {
|
||||
_currencies = _$v.currencies?.toBuilder();
|
||||
_sizes = _$v.sizes?.toBuilder();
|
||||
_industries = _$v.industries?.toBuilder();
|
||||
_timezones = _$v.timezones?.toBuilder();
|
||||
_dateFormats = _$v.dateFormats?.toBuilder();
|
||||
_datetimeFormats = _$v.datetimeFormats?.toBuilder();
|
||||
_languages = _$v.languages?.toBuilder();
|
||||
_paymentTypes = _$v.paymentTypes?.toBuilder();
|
||||
_countries = _$v.countries?.toBuilder();
|
||||
_invoiceStatus = _$v.invoiceStatus?.toBuilder();
|
||||
_frequencies = _$v.frequencies?.toBuilder();
|
||||
_$v = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@override
|
||||
void replace(StaticState other) {
|
||||
if (other == null) throw new ArgumentError.notNull('other');
|
||||
_$v = other as _$StaticState;
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void updates(StaticStateBuilder b)) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@override
|
||||
_$StaticState build() {
|
||||
_$StaticState _$result;
|
||||
try {
|
||||
_$result = _$v ??
|
||||
new _$StaticState._(
|
||||
currencies: currencies.build(),
|
||||
sizes: sizes.build(),
|
||||
industries: industries.build(),
|
||||
timezones: timezones.build(),
|
||||
dateFormats: dateFormats.build(),
|
||||
datetimeFormats: datetimeFormats.build(),
|
||||
languages: languages.build(),
|
||||
paymentTypes: paymentTypes.build(),
|
||||
countries: countries.build(),
|
||||
invoiceStatus: invoiceStatus.build(),
|
||||
frequencies: frequencies.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
try {
|
||||
_$failedField = 'currencies';
|
||||
currencies.build();
|
||||
_$failedField = 'sizes';
|
||||
sizes.build();
|
||||
_$failedField = 'industries';
|
||||
industries.build();
|
||||
_$failedField = 'timezones';
|
||||
timezones.build();
|
||||
_$failedField = 'dateFormats';
|
||||
dateFormats.build();
|
||||
_$failedField = 'datetimeFormats';
|
||||
datetimeFormats.build();
|
||||
_$failedField = 'languages';
|
||||
languages.build();
|
||||
_$failedField = 'paymentTypes';
|
||||
paymentTypes.build();
|
||||
_$failedField = 'countries';
|
||||
countries.build();
|
||||
_$failedField = 'invoiceStatus';
|
||||
invoiceStatus.build();
|
||||
_$failedField = 'frequencies';
|
||||
frequencies.build();
|
||||
} catch (e) {
|
||||
throw new BuiltValueNestedFieldError(
|
||||
'StaticState', _$failedField, e.toString());
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
replace(_$result);
|
||||
return _$result;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,13 +4,13 @@ import 'package:flutter_redux/flutter_redux.dart';
|
|||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:invoiceninja/data/models/models.dart';
|
||||
import 'package:invoiceninja/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja/redux/invoice/invoice_selectors.dart';
|
||||
import 'package:invoiceninja/ui/app/actions_menu_button.dart';
|
||||
import 'package:invoiceninja/ui/app/icon_message.dart';
|
||||
import 'package:invoiceninja/ui/app/invoice/invoice_item_view.dart';
|
||||
import 'package:invoiceninja/ui/app/two_value_header.dart';
|
||||
import 'package:invoiceninja/ui/invoice/view/invoice_view_vm.dart';
|
||||
import 'package:invoiceninja/utils/localization.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class InvoiceView extends StatefulWidget {
|
||||
final InvoiceViewVM viewModel;
|
||||
|
|
@ -33,15 +33,6 @@ class _InvoiceViewState extends State<InvoiceView> {
|
|||
var invoice = viewModel.invoice;
|
||||
var client = viewModel.client;
|
||||
|
||||
_launchURL() async {
|
||||
var url = 'http://www.google.com';
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url, forceSafariVC: false, forceWebView: false);
|
||||
} else {
|
||||
throw '${localization.couldNotLaunch}';
|
||||
}
|
||||
}
|
||||
|
||||
_buildView() {
|
||||
var invoice = widget.viewModel.invoice;
|
||||
var widgets = <Widget>[
|
||||
|
|
@ -54,6 +45,7 @@ class _InvoiceViewState extends State<InvoiceView> {
|
|||
];
|
||||
|
||||
Map<String, String> fields = {
|
||||
//InvoiceFields.invoiceStatusId: invoiceStatusSelector(invoice, store.state.),
|
||||
InvoiceFields.invoiceDate: invoice.invoiceDate,
|
||||
InvoiceFields.dueDate: invoice.dueDate,
|
||||
InvoiceFields.partial: invoice.partial.toStringAsFixed(2),
|
||||
|
|
|
|||
Loading…
Reference in New Issue