Skip to content

Commit f7ea4c5

Browse files
author
Luis Ciber
committed
Fixing bugs
1 parent 3617f85 commit f7ea4c5

File tree

7 files changed

+122
-47
lines changed

7 files changed

+122
-47
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# Historial de Cambios
22

33
## 2.0.0
4+
5+
Cambios en la interfaz de usuario.
6+
Agregada pantalla de acciones recientes.

lib/app/data/repositories/ussd_repository.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:connectivity_plus/connectivity_plus.dart';
12
import 'package:injectable/injectable.dart';
23
import 'package:todo/app/app.dart';
34

@@ -8,19 +9,23 @@ class UssdRepository {
89
this._localDatasource,
910
this._remoteDatasource,
1011
this._recentDatasource,
12+
this._connectivity,
1113
);
1214

1315
final UssdAssetsDatasource _assetsDatasource;
1416
final UssdLocalDatasource _localDatasource;
1517
final UssdRemoteDatasource _remoteDatasource;
1618
final UssdRecentDatasource _recentDatasource;
19+
final Connectivity _connectivity;
1720

1821
Future<Result<List<UssdItem>>> getUssdCodes() async {
1922
try {
2023
final lastDay = await _localDatasource.getDay();
2124
final actualDay = DateTime.now().day;
2225

23-
if (lastDay != actualDay) {
26+
final status = await _connectivity.checkConnectivity();
27+
28+
if (lastDay != actualDay && status != ConnectivityResult.none) {
2429
final result = await getUssdCodesRemote();
2530

2631
return result.when(

lib/app/dependencies/dependencies.config.dart

Lines changed: 48 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/app/dependencies/dependencies.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:connectivity_plus/connectivity_plus.dart';
12
import 'package:get_it/get_it.dart';
23
import 'package:injectable/injectable.dart';
34
import 'package:path/path.dart';
@@ -14,6 +15,8 @@ abstract class RegisterModule {
1415
@preResolve
1516
Future<SharedPreferences> get prefs => SharedPreferences.getInstance();
1617

18+
Connectivity get connectivity => Connectivity();
19+
1720
@preResolve
1821
Future<Database> get database async {
1922
return openDatabase(

lib/ussd_codes/widgets/ussd_code_form.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ class _UssdCodeFormState extends State<UssdCodeForm> {
144144
if (cant.isNegative) {
145145
return l10n.greaterZero;
146146
}
147-
if (value.split('.')[1].length > 2) {
147+
148+
final doubleValue = value.split('.');
149+
150+
if (doubleValue.length > 1 &&
151+
doubleValue[1].length > 2) {
148152
return l10n.onlyMonetaryValues;
149153
}
150154
} on Exception {

pubspec.lock

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,48 @@ packages:
176176
url: "https://pub.dartlang.org"
177177
source: hosted
178178
version: "3.0.0"
179+
connectivity_plus:
180+
dependency: "direct main"
181+
description:
182+
name: connectivity_plus
183+
url: "https://pub.dartlang.org"
184+
source: hosted
185+
version: "2.0.2"
186+
connectivity_plus_linux:
187+
dependency: transitive
188+
description:
189+
name: connectivity_plus_linux
190+
url: "https://pub.dartlang.org"
191+
source: hosted
192+
version: "1.1.0"
193+
connectivity_plus_macos:
194+
dependency: transitive
195+
description:
196+
name: connectivity_plus_macos
197+
url: "https://pub.dartlang.org"
198+
source: hosted
199+
version: "1.2.1"
200+
connectivity_plus_platform_interface:
201+
dependency: transitive
202+
description:
203+
name: connectivity_plus_platform_interface
204+
url: "https://pub.dartlang.org"
205+
source: hosted
206+
version: "1.1.0"
207+
connectivity_plus_web:
208+
dependency: transitive
209+
description:
210+
name: connectivity_plus_web
211+
url: "https://pub.dartlang.org"
212+
source: hosted
213+
version: "1.1.0+1"
214+
connectivity_plus_windows:
215+
dependency: transitive
216+
description:
217+
name: connectivity_plus_windows
218+
url: "https://pub.dartlang.org"
219+
source: hosted
220+
version: "1.2.0"
179221
contact_picker:
180222
dependency: "direct main"
181223
description:
@@ -220,6 +262,13 @@ packages:
220262
url: "https://pub.dartlang.org"
221263
source: hosted
222264
version: "0.7.1"
265+
dbus:
266+
dependency: transitive
267+
description:
268+
name: dbus
269+
url: "https://pub.dartlang.org"
270+
source: hosted
271+
version: "0.5.6"
223272
dio:
224273
dependency: "direct main"
225274
description:
@@ -569,6 +618,13 @@ packages:
569618
url: "https://pub.dartlang.org"
570619
source: hosted
571620
version: "1.0.0"
621+
nm:
622+
dependency: transitive
623+
description:
624+
name: nm
625+
url: "https://pub.dartlang.org"
626+
source: hosted
627+
version: "0.3.0"
572628
node_preamble:
573629
dependency: transitive
574630
description:

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ environment:
99
dependencies:
1010
beamer: ^0.14.1
1111
bloc: ^7.2.0
12+
connectivity_plus: ^2.0.2
1213
contact_picker:
1314
git:
1415
url: https://github.com/correaleyval/contact_picker

0 commit comments

Comments
 (0)