-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
adds reaction v2 android side
1 parent
de6c244
commit 010226e
Showing
8 changed files
with
271 additions
and
27 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
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,38 @@ | ||
import { | ||
ContentTypeId, | ||
NativeContentCodec, | ||
NativeMessageContent, | ||
ReactionContent, | ||
} from '../ContentCodec' | ||
|
||
export class ReactionV2Codec implements NativeContentCodec<ReactionContent> { | ||
contentKey: 'reactionV2' = 'reactionV2' | ||
|
||
contentType: ContentTypeId = { | ||
authorityId: 'xmtp.org', | ||
typeId: 'reaction', | ||
versionMajor: 2, | ||
versionMinor: 0, | ||
} | ||
|
||
encode(content: ReactionContent): NativeMessageContent { | ||
return { | ||
reactionV2: content, | ||
} | ||
} | ||
|
||
decode(nativeContent: NativeMessageContent): ReactionContent { | ||
return nativeContent.reactionV2! | ||
} | ||
|
||
fallback(content: ReactionContent): string | undefined { | ||
switch (content.action) { | ||
case 'added': | ||
return `Reacted “${content.content}” to an earlier message` | ||
case 'removed': | ||
return `Removed “${content.content}” from an earlier message` | ||
default: | ||
return undefined | ||
} | ||
} | ||
} |
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