- Android
- iOS
- JavaScript
- Flutter
- ReactNative
Add a like or a custom reaction to a Moment.
API Reference
/**
* add a reaction
* @param momentId Moments post ID
* @param key reaction type
* @param callback result callback
*/
void addReaction(String momentId, String key, IMessageManager.ISimpleCallback callback);
Code Example
JIM.getInstance().getMomentManager().addReaction("momentId", "like", new IMessageManager.ISimpleCallback() {
@Override
public void onSuccess() {
}
@Override
public void onError(int errorCode) {
}
});
Add a like or a custom reaction to a Moment.
API Reference
/// add a reaction
/// - Parameters:
/// - momentId: Moments post ID
/// - key: reaction type
/// - completeBlock: result callback
- (void)addReaction:(nonnull NSString *)momentId
key:(nonnull NSString *)key
complete:(nullable void (^)(JErrorCode errorCode))completeBlock;
Code Example
[JIM.shared.momentManager addReaction:@"momentId" key:@"like" complete:^(JErrorCode errorCode) {
}];
Add a like or a custom reaction to a Moment.
API Reference
/**
* add a reaction
* @param momentId Moments post ID
* @param key reaction type
* return result code; 0 indicates success
*/
Future<int> addMomentReaction(String momentId, String key) async
Code Example
int addReactionResult = await JuggleIm.instance.addMomentReaction('momentId', 'like');
Add a like or a custom reaction to a Moment.
API Reference
/**
* add a reaction
* @param momentId Moments post ID
* @param key reaction type
* return Promise<void>
*/
addReaction(momentId: string, key: string): Promise<void>
Code Example
import { JuggleIMMoment } from 'juggleim-rnsdk';
await JuggleIMMoment.addReaction('momentId', 'like');
Add a like or a custom reaction to a Moment.
Parameters
| Name | Type | Required | Default | Description | Version |
|---|---|---|---|---|---|
| params | Object | Yes | - | Parameters for adding a reaction | 1.9.6 |
| params.momentId | String | Yes | - | Moment ID | 1.9.6 |
| params.reaction | Object | Yes | - | Reaction type | 1.9.6 |
| params.reaction.key | String | Yes | - | Reaction type key. See the code example. | 1.9.6 |
| params.reaction.value | String | Yes | - | Reaction type value. See the code example. | 1.9.6 |
Code Example
jim.addReaction({
momentId: 'momentId',
reaction: {
key: 'like',
value: 'like',
},
}).then(() => {
console.log('addReaction successfully');
})