Преглед на файлове

Support multiple names for the same service (#344)

Vishnu Mohandas преди 1 година
родител
ревизия
c359775ebc
променени са 2 файла, в които са добавени 9 реда и са изтрити 5 реда
  1. 1 5
      assets/custom-icons/_data/custom-icons.json
  2. 8 0
      lib/ui/utils/icon_utils.dart

+ 1 - 5
assets/custom-icons/_data/custom-icons.json

@@ -97,11 +97,7 @@
     },
     {
       "title": "Mastodon",
-      "slug": "mastodon",
-      "hex": "6364FF"
-    },
-    {
-      "title": "mstdn",
+      "altNames": ["mstdn", "fediscience", "mathstodon", "fosstodon"],
       "slug": "mastodon",
       "hex": "6364FF"
     },

+ 8 - 0
lib/ui/utils/icon_utils.dart

@@ -93,6 +93,14 @@ class IconUtils {
           icon["slug"],
           icon["hex"],
         );
+        if (icon["altNames"] != null) {
+          for (final name in icon["altNames"]) {
+            _customIcons[name] = CustomIconData(
+              icon["slug"],
+              icon["hex"],
+            );
+          }
+        }
       }
     } catch (e) {
       Logger("IconUtils").severe("Error loading icons", e);