Skip to content

Commit

Permalink
v4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitninawe-cometchat committed Jun 4, 2024
1 parent cfa6703 commit 7d347b6
Show file tree
Hide file tree
Showing 98 changed files with 4,288 additions and 448 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

[![Platform](https://img.shields.io/badge/Platform-ReactNative-brightgreen.svg)](#)
[![Platform](https://img.shields.io/badge/Language-TypeScript-yellowgreen.svg)](#)
![Version](https://shields.io/badge/version-v4.0.0-orange)
![Version](https://shields.io/badge/version-v4.0.2-orange)
![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)

## Table of contents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.HashMap;
import java.util.Map;

public class RNSoundModule
public class CometChatSoundModule
extends ReactContextBaseJavaModule
implements AudioManager.OnAudioFocusChangeListener {

Expand All @@ -36,7 +36,7 @@ public class RNSoundModule
Double focusedPlayerKey;
Boolean wasPlayingBeforeFocusChange = false;

public RNSoundModule(ReactApplicationContext context) {
public CometChatSoundModule(ReactApplicationContext context) {
super(context);
this.context = context;
this.category = null;
Expand All @@ -54,7 +54,7 @@ private void setOnPlay(boolean isPlaying, final Double playerKey) {

@Override
public String getName() {
return "RNSound";
return "CometChatSoundModule";
}

@ReactMethod
Expand Down Expand Up @@ -84,7 +84,7 @@ public void prepare(
}
this.playerPool.put(key, player);

final RNSoundModule module = this;
final CometChatSoundModule module = this;

if (module.category != null) {
Integer category = null;
Expand All @@ -109,7 +109,7 @@ public void prepare(
break;
default:
Log.e(
"RNSoundModule",
"CometChatSoundModule",
String.format("Unrecognised category %s", module.category)
);
break;
Expand All @@ -134,7 +134,7 @@ public synchronized void onPrepared(MediaPlayer mp) {
callback.invoke(NULL, props);
} catch (RuntimeException runtimeException) {
// The callback was already invoked
Log.e("RNSoundModule", "Exception", runtimeException);
Log.e("CometChatSoundModule", "Exception", runtimeException);
}
}
}
Expand All @@ -159,7 +159,7 @@ public synchronized boolean onError(
callback.invoke(props, NULL);
} catch (RuntimeException runtimeException) {
// The callback was already invoked
Log.e("RNSoundModule", "Exception", runtimeException);
Log.e("CometChatSoundModule", "Exception", runtimeException);
}
return true;
}
Expand All @@ -175,7 +175,7 @@ public synchronized boolean onError(
} catch (Exception ignored) {
// When loading files from a file, we useMediaPlayer.create, which actually
// prepares the audio for us already. So we catch and ignore this error
Log.e("RNSoundModule", "Exception", ignored);
Log.e("CometChatSoundModule", "Exception", ignored);
}
}

Expand All @@ -194,19 +194,19 @@ protected MediaPlayer createMediaPlayer(final String fileName) {
);
afd.close();
} catch (IOException e) {
Log.e("RNSoundModule", "Exception", e);
Log.e("CometChatSoundModule", "Exception", e);
return null;
}
return mediaPlayer;
}

if (fileName.startsWith("http://") || fileName.startsWith("https://")) {
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
Log.i("RNSoundModule", fileName);
Log.i("CometChatSoundModule", fileName);
try {
mediaPlayer.setDataSource(fileName);
} catch (IOException e) {
Log.e("RNSoundModule", "Exception", e);
Log.e("CometChatSoundModule", "Exception", e);
return null;
}
return mediaPlayer;
Expand All @@ -224,7 +224,7 @@ protected MediaPlayer createMediaPlayer(final String fileName) {
descriptor.close();
return mediaPlayer;
} catch (IOException e) {
Log.e("RNSoundModule", "Exception", e);
Log.e("CometChatSoundModule", "Exception", e);
return null;
}
}
Expand All @@ -233,7 +233,7 @@ protected MediaPlayer createMediaPlayer(final String fileName) {
try {
mediaPlayer.setDataSource(fileName);
} catch (IOException e) {
Log.e("RNSoundModule", "Exception", e);
Log.e("CometChatSoundModule", "Exception", e);
return null;
}
return mediaPlayer;
Expand All @@ -242,11 +242,11 @@ protected MediaPlayer createMediaPlayer(final String fileName) {
File file = new File(fileName);
if (file.exists()) {
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
Log.i("RNSoundModule", fileName);
Log.i("CometChatSoundModule", fileName);
try {
mediaPlayer.setDataSource(fileName);
} catch (IOException e) {
Log.e("RNSoundModule", "Exception", e);
Log.e("CometChatSoundModule", "Exception", e);
return null;
}
return mediaPlayer;
Expand Down Expand Up @@ -332,11 +332,11 @@ public synchronized boolean onError(

@ReactMethod
public void checkMode(Promise promise){
Log.e("RNSoundModule"," entry POINT");
Log.e("CometChatSoundModule"," entry POINT");
AudioManager audioManager = (AudioManager) context.getSystemService(
Context.AUDIO_SERVICE
);
Log.e("RNSoundModule",audioManager.toString());
Log.e("CometChatSoundModule",audioManager.toString());
String mode= "";

switch( audioManager.getRingerMode() ){
Expand All @@ -350,7 +350,7 @@ public void checkMode(Promise promise){
mode = "VIBRATE";
break;
}
Log.e("RNSoundModule",mode);
Log.e("CometChatSoundModule",mode);
promise.resolve(mode);

}
Expand Down Expand Up @@ -446,9 +446,9 @@ public void checkOtherAudioPlaying(Promise isPlaying) {
}
} catch (RuntimeException runtimeException) {
// The callback was already invoked
Log.e("RNSoundModule", "Exception", runtimeException);
Log.e("CometChatSoundModule", "Exception", runtimeException);
}
Log.e("RNSoundModule", "returns false");
Log.e("CometChatSoundModule", "returns false");
isPlaying.resolve(false);

}
Expand Down Expand Up @@ -495,7 +495,7 @@ public void setLooping(final Double key, final Boolean looping) {
@ReactMethod
public void setSpeed(final Double key, final Float speed) {
if (android.os.Build.VERSION.SDK_INT < 23) {
Log.w("RNSoundModule", "setSpeed ignored due to sdk limit");
Log.w("CometChatSoundModule", "setSpeed ignored due to sdk limit");
return;
}

Expand All @@ -508,7 +508,7 @@ public void setSpeed(final Double key, final Float speed) {
@ReactMethod
public void setPitch(final Double key, final Float pitch) {
if (android.os.Build.VERSION.SDK_INT < 23) {
Log.w("RNSoundModule", "setPitch ignored due to sdk limit");
Log.w("CometChatSoundModule", "setPitch ignored due to sdk limit");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CometchatUiKitPackage implements ReactPackage {
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new CometchatUiKitModule(reactContext));
modules.add(new RNSoundModule(reactContext));
modules.add(new CometChatSoundModule(reactContext));
modules.add(new SoundPlayer(reactContext));
modules.add(new FileManager(reactContext));
modules.add(new VideoManager(reactContext));
Expand Down
2 changes: 1 addition & 1 deletion ios/RNSound.h → ios/CometChatSoundModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
#import "RCTEventEmitter.h"
#endif

@interface RNSound : RCTEventEmitter <RCTBridgeModule, AVAudioPlayerDelegate>
@interface CometChatSoundModule : RCTEventEmitter <RCTBridgeModule, AVAudioPlayerDelegate>
@property (nonatomic, weak) NSNumber *_key;
@end
4 changes: 2 additions & 2 deletions ios/RNSound.m → ios/CometChatSoundModule.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#import "RNSound.h"
#import "CometChatSoundModule.h"

#if __has_include("RCTUtils.h")
#import "RCTUtils.h"
#else
#import <React/RCTUtils.h>
#endif

@implementation RNSound {
@implementation CometChatSoundModule {
NSMutableDictionary *_playerPool;
NSMutableDictionary *_callbackPool;
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cometchat/chat-uikit-react-native",
"version": "4.0.1",
"version": "4.0.2",
"description": "CometChat React Native UI Kit is a collection of custom UI Components designed to build text , chat and calling features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly",
"main": "src/index",
"module": "src/index",
Expand Down Expand Up @@ -70,7 +70,7 @@
"@types/react": "17.0.21"
},
"dependencies": {
"@cometchat/chat-sdk-react-native": "^4.0.2",
"@cometchat/chat-sdk-react-native": "^4.0.3",
"@react-native-async-storage/async-storage": "^1.17.10",
"@react-native-community/clipboard": "^1.5.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ this.closePanel();
attachMessageListener(){

this.cardViewStyle = getCardViewStyle(this.theme,this.configuration?.conversationStarterStyle)
CometChat.addMessageListener(
CometChatUIEventHandler.addMessageListener(
this.messageListenerId,
new CometChat.MessageListener({
{
onTextMessageReceived: (textMessage) => {
this.closeIfMessageReceived(textMessage)

Expand All @@ -221,8 +221,7 @@ this.closePanel();
this.closeIfMessageReceived(customMessage)

}
})
);
});


}
Expand Down
Loading

0 comments on commit 7d347b6

Please sign in to comment.