void _showShareView(IEvent eventObj) { ShareUtils.showShareView( new ShareView( projectType: ProjectType.iEvent, onPressed: type => { var linkUrl = $"{Config.apiAddress}/events/{eventObj.id}"; if (type == ShareType.clipBoard) { this.widget.actionModel.copyText(linkUrl); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); } else { var imageUrl = $"{eventObj.avatar}.200x0x1.jpg"; CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); this.widget.actionModel.shareToWechat(type, eventObj.title, eventObj.shortDescription, linkUrl, imageUrl).Then(CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } } ) ); }
void _showShareView(IEvent eventObj) { ShareUtils.showShareView( new ShareView( projectType: ProjectType.iEvent, onPressed: type => { AnalyticsManager.ClickShare(shareType: type, "Event", "Event_" + eventObj.id, title: eventObj.title); var linkUrl = $"{Config.apiAddress}/events/{eventObj.id}"; var path = CStringUtils.CreateMiniPath(id: eventObj.id, title: eventObj.title); if (type == ShareType.clipBoard) { this.widget.actionModel.copyText(obj: linkUrl); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); } else { var imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: eventObj.avatar); CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); this.widget.actionModel.shareToWechat( arg1: type, arg2: eventObj.title, arg3: eventObj.shortDescription, arg4: linkUrl, arg5: imageUrl, arg6: path) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } } ) ); }
public bool AtLeastOneBuildIsRegistered() { if (!IsWebGLPublisherOpen()) { return(false); } return(ShareUtils.GetAllBuildsDirectories().Count > 0); }
public void GetUnityVersionOfBuild_ValidBuild_Success() { List <string> lines = new List <string>(); lines.Add("m_EditorVersion: 2019.3.4f1"); lines.Add("m_EditorVersionWithRevision: 2019.3.4f1(4f139db2fdbd)"); File.WriteAllLines(Path.Combine(outputFolder, "ProjectVersion.txt"), lines); Assert.AreEqual("2019.3", ShareUtils.GetUnityVersionOfBuild(outputFolder)); }
public void GetUnityVersionOfBuild_InvalidVersionFile_Fails() { List <string> lines = new List <string>(); lines.Add("m_EditorVersion: broken data"); lines.Add("m_EditorVersionWithRevision: broken data"); File.WriteAllLines(Path.Combine(outputFolder, "ProjectVersion.txt"), lines); Assert.AreEqual(string.Empty, ShareUtils.GetUnityVersionOfBuild(outputFolder)); }
public static void showArticleShareView( bool showReportAndBlock, bool isLoggedIn, VoidCallback pushToCopy, VoidCallback pushToLogin, VoidCallback pushToBlock, VoidCallback pushToReport, OnShareType shareToWechat, VoidCallback mainRouterPop = null ) { ShareUtils.showShareView(new ShareView( projectType: ProjectType.article, showReportAndBlock: showReportAndBlock, onPressed: type => { if (type == ShareType.clipBoard) { if (pushToCopy != null) { pushToCopy(); } } else if (type == ShareType.block) { ReportManager.block( isLoggedIn: isLoggedIn, pushToLogin: pushToLogin, pushToBlock: pushToBlock, mainRouterPop: mainRouterPop ); } else if (type == ShareType.report) { ReportManager.report( isLoggedIn: isLoggedIn, pushToLogin: pushToLogin, pushToReport: pushToReport ); } else { if (shareToWechat != null) { shareToWechat(type: type); } } } )); }
void _share(Article article) { ShareUtils.showShareView(new ShareView( projectType: ProjectType.article, onPressed: type => { var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); if (type == ShareType.clipBoard) { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); } else if (type == ShareType.block) { ReportManager.block( isLoggedIn: this.widget.viewModel.isLoggedIn, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(article.id), () => this.widget.actionModel.mainRouterPop() ); } else if (type == ShareType.report) { ReportManager.report( isLoggedIn: this.widget.viewModel.isLoggedIn, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToReport(arg1: article.id, arg2: ReportType.article) ); } else { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url); this.widget.actionModel.shareToWechat(type, article.title, article.subTitle, linkUrl, imageUrl).Then(CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } } )); }
void share() { ShareUtils.showShareView(new ShareView( projectType: ProjectType.article, onPressed: type => { string linkUrl = $"{Config.apiAddress}/p/{this._article.id}"; if (type == ShareType.clipBoard) { Clipboard.setData(new ClipboardData(linkUrl)); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); } else if (type == ShareType.block) { ReportManager.block(this.widget.viewModel.isLoggedIn, this._article.id, this.widget.actionModel.pushToLogin, this.widget.actionModel.pushToBlock, this.widget.actionModel.mainRouterPop ); } else if (type == ShareType.report) { ReportManager.report(this.widget.viewModel.isLoggedIn, this._article.id, ReportType.article, this.widget.actionModel.pushToLogin, this.widget.actionModel.pushToReport ); } else { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = $"{this._article.thumbnail.url}.200x0x1.jpg"; this.widget.actionModel.shareToWechat(type, this._article.title, this._article.subTitle, linkUrl, imageUrl).Then(CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } } )); }
public async void ShareLinkAsync() { MyCustomWebView currentWebView = GetCurrentWebView(); try { if (currentWebView != null) { string title = await currentWebView.EvaluateJavaScriptAsync("document.title;"); string lite = !title.Contains("Mantenimiento") ? UtilsXF.RemoveSpecialCharacters(title.Substring(title.LastIndexOf(" - "))) : title; _ = ShareUtils.ShareText(lite, ((UrlWebViewSource)WebView.Source).Url); } } catch (Exception) { if (currentWebView != null) { _ = ShareUtils.ShareText("", ((UrlWebViewSource)WebView.Source).Url); } } }
private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args) { ShareUtils.Share(args.Request); }
Widget _buildHeadTop(bool isShowShare, IEvent eventObj) { Widget shareWidget = new Container(); if (isShowShare) { shareWidget = new CustomButton( onPressed: () => ShareUtils.showShareView(new ShareView( projectType: ProjectType.iEvent, onPressed: type => { var linkUrl = $"{Config.apiAddress}/events/{eventObj.id}"; if (type == ShareType.clipBoard) { this.widget.actionModel.copyText(linkUrl); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); } else { var imageUrl = $"{eventObj.avatar}.200x0x1.jpg"; CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); this.widget.actionModel.shareToWechat(type, eventObj.title, eventObj.shortDescription, linkUrl, imageUrl).Then(CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } })), child: new Container( alignment: Alignment.topRight, width: 64, height: 64, color: CColors.Transparent, child: new Icon(Icons.share, size: 28, color: this._showNavBarShadow ? CColors.White : CColors.icon3)) ); } return(new AnimatedContainer( height: 44, duration: new TimeSpan(0, 0, 0, 0, 0), padding: EdgeInsets.symmetric(horizontal: 8), decoration: new BoxDecoration( CColors.White, gradient: this._showNavBarShadow ? new LinearGradient( colors: new List <Color> { new Color(0x80000000), new Color(0x0) }, begin: Alignment.topCenter, end: Alignment.bottomCenter ) : null ), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new CustomButton( onPressed: () => this.widget.actionModel.mainRouterPop(), child: new Icon( Icons.arrow_back, size: 28, color: this._showNavBarShadow ? CColors.White : CColors.icon3 ) ), shareWidget } ) )); }
Widget _buildHeadTop(IEvent eventObj) { Widget shareWidget = new CustomButton( onPressed: () => ShareUtils.showShareView(new ShareView( projectType: ProjectType.iEvent, onPressed: type => { AnalyticsManager.ClickShare(type, "Event", "Event_" + eventObj.id, eventObj.title); var linkUrl = $"{Config.apiAddress}/events/{eventObj.id}"; if (type == ShareType.clipBoard) { this.widget.actionModel.copyText(linkUrl); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); } else { var imageUrl = CImageUtils.SizeTo200ImageUrl(eventObj.avatar); CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); this.widget.actionModel.shareToWechat(type, eventObj.title, eventObj.shortDescription, linkUrl, imageUrl, null).Then(CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } })), child: new Container( color: CColors.Transparent, child: new Icon(Icons.share, size: 24, color: this._showNavBarShadow ? CColors.White : CColors.Icon)) ); Widget titleWidget = new Container(); if (this._isHaveTitle) { titleWidget = new Text( eventObj.title, style: CTextStyle.PXLargeMedium, maxLines: 1, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center ); } return(new AnimatedContainer( height: 44 + this._topPadding, duration: TimeSpan.Zero, padding: EdgeInsets.only(left: 8, right: 8, top: this._topPadding), decoration: new BoxDecoration( CColors.White, border: new Border( bottom: new BorderSide(this._isHaveTitle ? CColors.Separator2 : CColors.Transparent)), gradient: this._showNavBarShadow ? new LinearGradient( colors: new List <Color> { new Color(0x80000000), new Color(0x0) }, begin: Alignment.topCenter, end: Alignment.bottomCenter ) : null ), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new CustomButton( onPressed: () => this.widget.actionModel.mainRouterPop(), child: new Icon( Icons.arrow_back, size: 24, color: this._showNavBarShadow ? CColors.White : CColors.Icon ) ), new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { new PositionedTransition( rect: this._animation, child: titleWidget ) } ) ), shareWidget } ) )); }
public void FormatBytes_HandlesAllCases_Success(ulong bytes, string expectedResult) { Assert.AreEqual(expectedResult, ShareUtils.FormatBytes(bytes)); }
public void GetFilteredGameTitle_HandlesAllCases_Success(string originalTitle, string expectedResult) { string filteredTitle = ShareUtils.GetFilteredGameTitle(originalTitle); Assert.AreEqual(expectedResult, filteredTitle); }