diff --git a/android/app/build.gradle b/android/app/build.gradle
index 873647555..705e99608 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -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"
}
diff --git a/ios/Runner/Info.plist.example b/ios/Runner/Info.plist.example
index 2627125b2..f34718d7d 100644
--- a/ios/Runner/Info.plist.example
+++ b/ios/Runner/Info.plist.example
@@ -17,11 +17,11 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.1.34
+ 0.1.35
CFBundleSignature
????
CFBundleVersion
- 34
+ 35
LSRequiresIPhoneOS
UILaunchStoryboardName
diff --git a/lib/.env.dart.example b/lib/.env.dart.example
index 941ed171f..8238334e4 100644
--- a/lib/.env.dart.example
+++ b/lib/.env.dart.example
@@ -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 = '';
}
diff --git a/lib/constants.dart b/lib/constants.dart
index 71665bc2b..ac233ebaf 100644
--- a/lib/constants.dart
+++ b/lib/constants.dart
@@ -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 =
diff --git a/lib/main.dart b/lib/main.dart
index 40bae8e79..3e4456e3b 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -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;
diff --git a/lib/redux/app/app_middleware.dart b/lib/redux/app/app_middleware.dart
index a8db79b37..f9a43034e 100644
--- a/lib/redux/app/app_middleware.dart
+++ b/lib/redux/app/app_middleware.dart
@@ -286,11 +286,11 @@ Middleware _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);
diff --git a/lib/redux/app/app_state.dart b/lib/redux/app/app_state.dart
index 9636b9847..0798beb57 100644
--- a/lib/redux/app/app_state.dart
+++ b/lib/redux/app/app_state.dart
@@ -173,6 +173,7 @@ abstract class AppState implements Built {
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}';
}
}
diff --git a/lib/redux/company/company_actions.dart b/lib/redux/company/company_actions.dart
index e03348b7c..8b86bdac4 100644
--- a/lib/redux/company/company_actions.dart
+++ b/lib/redux/company/company_actions.dart
@@ -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 {
diff --git a/lib/redux/company/company_reducer.dart b/lib/redux/company/company_reducer.dart
index 087ff4ceb..a71d2d92b 100644
--- a/lib/redux/company/company_reducer.dart
+++ b/lib/redux/company/company_reducer.dart
@@ -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)));
}
diff --git a/lib/redux/dashboard/dashboard_reducer.dart b/lib/redux/dashboard/dashboard_reducer.dart
index 726840ed1..5faa225a0 100644
--- a/lib/redux/dashboard/dashboard_reducer.dart
+++ b/lib/redux/dashboard/dashboard_reducer.dart
@@ -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;
diff --git a/lib/redux/dashboard/dashboard_state.dart b/lib/redux/dashboard/dashboard_state.dart
index f1bdc334f..c1cec7faa 100644
--- a/lib/redux/dashboard/dashboard_state.dart
+++ b/lib/redux/dashboard/dashboard_state.dart
@@ -43,7 +43,7 @@ abstract class DashboardState
abstract class DashboardUIState
implements Built {
- 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,
);
}
diff --git a/lib/redux/payment/payment_state.dart b/lib/redux/payment/payment_state.dart
index 5cf98ef65..2d0af2acf 100644
--- a/lib/redux/payment/payment_state.dart
+++ b/lib/redux/payment/payment_state.dart
@@ -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 {
- factory PaymentUIState(CompanyEntity company) {
+ factory PaymentUIState() {
return _$PaymentUIState._(
listUIState: ListUIState(PaymentFields.paymentDate, sortAscending: false),
- editing: PaymentEntity(company: company),
+ editing: PaymentEntity(),
selectedId: 0,
);
}
diff --git a/lib/redux/ui/ui_state.dart b/lib/redux/ui/ui_state.dart
index 6becd6691..5e6084af8 100644
--- a/lib/redux/ui/ui_state.dart
+++ b/lib/redux/ui/ui_state.dart
@@ -28,14 +28,14 @@ abstract class UIState implements Built {
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(),
);
}
diff --git a/lib/ui/app/app_drawer.dart b/lib/ui/app/app_drawer.dart
index 9ed4b7e61..a93b5658f 100644
--- a/lib/ui/app/app_drawer.dart
+++ b/lib/ui/app/app_drawer.dart
@@ -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]);
},
),
)
diff --git a/lib/ui/app/app_drawer_vm.dart b/lib/ui/app/app_drawer_vm.dart
index da861ab35..551e01ab5 100644
--- a/lib/ui/app/app_drawer_vm.dart
+++ b/lib/ui/app/app_drawer_vm.dart
@@ -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 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();
},
);
diff --git a/pubspec.yaml b/pubspec.yaml
index e5a2b2d1a..dbc2f5cdb 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -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