Skip to content
Merged

0.9.0 #127

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.9.0

## Update
* Updated channeltalk plugin v12
* We introduce powerful feature to help your chat: Workflow. Workflow will completely replace support bots.
* Removed ChannelIO.openSupportBot() in favor of new ChannelIO.openWorkflow().
* Added new public API: ChannelIO.hidePopup()

# 0.8.3

## Update
Expand Down
8 changes: 4 additions & 4 deletions RNChannelIO.podspec
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Pod::Spec.new do |s|
s.name = "RNChannelIO"
s.version = "0.2.2"
s.version = "0.3.0"
s.summary = "RNChannelIO"
s.description = "channel plugin for react native"
s.homepage = "https://channel.io"
s.license = { :type => "SDK", :file => "LICENSE" }
s.author = { 'Channel Corp.' => 'eng@channel.io', 'Channel Corp. iOS' => 'ios@channel.io' }
s.platform = :ios, "11.0"
s.platform = :ios, "12.0"
s.source = { :git => "https://github.com/zoyi/react-native-channel-io.git" }
s.source_files = "ios/**/*.{h,m}"
s.requires_arc = true
s.swift_version = '5.0'

s.ios.deployment_target = '11.0'
s.ios.deployment_target = '12.0'

s.dependency "React"
s.dependency "ChannelIOSDK", '~> 11.2'
s.dependency "ChannelIOSDK", '~> 12'
end
16 changes: 9 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:3.2.0'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 33
buildToolsVersion "31.0.0"

defaultConfig {
minSdkVersion 15
targetSdkVersion 33
compileSdk 34
minSdkVersion 23
targetSdkVersion 34
versionCode 1
// get version name from package.json version
versionName computeVersionName()
Expand All @@ -51,9 +49,13 @@ repositories {
url 'https://maven.google.com/'
name 'Google'
}
maven {
url 'https://maven.channel.io/maven2'
name 'ChannelTalk'
}
}

dependencies {
implementation 'com.facebook.react:react-native'
api 'io.channel:plugin-android:11.6.3'
api 'io.channel:plugin-android:12.0.0'
}
14 changes: 10 additions & 4 deletions android/src/main/java/com/zoyi/channel/rn/RNChannelIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ public void openChat(String chatId, String message) {
}

@ReactMethod
public void openSupportBot(String supportBotId, String message) {
ChannelIO.openSupportBot(getCurrentActivity(), supportBotId, message);
public void openWorkflow(String workflowId) {
ChannelIO.openWorkflow(getCurrentActivity(), workflowId);
}

@ReactMethod
Expand Down Expand Up @@ -326,8 +326,9 @@ private Intent reconstructHostAppIntent(String userId, String chatId) {
}

@ReactMethod
public void setPage(@Nullable String page) {
ChannelIO.setPage(page);
public void setPage(@Nullable String page, @Nullable ReadableMap profile) {
Map<String, Object> profileMap = profile == null ? null : profile.toHashMap();
ChannelIO.setPage(page, profileMap);
}

@ReactMethod
Expand All @@ -342,4 +343,9 @@ public void setAppearance(@Nullable String appearance) {
ChannelIO.setAppearance(appearanceValue);
}
}

@ReactMethod
public void hidePopup() {
ChannelIO.hidePopup();
}
}
28 changes: 19 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,13 @@ export const ChannelIO = {
},

/**
* Opens User chat to run a specific Support bot.
* @param {String} supportBotId This is the support bot's ID. If supportBotId is invalid or nil, the chat room is closed.
* @param {String} message This message will be displayed in the input field after completing the support bot operation.
* Opens a user chat and starts the specified workflow.
* - If a corresponded workflow with the provided workflowId is exists, it will be executed. if workflowId is invalid, an error page is displayed.
* - If you don't pass workflowId, no action is taken.
* @param {String} workflowId The ID of workflow to start with. An error page will be shown if such workflow does not exist.
*/
openSupportBot: (supportBotId, message) => {
ChannelModule.openSupportBot(supportBotId, message);
openWorkflow: (workflowId) => {
ChannelModule.openWorkflow(workflowId);
},

/**
Expand Down Expand Up @@ -231,13 +232,17 @@ export const ChannelIO = {
openStoredPushNotification: () => ChannelModule.openStoredPushNotification(),

/**
* Set page to be used instead of recent activity name or view controller.
* Sets the name of the screen along with user chat profile. If track is called before setPage, the event will not reflect the page information.
* @param {String} page This is the screen name when track is called. When calling .track(), the event's page is set to null.
* @param {String} profile The user chat profile value.
* - When nil is assigned to a specific field within the profile object, only the value of that field is cleared.
* - The user chat profile value is applied when a user chat is created.
*/
setPage: (page) => {
setPage: (page, profile) => {
if (typeof page === "string") {
ChannelModule.setPage(page)
ChannelModule.setPage(page, profile)
} else if (page === null || page === undefined) {
ChannelModule.setPage(null)
ChannelModule.setPage(null, profile)
} else {
console.error('ChannelIO', '"page" must be type of "string", null or undefined.')
}
Expand All @@ -260,6 +265,11 @@ export const ChannelIO = {
}
},

/**
* Hides the Channel popup on the global screen.
*/
hidePopup: () => ChannelModule.hidePopup(),

/**
* @deprecated
* Event listener that triggers when badge count has been changed
Expand Down
14 changes: 11 additions & 3 deletions ios/RNChannelIO.m
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ - (NSDictionary *)constantsToExport {
[ChannelIO openChatWith:chatId message:payload];
}

RCT_EXPORT_METHOD(openSupportBot:(NSString *)supportBotId message:(NSString *)message) {
[ChannelIO openSupportBotWith:supportBotId message:message];
RCT_EXPORT_METHOD(openWorkflow:(NSString *)workflowId) {
[ChannelIO openWorkflowWith:workflowId];
}

RCT_EXPORT_METHOD(track:(NSString *)name eventProperty:(NSDictionary *)properties) {
Expand Down Expand Up @@ -377,7 +377,11 @@ - (NSDictionary *)constantsToExport {
}

RCT_EXPORT_METHOD(setPage:(NSString *)page) {
[ChannelIO setPage:page];
[ChannelIO setPage:page profile:[[NSDictionary alloc] init]];
}

RCT_EXPORT_METHOD(setPage:(NSString *)page profile:(NSDictionary<NSString *, id> *)profile) {
[ChannelIO setPage:page profile:profile];
}

RCT_EXPORT_METHOD(resetPage) {
Expand All @@ -396,6 +400,10 @@ - (NSDictionary *)constantsToExport {
}
}

RCT_EXPORT_METHOD(hidePopup) {
[ChannelIO hidePopup];
}

#pragma mark ChannelPluginDelegate
- (void)onBadgeChangedWithUnread:(NSInteger)unread alert:(NSInteger)alert {
if (hasListeners) {
Expand Down
4 changes: 2 additions & 2 deletions ios/RNChannelIO.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -200,7 +200,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-channel-plugin",
"version": "0.8.3",
"version": "0.9.0",
"description": "react native module for channel io",
"main": "index.js",
"scripts": {
Expand Down