1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-08-16 06:31:42 +02:00
Files
.github
.idea
bld
lib
TweetLib.Browser
TweetLib.Browser.CEF
TweetLib.Communication
TweetLib.Core
Application
Features
Notifications
Plugins
TweetDeck
ISoundNotificationHandler.cs
ITweetDeckInterface.cs
TweetDeckBridgeObject.cs
TweetDeckBrowser.cs
TweetDeckExtraContext.cs
TweetDeckFunctions.cs
TweetDuckSchemeHandler.cs
VendorScriptProcessor.cs
Twitter
BaseBrowser.cs
BaseContextMenu.cs
BaseResourceRequestHandler.cs
CommonBridgeObject.cs
FileDownloadManager.cs
ICommonInterface.cs
PropertyObjectScript.cs
Resources
Systems
App.cs
Lib.cs
TweetLib.Core.csproj
TweetLib.Utils
TweetTest.Browser.CEF
TweetTest.Core
TweetTest.Utils
linux
resources
windows
.gitattributes
.gitignore
LICENSE.md
README.md
TweetDuck.sln
TweetDuck.sln.DotSettings
Version.cs
global.json

64 lines
2.2 KiB
C#

using System.Diagnostics.CodeAnalysis;
using System.Linq;
using TweetLib.Browser.Contexts;
using TweetLib.Core.Features.Notifications;
using TweetLib.Core.Features.Twitter;
using TweetLib.Utils.Static;
namespace TweetLib.Core.Features.TweetDeck {
[SuppressMessage("ReSharper", "UnusedMember.Global")]
sealed class TweetDeckBridgeObject : CommonBridge {
private readonly ITweetDeckInterface i;
private readonly TweetDeckBrowser browser;
private readonly TweetDeckExtraContext extraContext;
public TweetDeckBridgeObject(ITweetDeckInterface tweetDeckInterface, TweetDeckBrowser browser, TweetDeckExtraContext extraContext) : base(tweetDeckInterface) {
this.i = tweetDeckInterface;
this.browser = browser;
this.extraContext = extraContext;
}
public void OnModulesLoaded(string moduleNamespace) {
browser.OnModulesLoaded(moduleNamespace);
}
public void OpenContextMenu() {
i.OpenContextMenu();
}
public void OpenProfileImport() {
i.OpenProfileImport();
}
public void OnIntroductionClosed(bool showGuide) {
i.OnIntroductionClosed(showGuide);
}
public void LoadNotificationLayout(string fontSize, string headLayout) {
NotificationBrowser.SetNotificationLayout(fontSize, headLayout);
}
public void DisplayTooltip(string? text) {
i.DisplayTooltip(text);
}
public void SetRightClickedChirp(string columnId, string chirpId, string? tweetUrl, string? quoteUrl, string? chirpAuthors, string? chirpImages) {
if (tweetUrl == null) {
extraContext.SetTweet(null);
return;
}
var authors = chirpAuthors?.Split(';') ?? StringUtils.EmptyArray;
var images = chirpImages?.Split(';') ?? StringUtils.EmptyArray;
var tweetAuthor = authors.Length >= 1 ? authors[0] : null;
var quoteAuthor = authors.Length >= 2 ? authors[1] : null;
var imageUrls = images.Length > 0 ? images.Select(static url => TwitterUrls.GetMediaLink(url, App.UserConfiguration.TwitterImageQuality)).ToArray() : StringUtils.EmptyArray;
extraContext.SetTweet(new Tweet(tweetUrl, quoteUrl, tweetAuthor, quoteAuthor, imageUrls, columnId, chirpId));
}
public void SetRightClickedLink(string type, string? url) {
extraContext.SetLink(type, url);
}
}
}