Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
1.2.2+8
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Correa committed Jul 1, 2020
1 parent c19a3da commit a42c265
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 77 deletions.
21 changes: 8 additions & 13 deletions lib/components/connected_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class _ConnectedFormState extends State<ConnectedForm> {
.checkConnectivity()
.then((value) => updateNetworkState(value));

suscription = Connectivity().onConnectivityChanged.listen(updateNetworkState);
suscription =
Connectivity().onConnectivityChanged.listen(updateNetworkState);

setState(() {
nautaClient = NautaClient(
Expand Down Expand Up @@ -132,16 +133,6 @@ class _ConnectedFormState extends State<ConnectedForm> {
return Container(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.all(4.0),
child: Text(
'Conectado',
style: TextStyle(
color: Theme.of(context).focusColor,
fontSize: 20,
),
),
),
Padding(
padding: EdgeInsets.all(20),
child: Center(
Expand Down Expand Up @@ -182,7 +173,7 @@ class _ConnectedFormState extends State<ConnectedForm> {
color: Theme.of(context).focusColor,
minWidth: MediaQuery.of(context).size.width,
child: Text(
'Salir',
'Cerrar sesión',
style: TextStyle(color: Colors.white),
),
onPressed: () async {
Expand All @@ -191,9 +182,13 @@ class _ConnectedFormState extends State<ConnectedForm> {

try {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.remove('nauta_username');

// Que primero haga logout
await nautaClient.logout();

// Y luego borre la sessión
await prefs.remove('nauta_username');

_timer.cancel();
await pr.hide();

Expand Down
43 changes: 0 additions & 43 deletions lib/pages/connected_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:todo/components/connected_form.dart';
import 'package:connectivity/connectivity.dart';

class ConnectedPage extends StatefulWidget {
ConnectedPage({Key key, this.title = 'Conectado', this.username})
Expand All @@ -14,39 +13,6 @@ class ConnectedPage extends StatefulWidget {
}

class _ConnectedPageState extends State<ConnectedPage> {
String wifiSSID = '';
String wifiIP = '';

var suscription;

@override
void initState() {
super.initState();

Connectivity()
.checkConnectivity()
.then((value) => updateNetworkState(value));

suscription =
Connectivity().onConnectivityChanged.listen(updateNetworkState);
}

updateNetworkState(ConnectivityResult result) async {
final wifiName = await (Connectivity().getWifiName());
final ip = await (Connectivity().getWifiIP());

setState(() {
wifiSSID = wifiName;
wifiIP = ip;
});
}

@override
void dispose() {
suscription.cancel();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -60,15 +26,6 @@ class _ConnectedPageState extends State<ConnectedPage> {
widget.title,
style: TextStyle(fontWeight: FontWeight.bold),
),
background: Container(
color: Theme.of(context).scaffoldBackgroundColor,
child: Center(
child: Text(
'SSID: $wifiSSID IP: $wifiIP',
style: TextStyle(color: Colors.white),
),
),
),
),
elevation: 0,
leading: IconButton(
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/download_ussd_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ class _DownloadUssdPageState extends State<DownloadUssdPage> {
'Body: ${resp.body}',
);
}
Navigator.pushReplacement(
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => HomePage(title: 'TODO')),
(Route<dynamic> route) => false,
);
} catch (e) {
log(e.toString());
Expand Down
18 changes: 0 additions & 18 deletions lib/pages/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ class _LoginPageState extends State<LoginPage> {
String wlanIp;
String ip;

String wifiSSID = '';
String wifiIP = '';

IconData networkIcon;

final _scaffoldKey = GlobalKey<ScaffoldState>();
Expand Down Expand Up @@ -80,13 +77,8 @@ class _LoginPageState extends State<LoginPage> {
networkIcon = Icons.network_cell;
});
} else if (result == ConnectivityResult.wifi) {
final wifiName = await (Connectivity().getWifiName());
final ip = await (Connectivity().getWifiIP());
setState(() {
networkIcon = Icons.wifi_lock;

wifiSSID = wifiName;
wifiIP = ip;
});
} else {
setState(() {
Expand Down Expand Up @@ -164,16 +156,6 @@ class _LoginPageState extends State<LoginPage> {
SliverList(
delegate: SliverChildListDelegate(
[
Container(
height: 18,
color: Theme.of(context).scaffoldBackgroundColor,
child: Center(
child: Text(
'SSID: $wifiSSID IP: $wifiIP',
style: TextStyle(color: Colors.white),
),
),
),
Container(
child: Padding(
padding: EdgeInsets.only(left: 30, right: 30, bottom: 10),
Expand Down
2 changes: 1 addition & 1 deletion nauta_api/lib/src/nauta_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class NautaProtocol {
static Future<SessionObject> createSession() async {
if (await isConnected()) {
if (isLoggedIn()) {
throw NautaPreLoginException("Hay una session abierta");
throw NautaPreLoginException("Hay una sesión abierta");
} else {
throw NautaPreLoginException("Hay una conexion activa");
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.2.2+7
version: 1.2.2+8

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit a42c265

Please sign in to comment.