public WechatShareSeq(NotifyDoShare currentNotifyDoShare,
                       IDataContainer <NotifyDoShareResult> notifyDoShareResult, RemoteAPI remoteApi, IDialogManager dialogManager,
                       Action callBack)
 {
     _finishCallBack       = callBack;
     _dialogManager        = dialogManager;
     _remoteAPI            = remoteApi;
     StartListener         = BeforeStart;
     _notifyDoShareResult  = notifyDoShareResult;
     _currentNotifyDoShare = currentNotifyDoShare;
 }
        public void WxShareResult(string content)
        {
            MyLog.InfoWithFrame(name, "WXShareResult: " + content);
            if (string.IsNullOrEmpty(content))
            {
                return;
            }

            var result = JsonUtility.FromJson <WxShareResult>(content);

            if (result.Res == WeChat.WxShareResult.Success)
            {
                var shareContent = JsonUtility.FromJson <ShareContent>(result.Content);
                if (shareContent == null)
                {
                    return;
                }

                var type = shareContent.Type;
                var code = shareContent.Content;

                if (string.IsNullOrEmpty(code))
                {
                    return;
                }

                var notifyDoShare = new NotifyDoShare();
                notifyDoShare.id   = System.Guid.NewGuid().ToString("N");
                notifyDoShare.type = type;
                if (type == (int)ShareResultType.AwardCode)
                {
                    notifyDoShare.award_code = code;
                }
                else if (type == (int)ShareResultType.TaskCode)
                {
                    notifyDoShare.user_task_code = code;
                }

                EnqueueDoShare(notifyDoShare);
            }
            else
            {
                if (!string.IsNullOrEmpty(result.ErrMsg))
                {
                    _dialogManager.ShowToast(result.ErrMsg, 2, true);
                }
            }
        }
        private void EnqueueDoShare(NotifyDoShare doShare)
        {
            if (_doShares == null)
            {
                return;
            }

            foreach (var k in _doShares)
            {
                if (doShare.id == k.id)
                {
                    return;
                }
            }

            _doShares.Enqueue(doShare);
        }