/// <summary>
        /// 加载共享类型回调
        /// </summary>
        private void AddContent_Type_CallBack(SharingType type)
        {
            try
            {
                //if (type == SharingType.ppt)
                //{
                //    this.PPTOperationVisibility = vy.Visible;
                //}
                //else
                //{
                //    this.PPTOperationVisibility = vy.Collapsed;

                //}
                if (this.conversationResourceWindow != null)
                {
                    this.conversationResourceWindow.RefleshViewByMesuare();
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
Beispiel #2
0
 public static void ShowShareUI(SharingType sharingType, Action <CallbackResponse> OnShareCompleted)
 {
     _sharingType      = sharingType;
     _onShareCompleted = OnShareCompleted;
     Utils.RunOnWindowsUIThread(() =>
     {
         try
         {
             DataTransferManager.ShowShareUI();
         }
         catch (Exception ex)
         {
             Utils.RunOnUnityAppThread(() =>
             {
                 if (OnShareCompleted != null)
                 {
                     OnShareCompleted(new CallbackResponse {
                         Exception = ex, Status = CallbackStatus.Failure
                     });
                     return;
                 }
             });
         }
     });
 }
 /// <summary>
 /// 移除共享类型回调
 /// </summary>
 private void RemoveContent_Type_CallBack(SharingType type)
 {
     try
     {
         if (this.conversationResourceWindow != null)
         {
             this.conversationResourceWindow.RefleshViewByMesuare();
         }
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }
Beispiel #4
0
 public static void ShowShareUI(SharingType sharingType, Action<CallbackResponse> OnShareCompleted)
 {
     _sharingType = sharingType;
     _onShareCompleted = OnShareCompleted;
     Utils.RunOnWindowsUIThread(() =>
     {
         try
         {
             DataTransferManager.ShowShareUI();
         }
         catch(Exception ex)
         {
             Utils.RunOnUnityAppThread(() =>
             {
                 if (OnShareCompleted != null)
                 {
                     OnShareCompleted(new CallbackResponse { Exception = ex, Status = CallbackStatus.Failure });
                     return;
                 }
             });
         }
     });
 }
        /// <summary>
        ///     Share story to someone
        /// </summary>
        /// <param name="reelId">Reel id</param>
        /// <param name="storyMediaId">Story media id</param>
        /// <param name="threadId">Thread id</param>
        /// <param name="sharingType">Sharing type</param>
        public async Task <IResult <InstaSharing> > ShareStoryAsync(string reelId, string storyMediaId, string threadId, SharingType sharingType = SharingType.Video)
        {
            UserAuthValidator.Validate(_userAuthValidate);
            try
            {
                var instaUri = new Uri(InstaApiConstants.BASE_INSTAGRAM_API_URL + $"direct_v2/threads/broadcast/story_share/?media_type={sharingType.ToString().ToLower()}");
                var data     = new JObject
                {
                    { "action", "send_item" },
                    { "thread_ids", $"[{threadId}]" },
                    { "unified_broadcast_format", "1" },
                    { "reel_id", reelId },
                    { "story_media_id", storyMediaId },
                    { "_csrftoken", _user.CsrfToken },
                    { "_uid", _user.LoggedInUser.Pk.ToString() },
                    { "_uuid", _deviceInfo.DeviceGuid.ToString() },
                };
                var request = HttpHelper.GetSignedRequest(HttpMethod.Post, instaUri, _deviceInfo, data);
                request.Headers.Add("Host", "i.instagram.com");
                var response = await _httpRequestProcessor.SendAsync(request);

                var json = await response.Content.ReadAsStringAsync();

                if (response.StatusCode != HttpStatusCode.OK)
                {
                    return(Result.Fail("Status code: " + response.StatusCode, (InstaSharing)null));
                }
                var obj = JsonConvert.DeserializeObject <InstaSharing>(json);

                return(Result.Success(obj));
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                _logger?.LogException(exception);
                return(Result.Fail <InstaSharing>(exception));
            }
        }
Beispiel #6
0
 public static void ShowShareUI(SharingType sharingType, Action<CallbackResponse> OnShareCompleted)
 {
     OnShareCompleted(new CallbackResponse { Status = CallbackStatus.Failure, Exception = new Exception("Cannot call Windows Store APIs in Unity Editor")});
 }
Beispiel #7
0
 public static void ShowShareUI(SharingType sharingType, Action <CallbackResponse> OnShareCompleted)
 {
     OnShareCompleted(new CallbackResponse {
         Status = CallbackStatus.Failure, Exception = new Exception("Cannot call Windows Store APIs in Unity Editor")
     });
 }