forked from Customrombay/database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync_with_havoc_os.dart
62 lines (57 loc) · 2.19 KB
/
sync_with_havoc_os.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import 'dart:io';
import 'package:yaml/yaml.dart';
import 'tools/add_to_support.dart';
import 'tools/extended_codename_creator.dart';
import 'tools/is_supported.dart';
void main() async {
stdout.write("Cloning https://github.com/Havoc-OS/OTA.git...");
int numberOfCovered = 0;
int numberOfNotCovered = 0;
List<String> listOfNotCovered = [];
List<String> listOfCovered = [];
Directory cacheDir = Directory(".cache/HavocOSSync");
if (cacheDir.existsSync()) {
cacheDir.deleteSync(recursive: true);
}
cacheDir.createSync(recursive: true);
Process.runSync("git", ["clone", "-b", "thirteen", "https://github.com/Havoc-OS/OTA.git", cacheDir.path]);
stdout.write("OK\n");
Directory gappsDir = Directory("${cacheDir.path}/gapps");
for (FileSystemEntity deviceFile in gappsDir.listSync()){
if (deviceFile is File) {
stdout.write("${deviceFile.path}\n");
String deviceFileContent = await deviceFile.readAsString();
YamlMap ydoc = loadYaml(deviceFileContent);
String readVendor = ydoc["oem"];
String readCodename = ydoc["codename"];
String romType = ydoc["romtype"];
String extendedCodename = extendedCodenameCreator(readCodename: readCodename, readVendor: readVendor);
stdout.write("$extendedCodename\n");
if (romType != "Official") {
throw Exception();
}
if (isSupported(extendedCodename: extendedCodename) && !listOfCovered.contains(extendedCodename)) {
numberOfCovered += 1;
listOfCovered += [extendedCodename];
addToSupport(
extendedCodename: extendedCodename,
romName: "HavocOS",
romState: "Official",
romSupport: true,
androidVersion: "13",
romWebpage: "https://havoc-os.com/",
deviceWebpage: "https://havoc-os.com/device#$readCodename"
);
}
else if (!listOfNotCovered.contains(extendedCodename) && !listOfCovered.contains(extendedCodename)) {
numberOfNotCovered += 1;
listOfNotCovered += [extendedCodename];
}
}
}
stdout.write("Covered: $numberOfCovered\n");
stdout.write("Not covered: $numberOfNotCovered\n");
for (var device in listOfNotCovered) {
stdout.write("$device\n");
}
}