This commit is contained in:
Hillel Coren 2019-08-29 10:54:11 +03:00
parent 89f3f314a5
commit bb4de2b31d
5 changed files with 36 additions and 30 deletions

View File

@ -270,7 +270,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
@override
String toString() {
return 'URL: ${authState.url}';
return 'URL: ${authState.url}, ${selectedCompany.plan}';
//return 'Is Testing: ${uiState.isTesting}';
//return 'Route: ${uiState.currentRoute}, Previous: ${uiState.previousRoute}, Layout: ${uiState.layout}, Menu: ${uiState.isMenuVisible}, History: ${uiState.isHistoryVisible}';
}

View File

@ -1,6 +1,7 @@
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:invoiceninja_flutter/constants.dart';
import 'package:invoiceninja_flutter/utils/formatting.dart';
part 'auth_state.g.dart';
@ -34,7 +35,8 @@ abstract class AuthState implements Built<AuthState, AuthStateBuilder> {
String get error;
bool get isHosted =>
isAuthenticated && (url == null || url.isEmpty || url == kAppUrl);
isAuthenticated &&
(cleanApiUrl(url).isEmpty || cleanApiUrl(url) == kAppUrl);
bool get isSelfHost => isAuthenticated && !isHosted;

View File

@ -26,6 +26,7 @@ class LoadingIndicator extends StatelessWidget {
return Container(
height: height,
width: height,
child: Center(
child: CircularProgressIndicator(),
),

View File

@ -5,6 +5,7 @@ import 'package:invoiceninja_flutter/redux/ui/ui_state.dart';
import 'package:invoiceninja_flutter/ui/app/buttons/elevated_button.dart';
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
import 'package:invoiceninja_flutter/ui/app/link_text.dart';
import 'package:invoiceninja_flutter/ui/app/loading_indicator.dart';
import 'package:invoiceninja_flutter/ui/app/progress_button.dart';
import 'package:invoiceninja_flutter/ui/auth/login_vm.dart';
import 'package:invoiceninja_flutter/utils/formatting.dart';
@ -343,34 +344,36 @@ class _LoginState extends State<LoginView> {
),
Padding(
padding: EdgeInsets.only(top: 30, bottom: 10),
child: _createAccount
? ProgressButton(
isLoading: viewModel.isLoading,
label: localization.signUp.toUpperCase(),
onPressed: () => _submitSignUpForm(),
)
: Row(
children: <Widget>[
Expanded(
child: ProgressButton(
isLoading: viewModel.isLoading,
label: localization.emailLogin.toUpperCase(),
onPressed: () => _submitLoginForm(),
),
child: viewModel.isLoading
? LoadingIndicator(height: 50)
: _createAccount
? ElevatedButton(
label: localization.signUp.toUpperCase(),
onPressed: () => _submitSignUpForm(),
)
: Row(
children: <Widget>[
Expanded(
child: ElevatedButton(
label:
localization.emailLogin.toUpperCase(),
onPressed: () => _submitLoginForm(),
),
),
SizedBox(width: 20),
Expanded(
child: ElevatedButton(
label: localization.googleLogin
.toUpperCase(),
onPressed: () =>
viewModel.onGoogleLoginPressed(
context,
_urlController.text,
_secretController.text),
),
),
],
),
SizedBox(width: 20),
Expanded(
child: ElevatedButton(
label: localization.googleLogin.toUpperCase(),
onPressed: () =>
viewModel.onGoogleLoginPressed(
context,
_urlController.text,
_secretController.text),
),
),
],
),
),
SizedBox(height: 6),
if (!isOneTimePassword)

View File

@ -279,7 +279,7 @@ String formatDate(String value, BuildContext context,
String formatApiUrl(String url) => cleanApiUrl(url) + '/api/v1';
String cleanApiUrl(String url) => url
String cleanApiUrl(String url) => (url ?? '')
.trim()
.replaceFirst(RegExp(r'/api/v1'), '')
.replaceFirst(RegExp(r'/$'), '');