Skip to content

Commit

Permalink
Show login button when login fails
Browse files Browse the repository at this point in the history
  • Loading branch information
samapraku committed Sep 10, 2020
1 parent 423631c commit b1557eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 6 additions & 2 deletions lib/pages/loginForm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class LoginFormState extends State<LoginForm> {
if (srv.loggedIn()) {

setState(() => _isLoading = false);

if (await srvrRequest.isExtensionInstalled(_currentServer, "twilio")) {
_currentServer.twilioInstalled = true;
}
Expand All @@ -317,6 +317,7 @@ class LoginFormState extends State<LoginForm> {
if (_currentServer.installationid.isEmpty) {
_showSnackBar("Couldn't find this app's extension at the given url");
}


} catch (e) {
_showSnackBar("Couldn't communicate with the extension on the server.");
Expand All @@ -336,6 +337,7 @@ class LoginFormState extends State<LoginForm> {
_currentServer.departments_ids = user['departments_ids'];
});
}


dbHelper.upsertServer(
_currentServer, "id=?", [_currentServer.id]).then((srvv) {
Expand All @@ -354,8 +356,10 @@ class LoginFormState extends State<LoginForm> {
), (Route<dynamic> route) => false);

});
} else
} else{
setState(() => _isLoading = false);
_showSnackBar("Login was not successful");
}
}

void _showSnackBar(String text) {
Expand Down
10 changes: 5 additions & 5 deletions lib/pages/servers_manage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:livehelp/data/database.dart';
import 'package:livehelp/model/server.dart';
import 'package:livehelp/pages/loginForm.dart';
import 'package:livehelp/pages/main_page.dart';
import 'package:livehelp/utils/routes.dart';
import 'package:livehelp/utils/routes.dart' as LHCRouter;
import 'package:livehelp/utils/server_requests.dart';
import 'package:livehelp/pages/token_inherited_widget.dart';
import 'package:livehelp/widget/server_item_widget.dart';
Expand Down Expand Up @@ -126,8 +126,8 @@ class ServersManageState extends State<ServersManage> {
else {
Navigator.of(context).pop();
Navigator.of(context).pushReplacement(
Router.generateRoute(new RouteSettings(
name: AppRoutes.main, arguments:new RouteArguments(_fcmToken)
LHCRouter.Router.generateRoute(new RouteSettings(
name: LHCRouter.AppRoutes.main, arguments:new LHCRouter.RouteArguments(_fcmToken)
)
)
);
Expand Down Expand Up @@ -155,10 +155,10 @@ class ServersManageState extends State<ServersManage> {

void _addServer({Server svr}) {
//Navigator.of(context).pop();
Navigator.of(context).push(FadeRoute(
Navigator.of(context).push(LHCRouter.FadeRoute(
builder: (BuildContext context) => new TokenInheritedWidget(
token: _fcmToken, child: LoginForm(isNew: true, server: svr,)),
settings: new RouteSettings(name: AppRoutes.login,),
settings: new RouteSettings(name: LHCRouter.AppRoutes.login,),
));
}

Expand Down

1 comment on commit b1557eb

@samapraku
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #17

Please sign in to comment.