Giter Site home page Giter Site logo

0nom4d / guardiandock Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 800 KB

GuardianDock is a mobile app developed with Flutter for IOS and Android that allows Destiny users to check their stats and news about the game.

Kotlin 0.02% Swift 0.10% Objective-C 0.01% Dart 99.69% Ruby 0.19%
bungie-destiny-api destiny2 flutter mobile-app stat-tracking stats

guardiandock's Introduction

GuardianDock

Your stats provided by Guardians for Guardians

Flutter MultiPlatform Build FlutterCI

GuardianDock is a multi-function app for Destiny 2.

GuardianDock goal is to provide a Destiny 2 player to access his stats at the same place:

  • PVE Stats (Strikes, Regular and Grandmaster Nightfalls)
  • PVP Stats (Crucible, Iron Banner, Trials Of Osiris)
  • Raid / Dungeon Stat

History

GuardianDock is an old school project developed with 2 friends: EternalRat and TrueBabyChaise.

The project was a React Native app connected with random APIs for Call Of Duty: Modern Warfare (2019) for Warzone, Fortnite and Destiny 2.

The project knew a first wave of refactoring that I conducted alone but I didn't do much because I tried to make the app with TypeScript and React Native (again).

Author

Contributors

Alt Text

guardiandock's People

Contributors

0nom4d avatar

Watchers

 avatar  avatar

guardiandock's Issues

Persistent Search Bar

With the NewsArticle from the RSS api endpoint on the home view, the search bar should always be available for the user. Thus, we need to implement slivers.

  • Implement a CustomScrollView
  • Implement a PersistentSliverHeader for Persistent Search Bar
  • User should be able to scroll through HomeView without using ListView.builder

User Stat Display - Page header

Now that I handled most of the things I wanted to handle such as API errors, maintenances, API testing with Insomnia and design analysis for the app, I'm going to begin the user's statistics display.

For the header

The stat display page header must display:

  • The chosen user's id
  • The platform he has played on (only handling XBOX, PlayStation, Steam, Blizzard and Stadia)
  • The library I'm using for the icons doesn't have the Blizzard launcher icon so I'm going to use the Activision icon for the moment.
  • The name of his clan.
  • Maybe this clan thing will be integrated in the app but it will be later for obvious reasons.

More informations could be displayed such as titles but I'm not such about that. I'll change that issue if I change my mind.

Build CI

Must build app for IOS and Android

API down handling

During the last months, Bungie API has been downed multiple times. Since the users should be notify for API health status, the app should evolve to provide informations about these errors.

Thus, I need to implement a way to provide informations about the situation and a way to avoid API calls that will systematically return an 500 error.

  • Check if initial Manifest API call returns a 500 error
  • If Manifest API call returns 500 error, cancel every API call made from app
  • If Manifest API call returns 500 error, show a constant error message saying that API is disabled

App Theme

Need to create a Destiny Theme with fonts and colors

Get Destiny Activity Definitions

  • Make request to fetch data for a specific activity hash
  • Make request to fetch data about activity place
  • Make request to fetch data about destination
  • Make request to fetch data about activity type
  • Make request to fetch data for a specific character data
  • Make request to fetch data about character race
  • Make request to fetch data about character gender
  • Make request to fetch data about character class
  • Make request to fetch data for Commendations and Guardian Ranks

Build CI Artifact

On the Build CI for IOS and Android, the CI should now:

  • Upload .apk file as artifact
  • Upload .ipa file as artifact

Article Layout with Tables

I implemented the layout for articles using the Flutter widget from HTML package.

Layout issue

When using this package, I found an issue in my layout when I tested layout with a table.

This issue results in a pixel overflow when the table is built. This also cancels the ability for the user to scroll.

Potential fixes

  • Find a new way of displaying the tables
  • Try to implement horizontal scroll for tables

Better future handling in home view

Current issue

When launching the app, the user will land on the home view. When created the home view has this behaviour:

class _HomeViewState extends State<HomeView> {
List<NewsArticle> fetchedArticles = [];
bool isLoadingNewsArticle = false;
Future<void> getManifest() async => await GetIt.I<ApiClient>().getManifest();
void getNewsArticles() async {
setState(() {
isLoadingNewsArticle = true;
});
fetchedArticles = await GetIt.I<ApiClient>().rss.getLatestArticles('fr');
setState(() {
isLoadingNewsArticle = false;
});
}
@override
void initState() {
super.initState();
getNewsArticles();
}
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: getManifest(),
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {

  • First, we init the state of our view.
  • Then, we're calling an async callback fetching the articles from the Bungie API.
  • Finally, we're calling a FutureBuilder with a Future<void> callback directly with the callback.

This triggers the getManifest() callback twice, making the CircularProgressIndicator appear twice in a row.

In order to comply with Flutter guidelines and to fix this unexpected behaviour, I need to follow the following guideline:

"The future must have been obtained earlier, e.g. during State.initState, State.didUpdateWidget, or State.didChangeDependencies. It must not be created during the State.build or StatelessWidget.build method call when constructing the FutureBuilder. If the future is created at the same time as the FutureBuilder, then every time the FutureBuilder's parent is rebuilt, the asynchronous task will be restarted."

This guideline states that the Future callback directly called from the build method should be created inside the initState method.

Fix

In order to fix this behaviour, I'm going to do the following:

  • Create a Future variable.

This variable should be set as a late variable in order to be created only inside the initState method.

  • "Combining" the 2 Future callback that I'm using by implementing the Future.wait(List) function

This function waits for the number of futures inside the future list and returns a future waiting for both callback to end.

  • Calling my future should not display the CircularProgressIndicator loading the Manifest twice but only once

Player search

User can search for his Bungie gamertag from the interface

Test coverage threshold

When working on that project, I wrote CIs. One for unit testing and the other for build test for Android and iOS.

Unfortunately, I didn't implemented a coverage threshold to avoid code to be not tested enough. This issue should solve the problem with a threshold coverage up to 80%.

  • If coverage is lower than 80%, CI must fail.
  • If coverage is 80% or higher, CI must succeed.

Link Bungie Account with app

  • Handle Bungie API oAuth2 connexion
  • Store tokens into Bungie API
  • Reconnect user when app is closed / suspended / terminated

Display News Articles content

  • When a news article item is clicked, the app should send the user on a new page, showing the article, he's reading
  • The user should be able to go back to the previous page

Test CI Artifacts

After Test CI, the CI should:

  • Upload the tests results as artifacts
  • Fail the run if the test coverage is lower than 85
  • Show the tests coverage percent

CI Secrets

Feature

In order to build a truly functional app for Android and iOS, the build CIs need to have access to the Bungie API Key I'm using.

Unfortunately, at this moment, the API key doesn't have any value in any version of the build application.

Thus, I need to implement the API key inside the build CI. This implement should at least be a bit secure so I'll use the Github Actions secrets as a first secure implementation.

  • Add API key as a secret
  • Implement API key inside the flutter build apk / ipa commands

Router Setup

Using GoRouter:

  • Setup router
  • Setup routes
  • Prepare parametric routes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.