Comparing version 2.4.23 to 2.4.24
{ | ||
"name": "sendbird", | ||
"version": "2.4.23", | ||
"version": "2.4.24", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "SendBird <support@sendbird.com>" |
@@ -5,2 +5,8 @@ Changelog | ||
## v2.4.24 | ||
### add | ||
* added `onUploadProgress` event. | ||
## v2.4.22 | ||
@@ -7,0 +13,0 @@ |
{ | ||
"name": "sendbird", | ||
"version": "2.4.23", | ||
"version": "2.4.24", | ||
"description": "SendBird JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "SendBird.min.js", |
@@ -30,6 +30,6 @@ SendBird-SDK-JavaScript | ||
## Upgrading to v2.4.23 | ||
## Upgrading to v2.4.24 | ||
If you want to check the record of other version, go to [Change Log](https://github.com/smilefam/SendBird-SDK-JavaScript/blob/master/CHANGELOG.md). | ||
* added `sendFileWithData` function. | ||
* added `onUploadProgress` event. | ||
@@ -36,0 +36,0 @@ |
/** | ||
* SendBird JavaScript SDK v2.4.23 | ||
* SendBird JavaScript SDK v2.4.24 | ||
*/ | ||
!function(e,n){var t=n();"function"==typeof define&&define.amd?define([],t.getInstance()):"object"==typeof exports?(module.exports=t.getInstance(),module.exports.SB=t,module.exports.sendbird=t.getInstance()):(e.SB=t,e.sendbird=t.getInstance())}(this,function(){function e(){try{if("undefined"==typeof navigator||"undefined"==typeof navigator.userAgent)return!1;var e=navigator.userAgent.toLowerCase();return-1!=e.indexOf("msie")?parseInt(e.split("msie")[1]):!1}catch(n){return!1}}function n(n,r,s,i,a,o){var c=t?new t:new XMLHttpRequest,u=e();if(!("withCredentials"in c)&&u&&10>u){c=new XDomainRequest,c.withCredentials=!0;try{switch(s.toLowerCase()){case"get":c.open("GET",n);break;default:c.open("POST",n)}}catch(g){c.open("POST",n)}for(var p in i)r[p]=i[p];c.onload=function(){var e=JSON.parse(c.responseText);e.error?o(c.status,c.statusText):a(e)},c.onerror=function(){o(404,"There was a connection error")}}else{try{switch(c=t?new t:new XMLHttpRequest,s.toLowerCase()){case"get":c.open("GET",n);break;default:c.open("POST",n)}c.onload=function(){if(c.status>=m&&c.status<v){var e=c.responseText;a(JSON.parse(e))}else o(c.status,c.statusText)},c.onerror=function(){o(404,"There was a connection error")}}catch(d){c=new ActiveXObject("Microsoft.XMLHTTP");try{switch(s.toLowerCase()){case"get":c.open("GET",n);break;default:c.open("POST",n)}}catch(g){c.open("POST",n)}c.onreadystatechange=function(){if(4==c.readyState)if(c.status>=m&&c.status<v){var e=c.responseText;a(JSON.parse(e))}else o(c.status,c.statusText)}}c.setRequestHeader("Content-Type","text/plain; charset=UTF-8");for(var p in i)c.setRequestHeader(p,i[p])}switch(s.toLowerCase()){case"get":c.send();break;default:c.send(JSON.stringify(r))}}var t,r;try{t="undefined"==typeof window?require("xhr2"):null}catch(s){t=null}if(t){var i=require("http"),a=require("https"),o=new i.Agent({keepAlive:!0,keepAliveMsecs:6e4}),c=new a.Agent({keepAlive:!0,keepAliveMsecs:6e4}),u={};u.httpAgent=o,u.httpsAgent=c,t.nodejsSet(u)}try{r="undefined"==typeof WebSocket?require("websocket").w3cwebsocket:WebSocket}catch(s){r=WebSocket}var g=!1,p=!1;try{var d=window.console||{log:function(){}}}catch(_){var d={log:function(){}}}var l=function(e){g&&d.log(e)},f=function(e){e=e||{};for(var n=arguments.length,t=1;n>t;t++)if(arguments[t])for(var r in arguments[t])arguments[t].hasOwnProperty(r)&&(e[r]=arguments[t][r]);return e};"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var m=200,v=400,S=function(){function e(){var e=new k;return e}var n,t=function(t){var r=f({},{newInstance:!1},t);return r.newInstance?e():(n||(n=e()),n)};return{getInstance:t}}(),k=function(){function e(e){return a(k+C.app_id),c+"v"+S.replace(/[^(0-9)]/gi,"")+"/"+e}function s(e){return a(k+C.app_id),c+"v3/"+e}function i(){0!==O&&(F=3e3,M=5,O=0,l("=== Reset Reconnect Values ==="))}function a(e,t,r){if(_)u="ws://localtest.me:9000",c="http://api.localtest.me:8000/","function"==typeof t&&t();else{var s=(new Date).getTime()/1e3;0==W||W-s>300?n(e,{},"GET",{SendBird:w+C.app_id},function(e){u=e.ws_server,c=e.api_server+"/",l("Routing Info Update: "+u+", "+c),W=s,"function"==typeof t&&t()},function(e,n){"function"==typeof r&&r(e,n)}):"function"==typeof t&&t()}}function o(e){C.app_id=e.app_id,C.guest_id=e.guest_id,C.user_name=e.user_name,C.image_url=void 0==e.image_url||null==e.image_url?"":e.image_url,C.access_token=void 0==e.access_token||null==e.access_token?"":e.access_token,X({successFunc:function(n){e.successFunc(n)},errorFunc:function(n,t){e.errorFunc(n,t)},async:e.async})}var c,u,_=!1,S="1",k="https://api.sendbird.com/routing/",y="2.4.23";try{var h=encodeURIComponent(navigator.userAgent)}catch(T){var h="undefined"}var F,M,O,P="/?p=JS&pv="+h+"&sv="+y+"&ai=",w="JS,"+h+","+y+",",R=null,b={MESG:"MESG",FILE:"FILE",LOGI:"LOGI",JOIN:"JOIN",SYSM:"SYSM",BRDM:"BRDM",MCUP:"MCUP",READ:"READ",TPST:"TPST",TPEN:"TPEN",BAAN:"BAAN",FREZ:"FREZ",PING:"PING",PONG:"PONG"},C={},N={},I=0,E=0,A=null,G=null,B=null,L=0,D=!1,J=0,x=1e4,W=0;i();var U=function(e,n){switch(e){case b.MESG:z.onMessageReceived(JSON.parse(n));break;case b.SYSM:z.onSystemMessageReceived(JSON.parse(n));break;case b.FILE:z.onFileMessageReceived(JSON.parse(n));break;case b.BRDM:z.onBroadcastMessageReceived(JSON.parse(n));break;case b.TPST:z.onTypeStartReceived(JSON.parse(n));break;case b.TPEN:z.onTypeEndReceived(JSON.parse(n));break;case b.PONG:i(),l(b.PONG);break;case b.READ:z.onReadReceived(JSON.parse(n));break;case b.BAAN:z.onBanReceived(JSON.parse(n));break;case b.FREZ:var t=JSON.parse(n),r=!1;try{r=t.freeze}catch(s){r=!1}N.data=JSON.stringify({freeze:r}),z.onChannelFreezeReceived(t);break;default:z.onUndefinedMessageReceived(e,JSON.parse(n))}return JSON.parse(n)},q={successFunc:function(e){},errorFunc:function(e,n){l(e),l(n)}},z={onMessageReceived:function(e){l(e)},onSystemMessageReceived:function(e){l(e)},onFileMessageReceived:function(e){l(e)},onBroadcastMessageReceived:function(e){l(e)},onReadReceived:function(e){l(e)},onMessagingChannelUpdateReceived:function(e){l(e)},onTypeStartReceived:function(e){l(e)},onTypeEndReceived:function(e){l(e)},onMessageDelivery:function(e){l(e)},onBanReceived:function(e){l(e)},onChannelFreezeReceived:function(e){l(e)},onUndefinedMessageReceived:function(e,n){l(e),l(n)},onReconnectFailed:function(){},onWebSocket:function(e,n){},onLog:function(e){}},H=6,j=5,X=function(t){l("=== Start SendBird SDK ===");var r=f({},q,t),s="guest_login/",i={guest_id:C.guest_id,app_id:C.app_id,nickname:C.user_name,image_url:C.image_url,access_token:C.access_token};void 0!=C.gcm_reg_token&&""!=C.gcm_reg_token&&(i.gcm_reg_token=C.gcm_reg_token),void 0!=C.apns_device_token&&""!=C.apns_device_token&&(i.apns_device_token=C.apns_device_token),a(k+C.app_id,function(){n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):(C.guest_key=e.key,C.remove_apns_token&&Ue(C.remove_apns_token),C.remove_gcm_token&&We(C.remove_gcm_token),r.successFunc({}))},function(e,n){r.errorFunc(e,n)})},function(e,n){r.errorFunc(e,n)})},Y=function(t,r){l("=== Join Channel ===");var s=f({},q,r),i="channel_join/",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(e.isMessaging=!1,f(N,e),o=N,s.successFunc(o))},function(e,n){s.errorFunc(e,n)})},Z=function(t,r){l("=== Leave Channel ===");var s=f({},q,r),i="channel_leave",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(o=e,s.successFunc(o))},function(e,n){s.errorFunc(e,n)})},K=function(t,r){l("=== Member List ===");var s=f({},q,r),i="member_list/",a={app_id:C.app_id,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(o=e,s.successFunc(o))},function(e,n){s.errorFunc(e,n)})},V=function(t){l("=== Channel List ==="),t=f({},{limit:20,page:1,query:""},t);var r=f({},q,t),s="channel_list/",i={app_id:C.app_id,page:r.page,limit:r.limit,query:r.query},a={};n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):(a=e,r.successFunc(a))},function(e,n){r.errorFunc(e,n)})},$=function(e){V(e)},Q=function(e){return void 0!=e.last_message&&""!=e.last_message&&(e.last_message=JSON.parse(e.last_message.substring(4))),e},ee=function(t,r){l("=== Join Messaging Channel ===");var s=f({},q,r),i="messaging_join/",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(e.channel.isMessaging=!0,f(N,e.channel),o=e,s.successFunc(Q(o)))},function(e,n){s.errorFunc(e,n)})},ne=function(t,r){l("=== Start Messaging ==="),r=f({},{is_group:!1},r),t=t instanceof Array?t:new Array(t);var s=f({},q,r),i="messaging_start/",a={app_id:C.app_id,session_key:C.guest_key,guest_ids:t,is_group:r.is_group},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(f(N,e.channel),o=e,s.successFunc(Q(o)))},function(e,n){s.errorFunc(e,n)})},te=function(e,n,t){if(2==arguments.length){var r=arguments[1].channel_url;void 0!=r&&""!=r||(r=N.channel_url),re(arguments[0],r,arguments[1])}else re(e,n,t)},re=function(t,r,s){l("=== Invite Messaging ==="),t=t instanceof Array?t:new Array(t);var i=f({},q,s),a="messaging_invite/",o={app_id:C.app_id,session_key:C.guest_key,channel_url:r,guest_ids:t},c={};n(e(a),o,"POST",{SendBird:w+C.app_id},function(e){e.error?i.errorFunc(m,e.message):(f(N,e.channel),c=e,i.successFunc(Q(c)))},function(e,n){i.errorFunc(e,n)})},se=function(t,r){l("=== End Messaging ===");var s=f({},q,r),i="messaging_end/",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(f(N,e),o=e,s.successFunc(Q(o)))},function(e,n){s.errorFunc(e,n)})},ie=function(t){l("=== Get Messaging Channel List (Deprecated) ==="),t=f({},{limit:9999,page:1},t);var r=f({},q,t),s="messaging_list/",i={app_id:C.app_id,session_key:C.guest_key,page:r.page,limit:r.limit},a={};n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):(a=e,a.channels.forEach(function(e,n){e=Q(e)}),r.successFunc(a))},function(e,n){r.errorFunc(e,n)})},ae=function(e){l("=== Get Messaging Channel Pagination List ==="),e=f({},{limit:15,page:1,show_empty:!1},e);var t=f({},q,e),r="messaging_list/",i={app_id:C.app_id,session_key:C.guest_key,page:t.page,limit:t.limit,show_empty:t.show_empty},a={};n(s(r),i,"POST",{SendBird:w+C.app_id},function(e){e.error?t.errorFunc(m,e.message):(a=e,a.channels.forEach(function(e,n){e=Q(e)}),t.successFunc(a))},function(e,n){t.errorFunc(e,n)})},oe=function(t,r){l("=== Messaging Channel Info ===");var s=f({},q,r),i="messaging_info/",a={app_id:C.app_id,session_key:C.guest_key,channel_id:t};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):z.onMessagingChannelUpdateReceived(Q(e))},function(e,n){s.errorFunc(e,n)})},ce=function(t,r){l("=== Message Mark As Read ===");var s=f({},q,r),i="mark_as_read/",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(o=e,s.successFunc(o))},function(e,n){s.errorFunc(e,n)})},ue=function(t){l("=== Message Load More ==="),t=f({},{limit:20},t);var r=f({},q,t),s=(new Date).getTime(),i="message_list",a={app_id:C.app_id,session_key:C.guest_key,channel_url:N.channel_url,message_ts:0==E?s:E,prev_limit:r.limit,next_limit:0,include:!1},o=[];n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):(e.messages.forEach(function(e,n){var t=JSON.parse(e.substring(4));0==E?E=t.ts:E>t.ts&&(E=t.ts),o.push(Ne(e))}),r.successFunc({messages:o}))},function(e,n){r.errorFunc(e,n)})},ge=function(t){l("=== User List ==="),t=f({},{token:"",page:1,limit:30},t);var r=f({},q,t),s="user_list/",i={app_id:C.app_id,session_key:C.guest_key,token:r.token,page:r.page,limit:r.limit};n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):r.successFunc(e)},function(e,n){r.errorFunc(e,n)})},pe=function(e,n,t){t.custom=n,de(e,t)},de=function(e,n){l("=== Upload File ===");var r=f({},q,n),s="upload_file/",i='{"app_id": "'+C.app_id+'"}',a=new FormData;a.append("meta",i),a.append("file",e);var o="",u=c+"v"+S.replace(/[^(0-9)]/gi,"")+"/"+s,g=void 0==r.async?!0:r.async,p=r.hasOwnProperty("custom")?r.custom:"",d=t?new t:new XMLHttpRequest;d.open("POST",u,g),d.onload=function(){if(d.status>=m&&d.status<v){var n=d.responseText,t=JSON.parse(n);t.error?r.errorFunc(m,t.message):(o={error:!1,url:t.url},be({url:t.url,name:e.name,type:e.type,size:e.size,custom:p}),r.successFunc(o))}else r.errorFunc(d.status,d.statusText)},d.send(a)},_e=function(){l("=== Typing Start ===");var e=(new Date).getTime();Te(b.TPST,{channel_id:N.id,time:e}),J=e,D=!0},le=function(){l("=== Typing End ===");var e=(new Date).getTime();Te(b.TPEN,{channel_id:N.id,time:e}),J=0,D=!1},fe=(setInterval(function(){var e=(new Date).getTime();D&&e-J>x&&le()},x),function(t,r){l("=== Delete Message ===");var s=f({},q,r),i="message_delete/",a={app_id:C.app_id,session_key:C.guest_key,msg_id:t};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):s.successFunc(e)},function(e,n){s.errorFunc(e,n)})}),me=function(e){l("=== Web Socket Connect to Server ==="),ye();var n=f({},q,e);try{R=new r(u+P+C.app_id+"&key="+C.guest_key)}catch(t){d.log(t)}R.onopen=function(e){l("=== Web Socket Connected ==="),z.onWebSocket("open",e),Pe(!0),Fe(C.guest_key);var t=(new Date).getTime();if(void 0===N.id||Me(N.id,t)){var r={};n.successFunc(r)}else n.errorFunc(v,"WebSocket is not connected yet.")},R.onmessage=function(e){I=(new Date).getTime();for(var n=e.data.split("\n"),t=0;t<n.length;t++)if(0!=n[t].trim().length){var r=n[t].substring(0,4),s=n[t].substring(4);if(0!==r.trim().length||0!==s.trim().length)if(r==b.MCUP){var i=JSON.parse(s);oe(i.channel_id)}else U(r,s)}},R.onerror=function(e){l("=== Web Socket onerror ==="),z.onWebSocket("error",e),l(e)},R.onclose=function(e){l("=== Web Socket onclose ==="),z.onWebSocket("close",e),l(e),p||Se(),Pe(!1)}},ve=function(e){"undefined"==typeof e||1==e?(l("=== Web Socket Explicit Disconnect ==="),p=!0,Pe(!1),ke()):(l("=== Web Socket Disconnect ==="),p=e,ye())},Se=function(){p!==!0&&(null==B?M>O?(ye(),l("=== Start Reconnect (After "+(F/1e3).toString()+" Seconds) ==="),B=setTimeout(function(){O++,F*=2,me(),B=null,l("=== Reconnect done: "+O.toString()+" ===")},F)):(z.onReconnectFailed(),l("=== Stop Reconnect ===")):l("=== Reconnect is in progress. (skip) ==="))},ke=function(){l("=== clearConnection ==="),R&&ye(),N={},E=0;try{clearInterval(A),l("=== clearInterval: pingHandler ===")}catch(e){l("=== clearInterval fail: pingHandler ===")}A=null;try{clearTimeout(B),l("=== clearTimeout: retryHandler ===")}catch(e){l("=== clearTimeout fail: retryHandler ===")}B=null,L=0},ye=function(){if(R){z.onWebSocket("close"),R.close();try{R.onmessage=function(e){},R.onopen=function(e){},R.onerror=function(e){},R.onclose=function(e){}}catch(e){l("=== Error in clearWebSocket() ===")}R=null}E=0},he=function(){try{return R?R.readyState:r.CLOSED}catch(e){return r.CLOSED}},Te=function(e,n){var t=e+JSON.stringify(n)+"\n";try{if(!R)return!1;if(1!=R.readyState)return!1;R.send(t)}catch(r){return l(r),!1}return!0},Fe=function(e){Te(b.LOGI,{key:e})},Me=function(e,n){return Te(b.JOIN,{channel_id:e,last_ts:n})},Oe=function(){var e=(new Date).getTime();L=e,Te(b.PING,{id:e})},Pe=function(e){null!=A&&(clearInterval(A),A=null),e?(l("=== Start Pinger ==="),A=setInterval(function(){var e=(new Date).getTime(),n=e-I,t=parseInt(n/1e3);t>0&&t%15==0&&(l(b.PING),Oe(),clearTimeout(G),G=setTimeout(function(){var e=(new Date).getTime(),n=e-I,t=parseInt(n/1e3);t>=20&&(l("=== PING Timeout, Try Reconnect ==="),Pe(!1),Se())},6e3))},1e3)):l("=== Stop Pinger ===")},we=function(e,n){"string"!=typeof e&&(e=e.toString()),n=n||"","string"!=typeof n&&(n=n.toString());var t=Te(b.MESG,{channel_id:N.id,message:e,data:"",tid:n});z.onMessageDelivery({sent:t,message:e,data:"",id:n}),t&&N.isMessaging&&setTimeout(function(){le()},100)},Re=function(e,n,t){"string"!=typeof e&&(e=e.toString()),t=t||"","string"!=typeof t&&(t=t.toString());var r=Te(b.MESG,{channel_id:N.id,message:e,data:n,tid:t});z.onMessageDelivery({sent:r,message:e,data:n,tid:t}),r&&N.isMessaging&&setTimeout(function(){le()},100)},be=function(e){Te(b.FILE,{channel_id:N.id,name:e.name,url:e.url,type:e.type,size:e.size,custom:e.custom})},Ce=function(e){g=e},Ne=function(e){var n=e.substring(0,4),t=JSON.parse(e.substring(4));return{cmd:n,payload:t}},Ie=function(e){return e==b.MESG},Ee=function(e){return e==b.FILE},Ae=function(e){var n=e.url.split("."),t=n[n.length-1];return"png"==t||"jpeg"==t||"jpg"==t||"gif"==t||"bmp"==t?!0:e.type.indexOf("image")>=0},Ge=function(e){return e==H},Be=function(e){return e==j},Le=function(e){e({channel_url:N.channel_url,cover_img_url:N.cover_img_url,member_count:N.member_count,name:N.name,isMessaging:N.isMessaging,max_length_message:N.max_length_message,freeze:N.freeze})},De=function(e){e({guest_id:C.guest_id,image_url:C.image_url,nickname:C.user_name})},Je=function(t,r){if(C.guest_key){l("=== Start registerGCMToken ===");var s="register_push_token/",i={app_id:C.app_id,session_key:C.guest_key,gcm_reg_token:t},a=f({},q,r);n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?(l("=== Fail registerGCMToken ==="),C.gcm_reg_token=t,a.errorFunc(m,e.message)):(l("=== Success registerGCMToken ==="),a.successFunc(e))},function(e,n){C.gcm_reg_token=t,a.errorFunc(e,n)})}else C.gcm_reg_token=t},xe=function(t,r){if(C.guest_key){l("=== Start registerAPNSToken ===");var s="register_push_token/",i={app_id:C.app_id,session_key:C.guest_key,apns_device_token:t},a=f({},q,r);n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?(l("=== Fail registerAPNSToken ==="),C.apns_device_token=t,a.errorFunc(m,e.message)):(l("=== Success registerAPNSToken ==="),a.successFunc(e))},function(e,n){C.apns_device_token=t,a.errorFunc(e,n)})}else C.apns_device_token=t},We=function(t,r){if(C.guest_key){l("=== Start unregisterGCMToken ===");var s="unregister_push_token/",i={app_id:C.app_id,session_key:C.guest_key,gcm_reg_token:t},a=f({},q,r);n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?(l("=== Fail unregisterGCMToken ==="),C.remove_gcm_token=t,a.errorFunc(m,e.message)):(l("=== Success unregisterGCMToken ==="),C.remove_gcm_token="",a.successFunc(e))},function(e,n){l("=== Fail unregisterGCMToken ==="),C.remove_gcm_token=t,a.errorFunc(e,n)})}else C.remove_gcm_token=t},Ue=function(t,r){if(C.guest_key){l("=== Start unregisterAPNSToken ===");var s="unregister_push_token/",i={app_id:C.app_id,session_key:C.guest_key,apns_device_token:t},a=f({},q,r);n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?(l("=== Fail unregisterAPNSToken ==="),C.remove_apns_token=t,a.errorFunc(m,e.message)):(C.remove_apns_token="",a.successFunc(e))},function(e,n){l("=== Fail unregisterAPNSToken ==="),C.remove_apns_token=t,a.errorFunc(e,n)})}else C.remove_apns_token=t},qe=function(){return!!N.freeze},ze="[version] "+y,He=function(e){E="string"==typeof e?parseInt(e):e};return{version:ze,events:z,joinChannel:Y,leaveChannel:Z,getMemberList:K,getChannelSearch:V,getChannelList:$,joinMessagingChannel:ee,startMessaging:ne,inviteMessaging:te,endMessaging:se,getMessagingChannelList:ie,getMessagingChannelListPagination:ae,markAsRead:ce,getMessageLoadMore:ue,getUserList:ge,sendFile:de,sendFileWithData:pe,typeStart:_e,typeEnd:le,deleteMessage:fe,connect:me,disconnect:ve,message:we,messageWithData:Re,sendFileURL:be,setDebugMessage:Ce,isMessage:Ie,isFileMessage:Ee,hasImage:Ae,isGroupMessaging:Ge,isGroupMessagingChannel:Ge,isMessagingChannel:Be,getChannelInfo:Le,getUserInfo:De,getConnectionState:he,registerGCMToken:Je,registerAPNSToken:xe,unregisterGCMToken:We,unregisterAPNSToken:Ue,isFreezeChannel:qe,init:o,setMinMessageTs:He}};return S}); | ||
!function(e,n){var t=n();"function"==typeof define&&define.amd?define([],t.getInstance()):"object"==typeof exports?(module.exports=t.getInstance(),module.exports.SB=t,module.exports.sendbird=t.getInstance()):(e.SB=t,e.sendbird=t.getInstance())}(this,function(){function e(){try{if("undefined"==typeof navigator||"undefined"==typeof navigator.userAgent)return!1;var e=navigator.userAgent.toLowerCase();return-1!=e.indexOf("msie")?parseInt(e.split("msie")[1]):!1}catch(n){return!1}}function n(n,r,s,i,a,o){var c=t?new t:new XMLHttpRequest,u=e();if(!("withCredentials"in c)&&u&&10>u){c=new XDomainRequest,c.withCredentials=!0;try{switch(s.toLowerCase()){case"get":c.open("GET",n);break;default:c.open("POST",n)}}catch(g){c.open("POST",n)}for(var p in i)r[p]=i[p];c.onload=function(){var e=JSON.parse(c.responseText);e.error?o(c.status,c.statusText):a(e)},c.onerror=function(){o(404,"There was a connection error")}}else{try{switch(c=t?new t:new XMLHttpRequest,s.toLowerCase()){case"get":c.open("GET",n);break;default:c.open("POST",n)}c.onload=function(){if(c.status>=m&&c.status<v){var e=c.responseText;a(JSON.parse(e))}else o(c.status,c.statusText)},c.onerror=function(){o(404,"There was a connection error")}}catch(d){c=new ActiveXObject("Microsoft.XMLHTTP");try{switch(s.toLowerCase()){case"get":c.open("GET",n);break;default:c.open("POST",n)}}catch(g){c.open("POST",n)}c.onreadystatechange=function(){if(4==c.readyState)if(c.status>=m&&c.status<v){var e=c.responseText;a(JSON.parse(e))}else o(c.status,c.statusText)}}c.setRequestHeader("Content-Type","text/plain; charset=UTF-8");for(var p in i)c.setRequestHeader(p,i[p])}switch(s.toLowerCase()){case"get":c.send();break;default:c.send(JSON.stringify(r))}}var t,r;try{t="undefined"==typeof window?require("xhr2"):null}catch(s){t=null}if(t){var i=require("http"),a=require("https"),o=new i.Agent({keepAlive:!0,keepAliveMsecs:6e4}),c=new a.Agent({keepAlive:!0,keepAliveMsecs:6e4}),u={};u.httpAgent=o,u.httpsAgent=c,t.nodejsSet(u)}try{r="undefined"==typeof WebSocket?require("websocket").w3cwebsocket:WebSocket}catch(s){r=WebSocket}var g=!1,p=!1;try{var d=window.console||{log:function(){}}}catch(_){var d={log:function(){}}}var l=function(e){g&&d.log(e)},f=function(e){e=e||{};for(var n=arguments.length,t=1;n>t;t++)if(arguments[t])for(var r in arguments[t])arguments[t].hasOwnProperty(r)&&(e[r]=arguments[t][r]);return e};"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var m=200,v=400,S=function(){function e(){var e=new k;return e}var n,t=function(t){var r=f({},{newInstance:!1},t);return r.newInstance?e():(n||(n=e()),n)};return{getInstance:t}}(),k=function(){function e(e){return a(k+C.app_id),c+"v"+S.replace(/[^(0-9)]/gi,"")+"/"+e}function s(e){return a(k+C.app_id),c+"v3/"+e}function i(){0!==O&&(F=3e3,M=5,O=0,l("=== Reset Reconnect Values ==="))}function a(e,t,r){if(_)u="ws://localtest.me:9000",c="http://api.localtest.me:8000/","function"==typeof t&&t();else{var s=(new Date).getTime()/1e3;0==W||W-s>300?n(e,{},"GET",{SendBird:w+C.app_id},function(e){u=e.ws_server,c=e.api_server+"/",l("Routing Info Update: "+u+", "+c),W=s,"function"==typeof t&&t()},function(e,n){"function"==typeof r&&r(e,n)}):"function"==typeof t&&t()}}function o(e){C.app_id=e.app_id,C.guest_id=e.guest_id,C.user_name=e.user_name,C.image_url=void 0==e.image_url||null==e.image_url?"":e.image_url,C.access_token=void 0==e.access_token||null==e.access_token?"":e.access_token,X({successFunc:function(n){e.successFunc(n)},errorFunc:function(n,t){e.errorFunc(n,t)},async:e.async})}var c,u,_=!1,S="1",k="https://api.sendbird.com/routing/",y="2.4.24";try{var h=encodeURIComponent(navigator.userAgent)}catch(T){var h="undefined"}var F,M,O,P="/?p=JS&pv="+h+"&sv="+y+"&ai=",w="JS,"+h+","+y+",",R=null,b={MESG:"MESG",FILE:"FILE",LOGI:"LOGI",JOIN:"JOIN",SYSM:"SYSM",BRDM:"BRDM",MCUP:"MCUP",READ:"READ",TPST:"TPST",TPEN:"TPEN",BAAN:"BAAN",FREZ:"FREZ",PING:"PING",PONG:"PONG"},C={},N={},I=0,E=0,A=null,G=null,B=null,L=0,D=!1,J=0,x=1e4,W=0;i();var U=function(e,n){switch(e){case b.MESG:z.onMessageReceived(JSON.parse(n));break;case b.SYSM:z.onSystemMessageReceived(JSON.parse(n));break;case b.FILE:z.onFileMessageReceived(JSON.parse(n));break;case b.BRDM:z.onBroadcastMessageReceived(JSON.parse(n));break;case b.TPST:z.onTypeStartReceived(JSON.parse(n));break;case b.TPEN:z.onTypeEndReceived(JSON.parse(n));break;case b.PONG:i(),l(b.PONG);break;case b.READ:z.onReadReceived(JSON.parse(n));break;case b.BAAN:z.onBanReceived(JSON.parse(n));break;case b.FREZ:var t=JSON.parse(n),r=!1;try{r=t.freeze}catch(s){r=!1}N.data=JSON.stringify({freeze:r}),z.onChannelFreezeReceived(t);break;default:z.onUndefinedMessageReceived(e,JSON.parse(n))}return JSON.parse(n)},q={successFunc:function(e){},errorFunc:function(e,n){l(e),l(n)}},z={onMessageReceived:function(e){l(e)},onSystemMessageReceived:function(e){l(e)},onFileMessageReceived:function(e){l(e)},onBroadcastMessageReceived:function(e){l(e)},onReadReceived:function(e){l(e)},onMessagingChannelUpdateReceived:function(e){l(e)},onTypeStartReceived:function(e){l(e)},onTypeEndReceived:function(e){l(e)},onMessageDelivery:function(e){l(e)},onBanReceived:function(e){l(e)},onChannelFreezeReceived:function(e){l(e)},onUndefinedMessageReceived:function(e,n){l(e),l(n)},onReconnectFailed:function(){},onUploadProgress:function(e,n){l(e),l(n)},onWebSocket:function(e,n){},onLog:function(e){}},H=6,j=5,X=function(t){l("=== Start SendBird SDK ===");var r=f({},q,t),s="guest_login/",i={guest_id:C.guest_id,app_id:C.app_id,nickname:C.user_name,image_url:C.image_url,access_token:C.access_token};void 0!=C.gcm_reg_token&&""!=C.gcm_reg_token&&(i.gcm_reg_token=C.gcm_reg_token),void 0!=C.apns_device_token&&""!=C.apns_device_token&&(i.apns_device_token=C.apns_device_token),a(k+C.app_id,function(){n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):(C.guest_key=e.key,C.remove_apns_token&&Ue(C.remove_apns_token),C.remove_gcm_token&&We(C.remove_gcm_token),r.successFunc({}))},function(e,n){r.errorFunc(e,n)})},function(e,n){r.errorFunc(e,n)})},Y=function(t,r){l("=== Join Channel ===");var s=f({},q,r),i="channel_join/",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(e.isMessaging=!1,f(N,e),o=N,s.successFunc(o))},function(e,n){s.errorFunc(e,n)})},Z=function(t,r){l("=== Leave Channel ===");var s=f({},q,r),i="channel_leave",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(o=e,s.successFunc(o))},function(e,n){s.errorFunc(e,n)})},K=function(t,r){l("=== Member List ===");var s=f({},q,r),i="member_list/",a={app_id:C.app_id,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(o=e,s.successFunc(o))},function(e,n){s.errorFunc(e,n)})},V=function(t){l("=== Channel List ==="),t=f({},{limit:20,page:1,query:""},t);var r=f({},q,t),s="channel_list/",i={app_id:C.app_id,page:r.page,limit:r.limit,query:r.query},a={};n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):(a=e,r.successFunc(a))},function(e,n){r.errorFunc(e,n)})},$=function(e){V(e)},Q=function(e){return void 0!=e.last_message&&""!=e.last_message&&(e.last_message=JSON.parse(e.last_message.substring(4))),e},ee=function(t,r){l("=== Join Messaging Channel ===");var s=f({},q,r),i="messaging_join/",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(e.channel.isMessaging=!0,f(N,e.channel),o=e,s.successFunc(Q(o)))},function(e,n){s.errorFunc(e,n)})},ne=function(t,r){l("=== Start Messaging ==="),r=f({},{is_group:!1},r),t=t instanceof Array?t:new Array(t);var s=f({},q,r),i="messaging_start/",a={app_id:C.app_id,session_key:C.guest_key,guest_ids:t,is_group:r.is_group},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(f(N,e.channel),o=e,s.successFunc(Q(o)))},function(e,n){s.errorFunc(e,n)})},te=function(e,n,t){if(2==arguments.length){var r=arguments[1].channel_url;void 0!=r&&""!=r||(r=N.channel_url),re(arguments[0],r,arguments[1])}else re(e,n,t)},re=function(t,r,s){l("=== Invite Messaging ==="),t=t instanceof Array?t:new Array(t);var i=f({},q,s),a="messaging_invite/",o={app_id:C.app_id,session_key:C.guest_key,channel_url:r,guest_ids:t},c={};n(e(a),o,"POST",{SendBird:w+C.app_id},function(e){e.error?i.errorFunc(m,e.message):(f(N,e.channel),c=e,i.successFunc(Q(c)))},function(e,n){i.errorFunc(e,n)})},se=function(t,r){l("=== End Messaging ===");var s=f({},q,r),i="messaging_end/",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(f(N,e),o=e,s.successFunc(Q(o)))},function(e,n){s.errorFunc(e,n)})},ie=function(t){l("=== Get Messaging Channel List (Deprecated) ==="),t=f({},{limit:9999,page:1},t);var r=f({},q,t),s="messaging_list/",i={app_id:C.app_id,session_key:C.guest_key,page:r.page,limit:r.limit},a={};n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):(a=e,a.channels.forEach(function(e,n){e=Q(e)}),r.successFunc(a))},function(e,n){r.errorFunc(e,n)})},ae=function(e){l("=== Get Messaging Channel Pagination List ==="),e=f({},{limit:15,page:1,show_empty:!1},e);var t=f({},q,e),r="messaging_list/",i={app_id:C.app_id,session_key:C.guest_key,page:t.page,limit:t.limit,show_empty:t.show_empty},a={};n(s(r),i,"POST",{SendBird:w+C.app_id},function(e){e.error?t.errorFunc(m,e.message):(a=e,a.channels.forEach(function(e,n){e=Q(e)}),t.successFunc(a))},function(e,n){t.errorFunc(e,n)})},oe=function(t,r){l("=== Messaging Channel Info ===");var s=f({},q,r),i="messaging_info/",a={app_id:C.app_id,session_key:C.guest_key,channel_id:t};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):z.onMessagingChannelUpdateReceived(Q(e))},function(e,n){s.errorFunc(e,n)})},ce=function(t,r){l("=== Message Mark As Read ===");var s=f({},q,r),i="mark_as_read/",a={app_id:C.app_id,session_key:C.guest_key,channel_url:t},o={};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):(o=e,s.successFunc(o))},function(e,n){s.errorFunc(e,n)})},ue=function(t){l("=== Message Load More ==="),t=f({},{limit:20},t);var r=f({},q,t),s=(new Date).getTime(),i="message_list",a={app_id:C.app_id,session_key:C.guest_key,channel_url:N.channel_url,message_ts:0==E?s:E,prev_limit:r.limit,next_limit:0,include:!1},o=[];n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):(e.messages.forEach(function(e,n){var t=JSON.parse(e.substring(4));0==E?E=t.ts:E>t.ts&&(E=t.ts),o.push(Ne(e))}),r.successFunc({messages:o}))},function(e,n){r.errorFunc(e,n)})},ge=function(t){l("=== User List ==="),t=f({},{token:"",page:1,limit:30},t);var r=f({},q,t),s="user_list/",i={app_id:C.app_id,session_key:C.guest_key,token:r.token,page:r.page,limit:r.limit};n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?r.errorFunc(m,e.message):r.successFunc(e)},function(e,n){r.errorFunc(e,n)})},pe=function(e,n,t){t.custom=n,de(e,t)},de=function(e,n){l("=== Upload File ===");var r=f({},q,n),s="upload_file/",i='{"app_id": "'+C.app_id+'"}',a=new FormData;a.append("meta",i),a.append("file",e);var o="",u=c+"v"+S.replace(/[^(0-9)]/gi,"")+"/"+s,g=void 0==r.async?!0:r.async,p=r.hasOwnProperty("custom")?r.custom:"",d=t?new t:new XMLHttpRequest;try{d.upload.onprogress=function(n){z.onUploadProgress(n,e)}}catch(_){}d.open("POST",u,g),d.onload=function(){if(d.status>=m&&d.status<v){var n=d.responseText,t=JSON.parse(n);t.error?r.errorFunc(m,t.message):(o={error:!1,url:t.url},be({url:t.url,name:e.name,type:e.type,size:e.size,custom:p}),r.successFunc(o))}else r.errorFunc(d.status,d.statusText)},d.send(a)},_e=function(){l("=== Typing Start ===");var e=(new Date).getTime();Te(b.TPST,{channel_id:N.id,time:e}),J=e,D=!0},le=function(){l("=== Typing End ===");var e=(new Date).getTime();Te(b.TPEN,{channel_id:N.id,time:e}),J=0,D=!1},fe=(setInterval(function(){var e=(new Date).getTime();D&&e-J>x&&le()},x),function(t,r){l("=== Delete Message ===");var s=f({},q,r),i="message_delete/",a={app_id:C.app_id,session_key:C.guest_key,msg_id:t};n(e(i),a,"POST",{SendBird:w+C.app_id},function(e){e.error?s.errorFunc(m,e.message):s.successFunc(e)},function(e,n){s.errorFunc(e,n)})}),me=function(e){l("=== Web Socket Connect to Server ==="),ye();var n=f({},q,e);try{R=new r(u+P+C.app_id+"&key="+C.guest_key)}catch(t){d.log(t)}R.onopen=function(e){l("=== Web Socket Connected ==="),z.onWebSocket("open",e),Pe(!0),Fe(C.guest_key);var t=(new Date).getTime();if(void 0===N.id||Me(N.id,t)){var r={};n.successFunc(r)}else n.errorFunc(v,"WebSocket is not connected yet.")},R.onmessage=function(e){I=(new Date).getTime();for(var n=e.data.split("\n"),t=0;t<n.length;t++)if(0!=n[t].trim().length){var r=n[t].substring(0,4),s=n[t].substring(4);if(0!==r.trim().length||0!==s.trim().length)if(r==b.MCUP){var i=JSON.parse(s);oe(i.channel_id)}else U(r,s)}},R.onerror=function(e){l("=== Web Socket onerror ==="),z.onWebSocket("error",e),l(e)},R.onclose=function(e){l("=== Web Socket onclose ==="),z.onWebSocket("close",e),l(e),p||Se(),Pe(!1)}},ve=function(e){"undefined"==typeof e||1==e?(l("=== Web Socket Explicit Disconnect ==="),p=!0,Pe(!1),ke()):(l("=== Web Socket Disconnect ==="),p=e,ye())},Se=function(){p!==!0&&(null==B?M>O?(ye(),l("=== Start Reconnect (After "+(F/1e3).toString()+" Seconds) ==="),B=setTimeout(function(){O++,F*=2,me(),B=null,l("=== Reconnect done: "+O.toString()+" ===")},F)):(z.onReconnectFailed(),l("=== Stop Reconnect ===")):l("=== Reconnect is in progress. (skip) ==="))},ke=function(){l("=== clearConnection ==="),R&&ye(),N={},E=0;try{clearInterval(A),l("=== clearInterval: pingHandler ===")}catch(e){l("=== clearInterval fail: pingHandler ===")}A=null;try{clearTimeout(B),l("=== clearTimeout: retryHandler ===")}catch(e){l("=== clearTimeout fail: retryHandler ===")}B=null,L=0},ye=function(){if(R){z.onWebSocket("close"),R.close();try{R.onmessage=function(e){},R.onopen=function(e){},R.onerror=function(e){},R.onclose=function(e){}}catch(e){l("=== Error in clearWebSocket() ===")}R=null}E=0},he=function(){try{return R?R.readyState:r.CLOSED}catch(e){return r.CLOSED}},Te=function(e,n){var t=e+JSON.stringify(n)+"\n";try{if(!R)return!1;if(1!=R.readyState)return!1;R.send(t)}catch(r){return l(r),!1}return!0},Fe=function(e){Te(b.LOGI,{key:e})},Me=function(e,n){return Te(b.JOIN,{channel_id:e,last_ts:n})},Oe=function(){var e=(new Date).getTime();L=e,Te(b.PING,{id:e})},Pe=function(e){null!=A&&(clearInterval(A),A=null),e?(l("=== Start Pinger ==="),A=setInterval(function(){var e=(new Date).getTime(),n=e-I,t=parseInt(n/1e3);t>0&&t%15==0&&(l(b.PING),Oe(),clearTimeout(G),G=setTimeout(function(){var e=(new Date).getTime(),n=e-I,t=parseInt(n/1e3);t>=20&&(l("=== PING Timeout, Try Reconnect ==="),Pe(!1),Se())},6e3))},1e3)):l("=== Stop Pinger ===")},we=function(e,n){"string"!=typeof e&&(e=e.toString()),n=n||"","string"!=typeof n&&(n=n.toString());var t=Te(b.MESG,{channel_id:N.id,message:e,data:"",tid:n});z.onMessageDelivery({sent:t,message:e,data:"",id:n}),t&&N.isMessaging&&setTimeout(function(){le()},100)},Re=function(e,n,t){"string"!=typeof e&&(e=e.toString()),t=t||"","string"!=typeof t&&(t=t.toString());var r=Te(b.MESG,{channel_id:N.id,message:e,data:n,tid:t});z.onMessageDelivery({sent:r,message:e,data:n,tid:t}),r&&N.isMessaging&&setTimeout(function(){le()},100)},be=function(e){Te(b.FILE,{channel_id:N.id,name:e.name,url:e.url,type:e.type,size:e.size,custom:e.custom})},Ce=function(e){g=e},Ne=function(e){var n=e.substring(0,4),t=JSON.parse(e.substring(4));return{cmd:n,payload:t}},Ie=function(e){return e==b.MESG},Ee=function(e){return e==b.FILE},Ae=function(e){var n=e.url.split("."),t=n[n.length-1];return"png"==t||"jpeg"==t||"jpg"==t||"gif"==t||"bmp"==t?!0:e.type.indexOf("image")>=0},Ge=function(e){return e==H},Be=function(e){return e==j},Le=function(e){e({channel_url:N.channel_url,cover_img_url:N.cover_img_url,member_count:N.member_count,name:N.name,isMessaging:N.isMessaging,max_length_message:N.max_length_message,freeze:N.freeze})},De=function(e){e({guest_id:C.guest_id,image_url:C.image_url,nickname:C.user_name})},Je=function(t,r){if(C.guest_key){l("=== Start registerGCMToken ===");var s="register_push_token/",i={app_id:C.app_id,session_key:C.guest_key,gcm_reg_token:t},a=f({},q,r);n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?(l("=== Fail registerGCMToken ==="),C.gcm_reg_token=t,a.errorFunc(m,e.message)):(l("=== Success registerGCMToken ==="),a.successFunc(e))},function(e,n){C.gcm_reg_token=t,a.errorFunc(e,n)})}else C.gcm_reg_token=t},xe=function(t,r){if(C.guest_key){l("=== Start registerAPNSToken ===");var s="register_push_token/",i={app_id:C.app_id,session_key:C.guest_key,apns_device_token:t},a=f({},q,r);n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?(l("=== Fail registerAPNSToken ==="),C.apns_device_token=t,a.errorFunc(m,e.message)):(l("=== Success registerAPNSToken ==="),a.successFunc(e))},function(e,n){C.apns_device_token=t,a.errorFunc(e,n)})}else C.apns_device_token=t},We=function(t,r){if(C.guest_key){l("=== Start unregisterGCMToken ===");var s="unregister_push_token/",i={app_id:C.app_id,session_key:C.guest_key,gcm_reg_token:t},a=f({},q,r);n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?(l("=== Fail unregisterGCMToken ==="),C.remove_gcm_token=t,a.errorFunc(m,e.message)):(l("=== Success unregisterGCMToken ==="),C.remove_gcm_token="",a.successFunc(e))},function(e,n){l("=== Fail unregisterGCMToken ==="),C.remove_gcm_token=t,a.errorFunc(e,n)})}else C.remove_gcm_token=t},Ue=function(t,r){if(C.guest_key){l("=== Start unregisterAPNSToken ===");var s="unregister_push_token/",i={app_id:C.app_id,session_key:C.guest_key,apns_device_token:t},a=f({},q,r);n(e(s),i,"POST",{SendBird:w+C.app_id},function(e){e.error?(l("=== Fail unregisterAPNSToken ==="),C.remove_apns_token=t,a.errorFunc(m,e.message)):(C.remove_apns_token="",a.successFunc(e))},function(e,n){l("=== Fail unregisterAPNSToken ==="),C.remove_apns_token=t,a.errorFunc(e,n)})}else C.remove_apns_token=t},qe=function(){return!!N.freeze},ze="[version] "+y,He=function(e){E="string"==typeof e?parseInt(e):e};return{version:ze,events:z,joinChannel:Y,leaveChannel:Z,getMemberList:K,getChannelSearch:V,getChannelList:$,joinMessagingChannel:ee,startMessaging:ne,inviteMessaging:te,endMessaging:se,getMessagingChannelList:ie,getMessagingChannelListPagination:ae,markAsRead:ce,getMessageLoadMore:ue,getUserList:ge,sendFile:de,sendFileWithData:pe,typeStart:_e,typeEnd:le,deleteMessage:fe,connect:me,disconnect:ve,message:we,messageWithData:Re,sendFileURL:be,setDebugMessage:Ce,isMessage:Ie,isFileMessage:Ee,hasImage:Ae,isGroupMessaging:Ge,isGroupMessagingChannel:Ge,isMessagingChannel:Be,getChannelInfo:Le,getUserInfo:De,getConnectionState:he,registerGCMToken:Je,registerAPNSToken:xe,unregisterGCMToken:We,unregisterAPNSToken:Ue,isFreezeChannel:qe,init:o,setMinMessageTs:He}};return S}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68768