Skip to content

Commit

Permalink
feature/staticMicButton (#86)
Browse files Browse the repository at this point in the history
* Static Mic button support added

* setMicButtonMovable

* Update YMChatModule.java

---------

Co-authored-by: Rohit Kumar <[email protected]>
  • Loading branch information
sankalpym and rohit-131 authored Oct 25, 2024
1 parent c8457d1 commit 393d6a2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ repositories {

dependencies {
api 'com.facebook.react:react-native:+'
implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.15.0'
implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.17.0'
}

Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ public void setMicBackgroundColor(String color) {
ymChatService.setMicBackgroundColor(color);
}

@ReactMethod
public void setMicButtonMovable(boolean shouldMicButtonMovable) {
ymChatService.setMicButtonMovable(shouldMicButtonMovable);
}

@ReactMethod
public void useSecureYmAuth(boolean shouldUseSecureYmAuth) {
ymChatService.useSecureYmAuth(shouldUseSecureYmAuth);
Expand Down
10 changes: 7 additions & 3 deletions android/src/main/java/com/reactlibrary/ymchat/YMChatService.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ public void setDeviceToken(String token) {
}

public void setEnableSpeech(boolean speech) {
ymChat.config.enableSpeech = speech;
ymChat.config.speechConfig.enableSpeech = speech;
}

public void setMicButtonMovable(boolean shouldMicButtonMovable) {
ymChat.config.speechConfig.isButtonMovable = shouldMicButtonMovable;
}

public void setAuthenticationToken(String token) {
Expand Down Expand Up @@ -177,11 +181,11 @@ public void useLiteVersion(boolean shouldUseLiteVersion) {
}

public void setMicIconColor(String color) {
ymChat.config.enableSpeechConfig.fabIconColor = color;
ymChat.config.speechConfig.fabIconColor = color;
}

public void setMicBackgroundColor(String color) {
ymChat.config.enableSpeechConfig.fabBackgroundColor = color;
ymChat.config.speechConfig.fabBackgroundColor = color;
}

public void useSecureYmAuth(boolean shouldUseSecureYmAuth) {
Expand Down
11 changes: 8 additions & 3 deletions ios/YMChatReactNative.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ - (dispatch_queue_t)methodQueue {

RCT_EXPORT_METHOD(setEnableSpeech:(BOOL) speech) {
assert(YMChat.shared.config != nil);
YMChat.shared.config.enableSpeech = speech;
YMChat.shared.config.speechConfig.enableSpeech = speech;
}

RCT_EXPORT_METHOD(setMicButtonMovable:(BOOL) shouldMicButtonMovable) {
assert(YMChat.shared.config != nil);
YMChat.shared.config.speechConfig.isButtonMovable = shouldMicButtonMovable;
}

RCT_EXPORT_METHOD(setAuthenticationToken:(NSString *) token) {
Expand Down Expand Up @@ -140,12 +145,12 @@ - (dispatch_queue_t)methodQueue {

RCT_EXPORT_METHOD(setMicIconColor:(NSString *) color) {
assert(YMChat.shared.config != nil);
YMChat.shared.config.enableSpeechConfig.fabIconColor = [self getColorFromHexString:color];
YMChat.shared.config.speechConfig.fabIconColor = [self getColorFromHexString:color];
}

RCT_EXPORT_METHOD(setMicBackgroundColor:(NSString *) color) {
assert(YMChat.shared.config != nil);
YMChat.shared.config.enableSpeechConfig.fabBackgroundColor = [self getColorFromHexString:color];
YMChat.shared.config.speechConfig.fabBackgroundColor = [self getColorFromHexString:color];
}

RCT_EXPORT_METHOD(useSecureYmAuth:(BOOL) shouldUseSecureYmAuth) {
Expand Down
2 changes: 1 addition & 1 deletion ymchat-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Pod::Spec.new do |s|
s.swift_version = "5.0"

s.dependency "React"
s.dependency "YMChat", "~> 1.20"
s.dependency "YMChat", "~> 1.21.1"

end

0 comments on commit 393d6a2

Please sign in to comment.