UNPKG

cordova-plugin-rapida

Version:

Cordova chat Plugin

907 lines (551 loc) 27.6 kB
var exec = require('cordova/exec'); var siteURL; function CustomUI() { } /*======== OneonOne ==========*/ CustomUI.prototype.seturl = function(url,callback){ var arr = []; arr[0] = url; exec(callback,function(error){},"CustomUI","seturl",arr); } CustomUI.prototype.loginUsername = function(username,password,callback){ var arr = []; arr[0] = username; arr[1] = password; exec(callback,function(error){},"CustomUI","loginUsername",arr); } CustomUI.prototype.loginUserid = function(userid,callback){ var arr = []; arr[0] = userid; exec(callback,function(error){},"CustomUI","loginUserid",arr); } CustomUI.prototype.guestLogin = function(guestname,callback){ var arr = []; arr[0] = guestname; exec(callback,function(error){},"CustomUI","guestLogin",arr); } CustomUI.prototype.setCometChatURL = function(url,callback){ var arr = []; arr[0] = url; exec(callback,function(error){},"CustomUI","setCometChatURL",arr); } CustomUI.prototype.createUser = function(apikey,username,password,link,avatar,displayname,callback){ var arr = []; arr[0] = apikey; arr[1] = username; arr[2] = password; arr[3] = link; arr[4] = avatar; arr[5] = displayname; exec(callback,function(error){},"CustomUI","createUser",arr); } CustomUI.prototype.removeUserByID = function(apikey,userid,callback){ var arr = []; arr[0] = apikey; arr[1] = userid; exec(callback,function(error){},"CustomUI","removeUserByID",arr); } CustomUI.prototype.updateDisplayName = function(apikey,displayname,newPassword,link,avatarPath,userID,originalPassword,flag,callback){ var arr = []; arr[0] = apikey; arr[1] = displayname; arr[2] = newPassword; arr[3] = link; arr[4] = avatarPath; arr[5] = userID; arr[6] = originalPassword; arr[7] = flag; exec(callback,function(error){},"CustomUI","updateDisplayName",arr); } CustomUI.prototype.addFriends = function(apikey,userIDArray,callback){ var arr = []; arr[0] = apikey; arr[1] = userIDArray; exec(callback,function(error){},"CustomUI","addFriends",arr); } CustomUI.prototype.removeFriends = function(apikey,userIDArray,callback){ var arr = []; arr[0] = apikey; arr[1] = userIDArray; exec(callback,function(error){},"CustomUI","removeFriends",arr); } CustomUI.prototype.subscribe = function(flag,callback){ var arr = []; arr[0] = flag; exec(callback,function(error){},"CustomUI","subscribe",arr); } CustomUI.prototype.sendMessage = function(message,userID,callback){ var arr = []; arr[0] = message; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendMessage",arr); } CustomUI.prototype.sendImageWithPath = function(imagePath,userID,callback){ var arr = []; arr[0] = imagePath; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendImageWithPath",arr); } CustomUI.prototype.sendImageWithData = function(imageData,userID,callback){ var arr = []; arr[0] = imageData; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendImageWithData",arr); } CustomUI.prototype.sendAudioWithPath = function(audioPath,userID,callback){ var arr = []; arr[0] = audioPath; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendAudioWithPath",arr); } CustomUI.prototype.sendAudioWithData = function(audioData,userID,callback){ var arr = []; arr[0] = audioPath; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendAudioWithData",arr); } CustomUI.prototype.sendFileWithPath = function(filePath,userID,callback){ var arr = []; arr[0] = filePath; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendFileWithPath",arr); } CustomUI.prototype.sendVideoWithPath = function(videoPath,userID,callback){ var arr = []; arr[0] = videoPath; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendVideoWithPath",arr); } CustomUI.prototype.sendVideoWithURL = function(videoURL,userID,callback){ var arr = []; arr[0] = videoURL; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendVideoWithURL",arr); } CustomUI.prototype.broadcastMessage = function(message,userID,callback){ var arr = []; arr[0] = message; arr[1] = userID; exec(callback,function(error){},"CustomUI","broadcastMessage",arr); } CustomUI.prototype.sendWhiteBoardRequest = function(buddyID,callback){ var arr = []; arr[0] = buddyID; exec(callback,function(error){},"CustomUI","sendWhiteBoardRequest",arr); } CustomUI.prototype.sendWriteBoardRequest = function(buddyID,callback){ var arr = []; arr[0] = buddyID; exec(callback,function(error){},"CustomUI","sendWriteBoardRequest",arr); } CustomUI.prototype.sendWriteBoardAck = function(buddyID,callback){ var arr = []; arr[0] = buddyID; exec(callback,function(error){},"CustomUI","sendWriteBoardAck",arr); } CustomUI.prototype.changeStatus = function(status,callback){ var arr = []; arr[0] = status; exec(callback,function(error){},"CustomUI","changeStatus",arr); } CustomUI.prototype.changeStatusMessage = function(statusMessage,callback){ var arr = []; arr[0] = status; exec(callback,function(error){},"CustomUI","changeStatusMessage",arr); } CustomUI.prototype.getPluginInfo = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","getPluginInfo",arr); } CustomUI.prototype.getUserInfo = function(userId,callback){ var arr = []; arr[0] = userId; exec(callback,function(error){},"CustomUI","getUserInfo",arr); } CustomUI.prototype.getOnlineUsersWithResponse = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","getOnlineUsersWithResponse",arr); } CustomUI.prototype.getSinglePlayerGamesUrl = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","getSinglePlayerGamesUrl",arr); } CustomUI.prototype.getAllAnnouncements = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","getAllAnnouncements",arr); } CustomUI.prototype.blockUser = function(userId,callback){ var arr = []; arr[0] = userId; exec(callback,function(error){},"CustomUI","blockUser",arr); } CustomUI.prototype.unblockUser = function(userId,callback){ var arr = []; arr[0] = userId; exec(callback,function(error){},"CustomUI","unblockUser",arr); } CustomUI.prototype.deleteUserHistory = function(userId,callback){ var arr = []; arr[0] = userId; exec(callback,function(error){},"CustomUI","deleteUserHistory",arr); } CustomUI.prototype.getBlockedUsersWithResponse = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","getBlockedUsersWithResponse",arr); } CustomUI.prototype.getChatHistoryOfUser = function(friendID,messageID,callback){ var arr = []; arr[0] = friendID; arr[1] = messageID; exec(callback,function(error){},"CustomUI","getChatHistoryOfUser",arr); } CustomUI.prototype.sendStickers = function(stickerName,userID,callback){ var arr = []; arr[0] = stickerName; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendStickers",arr); } CustomUI.prototype.setTranslationLanguage = function(language,callback){ var arr = []; arr[0] = language; exec(callback,function(error){},"CustomUI","setTranslationLanguage",arr); } CustomUI.prototype.unsubscribe = function(){ var arr = []; exec(callback,function(error){},"CustomUI","unsubscribe",arr); } CustomUI.prototype.logoutWithSuccess = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","logoutWithSuccess",arr); } CustomUI.prototype.getSDKVersion = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","getSDKVersion",arr); } CustomUI.prototype.isCometChatInstalled = function(siteURL,callback){ var arr = []; arr[0] = siteURL; exec(callback,function(error){},"CustomUI","isCometChatInstalled",arr); } CustomUI.prototype.isTyping = function(flag,channel,callback){ var arr = []; arr[0] = flag; arr[1] = channel; exec(callback,function(error){},"CustomUI","isTyping",arr); } CustomUI.prototype.sendDeliverdReceipt = function(msgID,channel,callback){ var arr = []; arr[0] = msgID; arr[1] = channel; exec(callback,function(error){},"CustomUI","sendDeliverdReceipt",arr); } CustomUI.prototype.sendReadReceipt = function(msgID,channel,callback){ var arr = []; arr[0] = msgID; arr[1] = channel; exec(callback,function(error){},"CustomUI","sendReadReceipt",arr); } /*======= Chatroom ========*/ CustomUI.prototype.subscribeToChatroomWithMode = function(mode,callback){ var arr = []; arr[0] = mode; exec(callback,function(error){},"CustomUI","subscribeToChatroomWithMode",arr); } CustomUI.prototype.joinChatroom = function(chatroomName,chatroomID,chatroomPassword,callback){ var arr = []; arr[0] = chatroomName; arr[1] = chatroomID; arr[2] = chatroomPassword; exec(callback,function(error){},"CustomUI","joinChatroom",arr); } CustomUI.prototype.createChatRoom = function(chatroomName,type,chatroomPassword,callback){ var arr = []; arr[0] = chatroomName; arr[1] = type; arr[2] = chatroomPassword; exec(callback,function(error){},"CustomUI","createChatRoom",arr); } CustomUI.prototype.getChatroomMembers = function(chatroomid,callback){ var arr = []; arr[0] = chatroomid; exec(callback,function(error){},"CustomUI","createChatRoom",arr); } CustomUI.prototype.deleteChatRoom = function(chatroomID,callback){ var arr = []; arr[0] = chatroomID; exec(callback,function(error){},"CustomUI","deleteChatRoom",arr); } CustomUI.prototype.inviteUsers = function(usersID,chatroomName,chatroomid,callback){ var arr = []; arr[0] = usersID; arr[1] = chatroomName; arr[2] = chatroomid; exec(callback,function(error){},"CustomUI","inviteUsers",arr); } CustomUI.prototype.sendChatroomMessage = function(message,chatroomName,chatroomid,callback){ var arr = []; arr[0] = message; arr[1] = chatroomName; arr[2] = chatroomid; exec(callback,function(error){},"CustomUI","sendChatroomMessage",arr); } CustomUI.prototype.sendChatroomStickers = function(sticker,chatroomName,chatroomid,callback){ var arr = []; arr[0] = sticker; arr[1] = chatroomName; arr[2] = chatroomid; exec(callback,function(error){},"CustomUI","sendChatroomStickers",arr); } CustomUI.prototype.sendImageWithPathChatroom = function(imagePath,chatroomName,chatroomid,callback){ var arr = []; arr[0] = imagePath; arr[1] = chatroomid; arr[2] = chatroomName; exec(callback,function(error){},"CustomUI","sendImageWithPathChatroom",arr); } CustomUI.prototype.sendImageWithDataChatroom = function(imageData,chatroomName,chatroomid,callback){ var arr = []; arr[0] = imageData; arr[1] = chatroomName; arr[2] = chatroomid; exec(callback,function(error){},"CustomUI","sendImageWithDataChatroom",arr); } CustomUI.prototype.sendAudioWithPathChatroom = function(audioPath,chatroomName,chatroomid,callback){ var arr = []; arr[0] = audioPath; arr[1] = chatroomName; arr[2] = chatroomid; exec(callback,function(error){},"CustomUI","sendAudioWithPathChatroom",arr); } CustomUI.prototype.sendVideoWithPathChatroom = function(videoPath,chatroomName,chatroomid,callback){ var arr = []; arr[0] = videoPath; arr[1] = chatroomName; arr[2] = chatroomid; exec(callback,function(error){},"CustomUI","sendVideoWithPathChatroom",arr); } CustomUI.prototype.sendVideoWithURLChatroom = function(videoURL,chatroomName,chatroomid,callback){ var arr = []; arr[0] = videoURL; arr[1] = chatroomName; arr[2] = chatroomid; exec(callback,function(error){},"CustomUI","sendVideoWithURLChatroom",arr); } CustomUI.prototype.sendFileWithPathChatroom = function(filePath,chatroomName,chatroomid,callback){ var arr = []; arr[0] = filePath; arr[1] = chatroomName; arr[2] = chatroomid; exec(callback,function(error){},"CustomUI","sendFileWithPathChatroom",arr); } CustomUI.prototype.getAllChatrooms = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","getAllChatrooms",arr); } CustomUI.prototype.leaveChatroom = function(chatroomid,callback){ var arr = []; arr[0] = chatroomid; exec(callback,function(error){},"CustomUI","leaveChatroom",arr); } CustomUI.prototype.unsubscribeFromChatRoom = function(){ var arr = []; exec(callback,function(error){},"CustomUI","unsubscribeFromChatRoom",arr); } CustomUI.prototype.getCurrentChatroom = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","getCurrentChatroom",arr); } CustomUI.prototype.isSubscribedToChatroom = function(chatroomID,callback){ var arr = []; arr[0] = chatroomID; exec(callback,function(error){},"CustomUI","isSubscribedToChatroom",arr); } CustomUI.prototype.getSHA1ValueOfString = function(string,callback){ var arr = []; arr[0] = string; exec(callback,function(error){},"CustomUI","getSHA1ValueOfString",arr); } /*======= Audio =========*/ CustomUI.prototype.startAudioChatWithCallID = function(callID,container,callback){ var arr = []; arr[0] = callID; arr[1] = container; exec(callback,function(error){},"CustomUI","startAudioChatWithCallID",arr); } CustomUI.prototype.sendAudioChatRequestToUser = function(userID,callback){ var arr = []; arr[0] = userID; exec(callback,function(error){},"CustomUI","sendAudioChatRequestToUser",arr); } CustomUI.prototype.acceptAudioChatRequestOfUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = callID; exec(callback,function(error){},"CustomUI","acceptAudioChatRequestOfUser",arr); } CustomUI.prototype.endAudioChatWithUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = callID; exec(callback,function(error){},"CustomUI","endAudioChatWithUser",arr); } CustomUI.prototype.cancelAudioChatRequestWithUser = function(userID,callback){ var arr = []; arr[0] = userID; exec(callback,function(error){},"CustomUI","cancelAudioChatRequestWithUser",arr); } CustomUI.prototype.sendBusyCallToUser = function(userID,callback){ var arr = []; arr[0] = userID; exec(callback,function(error){},"CustomUI","sendBusyCallToUser",arr); } CustomUI.prototype.rejectAudioChatRequestOfUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = userID; exec(callback,function(error){},"CustomUI","rejectAudioChatRequestOfUser",arr); } CustomUI.prototype.sendNoAnswerCallOfUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = userID; exec(callback,function(error){},"CustomUI","sendNoAnswerCallOfUser",arr); } CustomUI.prototype.toggleAudio = function(audioControlFlag,callback){ var arr = []; arr[0] = audioControlFlag; exec(callback,function(error){},"CustomUI","toggleAudio",arr); } /*========== AVChat =========*/ CustomUI.prototype.startAVChatWithCallID = function(callID,container,callback){ var arr = []; arr[0] = callID; arr[1] = container; exec(callback,function(error){},"CustomUI","startAVChatWithCallID",arr); } CustomUI.prototype.sendAVChatRequestToUser = function(userID,callback){ var arr = []; arr[0] = userID; exec(callback,function(error){},"CustomUI","sendAVChatRequestToUser",arr); } CustomUI.prototype.acceptAVChatRequestOfUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = callID; exec(callback,function(error){},"CustomUI","acceptAVChatRequestOfUser",arr); } CustomUI.prototype.endAVChatWithUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = callID; exec(callback,function(error){},"CustomUI","endAVChatWithUser",arr); } CustomUI.prototype.cancelAVChatRequestWithUser = function(userID,callback){ var arr = []; arr[0] = userID; exec(callback,function(error){},"CustomUI","cancelAVChatRequestWithUser",arr); } CustomUI.prototype.sendBusyAVCallToUser = function(userID,callback){ var arr = []; arr[0] = userID; exec(callback,function(error){},"CustomUI","sendBusyAVCallToUser",arr); } CustomUI.prototype.rejectAVChatRequestOfUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = callID; exec(callback,function(error){},"CustomUI","rejectAVChatRequestOfUser",arr); } CustomUI.prototype.sendAVNoAnswerCallOfUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = callID; exec(callback,function(error){},"CustomUI","sendAVNoAnswerCallOfUser",arr); } CustomUI.prototype.toggleAudioSDK = function(audioControlFlag,callback){ var arr = []; arr[0] = audioControlFlag; exec(callback,function(error){},"CustomUI","toggleAudioSDK",arr); } CustomUI.prototype.toggleVideoSDK = function(videoControlFlag,callback){ var arr = []; arr[0] = videoControlFlag; exec(callback,function(error){},"CustomUI","toggleVideoSDK",arr); } CustomUI.prototype.switchAudioRouteSDK = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","switchAudioRouteSDK",arr); } CustomUI.prototype.switchCameraSDK = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","switchCameraSDK",arr); } /*=========AVBroadcast========*/ CustomUI.prototype.startAVBroadcastWithInitiator = function(initiator,callID,container,callback){ var arr = []; arr[0] = initiator; arr[1] = callID; arr[2] = container; exec(callback,function(error){},"CustomUI","startAVBroadcastWithInitiator",arr); } CustomUI.prototype.sendAVBroadcastRequestToUser = function(userID,callback){ var arr = []; arr[0] = userID; exec(callback,function(error){},"CustomUI","sendAVBroadcastRequestToUser",arr); } CustomUI.prototype.endAVBroadcastWithUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = callID; exec(callback,function(error){},"CustomUI","endAVBroadcastWithUser",arr); } CustomUI.prototype.acceptAVBroadcastRequestOfUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = callID; exec(callback,function(error){},"CustomUI","acceptAVBroadcastRequestOfUser",arr); } CustomUI.prototype.inviteUser = function(userID,callID,callback){ var arr = []; arr[0] = userID; arr[1] = callID; exec(callback,function(error){},"CustomUI","inviteUser",arr); } CustomUI.prototype.switchCameraAVBroadcastSDK = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","switchCameraAVBroadcastSDK",arr); } /*========GROUP AVChat=======*/ CustomUI.prototype.startConferenceInContainer = function(container,callback){ var arr = []; arr[0] = container; exec(callback,function(error){},"CustomUI","startConferenceInContainer",arr); } CustomUI.prototype.sendConferenceRequest = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","sendConferenceRequest",arr); } CustomUI.prototype.joinConference = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","joinConference",arr); } CustomUI.prototype.endConference = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","endConference",arr); } CustomUI.prototype.toggleGroupAVAudioSDK = function(audioControlFlag,callback){ var arr = []; arr[0] = audioControlFlag; exec(callback,function(error){},"CustomUI","toggleGroupAVAudioSDK",arr); } CustomUI.prototype.toggleGroupAVVideoSDK = function(videoControlFlag,callback){ var arr = []; arr[0] = videoControlFlag; exec(callback,function(error){},"CustomUI","toggleGroupAVVideoSDK",arr); } CustomUI.prototype.switchGroupAVCameraSDK = function(callback){ var arr = []; exec(callback,function(error){},"CustomUI","switchGroupAVCameraSDK",arr); } var customui = new CustomUI(); module.exports = customui;