Dashboard bug fixes

This commit is contained in:
Hillel Coren 2019-02-07 20:49:03 +02:00
parent 06218d6fab
commit 3c8d738d28
16 changed files with 31 additions and 27 deletions

View File

@ -29,8 +29,8 @@ android {
applicationId "com.invoiceninja.flutter"
minSdkVersion 18
targetSdkVersion 27
versionCode 34
versionName "0.1.34"
versionCode 35
versionName "0.1.35"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

View File

@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.34</string>
<string>0.1.35</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>34</string>
<string>35</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>

View File

@ -5,4 +5,5 @@ class Config {
static const String LOGIN_SECRET = 'secret';
static const String API_SECRET = 'secret';
static const String SENTRY_DNS = '';
static const String PLATFORM = '';
}

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
// This version must be updated in tandem with the pubspec version.
const String kAppVersion = '0.1.34';
const String kAppVersion = '0.1.35';
const String kAppUrl = 'https://app.invoiceninja.com';
const String kAppleStoreUrl =

View File

@ -70,6 +70,7 @@ void main() async {
dsn: Config.SENTRY_DNS,
environmentAttributes: Event(
release: kAppVersion,
environment: Config.PLATFORM,
));
final prefs = await SharedPreferences.getInstance();
final enableDarkMode = prefs.getBool(kSharedPrefEnableDarkMode) ?? false;

View File

@ -286,11 +286,11 @@ Middleware<AppState> _createDataLoaded() {
final SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString(getKeychainTokenKey(i), company.token);
store.dispatch(SelectCompany(i + 1));
store.dispatch(SelectCompany(i + 1, company));
store.dispatch(LoadCompanySuccess(company));
}
store.dispatch(SelectCompany(1));
store.dispatch(SelectCompany(1, data.accounts[0]));
store.dispatch(UserLoginSuccess());
action.completer.complete(null);

View File

@ -173,6 +173,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
String toString() {
//return 'Is Loading: ${this.isLoading}, Invoice: ${this.invoiceUIState.selected}';
//return 'Date Formats: ${staticState.dateFormatMap}';
return 'Route: ${uiState.currentRoute}';
return 'Company Currency Id: ${selectedCompany.currencyId}, Dashboard Currency Id: ${uiState.dashboardUIState.currencyId}';
//return 'Route: ${uiState.currentRoute}';
}
}

View File

@ -1,9 +1,10 @@
import 'package:invoiceninja_flutter/data/models/models.dart';
class SelectCompany {
SelectCompany(this.companyIndex);
SelectCompany(this.companyIndex, this.company);
final int companyIndex;
final CompanyEntity company;
}
class LoadCompanySuccess {

View File

@ -29,12 +29,9 @@ CompanyState companyReducer(CompanyState state, dynamic action) {
..productState.replace(productsReducer(state.productState, action))
..invoiceState.replace(invoicesReducer(state.invoiceState, action))
// STARTER: reducer - do not remove comment
..taskState.replace(tasksReducer(state.taskState, action))
..projectState.replace(projectsReducer(state.projectState, action))
..paymentState.replace(paymentsReducer(state.paymentState, action))
..taskState.replace(tasksReducer(state.taskState, action))
..projectState.replace(projectsReducer(state.projectState, action))
..paymentState.replace(paymentsReducer(state.paymentState, action))
..quoteState.replace(quotesReducer(state.quoteState, action)));
}

View File

@ -1,3 +1,4 @@
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';
@ -31,6 +32,8 @@ DashboardUIState dashboardUIReducer(DashboardUIState state, dynamic action) {
} else if (action.currencyId != null) {
return state.rebuild((b) => b..currencyId = action.currencyId);
}
} else if (action is SelectCompany) {
return state.rebuild((b) => b..currencyId = action.company.currencyId);
}
return state;

View File

@ -43,7 +43,7 @@ abstract class DashboardState
abstract class DashboardUIState
implements Built<DashboardUIState, DashboardUIStateBuilder> {
factory DashboardUIState(CompanyEntity company) {
factory DashboardUIState() {
return _$DashboardUIState._(
dateRange: DateRange.last30Days,
customStartDate: '',
@ -53,7 +53,7 @@ abstract class DashboardUIState
compareCustomStartDate: '',
compareCustomEndDate: convertDateTimeToSqlDate(),
offset: 0,
currencyId: company.currencyId,
currencyId: 0,
);
}

View File

@ -2,7 +2,6 @@ import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:built_collection/built_collection.dart';
import 'package:invoiceninja_flutter/constants.dart';
import 'package:invoiceninja_flutter/data/models/company_model.dart';
import 'package:invoiceninja_flutter/data/models/payment_model.dart';
import 'package:invoiceninja_flutter/redux/ui/entity_ui_state.dart';
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
@ -45,10 +44,10 @@ abstract class PaymentState
abstract class PaymentUIState extends Object
with EntityUIState
implements Built<PaymentUIState, PaymentUIStateBuilder> {
factory PaymentUIState(CompanyEntity company) {
factory PaymentUIState() {
return _$PaymentUIState._(
listUIState: ListUIState(PaymentFields.paymentDate, sortAscending: false),
editing: PaymentEntity(company: company),
editing: PaymentEntity(),
selectedId: 0,
);
}

View File

@ -28,14 +28,14 @@ abstract class UIState implements Built<UIState, UIStateBuilder> {
requireAuthentication: requireAuthentication ?? false,
emailPayment: false,
autoStartTasks: false,
dashboardUIState: DashboardUIState(company),
dashboardUIState: DashboardUIState(),
productUIState: ProductUIState(),
clientUIState: ClientUIState(),
invoiceUIState: InvoiceUIState(),
// STARTER: constructor - do not remove comment
taskUIState: TaskUIState(),
projectUIState: ProjectUIState(),
paymentUIState: PaymentUIState(company),
paymentUIState: PaymentUIState(),
quoteUIState: QuoteUIState(),
);
}

View File

@ -74,7 +74,8 @@ class AppDrawer extends StatelessWidget {
))
.toList(),
onChanged: (value) {
viewModel.onCompanyChanged(context, value);
viewModel.onCompanyChanged(
context, value, viewModel.companies[int.parse(value) - 1]);
},
),
)

View File

@ -37,7 +37,7 @@ class AppDrawerVM {
final CompanyEntity selectedCompany;
final UserEntity user;
final String selectedCompanyIndex;
final Function(BuildContext context, String) onCompanyChanged;
final Function(BuildContext context, String, CompanyEntity) onCompanyChanged;
final bool isLoading;
static AppDrawerVM fromStore(Store<AppState> store) {
@ -49,8 +49,8 @@ class AppDrawerVM {
user: state.user,
selectedCompany: state.selectedCompany,
selectedCompanyIndex: state.uiState.selectedCompanyIndex.toString(),
onCompanyChanged: (BuildContext context, String companyIndex) {
store.dispatch(SelectCompany(int.parse(companyIndex)));
onCompanyChanged: (BuildContext context, String companyIndex, CompanyEntity company) {
store.dispatch(SelectCompany(int.parse(companyIndex), company));
AppBuilder.of(context).rebuild();
},
);

View File

@ -1,6 +1,6 @@
name: invoiceninja_flutter
description: Mobile app for Invoice Ninja
version: 0.1.34
version: 0.1.35
author: Hillel Coren
homepage: https://www.invoiceninja.com
documentation: http://docs.invoiceninja.com