@@ -23,19 +23,26 @@ Future<void> _fromV12ToV13() async {
23
23
if (appAccount != null && appAccount.isNotEmpty) {
24
24
String ? newAppAccount;
25
25
if (appAccount.contains ('"apiType":"Pronote"' )) {
26
- newAppAccount = appAccount.replaceAll ('"apiType":"Pronote"' , '"apiType":"pronote"' );
26
+ newAppAccount =
27
+ appAccount.replaceAll ('"apiType":"Pronote"' , '"apiType":"pronote"' );
27
28
} else if (appAccount.contains ('"apiType":"EcoleDirecte"' )) {
28
- newAppAccount = appAccount.replaceAll ('"apiType":"EcoleDirecte"' , '"apiType":"ecoleDirecte"' );
29
+ newAppAccount = appAccount.replaceAll (
30
+ '"apiType":"EcoleDirecte"' , '"apiType":"ecoleDirecte"' );
29
31
}
30
32
if (newAppAccount != null ) {
31
33
await KVS .write (key: "appAccount" , value: newAppAccount);
32
34
}
33
35
}
36
+
34
37
// As the logging system changed, the `logs.txt` file is no longer useful.
35
38
final directory = await FileStorage .getAppDirectory ();
36
39
final File file = File ("${directory .path }/logs.txt" );
37
40
if (await file.exists ()) {
38
- await file.delete ();
41
+ try {
42
+ await file.delete ();
43
+ } catch (e) {
44
+ Logger .error (e);
45
+ }
39
46
}
40
47
// There was an issue with new logs that can be corrupted.
41
48
// In order to get the new system working, the old `logs` folder
@@ -49,7 +56,8 @@ Future<void> _fromV12ToV13() async {
49
56
}
50
57
await KVS .write (key: "logsReset0" , value: "true" );
51
58
} catch (e) {
52
- Logger .log ("BACKWARD COMPATIBILITY" , "Error while deleting logs folder: $e " );
59
+ Logger .log (
60
+ "BACKWARD COMPATIBILITY" , "Error while deleting logs folder: $e " );
53
61
}
54
62
}
55
63
// Logging is done in another check because the logs would have been removed
@@ -72,7 +80,8 @@ Future<void> _fromV13ToV14() async {
72
80
// await LogsManager.deleteLogs();
73
81
await KVS .write (key: "logsReset2" , value: "true" );
74
82
} catch (e) {
75
- Logger .log ("BACKWARD COMPATIBILITY" , "Error while deleting logs folder: $e " );
83
+ Logger .log (
84
+ "BACKWARD COMPATIBILITY" , "Error while deleting logs folder: $e " );
76
85
}
77
86
}
78
87
// Logging is done in another check because the logs would have been removed
@@ -89,8 +98,12 @@ Future<void> _fromV14ToV15() async {
89
98
final bool fullReset0 = (await KVS .read (key: "fullReset0" )) == "true" ;
90
99
if (! fullReset0) {
91
100
await KVS .deleteAll ();
92
- final Directory dir = await FileStorage .getAppDirectory ();
93
- dir.deleteSync (recursive: true );
94
- await KVS .write (key: "fullReset0" , value: "true" );
101
+ try {
102
+ final Directory dir = await FileStorage .getAppDirectory ();
103
+ dir.deleteSync (recursive: true );
104
+ await KVS .write (key: "fullReset0" , value: "true" );
105
+ } catch (e) {
106
+ Logger .error (e);
107
+ }
95
108
}
96
109
}
0 commit comments