Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configs for quicklinks #911

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Conversation

MysticFragilist
Copy link
Contributor

@MysticFragilist MysticFragilist commented Dec 12, 2023

⁉️ Related Issue

No issues was made previously but a discussion was done in a coding session.

📖 Description

Here's a sneak peek of the changes:

  • Added a new service to connect to firebase cloud storage FirebaseStorageService.
  • Change dependency of font awesome to a forked version that is configured to use dynamic matcher from font name (We will need to maintain the repo).
    • In case we want to bump the version of font awesome, simply sync source with our fork and merge the wanted version with our used branch ets-mobile. More details in wiki.
  • Modify the QuicklinkRepository.getDefaultQuicklink(AppIntl)
    • Add a way to take icon from remote config json and render them as specified icon.
    • Add a way to handle using remote path for loading up custom icons.
    • icon and remotePath attributes are mutually exclusive which means one should be null if the other one is defined. In the case there is an error with the definition in remote config, icon will take precedence.
    • Custom icons loaded up from cloud storage are cached and url is only fetched when none is found in cache, this allows the fastest fetching possible for quicklinks­.

Example of remote config data

[
  {
    "id": "1",
    "nameFr": "Sécurité",
    "nameEn": "Security",
    "icon": "shield-halved",
    "link": "security"
  },
  {
    "id": "2",
    "nameFr": "MonÉTS",
    "nameEn": "MonÉTS",
    "remotePath": "ic_monets_sans_nom_red.png",
    "link": "https://portail.etsmtl.ca/home"
  },
  {
    "id": "3",
    "nameFr": "Bibliotech",
    "nameEn": "Bibliotech",
    "icon": "book",
    "link": "https://www.etsmtl.ca/Bibliotheque/Accueil"
  },
  {
    "id": "4",
    "nameFr": "Nouvelles",
    "nameEn": "News",
    "icon": "newspaper",
    "link": "https://www.etsmtl.ca/nouvelles"
  },
  {
    "id": "5",
    "nameFr": "Bottin",
    "nameEn": "Directory",
    "icon": "address-book",
    "link": "https://www.etsmtl.ca/bottin"
  },
  {
    "id": "6",
    "nameFr": "Moodle",
    "nameEn": "Moodle",
    "remotePath": "ic_moodle_red.png",
    "link": "https://ena.etsmtl.ca/"
  },
  {
    "id": "7",
    "nameFr": "HorairÉTS",
    "nameEn": "HorairÉTS",
    "icon": "calendar",
    "link": "https://horairets.emmanuelcoulombe.dev/"
  },
  {
    "id": "8",
    "nameFr": "GUS",
    "nameEn": "GUS",
    "remotePath": "ic_gus_red.png",
    "link": "https://gus.etsmtl.ca/c2atom/mobile/login"
  },
  {
    "id": "9",
    "nameFr": "PaperCut",
    "nameEn": "PaperCut",
    "icon": "print",
    "link": "https://cls.etsmtl.ca/user"
  }
]

Drawback:
The main drawback of using a map to load up icons (which allows us to get them dynamically) is that there is no tree shaking for the unused resources. We would need to analyze if the app size is still acceptable. In the case it's not, we would need to do manual cleansing of some dynamically provided key from font awesome package as read here.

🧪 How Has This Been Tested?

Added a couple of test to extract default quicklinks from remote config and from cache and a test to getImageUrl from the newly created FirebaseStorageService.

☑️ Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • If needed, I added analytics.
  • Make sure to add either one of the following labels: version: Major,version: Minor or version: Patch.
  • Make sure golden files changes were reviewed and approved.

🖼️ Screenshots (if useful):

image image image

Copy link

sonarcloud bot commented Apr 12, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@MysticFragilist MysticFragilist marked this pull request as draft April 12, 2024 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant