getGiftEmotionUrlByUrl method
Implementation
String? getGiftEmotionUrlByUrl(String? emotionUrl) {
if (emotionUrl == null || emotionUrl.isEmpty) return null;
var matches =
RegExp(r"(?<=picture://com.spero.vision/)(.*)(?=\.(gif)|(GIF))")
.firstMatch(emotionUrl);
if (matches == null) return null;
var name = matches.group(0);
if (name == null || name.isEmpty) return null;
var emotion = getEmotionByName("[$name]");
if (emotion is NetworkEmotion) {
return emotion.url;
}
return null;
}