public BeforeCreateShare(ShareContent shareContent) { ShareContent = shareContent; }
/// <summary> /// PROVISIONAL - Share a piece of content into Symphony Given a 3rd party content (eg. news article), it can share to the given stream.\nThe stream can be a chatroom, an IM or a multiparty IM.\n /// </summary> /// <exception cref="SymphonyOSS.RestApiClient.Generated.OpenApi.AgentApi.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="sid">Stream ID</param> /// <param name="sessionToken">Session authentication token.</param> /// <param name="shareContent"></param> /// <param name="keyManagerToken">Key Manager authentication token. (optional)</param> /// <returns>Task of ApiResponse (V2Message)</returns> public async System.Threading.Tasks.Task <ApiResponse <V2Message> > V3StreamSidSharePostAsyncWithHttpInfo(string sid, string sessionToken, ShareContent shareContent, string keyManagerToken = null) { // verify the required parameter 'sid' is set if (sid == null) { throw new ApiException(400, "Missing required parameter 'sid' when calling ShareApi->V3StreamSidSharePost"); } // verify the required parameter 'sessionToken' is set if (sessionToken == null) { throw new ApiException(400, "Missing required parameter 'sessionToken' when calling ShareApi->V3StreamSidSharePost"); } // verify the required parameter 'shareContent' is set if (shareContent == null) { throw new ApiException(400, "Missing required parameter 'shareContent' when calling ShareApi->V3StreamSidSharePost"); } var localVarPath = "/v3/stream/{sid}/share"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <String, String>(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json localVarPathParams.Add("format", "json"); if (sid != null) { localVarPathParams.Add("sid", Configuration.ApiClient.ParameterToString(sid)); // path parameter } if (sessionToken != null) { localVarHeaderParams.Add("sessionToken", Configuration.ApiClient.ParameterToString(sessionToken)); // header parameter } if (keyManagerToken != null) { localVarHeaderParams.Add("keyManagerToken", Configuration.ApiClient.ParameterToString(keyManagerToken)); // header parameter } if (shareContent.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(shareContent); // http body (model) parameter } else { localVarPostBody = shareContent; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (localVarStatusCode >= 400) { throw new ApiException(localVarStatusCode, "Error calling V3StreamSidSharePost: " + localVarResponse.Content, localVarResponse.Content); } else if (localVarStatusCode == 0) { throw new ApiException(localVarStatusCode, "Error calling V3StreamSidSharePost: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); } return(new ApiResponse <V2Message>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (V2Message)Configuration.ApiClient.Deserialize(localVarResponse, typeof(V2Message)))); }
void OnGUI() { GUI.skin = demoSkin; float scale = 1.0f; if (Application.platform == RuntimePlatform.IPhonePlayer) { scale = Screen.width / 320; } float btnWidth = 165 * scale; float btnHeight = 30 * scale; float btnTop = 20 * scale; float btnGap = 20 * scale; GUI.skin.button.fontSize = Convert.ToInt32(14 * scale); if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize")) { print(ssdk == null); ssdk.Authorize(PlatformType.QQ); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info")) { ssdk.GetUserInfo(PlatformType.QQ); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu")) { ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle("test title"); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); //不同平台分享不同内容 ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetText("Sina share content"); customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG"); customizeShareParams.SetShareType(ContentType.Text); customizeShareParams.SetObjectID("SinaID"); content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams); //优先客户端分享 // content.SetEnableClientShare(true); //使用微博API接口应用内分享 iOS only // content.SetEnableSinaWeiboAPIShare(true); //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View")) { ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle("test title"); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share Content")) { ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle("test title"); // content.SetTitleUrl("http://www.mob.com"); // content.SetSite("Mob-ShareSDK"); // content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://qjsj.youzu.com/jycs/"); // content.SetComment("test description"); // content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Webpage); ssdk.ShareContent(PlatformType.WeChat, content); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) { //获取新浪微博好友,第一页,每页15条数据 print("Click Btn Of Get Friends SinaWeibo"); ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo ")) { Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo); print("share result :"); print(MiniJSON.jsonEncode(authInfo)); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Close SSO Auth")) { ssdk.DisableSSO(true); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Remove Authorize ")) { ssdk.CancelAuthorize(PlatformType.SinaWeibo); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend ")) { //关注新浪微博 ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725"); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShareWithContentName")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件分享【本接口功能仅暂时支持iOS】 ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnWidth += 80 * scale; btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareMenuWithContentName")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】 ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "ShowShareViewWithContentName")) { Hashtable customFields = new Hashtable(); //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】 customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } }
/// <summary> /// PROVISIONAL - Share a piece of content into Symphony Given a 3rd party content (eg. news article), it can share to the given stream.\nThe stream can be a chatroom, an IM or a multiparty IM.\n /// </summary> /// <exception cref="SymphonyOSS.RestApiClient.Generated.OpenApi.AgentApi.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="sid">Stream ID</param> /// <param name="sessionToken">Session authentication token.</param> /// <param name="shareContent"></param> /// <param name="keyManagerToken">Key Manager authentication token. (optional)</param> /// <returns>V2Message</returns> public V2Message V3StreamSidSharePost(string sid, string sessionToken, ShareContent shareContent, string keyManagerToken = null) { ApiResponse <V2Message> localVarResponse = V3StreamSidSharePostWithHttpInfo(sid, sessionToken, shareContent, keyManagerToken); return(localVarResponse.Data); }
/// <summary> /// PROVISIONAL - Share a piece of content into Symphony Given a 3rd party content (eg. news article), it can share to the given stream.\nThe stream can be a chatroom, an IM or a multiparty IM.\n /// </summary> /// <exception cref="SymphonyOSS.RestApiClient.Generated.OpenApi.AgentApi.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="sid">Stream ID</param> /// <param name="sessionToken">Session authentication token.</param> /// <param name="shareContent"></param> /// <param name="keyManagerToken">Key Manager authentication token. (optional)</param> /// <returns>Task of V2Message</returns> public async System.Threading.Tasks.Task <V2Message> V3StreamSidSharePostAsync(string sid, string sessionToken, ShareContent shareContent, string keyManagerToken = null) { ApiResponse <V2Message> localVarResponse = await V3StreamSidSharePostAsyncWithHttpInfo(sid, sessionToken, shareContent, keyManagerToken); return(localVarResponse.Data); }
public void inviteFriend() { if (GlobalDataScript.roomVo != null) { RoomCreateVo roomvo = GlobalDataScript.roomVo; GlobalDataScript.totalTimes = roomvo.roundNumber; GlobalDataScript.surplusTimes = roomvo.roundNumber; string str = ""; if (roomvo.hong) { str += "红中麻将,"; } else { if (roomvo.roomType == 1) { str += "转转麻将,"; } else if (roomvo.roomType == 2) { str += "划水麻将,"; } else if (roomvo.roomType == 3) { str += "长沙麻将,"; } } str += "大战" + roomvo.roundNumber + "局,"; if (roomvo.ziMo == 1) { str += "只能自摸,"; } else { str += "可抢杠胡,"; } if (roomvo.addWordCard) { str += "有风牌,"; } if (roomvo.xiaYu > 0) { str += "下鱼" + roomvo.xiaYu + "条,"; } if (roomvo.ma > 0) { str += "抓" + roomvo.ma + "个码,"; } if (roomvo.magnification > 0) { str += "倍率" + roomvo.magnification; } str += "有胆,你就来!"; string title = "微牌 " + "房间号:" + roomvo.roomId; ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetTitle(title); customizeShareParams.SetText(str); customizeShareParams.SetUrl("http://www.weipaigame.com/downLoad/index.html"); customizeShareParams.SetImageUrl(APIS.ImgUrl + "icon96.png"); customizeShareParams.SetShareType(ContentType.Webpage); customizeShareParams.SetObjectID(""); shareSdk.ShowShareContentEditor(PlatformType.WeChat, customizeShareParams); } }
private void OnGUI() { GUI.skin = this.demoSkin; float num = 1f; if (Application.platform == RuntimePlatform.IPhonePlayer) { num = (float)(Screen.width / 320); } float num2 = 165f * num; float num3 = 30f * num; float num4 = 20f * num; float num5 = 20f * num; GUI.skin.button.fontSize = Convert.ToInt32(14f * num); if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Authorize")) { Debug.Log(this.ssdk == null); this.ssdk.Authorize(PlatformType.SinaWeibo); } if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Get User Info")) { this.ssdk.GetUserInfo(PlatformType.SinaWeibo); } num4 += num3 + 20f * num; if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Show Share Menu")) { ShareContent shareContent = new ShareContent(); shareContent.SetText("this is a test string."); shareContent.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); shareContent.SetTitle("test title"); shareContent.SetTitleUrl("http://www.mob.com"); shareContent.SetSite("Mob-ShareSDK"); shareContent.SetSiteUrl("http://www.mob.com"); shareContent.SetUrl("http://www.mob.com"); shareContent.SetComment("test description"); shareContent.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); shareContent.SetShareType(2); ShareContent shareContent2 = new ShareContent(); shareContent2.SetText("Sina share content"); shareContent2.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG"); shareContent2.SetShareType(2); shareContent2.SetObjectID("SinaID"); shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, shareContent2); this.ssdk.ShowPlatformList(null, shareContent, 100, 100); } if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Show Share View")) { ShareContent shareContent3 = new ShareContent(); shareContent3.SetText("this is a test string."); shareContent3.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); shareContent3.SetTitle("test title"); shareContent3.SetTitleUrl("http://www.mob.com"); shareContent3.SetSite("Mob-ShareSDK"); shareContent3.SetSiteUrl("http://www.mob.com"); shareContent3.SetUrl("http://www.mob.com"); shareContent3.SetComment("test description"); shareContent3.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); shareContent3.SetShareType(2); this.ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, shareContent3); } num4 += num3 + 20f * num; if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Share Content")) { ShareContent shareContent4 = new ShareContent(); shareContent4.SetText("this is a test string."); shareContent4.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); shareContent4.SetTitle("test title"); shareContent4.SetTitleUrl("http://www.mob.com"); shareContent4.SetSite("Mob-ShareSDK"); shareContent4.SetSiteUrl("http://www.mob.com"); shareContent4.SetUrl("http://www.mob.com"); shareContent4.SetComment("test description"); shareContent4.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); shareContent4.SetShareType(2); this.ssdk.ShareContent(PlatformType.SinaWeibo, shareContent4); } if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Get Friends SinaWeibo ")) { Debug.Log("Click Btn Of Get Friends SinaWeibo"); this.ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0); } num4 += num3 + 20f * num; if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Get Token SinaWeibo ")) { Hashtable authInfo = this.ssdk.GetAuthInfo(PlatformType.SinaWeibo); Debug.Log("share result :"); Debug.Log(MiniJSON.jsonEncode(authInfo)); } if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Close SSO Auth")) { this.ssdk.DisableSSO(true); } num4 += num3 + 20f * num; if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f - num2, num4, num2, num3), "Remove Authorize ")) { this.ssdk.CancelAuthorize(PlatformType.SinaWeibo); } if (GUI.Button(new Rect(((float)Screen.width - num5) / 2f + num5, num4, num2, num3), "Add Friend ")) { this.ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725"); } num4 += num3 + 20f * num; if (GUI.Button(new Rect(((float)Screen.width - num2) / 2f, num4, num2, num3), "ShareWithContentName")) { Hashtable hashtable = new Hashtable(); hashtable["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; this.ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", hashtable); } num2 += 80f * num; num4 += num3 + 20f * num; if (GUI.Button(new Rect(((float)Screen.width - num2) / 2f, num4, num2, num3), "ShowShareMenuWithContentName")) { Hashtable hashtable2 = new Hashtable(); hashtable2["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; this.ssdk.ShowPlatformListWithContentName("ShareSDK", hashtable2, null, 100, 100); } num4 += num3 + 20f * num; if (GUI.Button(new Rect(((float)Screen.width - num2) / 2f, num4, num2, num3), "ShowShareViewWithContentName")) { Hashtable hashtable3 = new Hashtable(); hashtable3["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; this.ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", hashtable3); } }
protected void Page_Load(object sender, EventArgs e) { if (My.Roles.IsInRole(Role.FullSiteBannedUsers)) { ShowError("您已经被整站屏蔽不能使用分享或收藏"); } if (CanUseCollection == false && CanUseShare == false) { ShowError("您所在的用户组没有分享或收藏的权限"); return; } IsCollection = _Request.Get("type", Method.Get, "") == "collection"; if (_Request.IsClick("shareforeveryone"))//分享对话筐 { Create(PrivacyType.AllVisible); } else if (_Request.IsClick("shareforfriend"))//分享对话筐 { Create(PrivacyType.FriendVisible); } else if (_Request.IsClick("shareforselfe"))//分享对话筐 { Create(PrivacyType.SelfVisible); } shareType = _Request.Get <ShareType>("sharetype", Method.Get); int? targetID = _Request.Get <int>("targetID", Method.Get); string url = _Request.Get("url", Method.Get, string.Empty); if (url.ToLower() == "http://") { ShowError("请填写要分享的地址"); } m_Url = url; if (shareType.HasValue) { if (targetID.HasValue) { ShareContent content = ShareBO.Instance.GetShareContent(shareType.Value, targetID.Value, out m_UserID, out m_IsCanShare); if (content != null) { m_Content = content.Content; m_Title = content.Title; //m_HideTitle = StringUtil.HtmlEncode(m_Title); m_HideContent = StringUtil.HtmlEncode(ProcessHidenContent(m_Content)); m_HideUrl = StringUtil.HtmlEncode(content.URL); m_Url = BbsRouter.ReplaceUrlTag(content.URL); m_Content = BbsRouter.ReplaceUrlTag(m_Content); m_Title = BbsRouter.ReplaceUrlTag(m_Title); ImageUrl = content.ImgUrl; } } else if (url != null) { ShareContent content = ShareBO.Instance.GetShareContent(url, true); if (content == null) { ShowError("无发找到您入的URL地址或者您的输入不正确"); } shareType = content.Catagory; m_Title = content.Title; m_Content = content.Content; //m_HideTitle = StringUtil.HtmlEncode(m_Title); m_HideContent = StringUtil.HtmlEncode(ProcessHidenContent(m_Content)); m_IsCanShare = true; m_Url = content.URL; m_HideUrl = StringUtil.HtmlEncode(m_Url); ImageUrl = content.ImgUrl; } } else { int?refShareID = _Request.Get <int>("refshareid", Method.Get); if (refShareID.HasValue) { Share share = ShareBO.Instance.GetShare(refShareID.Value); if (share != null) { shareType = share.Type; m_Title = share.Subject; m_Content = share.Content; //m_HideTitle = StringUtil.HtmlEncode(m_Title); m_HideContent = StringUtil.HtmlEncode(ProcessHidenContent(m_Content)); m_RefShareID = refShareID.Value; m_IsCanShare = true; } } } }
void OnGUI() { GUI.skin = demoSkin; float scale = 1.0f; if (Application.platform == RuntimePlatform.IPhonePlayer) { scale = Screen.width / 320; } //float btnWidth = 165 * scale; float btnWidth = Screen.width / 5 * 2; float btnWidth2 = btnWidth + 80 * scale; float btnHeight = Screen.height / 25; float btnTop = 30 * scale; float btnGap = 20 * scale; GUI.skin.button.fontSize = Convert.ToInt32(13 * scale); if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Authorize")) { print(ssdk == null); #if UNITY_ANDROID ssdk.Authorize(PlatformType.SinaWeibo); #elif UNITY_IPHONE ssdk.Authorize(PlatformType.Facebook); #endif } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get User Info")) { //ssdk.GetUserInfo(PlatformType.Douyin); print("share result :" + ssdk.GetUserInfo(PlatformType.QQ)); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Show Share Menu")) { ShareContent content = new ShareContent(); // //(Android only) 隐藏九宫格里面不需要用到的平台(仅仅是不显示平台) // //(Android only) 也可以把jar包删除或者把Enabl属性e改成false(对应平台的全部功能将用不了) String[] platfsList = { ((int)PlatformType.Facebook).ToString(), ((int)PlatformType.TencentWeibo).ToString() }; content.SetHidePlatforms(platfsList); content.SetText("this is a test string."); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle("test title"); //(Android only) 针对Android绕过审核的多图分享,传图片String数组 String[] imageArray = { "/sdcard/test.jpg", "http://f1.webshare.mob.com/dimgs/1c950a7b02087bf41bc56f07f7d3572c11dfcf36.jpg", "/sdcard/test.jpg" }; content.SetImageArray(imageArray); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://i.y.qq.com/v8/playsong.html?hostuin=0&songid=&songmid=002x5Jje3eUkXT&_wv=1&source=qq&appshare=iphone&media_mid=002x5Jje3eUkXT"); content.SetShareType(ContentType.Image); //不同平台分享不同内容 ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetText("Sina share content"); customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG"); customizeShareParams.SetShareType(ContentType.Text); customizeShareParams.SetObjectID("SinaID"); content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams); //优先客户端分享 content.SetEnableClientShare(true); //使用微博API接口应用内分享 iOS only content.SetEnableSinaWeiboAPIShare(true); //通过分享菜单分享 ssdk.ShowPlatformList(null, content, 100, 100); } if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Show Share View")) { ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle("test title"); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShowShareContentEditor(PlatformType.SinaWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Share Content")) { ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImageUrl("http://ww3.sinaimg.cn/mw690/be159dedgw1evgxdt9h3fj218g0xctod.jpg"); content.SetTitle("test title"); //content.SetTitleUrl("http://www.mob.com"); //content.SetSite("Mob-ShareSDK"); //content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://qjsj.youzu.com/jycs/"); //content.SetComment("test description"); //content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShareContent(PlatformType.Oasis, content); // // 开发者要自己传入Activity 在9.0及其以上的系统 // // AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); // // AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity"); // // content.SetActivity(jo); // // Debug.Log("QQQ 测试传入的activity ==================>>> " + jo); // ShareContent content = new ShareContent(); // content.SetFilePath("/storage/emulated/0/douyin.mp4"); // content.SetShareType(ContentType.Video); // ssdk.ShareContent (PlatformType.Douyin, content); } //if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) //{ //获取新浪微博好友,第一页,每页15条数据 //print ("Click Btn Of Get Friends SinaWeibo"); // ssdk.GetFriendList (PlatformType.SinaWeibo, 15, 0); //ssdk.openMiniProgram("gh_afb25ac019c9","pages/index/index",0); //} btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Get Token ")) { Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.QQ); print("share result :"); print(MiniJSON.jsonEncode(authInfo)); } //if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap , btnTop, btnWidth, btnHeight), "Close SSO Auth")) //{ //ssdk.DisableSSO (true); //} btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Remove Authorize ")) { ssdk.CancelAuthorize(PlatformType.QQ); } //if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Add Friend ")) //{ //关注新浪微博 //ssdk.AddFriend (PlatformType.SinaWeibo, "3189087725"); //} btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "ShareWithContentName(IOS only)")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件分享【本接口功能仅暂时支持iOS】 ssdk.ShareWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "ShowShareMenuWithContentName(IOS only)")) { Hashtable customFields = new Hashtable(); customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; //根据配置文件展示分享菜单分享【本接口功能仅暂时支持iOS】 ssdk.ShowPlatformListWithContentName("ShareSDK", customFields, null, 100, 100); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "ShowShareViewWithContentName(IOS only)")) { Hashtable customFields = new Hashtable(); //根据配置文件展示编辑界面分享【本接口功能仅暂时支持iOS】 customFields["imgUrl"] = "http://ww1.sinaimg.cn/mw690/006dJESWgw1f6iyb8bzraj31kw0v67a2.jpg"; ssdk.ShowShareContentEditorWithContentName(PlatformType.SinaWeibo, "ShareSDK", customFields); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "SMS Authorize")) { ssdk.Authorize(PlatformType.SMS); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "submitPolicyGrantResult")) { Debug.Log("ssdk ======> " + ssdk); Debug.Log("mobsdk ======> " + mobsdk); mobsdk.submitPolicyGrantResult(true); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "getPrivacyPolicy")) { Debug.Log("ssdk ======> " + ssdk); Debug.Log("mobsdk ======> " + mobsdk); #if UNITY_IPHONE mobsdk.getPrivacyPolicy(true); #elif UNITY_ANDROID mobsdk.getPrivacyPolicy(true); Debug.Log("mobsdk getPrivacyPolicy======> " + mobsdk.getPrivacyPolicy(true)); #endif } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Share wxMiniProgram")) { #if UNITY_IPHONE ShareContent content = new ShareContent(); content.SetTitle("MiniProgram"); content.SetText("test MiniProgram"); content.SetUrl("http://www.mob.com"); content.SetMiniProgramPath("pages/index/index"); content.SetThumbImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1527484508213&di=d993c2ca41fec50717d137718511120f&imgtype=0&src=http%3A%2F%2Fimg5.2345.com%2Fduoteimg%2FzixunImg%2Flocal%2F2017%2F05%2F03%2F14938009295612.jpg"); content.SetMiniProgramHdThumbImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1522154322305&di=7f4bf3d0803fe8c2c66c140f0a6ea0b4&imgtype=0&src=http%3A%2F%2Fa4.topitme.com%2Fo%2F201007%2F29%2F12803876734174.jpg"); content.SetMiniProgramUserName("gh_afb25ac019c9"); content.SetMiniProgramWithShareTicket(true); // iOS/Android 微信小程序的版本(0-正式,1-开发,2-体验) content.SetMiniProgramType(0); //content.SetShareType (ContentType.MiniProgram); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.WeChat, content); ssdk.ShareContent(PlatformType.WeChat, shareContent); #elif UNITY_ANDROID ShareContent content = new ShareContent(); content.SetTitle("MiniProgram"); content.SetText("test MiniProgram"); content.SetUrl("http://www.mob.com"); content.SetMiniProgramType(0); content.SetMiniProgramUserName("gh_52568203455c"); content.SetImageUrl("http://pic28.photophoto.cn/20130818/0020033143720852_b.jpg"); content.SetShareType(ContentType.MiniProgram); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.WeChat, content); ssdk.ShareContent(PlatformType.WeChat, shareContent); #endif } // if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Share qqMiniProgram(IOS only)")) { #if UNITY_IPHONE ShareContent content = new ShareContent(); content.SetTitle("MiniProgram"); content.SetText("test MiniProgram"); content.SetUrl("http://www.mob.com"); content.SetThumbImageUrl("http://download.sdk.mob.com/web/images/2019/07/30/14/1564468183056/750_750_65.12.png"); content.SetMiniProgramPath("pages/index/index"); content.SetMiniProgramHdThumbImage("http://download.sdk.mob.com/web/images/2019/07/30/14/1564468183056/750_750_65.12.png"); content.SetMiniProgramAppID("1108318575"); content.SetMiniProgramWebpageUrl("www.qq.com"); //iOS/Android QQ小程序的类型,默认正式版(3),可选测试版(1)、预览版(4) content.SetMiniProgramType(3); content.SetShareType(ContentType.MiniProgram); ShareContent shareContent = new ShareContent(); shareContent.SetShareContentCustomize(PlatformType.QQ, content); ssdk.ShareContent(PlatformType.QQ, shareContent); #elif UNITY_ANDROID //=============================================================== //when you test QQ miniprogram, you should use this params //At the same time, the package name and signature should //correspond to the package name signature of the specific //QQ sharing small program applied in the background of tencent //=============================================================== //ShareContent content = new ShareContent(); //content.SetTitle("MiniProgram"); //content.SetText("test MiniProgram"); //content.SetTitleUrl("http://www.mob.com"); //content.SetImageUrl("http://www.3wyu.com/wp-content/uploads/6e0eaf15gy1fvr5tnm2dfj20f108gtad.jpg");//必须为网络图片 //content.SetShareType(ContentType.QQ_MINI_PROGRAM); //content.SetMiniProgramAppID("1108318575"); //content.SetMiniProgramPath("page/share/index.html?share_name=QQ%E9%9F%B3%E4%B9%90&share_key=5aIqFGg&from=disk"); //content.SetQQMiniProgramType(""); //ShareContent shareContent = new ShareContent(); //shareContent.SetShareContentCustomize(PlatformType.QQ, content); //ssdk.ShareContent(PlatformType.QQ, shareContent); #endif } //btnTop += btnHeight + 20 * scale; //if (GUI.Button(new Rect((Screen.width - btnWidth2) / 2, btnTop, btnWidth2, btnHeight), "Share Sina LinkCard")) //{ //#if UNITY_IPHONE //ShareContent content = new ShareContent(); //content.SetText("sina LinkCard"); //content.SetUrl("http://www.mob.com"); //content.SetImageUrl("http://www.mob.com/assets/images/ShareSDK_pic_1-09d293a6.png");//必须为网络图片 //content.SetSinaLinkCard(true); //content.SetSinaCardTitle("这是Title"); //content.SetSinaCardSummary("这是Summary"); //content.SetShareType(ContentType.Webpage); //ShareContent shareContent = new ShareContent(); //shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content); //ssdk.ShareContent(PlatformType.SinaWeibo, shareContent); //#elif UNITY_ANDROID //JsonData jsonData = new JsonData(); //jsonData["url"] = "http://wx4.sinaimg.cn/large/006WfoFPly1fq0jo9svnaj30dw0dwdhv.jpg"; //jsonData["width"] = "120"; //jsonData["height"] = "120"; //ShareContent content = new ShareContent(); //content.SetText("sina LinkCard"); //content.SetSinaCardCreateAtAndroid("2019-01-24"); //content.SetSinaCardDisplayNameAndroid("displayName"); //content.SetSinaCardSummary("Summary"); //content.SetSinaCardURLAndroid("http://www.mob.com/"); //content.SetSinaCardTypeAndroid("webpage"); //content.SetSinaCardImageAndroid(jsonData); //content.SetEnableClientShare(true); //ShareContent shareContent = new ShareContent(); //shareContent.SetShareContentCustomize(PlatformType.SinaWeibo, content); //ssdk.ShareContent(PlatformType.SinaWeibo, shareContent); //#endif //} }
void OnGUI() { GUI.skin = demoSkin; float scale = 1.0f; if (Application.platform == RuntimePlatform.IPhonePlayer) { scale = Screen.width / 320; } float btnWidth = 200 * scale; float btnHeight = 45 * scale; float btnTop = 20 * scale; GUI.skin.button.fontSize = Convert.ToInt32(16 * scale); if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Authorize")) { print(ssdk == null); ssdk.Authorize(PlatformType.SinaWeibo); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get User Info")) { ssdk.GetUserInfo(PlatformType.SinaWeibo); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share Menu")) { ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg"); content.SetTitle("test title"); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); //不同平台分享不同内容 ShareContent customizeShareParams = new ShareContent(); customizeShareParams.SetText("Sina share content"); customizeShareParams.SetImageUrl("http://git.oschina.net/alexyu.yxj/MyTmpFiles/raw/master/kmk_pic_fld/small/107.JPG"); customizeShareParams.SetShareType(ContentType.Image); customizeShareParams.SetObjectID("SinaID"); content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams); ssdk.ShowPlatformList(null, content, 100, 100); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Show Share View")) { ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg"); content.SetTitle("test title"); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShowShareContentEditor(PlatformType.TencentWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Share Content")) { ShareContent content = new ShareContent(); content.SetText("this is a test string."); content.SetImageUrl("https://f1.webshare.mob.com/code/demo/img/1.jpg"); content.SetTitle("test title"); content.SetTitleUrl("http://www.mob.com"); content.SetSite("Mob-ShareSDK"); content.SetSiteUrl("http://www.mob.com"); content.SetUrl("http://www.mob.com"); content.SetComment("test description"); content.SetMusicUrl("http://mp3.mwap8.com/destdir/Music/2009/20090601/ZuiXuanMinZuFeng20090601119.mp3"); content.SetShareType(ContentType.Image); ssdk.ShareContent(PlatformType.SinaWeibo, content); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Friends SinaWeibo ")) { //获取新浪微博好友,第一页,每页15条数据 print("Click Btn Of Get Friends SinaWeibo"); ssdk.GetFriendList(PlatformType.SinaWeibo, 15, 0); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Get Token SinaWeibo ")) { Hashtable authInfo = ssdk.GetAuthInfo(PlatformType.SinaWeibo); print("share result :"); print(MiniJSON.jsonEncode(authInfo)); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Close SSO Auth")) { ssdk.DisableSSO(true); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Remove Authorize ")) { ssdk.CancelAuthorize(PlatformType.SinaWeibo); } btnTop += btnHeight + 20 * scale; if (GUI.Button(new Rect((Screen.width - btnWidth) / 2, btnTop, btnWidth, btnHeight), "Add Friend ")) { //关注新浪微博 ssdk.AddFriend(PlatformType.SinaWeibo, "3189087725"); } }
/// <summary> /// PROVISIONAL - Share a piece of content into Symphony Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM. /// </summary> /// <exception cref="SymphonyOSS.RestApiClient.Generated.OpenApi.AgentApi.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="sid">Stream ID</param> /// <param name="sessionToken">Session authentication token.</param> /// <param name="shareContent"></param> /// <param name="keyManagerToken">Key Manager authentication token. (optional)</param> /// <returns>ApiResponse of V2Message</returns> public ApiResponse <V2Message> V3StreamSidSharePostWithHttpInfo(string sid, string sessionToken, ShareContent shareContent, string keyManagerToken = null) { // verify the required parameter 'sid' is set if (sid == null) { throw new ApiException(400, "Missing required parameter 'sid' when calling ShareApi->V3StreamSidSharePost"); } // verify the required parameter 'sessionToken' is set if (sessionToken == null) { throw new ApiException(400, "Missing required parameter 'sessionToken' when calling ShareApi->V3StreamSidSharePost"); } // verify the required parameter 'shareContent' is set if (shareContent == null) { throw new ApiException(400, "Missing required parameter 'shareContent' when calling ShareApi->V3StreamSidSharePost"); } var localVarPath = "./v3/stream/{sid}/share"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (sid != null) { localVarPathParams.Add("sid", Configuration.ApiClient.ParameterToString(sid)); // path parameter } if (sessionToken != null) { localVarHeaderParams.Add("sessionToken", Configuration.ApiClient.ParameterToString(sessionToken)); // header parameter } if (keyManagerToken != null) { localVarHeaderParams.Add("keyManagerToken", Configuration.ApiClient.ParameterToString(keyManagerToken)); // header parameter } if (shareContent != null && shareContent.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(shareContent); // http body (model) parameter } else { localVarPostBody = shareContent; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("V3StreamSidSharePost", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <V2Message>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (V2Message)Configuration.ApiClient.Deserialize(localVarResponse, typeof(V2Message)))); }
async void RequestShare(Dictionary <string, object> paramsDictionary) { if (paramsDictionary.TryGetValue("content", out object shareContent) && shareContent is FacebookShareContent) { ShareContent content = null; if (shareContent is FacebookShareLinkContent) { FacebookShareLinkContent linkContent = shareContent as FacebookShareLinkContent; ShareLinkContent.Builder linkContentBuilder = new ShareLinkContent.Builder(); if (linkContent.Quote != null) { linkContentBuilder.SetQuote(linkContent.Quote); } if (linkContent.ContentLink != null) { linkContentBuilder.SetContentUrl(Android.Net.Uri.Parse(linkContent.ContentLink.AbsoluteUri)); } if (!string.IsNullOrEmpty(linkContent.Hashtag)) { var shareHashTagBuilder = new ShareHashtag.Builder(); shareHashTagBuilder.SetHashtag(linkContent.Hashtag); linkContentBuilder.SetShareHashtag(shareHashTagBuilder.Build().JavaCast <ShareHashtag>()); } if (linkContent.PeopleIds != null && linkContent.PeopleIds.Length > 0) { linkContentBuilder.SetPeopleIds(linkContent.PeopleIds); } if (!string.IsNullOrEmpty(linkContent.PlaceId)) { linkContentBuilder.SetPlaceId(linkContent.PlaceId); } if (!string.IsNullOrEmpty(linkContent.Ref)) { linkContentBuilder.SetRef(linkContent.Ref); } content = linkContentBuilder.Build(); } else if (shareContent is FacebookSharePhotoContent) { FacebookSharePhotoContent photoContent = shareContent as FacebookSharePhotoContent; SharePhotoContent.Builder photoContentBuilder = new SharePhotoContent.Builder(); if (photoContent.Photos != null && photoContent.Photos.Length > 0) { foreach (var p in photoContent.Photos) { SharePhoto.Builder photoBuilder = new SharePhoto.Builder(); if (!string.IsNullOrEmpty(p.Caption)) { photoBuilder.SetCaption(p.Caption); } if (p.ImageUrl != null && !string.IsNullOrEmpty(p.ImageUrl.AbsoluteUri)) { photoBuilder.SetImageUrl(Android.Net.Uri.Parse(p.ImageUrl.AbsoluteUri)); } if (p.Image != null) { Bitmap bmp = BitmapFactory.DecodeByteArray(p.Image, 0, p.Image.Length); photoBuilder.SetBitmap(bmp); } photoContentBuilder.AddPhoto(photoBuilder.Build().JavaCast <SharePhoto>()); } } if (photoContent.ContentLink != null) { photoContentBuilder.SetContentUrl(Android.Net.Uri.Parse(photoContent.ContentLink.AbsoluteUri)); } if (!string.IsNullOrEmpty(photoContent.Hashtag)) { var shareHashTagBuilder = new ShareHashtag.Builder(); shareHashTagBuilder.SetHashtag(photoContent.Hashtag); photoContentBuilder.SetShareHashtag(shareHashTagBuilder.Build().JavaCast <ShareHashtag>()); } if (photoContent.PeopleIds != null && photoContent.PeopleIds.Length > 0) { photoContentBuilder.SetPeopleIds(photoContent.PeopleIds); } if (!string.IsNullOrEmpty(photoContent.PlaceId)) { photoContentBuilder.SetPlaceId(photoContent.PlaceId); } if (!string.IsNullOrEmpty(photoContent.Ref)) { photoContentBuilder.SetRef(photoContent.Ref); } content = photoContentBuilder.Build(); } else if (shareContent is FacebookShareVideoContent) { FacebookShareVideoContent videoContent = shareContent as FacebookShareVideoContent; ShareVideoContent.Builder videoContentBuilder = new ShareVideoContent.Builder(); if (videoContent.PreviewPhoto != null) { SharePhoto.Builder photoBuilder = new SharePhoto.Builder(); if (!string.IsNullOrEmpty(videoContent.PreviewPhoto.Caption)) { photoBuilder.SetCaption(videoContent.PreviewPhoto.Caption); } if (videoContent.PreviewPhoto.ImageUrl != null && !string.IsNullOrEmpty(videoContent.PreviewPhoto.ImageUrl.AbsoluteUri)) { photoBuilder.SetImageUrl(Android.Net.Uri.Parse(videoContent.PreviewPhoto.ImageUrl.AbsoluteUri)); } if (videoContent.PreviewPhoto.Image != null) { Bitmap bmp = BitmapFactory.DecodeByteArray(videoContent.PreviewPhoto.Image, 0, videoContent.PreviewPhoto.Image.Length); photoBuilder.SetBitmap(bmp); } videoContentBuilder.SetPreviewPhoto(photoBuilder.Build().JavaCast <SharePhoto>()); } if (videoContent.Video != null) { ShareVideo.Builder videoBuilder = new ShareVideo.Builder(); if (videoContent.Video.LocalUrl != null) { videoBuilder.SetLocalUrl(Android.Net.Uri.Parse(videoContent.PreviewPhoto.ImageUrl.AbsoluteUri)); } videoContentBuilder.SetVideo(videoBuilder.Build().JavaCast <ShareVideo>()); } if (videoContent.ContentLink != null) { videoContentBuilder.SetContentUrl(Android.Net.Uri.Parse(videoContent.ContentLink.AbsoluteUri)); } if (!string.IsNullOrEmpty(videoContent.Hashtag)) { var shareHashTagBuilder = new ShareHashtag.Builder(); shareHashTagBuilder.SetHashtag(videoContent.Hashtag); videoContentBuilder.SetShareHashtag(shareHashTagBuilder.Build().JavaCast <ShareHashtag>()); } if (videoContent.PeopleIds != null && videoContent.PeopleIds.Length > 0) { videoContentBuilder.SetPeopleIds(videoContent.PeopleIds); } if (!string.IsNullOrEmpty(videoContent.PlaceId)) { videoContentBuilder.SetPlaceId(videoContent.PlaceId); } if (!string.IsNullOrEmpty(videoContent.Ref)) { videoContentBuilder.SetRef(videoContent.Ref); } content = videoContentBuilder.Build(); } if (content != null) { ShareApi.Share(content, shareCallback); } } }