diff --git a/android/app/build.gradle b/android/app/build.gradle
index ffac8b969..81e517607 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 19
- versionName "0.1.17"
+ versionCode 20
+ versionName "0.1.18"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
diff --git a/ios/Runner/Info.plist.example b/ios/Runner/Info.plist.example
index 9dbd492ca..d416e2713 100644
--- a/ios/Runner/Info.plist.example
+++ b/ios/Runner/Info.plist.example
@@ -17,11 +17,11 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.1.17
+ 0.1.18
CFBundleSignature
????
CFBundleVersion
- 19
+ 20
LSRequiresIPhoneOS
UILaunchStoryboardName
diff --git a/lib/constants.dart b/lib/constants.dart
index a658e5588..db3d516d5 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.17';
+const String kAppVersion = '0.1.18';
const String kAppUrl = 'https://app.invoiceninja.com';
const String kSharedPrefEmail = 'email';
diff --git a/lib/data/repositories/persistence_repository.dart b/lib/data/repositories/persistence_repository.dart
index c837850aa..518fdc30b 100644
--- a/lib/data/repositories/persistence_repository.dart
+++ b/lib/data/repositories/persistence_repository.dart
@@ -3,7 +3,6 @@ import 'dart:convert';
import 'dart:core';
import 'dart:io';
import 'package:flutter/foundation.dart';
-import 'package:flutter_keychain/flutter_keychain.dart';
import 'package:invoiceninja_flutter/constants.dart';
import 'package:invoiceninja_flutter/redux/static/static_state.dart';
import 'package:invoiceninja_flutter/redux/auth/auth_state.dart';
@@ -12,6 +11,7 @@ import 'package:invoiceninja_flutter/redux/ui/ui_state.dart';
import 'package:meta/meta.dart';
import 'package:invoiceninja_flutter/data/models/serializers.dart';
import 'package:invoiceninja_flutter/data/file_storage.dart';
+import 'package:shared_preferences/shared_preferences.dart';
class PersistenceRepository {
final FileStorage fileStorage;
@@ -30,8 +30,8 @@ class PersistenceRepository {
Future loadCompanyState(int index) async {
final String data = await fileStorage.load();
- final token =
- await FlutterKeychain.get(key: getKeychainTokenKey(index - 1)) ?? '';
+ final SharedPreferences prefs = await SharedPreferences.getInstance();
+ final token = prefs.getString(getKeychainTokenKey(index - 1)) ?? '';
final companyState =
serializers.deserializeWith(CompanyState.serializer, json.decode(data));
return companyState.rebuild((b) => b
diff --git a/lib/redux/app/app_middleware.dart b/lib/redux/app/app_middleware.dart
index 53dc3cfb4..a8db79b37 100644
--- a/lib/redux/app/app_middleware.dart
+++ b/lib/redux/app/app_middleware.dart
@@ -20,7 +20,6 @@ import 'package:invoiceninja_flutter/utils/platforms.dart';
import 'package:redux/redux.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
-import 'package:flutter_keychain/flutter_keychain.dart';
List> createStorePersistenceMiddleware([
PersistenceRepository authRepository = const PersistenceRepository(
@@ -185,8 +184,10 @@ Middleware _createLoadState(
}
} catch (error) {
print(error);
- final String token =
- await FlutterKeychain.get(key: getKeychainTokenKey()) ?? '';
+
+ final SharedPreferences prefs = await SharedPreferences.getInstance();
+ final token = prefs.getString(getKeychainTokenKey()) ?? '';
+
if (token.isNotEmpty) {
final Completer completer = Completer();
completer.future.then((_) {
@@ -281,8 +282,9 @@ Middleware _createDataLoaded() {
for (int i = 0; i < data.accounts.length; i++) {
final CompanyEntity company = data.accounts[i];
- await FlutterKeychain.put(
- key: getKeychainTokenKey(i), value: company.token);
+
+ final SharedPreferences prefs = await SharedPreferences.getInstance();
+ prefs.setString(getKeychainTokenKey(i), company.token);
store.dispatch(SelectCompany(i + 1));
store.dispatch(LoadCompanySuccess(company));
@@ -348,8 +350,10 @@ Middleware _createDeleteState(
company4Repository.delete();
company5Repository.delete();
+ final SharedPreferences prefs = await SharedPreferences.getInstance();
+
for (int i=0; i<5; i++) {
- await FlutterKeychain.put(key: getKeychainTokenKey(i), value: '');
+ prefs.setString(getKeychainTokenKey(i), '');
}
next(action);
diff --git a/lib/redux/auth/auth_middleware.dart b/lib/redux/auth/auth_middleware.dart
index 1c821fb1b..debe4deb2 100644
--- a/lib/redux/auth/auth_middleware.dart
+++ b/lib/redux/auth/auth_middleware.dart
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
-import 'package:flutter_keychain/flutter_keychain.dart';
import 'package:invoiceninja_flutter/.env.dart';
import 'package:invoiceninja_flutter/constants.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
@@ -28,25 +27,22 @@ List> createStoreAuthMiddleware([
}
void _saveAuthLocal(dynamic action) async {
- await FlutterKeychain.put(key: kKeychainEmail, value: action.email);
+ final SharedPreferences prefs = await SharedPreferences.getInstance();
+ prefs.setString(kKeychainEmail, action.email);
if (formatApiUrlReadable(action.url) != kAppUrl) {
- await FlutterKeychain.put(
- key: kKeychainUrl, value: formatApiUrlMachine(action.url));
- await FlutterKeychain.put(key: kKeychainSecret, value: action.secret);
+ prefs.setString(kKeychainUrl, formatApiUrlMachine(action.url));
+ prefs.setString(kKeychainSecret, action.secret);
}
}
void _loadAuthLocal(Store store, dynamic action) async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
- final String email = await FlutterKeychain.get(key: kKeychainEmail) ??
- prefs.getString(kSharedPrefEmail) ??
- Config.LOGIN_EMAIL;
- final String url = await FlutterKeychain.get(key: kKeychainUrl) ??
+ final String email = prefs.getString(kSharedPrefEmail) ?? Config.LOGIN_EMAIL;
+ final String url =
formatApiUrlMachine(prefs.getString(kSharedPrefUrl) ?? Config.LOGIN_URL);
- final String secret = await FlutterKeychain.get(key: kKeychainSecret) ??
- prefs.getString(kSharedPrefSecret) ??
- Config.LOGIN_SECRET;
+ final String secret =
+ prefs.getString(kSharedPrefSecret) ?? Config.LOGIN_SECRET;
store.dispatch(UserLoginLoaded(email, url, secret));
final bool enableDarkMode = prefs.getBool(kSharedPrefEnableDarkMode) ?? false;
@@ -133,9 +129,9 @@ Middleware _createRefreshRequest(AuthRepository repository) {
_loadAuthLocal(store, action);
final SharedPreferences prefs = await SharedPreferences.getInstance();
- final String url = await FlutterKeychain.get(key: kKeychainUrl) ??
- formatApiUrlMachine(prefs.getString(kSharedPrefUrl) ?? Config.LOGIN_URL);
- final String token = await FlutterKeychain.get(key: getKeychainTokenKey());
+ final String url = formatApiUrlMachine(
+ prefs.getString(kSharedPrefUrl) ?? Config.LOGIN_URL);
+ final String token = prefs.getString(getKeychainTokenKey());
repository
.refresh(url: url, token: token, platform: action.platform)
diff --git a/pubspec.lock b/pubspec.lock
index 94df4203e..230e5854b 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -84,14 +84,14 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
- version: "6.1.3"
+ version: "6.1.4"
built_value_generator:
dependency: "direct dev"
description:
name: built_value_generator
url: "https://pub.dartlang.org"
source: hosted
- version: "6.1.3"
+ version: "6.1.4"
cached_network_image:
dependency: "direct main"
description:
@@ -200,13 +200,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
- flutter_keychain:
- dependency: "direct main"
- description:
- name: flutter_keychain
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.0.5"
flutter_localizations:
dependency: "direct main"
description: flutter
@@ -258,7 +251,7 @@ packages:
name: google_sign_in
url: "https://pub.dartlang.org"
source: hosted
- version: "3.0.5"
+ version: "3.2.1"
graphs:
dependency: transitive
description:
@@ -419,7 +412,7 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.2.0"
plugin:
dependency: transitive
description:
@@ -482,7 +475,7 @@ packages:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.2"
+ version: "0.4.3"
shelf:
dependency: transitive
description:
@@ -522,7 +515,7 @@ packages:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
- version: "0.9.1+1"
+ version: "0.9.1+2"
source_map_stack_trace:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index ed85af09f..c8d5b2f1a 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: invoiceninja_flutter
description: Mobile app for Invoice Ninja
-version: 0.1.17
+version: 0.1.18
author: Hillel Coren
homepage: https://www.invoiceninja.com
documentation: http://docs.invoiceninja.com
@@ -25,7 +25,6 @@ dependencies:
intl: ^0.15.7
flutter_slidable: ^0.4.6
charts_flutter: ^0.4.0
- flutter_keychain: ^0.0.5
google_sign_in: ^3.0.5
firebase_auth: ^0.5.20
#quick_actions: ^0.2.1