瀏覽代碼

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",
       "title": "Mastodon",
-      "slug": "mastodon",
-      "hex": "6364FF"
-    },
-    {
-      "title": "mstdn",
+      "altNames": ["mstdn", "fediscience", "mathstodon", "fosstodon"],
       "slug": "mastodon",
       "slug": "mastodon",
       "hex": "6364FF"
       "hex": "6364FF"
     },
     },

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

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