UNPKG

tjc-sdk

Version:

TIANJI IM SDK

2 lines (1 loc) 821 B
import t from"./messageContent.js";import s from"../config.js";class i extends t{file;remotePath="";localPath="";mediaType=0;constructor(t,s=0,i,e){super(t),this.mediaType=s,i?"string"!=typeof i||i.startsWith("http")?(this.file=i,i&&i.path&&(this.localPath=i.path,this.localPath.indexOf(i.name)<0&&(this.localPath+=i.name))):(this.localPath=i,this.remotePath=e):(this.localPath="",this.remotePath=e)}encode(){let t=super.encode();return t.localMediaPath=this.localPath,t.remoteMediaUrl=this.remotePath?this.remotePath:"",t.mediaType=this.mediaType,s.urlRedirect&&(this.remotePath=s.urlRedirect(t.remoteMediaUrl)),t}decode(t){super.decode(t),this.localPath=t.localMediaPath,this.remotePath=t.remoteMediaUrl,s.urlRedirect&&(this.remotePath=s.urlRedirect(t.remoteMediaUrl)),this.mediaType=t.mediaType}}export{i as default};