-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store timestamp/alt text with reactions
Also fixes a bug where sending a new set of emoji reaction would erase any custom emoji reaction. Sending a new set of emoji reaction will still erase any append-style emoji reaction but the assumption is you wanted that since you sent a whole new set of emoji. But custom can only be sent as append.
- Loading branch information
1 parent
2751744
commit 7adcfb3
Showing
8 changed files
with
157 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package snikket; | ||
|
||
@:nullSafety(Strict) | ||
@:expose | ||
class Reaction { | ||
public final senderId: String; | ||
public final timestamp: String; | ||
public final text: String; | ||
public final key: String; | ||
|
||
public function new(senderId: String, timestamp: String, text: String, key: Null<String> = null) { | ||
this.senderId = senderId; | ||
this.timestamp = timestamp; | ||
this.text = text; | ||
this.key = key ?? text; | ||
} | ||
|
||
public function render<T>(forText: (String) -> T, forImage: (String, String) -> T) { | ||
return forText(text + "\u{fe0f}"); | ||
} | ||
} | ||
|
||
@:expose | ||
class CustomEmojiReaction extends Reaction { | ||
public final uri: String; | ||
|
||
public function new(senderId: String, timestamp: String, text: String, uri: String) { | ||
super(senderId, timestamp, text, uri); | ||
this.uri = uri; | ||
} | ||
|
||
override public function render<T>(forText: (String) -> T, forImage: (String, String) -> T) { | ||
final hash = Hash.fromUri(uri); | ||
return forImage(text, hash?.toUri() ?? uri); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.