✨ Follow the manifest to load emotes
This commit is contained in:
parent
ebe381053e
commit
8067c35c70
@ -11,6 +11,7 @@ import 'package:solian/bootstrapper.dart';
|
||||
import 'package:solian/firebase_options.dart';
|
||||
import 'package:solian/platform.dart';
|
||||
import 'package:solian/providers/attachment_uploader.dart';
|
||||
import 'package:solian/providers/stickers.dart';
|
||||
import 'package:solian/providers/theme_switcher.dart';
|
||||
import 'package:solian/providers/websocket.dart';
|
||||
import 'package:solian/providers/auth.dart';
|
||||
@ -120,6 +121,7 @@ class SolianApp extends StatelessWidget {
|
||||
Get.lazyPut(() => AuthProvider());
|
||||
Get.lazyPut(() => RelationshipProvider());
|
||||
Get.lazyPut(() => PostProvider());
|
||||
Get.lazyPut(() => StickerProvider());
|
||||
Get.lazyPut(() => AttachmentProvider());
|
||||
Get.lazyPut(() => WebSocketProvider());
|
||||
Get.lazyPut(() => StatusProvider());
|
||||
|
@ -4,8 +4,8 @@ import 'package:solian/models/stickers.dart';
|
||||
import 'package:solian/services.dart';
|
||||
|
||||
class StickerProvider extends GetxController {
|
||||
final RxMap<String, String> _aliasImageMapping = RxMap();
|
||||
final RxMap<String, List<Sticker>> _availableStickers = RxMap();
|
||||
final RxMap<String, String> aliasImageMapping = RxMap();
|
||||
final RxMap<String, List<Sticker>> availableStickers = RxMap();
|
||||
|
||||
Future<void> refreshAvailableStickers() async {
|
||||
final client = ServiceFinder.configureClient('files');
|
||||
@ -24,15 +24,15 @@ class StickerProvider extends GetxController {
|
||||
'files',
|
||||
'/attachments/${sticker.attachmentId}',
|
||||
);
|
||||
_aliasImageMapping['${pack.prefix}${sticker.alias}'.camelCase!] =
|
||||
aliasImageMapping['${pack.prefix}${sticker.alias}'.camelCase!] =
|
||||
imageUrl;
|
||||
if (_availableStickers[pack.prefix] == null) {
|
||||
_availableStickers[pack.prefix] = List.empty(growable: true);
|
||||
if (availableStickers[pack.prefix] == null) {
|
||||
availableStickers[pack.prefix] = List.empty(growable: true);
|
||||
}
|
||||
_availableStickers[pack.prefix]!.add(sticker);
|
||||
availableStickers[pack.prefix]!.add(sticker);
|
||||
}
|
||||
}
|
||||
}
|
||||
_availableStickers.refresh();
|
||||
availableStickers.refresh();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown_selectionarea/flutter_markdown.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:markdown/markdown.dart' as markdown;
|
||||
import 'package:markdown/markdown.dart';
|
||||
import 'package:solian/providers/stickers.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
import 'account/account_profile_popup.dart';
|
||||
@ -101,10 +103,15 @@ class _CustomEmoteInlineSyntax extends InlineSyntax {
|
||||
|
||||
@override
|
||||
bool onMatch(markdown.InlineParser parser, Match match) {
|
||||
// final alias = match[1]!;
|
||||
// TODO mapping things...
|
||||
final StickerProvider sticker = Get.find();
|
||||
final alias = match[1]!;
|
||||
if (sticker.aliasImageMapping[alias] == null) {
|
||||
parser.advanceBy(1);
|
||||
return false;
|
||||
}
|
||||
|
||||
final element = markdown.Element.empty('img');
|
||||
element.attributes['src'] = 'https://www.twitch.tv/creatorcamp/assets/uploads/lul.png';
|
||||
element.attributes['src'] = sticker.aliasImageMapping[alias]!;
|
||||
parser.addNode(element);
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user