Skip to content
This repository has been archived by the owner on Sep 10, 2023. It is now read-only.

feat request: fallback pipe for missing emojis #2

Closed
somq opened this issue Mar 19, 2021 · 2 comments · Fixed by #3
Closed

feat request: fallback pipe for missing emojis #2

somq opened this issue Mar 19, 2021 · 2 comments · Fixed by #3

Comments

@somq
Copy link

somq commented Mar 19, 2021

Hi there,

It appears that some emoji are missing on some devices.

missing emojis

On your picker repo you implemented a fallback pipe, which might be able to fill the gap, though the detector fails to detect properly missing emojis.

Would that be possible to add the same fallback pipe on this repo?

As you stated, the picker repo is in maintenance mode, and at it's state is not suitable Ionic production apps for slow render reasons.
Just my 2 cents but I think this repo would be enough for both usecases; mobile & desktop apps, if it can handle somewhat old mobile devices and the fallback is then a main concern.

I suggest to use if-emoji lib or their implementation for the detector.

Currently, I use this simple pipe on my project for the fallback and it works with no false positive so far

import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import ifEmoji from 'if-emoji'
import twemoji from 'twemoji';

@Pipe({
  name: 'emojiFallback'
})
export class EmojiFallbackPipe implements PipeTransform {

  constructor(private domSanitizer: DomSanitizer) { }

  transform(emoji: string): string | SafeHtml {
    return ifEmoji(emoji) ? emoji : this.domSanitizer.bypassSecurityTrustHtml(twemoji.parse(emoji.trim()));
  }
}

If you need some help or a PR, please let me know.

@ahkohd
Copy link
Owner

ahkohd commented Mar 30, 2021

Hi, @somq I'm sorry for the late reply.

This is fantastic, can you make a PR that will introduce this feature?

@ahkohd
Copy link
Owner

ahkohd commented Apr 25, 2021

Thanks, @somq for adding this fix. I'll update the NPM package as soon as possible.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants