From 7a0688d358c5de02250930144debd93ed03d1cd3 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Sat, 13 Aug 2022 13:45:25 -0400 Subject: [PATCH] Started init work on source service --- lib/models.dart | 10 ++++++++++ lib/services/source_service.dart | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 lib/models.dart create mode 100644 lib/services/source_service.dart diff --git a/lib/models.dart b/lib/models.dart new file mode 100644 index 0000000..d56aa2f --- /dev/null +++ b/lib/models.dart @@ -0,0 +1,10 @@ +class App { + late String id; + late String url; + String? installedVersion; + late String latestVersion; + String? readmeHTML; + String? base64Icon; + App(this.id, this.url, this.installedVersion, this.latestVersion, + this.readmeHTML, this.base64Icon); +} diff --git a/lib/services/source_service.dart b/lib/services/source_service.dart new file mode 100644 index 0000000..d73f8ec --- /dev/null +++ b/lib/services/source_service.dart @@ -0,0 +1,19 @@ +class SourceService { + SourceService(); +} + +/* +- Make a function that validates and standardizes github URLs, do the same for gitlab (fail = error) +- Make a function that gets the App title and Author name from a github URL, do the same for gitlab (can't fail) +- Make a function that takes a github URL and finds the latest APK release if any (with version), do the same for gitlab (fail = error) +- Make a function that takes a github URL and returns a README HTML if any, do the same for gitlab (fail = "no description") +- Make a function that looks for the first image in a README HTML and returns a small base64 encoded version of it (fail = generic icon) + +- Make a function that integrates all above and returns an App object for a given github URL, do the same for gitlab + +- Make a function that detects the URL (Github or Gitlab) and runs the right function above + +- Make a function that can save/load an App object to/from persistent storage (JSON file with unique App ID as file name) + +- Make a function (using the above fn) that loads an array of all Apps +*/ \ No newline at end of file