mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 10:32:10 +02:00
Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
8d1c07d6b2 | |||
c32462cc9e | |||
ec94ea3273 | |||
41acd8c15b | |||
155a79f2ec | |||
9197cb9be6 | |||
03d50c847b | |||
bf45c40365 | |||
679e126194 | |||
50e39164bd | |||
cb9f75e968 | |||
aa7f6cc3b1 | |||
fe601aed41 | |||
2282a9df28 | |||
2b54627750 | |||
16051a0d25 | |||
66d5f0d790 | |||
07d29207f0 | |||
a60be2afcc | |||
027f3ee253 | |||
04774815e4 | |||
61a73c055b | |||
7731534ffc | |||
ed7bf99610 | |||
cbe4272556 | |||
8f5e3dfdcc | |||
35500c51f1 | |||
629f873bb2 | |||
a44cb884c4 | |||
d5ad1d0daa | |||
61ae7e3b6a | |||
01583e424f | |||
5c0aa1b3da | |||
07391efa70 | |||
b80f1bfc7c | |||
ad310db86c | |||
4ce0122a29 | |||
a8894f7054 | |||
1d1515351b |
@@ -35,9 +35,8 @@ namespace TweetDuck.Configuration{
|
||||
|
||||
// CONFIGURATION DATA
|
||||
|
||||
public bool FirstRun { get; set; } = true;
|
||||
public bool AllowDataCollection { get; set; } = false;
|
||||
public bool ShowFollowNotification { get; set; } = true;
|
||||
public bool FirstRun { get; set; } = true;
|
||||
public bool AllowDataCollection { get; set; } = false;
|
||||
|
||||
public WindowState BrowserWindow { get; set; } = new WindowState();
|
||||
public WindowState PluginsWindow { get; set; } = new WindowState();
|
||||
|
@@ -16,7 +16,7 @@ using TweetDuck.Plugins.Events;
|
||||
using TweetDuck.Updates;
|
||||
|
||||
namespace TweetDuck.Core{
|
||||
sealed partial class FormBrowser : Form{
|
||||
sealed partial class FormBrowser : Form, AnalyticsFile.IProvider{
|
||||
private static UserConfig Config => Program.UserConfig;
|
||||
|
||||
public bool IsWaiting{
|
||||
@@ -38,6 +38,8 @@ namespace TweetDuck.Core{
|
||||
|
||||
public string UpdateInstallerPath { get; private set; }
|
||||
|
||||
public AnalyticsFile AnalyticsFile => analytics?.File ?? AnalyticsFile.Dummy;
|
||||
|
||||
private readonly TweetDeckBrowser browser;
|
||||
private readonly PluginManager plugins;
|
||||
private readonly UpdateHandler updates;
|
||||
@@ -56,7 +58,10 @@ namespace TweetDuck.Core{
|
||||
|
||||
Text = Program.BrandName;
|
||||
|
||||
this.plugins = new PluginManager(Program.PluginPath, Program.PluginConfigFilePath);
|
||||
this.browser = new TweetDeckBrowser(this, new TweetDeckBridge.Browser(this, notification));
|
||||
this.contextMenu = ContextMenuBrowser.CreateMenu(this);
|
||||
|
||||
this.plugins = new PluginManager(browser, Program.PluginPath, Program.PluginConfigFilePath);
|
||||
this.plugins.Reloaded += plugins_Reloaded;
|
||||
this.plugins.Executed += plugins_Executed;
|
||||
this.plugins.Reload();
|
||||
@@ -64,9 +69,6 @@ namespace TweetDuck.Core{
|
||||
this.notification = new FormNotificationTweet(this, plugins);
|
||||
this.notification.Show();
|
||||
|
||||
this.browser = new TweetDeckBrowser(this, plugins, new TweetDeckBridge.Browser(this, notification));
|
||||
this.contextMenu = ContextMenuBrowser.CreateMenu(this);
|
||||
|
||||
Controls.Add(new MenuStrip{ Visible = false }); // fixes Alt freezing the program in Win 10 Anniversary Update
|
||||
|
||||
Disposed += (sender, args) => {
|
||||
@@ -89,7 +91,7 @@ namespace TweetDuck.Core{
|
||||
|
||||
UpdateTrayIcon();
|
||||
|
||||
this.updates = browser.CreateUpdateHandler(updaterSettings);
|
||||
this.updates = new UpdateHandler(browser, updaterSettings);
|
||||
this.updates.UpdateAccepted += updates_UpdateAccepted;
|
||||
this.updates.UpdateDismissed += updates_UpdateDismissed;
|
||||
|
||||
@@ -193,7 +195,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
private void Config_MuteToggled(object sender, EventArgs e){
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.MuteNotification);
|
||||
AnalyticsFile.NotificationMutes.Trigger();
|
||||
}
|
||||
|
||||
private void Config_TrayBehaviorChanged(object sender, EventArgs e){
|
||||
@@ -217,7 +219,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
if (isLoaded){
|
||||
ReloadToTweetDeck();
|
||||
browser.ReloadToTweetDeck();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +270,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
else{
|
||||
browser.OnMouseClickExtra(m.WParam);
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.BrowserExtraMouseButton);
|
||||
AnalyticsFile.BrowserExtraMouseButtons.Trigger();
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -293,6 +295,7 @@ namespace TweetDuck.Core{
|
||||
|
||||
public void ReloadToTweetDeck(){
|
||||
browser.ReloadToTweetDeck();
|
||||
AnalyticsFile.BrowserReloads.Trigger();
|
||||
}
|
||||
|
||||
public void TriggerTweetScreenshot(){
|
||||
@@ -309,10 +312,7 @@ namespace TweetDuck.Core{
|
||||
|
||||
public void ApplyROT13(){
|
||||
browser.ApplyROT13();
|
||||
}
|
||||
|
||||
public void TriggerAnalyticsEvent(AnalyticsFile.Event e){
|
||||
analytics?.TriggerEvent(e);
|
||||
AnalyticsFile.UsedROT13.Trigger();
|
||||
}
|
||||
|
||||
// callback handlers
|
||||
@@ -320,7 +320,6 @@ namespace TweetDuck.Core{
|
||||
public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){
|
||||
if (Config.FirstRun){
|
||||
Config.FirstRun = false;
|
||||
Config.ShowFollowNotification = false;
|
||||
Config.AllowDataCollection = allowDataCollection;
|
||||
Config.Save();
|
||||
|
||||
@@ -328,10 +327,6 @@ namespace TweetDuck.Core{
|
||||
analytics = new AnalyticsManager(this, plugins, Program.AnalyticsFilePath);
|
||||
}
|
||||
}
|
||||
else if (Config.ShowFollowNotification){
|
||||
Config.ShowFollowNotification = false;
|
||||
Config.Save();
|
||||
}
|
||||
|
||||
if (showGuide){
|
||||
FormGuide.Show();
|
||||
@@ -388,21 +383,21 @@ namespace TweetDuck.Core{
|
||||
form.Dispose();
|
||||
};
|
||||
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.OpenOptions);
|
||||
AnalyticsFile.OpenOptions.Trigger();
|
||||
ShowChildForm(form);
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenAbout(){
|
||||
if (!FormManager.TryBringToFront<FormAbout>()){
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.OpenAbout);
|
||||
AnalyticsFile.OpenAbout.Trigger();
|
||||
ShowChildForm(new FormAbout());
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenPlugins(){
|
||||
if (!FormManager.TryBringToFront<FormPlugins>()){
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.OpenPlugins);
|
||||
AnalyticsFile.OpenPlugins.Trigger();
|
||||
ShowChildForm(new FormPlugins(plugins));
|
||||
}
|
||||
}
|
||||
@@ -414,7 +409,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
public void OnTweetSound(){
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.SoundNotification);
|
||||
AnalyticsFile.SoundNotifications.Trigger();
|
||||
}
|
||||
|
||||
public void PlayVideo(string url, string username){
|
||||
@@ -432,7 +427,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
videoPlayer.Launch(url, username);
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.VideoPlay);
|
||||
AnalyticsFile.VideoPlays.Trigger();
|
||||
}
|
||||
|
||||
public bool ProcessBrowserKey(Keys key){
|
||||
@@ -454,7 +449,7 @@ namespace TweetDuck.Core{
|
||||
|
||||
notification.FinishCurrentNotification();
|
||||
browser.ShowTweetDetail(columnId, chirpId, fallbackUrl);
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.TweetDetail);
|
||||
AnalyticsFile.TweetDetails.Trigger();
|
||||
}
|
||||
|
||||
public void OnTweetScreenshotReady(string html, int width, int height){
|
||||
@@ -463,7 +458,7 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
notificationScreenshotManager.Trigger(html, width, height);
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.TweetScreenshot);
|
||||
AnalyticsFile.TweetScreenshots.Trigger();
|
||||
}
|
||||
|
||||
public void DisplayTooltip(string text){
|
||||
|
@@ -11,6 +11,7 @@ using System.Linq;
|
||||
using TweetDuck.Core.Management;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
abstract class ContextMenuBase : IContextMenuHandler{
|
||||
@@ -44,6 +45,12 @@ namespace TweetDuck.Core.Handling{
|
||||
private string[] lastHighlightedTweetAuthors;
|
||||
private string[] lastHighlightedTweetImageList;
|
||||
|
||||
private readonly AnalyticsFile.IProvider analytics;
|
||||
|
||||
protected ContextMenuBase(AnalyticsFile.IProvider analytics){
|
||||
this.analytics = analytics;
|
||||
}
|
||||
|
||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||
if (!TwitterUtils.IsTweetDeckWebsite(frame) || browser.IsLoading){
|
||||
lastHighlightedTweetAuthors = StringUtils.EmptyArray;
|
||||
@@ -82,7 +89,7 @@ namespace TweetDuck.Core.Handling{
|
||||
model.AddItem(MenuSaveMedia, TextSave("video"));
|
||||
model.AddSeparator();
|
||||
}
|
||||
else if (((parameters.TypeFlags.HasFlag(ContextMenuType.Media) && parameters.HasImageContents) || hasTweetImage) && parameters.SourceUrl != TweetNotification.AppLogoLink){
|
||||
else if (((parameters.TypeFlags.HasFlag(ContextMenuType.Media) && parameters.HasImageContents) || hasTweetImage) && parameters.SourceUrl != TweetNotification.AppLogo.Url){
|
||||
model.AddItem(MenuViewImage, "View image in photo viewer");
|
||||
model.AddItem(MenuOpenMediaUrl, TextOpen("image"));
|
||||
model.AddItem(MenuCopyMediaUrl, TextCopy("image"));
|
||||
@@ -97,26 +104,29 @@ namespace TweetDuck.Core.Handling{
|
||||
}
|
||||
|
||||
public virtual bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags){
|
||||
Control control = browserControl.AsControl();
|
||||
|
||||
switch(commandId){
|
||||
case MenuOpenLinkUrl:
|
||||
OpenBrowser(browserControl.AsControl(), IsLink ? ContextInfo.Value : parameters.LinkUrl);
|
||||
OpenBrowser(control, IsLink ? ContextInfo.Value : parameters.LinkUrl);
|
||||
break;
|
||||
|
||||
case MenuCopyLinkUrl:
|
||||
SetClipboardText(browserControl.AsControl(), IsLink ? ContextInfo.Value : parameters.UnfilteredLinkUrl);
|
||||
SetClipboardText(control, IsLink ? ContextInfo.Value : parameters.UnfilteredLinkUrl);
|
||||
break;
|
||||
|
||||
case MenuCopyUsername:
|
||||
Match match = TwitterUtils.RegexAccount.Match(parameters.UnfilteredLinkUrl);
|
||||
SetClipboardText(browserControl.AsControl(), match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
|
||||
SetClipboardText(control, match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
|
||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.CopiedUsernames.Trigger);
|
||||
break;
|
||||
|
||||
case MenuOpenMediaUrl:
|
||||
OpenBrowser(browserControl.AsControl(), TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality));
|
||||
OpenBrowser(control, TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality));
|
||||
break;
|
||||
|
||||
case MenuCopyMediaUrl:
|
||||
SetClipboardText(browserControl.AsControl(), TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality));
|
||||
SetClipboardText(control, TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality));
|
||||
break;
|
||||
|
||||
case MenuViewImage:
|
||||
@@ -138,6 +148,8 @@ namespace TweetDuck.Core.Handling{
|
||||
ViewFile();
|
||||
}
|
||||
else{
|
||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.ViewedImages.Trigger);
|
||||
|
||||
BrowserUtils.DownloadFileAsync(TwitterUtils.GetMediaLink(url, ImageQuality), file, ViewFile, ex => {
|
||||
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
|
||||
});
|
||||
@@ -147,15 +159,18 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
case MenuSaveMedia:
|
||||
if (IsVideo){
|
||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedVideos.Trigger);
|
||||
TwitterUtils.DownloadVideo(GetMediaLink(parameters), lastHighlightedTweetAuthors.LastOrDefault());
|
||||
}
|
||||
else{
|
||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedImages.Trigger);
|
||||
TwitterUtils.DownloadImage(GetMediaLink(parameters), lastHighlightedTweetAuthors.LastOrDefault(), ImageQuality);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MenuSaveTweetImages:
|
||||
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedImages.Trigger);
|
||||
TwitterUtils.DownloadImages(lastHighlightedTweetImageList, lastHighlightedTweetAuthors.LastOrDefault(), ImageQuality);
|
||||
break;
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
@@ -31,7 +30,7 @@ namespace TweetDuck.Core.Handling{
|
||||
private string lastHighlightedTweetUrl;
|
||||
private string lastHighlightedQuoteUrl;
|
||||
|
||||
public ContextMenuBrowser(FormBrowser form){
|
||||
public ContextMenuBrowser(FormBrowser form) : base(form){
|
||||
this.form = form;
|
||||
}
|
||||
|
||||
@@ -97,7 +96,7 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
RemoveSeparatorIfLast(model);
|
||||
|
||||
form.InvokeAsyncSafe(() => form.TriggerAnalyticsEvent(AnalyticsFile.Event.BrowserContextMenu));
|
||||
form.InvokeAsyncSafe(form.AnalyticsFile.BrowserContextMenus.Trigger);
|
||||
}
|
||||
|
||||
public override bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags){
|
||||
@@ -166,7 +165,7 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
menu.Popup += (sender, args) => {
|
||||
menu.MenuItems[1].Checked = Program.UserConfig.MuteNotifications;
|
||||
form.TriggerAnalyticsEvent(AnalyticsFile.Event.BrowserContextMenu);
|
||||
form.AnalyticsFile.BrowserContextMenus.Trigger();
|
||||
};
|
||||
|
||||
return menu;
|
||||
|
@@ -1,7 +1,10 @@
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
sealed class ContextMenuGuide : ContextMenuBase{
|
||||
public ContextMenuGuide(AnalyticsFile.IProvider analytics) : base(analytics){}
|
||||
|
||||
public override void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||
model.Clear();
|
||||
base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model);
|
||||
|
@@ -1,7 +1,6 @@
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
sealed class ContextMenuNotification : ContextMenuBase{
|
||||
@@ -14,7 +13,7 @@ namespace TweetDuck.Core.Handling{
|
||||
private readonly FormNotificationBase form;
|
||||
private readonly bool enableCustomMenu;
|
||||
|
||||
public ContextMenuNotification(FormNotificationBase form, bool enableCustomMenu){
|
||||
public ContextMenuNotification(FormNotificationBase form, bool enableCustomMenu) : base(form){
|
||||
this.form = form;
|
||||
this.enableCustomMenu = enableCustomMenu;
|
||||
}
|
||||
@@ -57,7 +56,7 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
form.InvokeAsyncSafe(() => {
|
||||
form.ContextMenuOpen = true;
|
||||
form.TriggerAnalyticsEvent(AnalyticsFile.Event.NotificationContextMenu);
|
||||
form.AnalyticsFile.NotificationContextMenus.Trigger();
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
|
||||
namespace TweetDuck.Core.Handling {
|
||||
sealed class KeyboardHandlerNotification : IKeyboardHandler{
|
||||
@@ -13,7 +12,7 @@ namespace TweetDuck.Core.Handling {
|
||||
}
|
||||
|
||||
private void TriggerKeyboardShortcutAnalytics(){
|
||||
notification.InvokeAsyncSafe(() => notification.TriggerAnalyticsEvent(AnalyticsFile.Event.NotificationKeyboardShortcut));
|
||||
notification.InvokeAsyncSafe(notification.AnalyticsFile.NotificationKeyboardShortcuts.Trigger);
|
||||
}
|
||||
|
||||
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using CefSharp;
|
||||
using System.Collections.Specialized;
|
||||
using CefSharp;
|
||||
using CefSharp.Handler;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
|
||||
@@ -7,5 +8,15 @@ namespace TweetDuck.Core.Handling{
|
||||
public override bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture){
|
||||
return LifeSpanHandler.HandleLinkClick(browserControl, targetDisposition, targetUrl);
|
||||
}
|
||||
|
||||
public override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||
if (ContextMenuBase.HasDevTools){
|
||||
NameValueCollection headers = request.Headers;
|
||||
headers.Remove("x-devtools-emulate-network-conditions-client-id");
|
||||
request.Headers = headers;
|
||||
}
|
||||
|
||||
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Handling{
|
||||
sealed class RequestHandlerBrowser : RequestHandlerBase{
|
||||
@@ -8,10 +9,20 @@ namespace TweetDuck.Core.Handling{
|
||||
|
||||
public override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||
if (request.ResourceType == ResourceType.Script && request.Url.Contains("analytics.")){
|
||||
callback.Dispose();
|
||||
return CefReturnValue.Cancel;
|
||||
}
|
||||
|
||||
return CefReturnValue.Continue;
|
||||
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
||||
}
|
||||
|
||||
public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||
if (request.ResourceType == ResourceType.Image && request.Url.Contains("backgrounds/spinner_blue")){
|
||||
request.Url = TwitterUtils.LoadingSpinner.Url;
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnResourceResponse(browserControl, browser, frame, request, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
Core/ITweetDeckBrowser.cs
Normal file
10
Core/ITweetDeckBrowser.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Core{
|
||||
interface ITweetDeckBrowser{
|
||||
void RegisterBridge(string name, object obj);
|
||||
void OnFrameLoaded(Action<IFrame> callback);
|
||||
void ExecuteFunction(string name, params object[] args);
|
||||
}
|
||||
}
|
@@ -16,7 +16,7 @@ namespace TweetDuck.Core.Management{
|
||||
public enum Items{
|
||||
None = 0,
|
||||
UserConfig = 1,
|
||||
SystemConfig = 2, // TODO implement later
|
||||
SystemConfig = 2,
|
||||
Session = 4,
|
||||
PluginData = 8,
|
||||
All = UserConfig|SystemConfig|Session|PluginData
|
||||
@@ -210,4 +210,10 @@ namespace TweetDuck.Core.Management{
|
||||
public string Relative { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
static class ProfileManagerExtensions{
|
||||
public static bool NeedsRestart(this ProfileManager.Items items){
|
||||
return items.HasFlag(ProfileManager.Items.SystemConfig) || items.HasFlag(ProfileManager.Items.Session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ namespace TweetDuck.Core.Management{
|
||||
|
||||
public event EventHandler ProcessExited;
|
||||
|
||||
private readonly Form owner;
|
||||
private readonly FormBrowser owner;
|
||||
private string lastUrl;
|
||||
private string lastUsername;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace TweetDuck.Core.Management{
|
||||
private DuplexPipe.Server currentPipe;
|
||||
private bool isClosing;
|
||||
|
||||
public VideoPlayer(Form owner){
|
||||
public VideoPlayer(FormBrowser owner){
|
||||
this.owner = owner;
|
||||
this.owner.FormClosing += owner_FormClosing;
|
||||
}
|
||||
@@ -83,6 +83,7 @@ namespace TweetDuck.Core.Management{
|
||||
break;
|
||||
|
||||
case "download":
|
||||
owner.AnalyticsFile.DownloadedVideos.Trigger();
|
||||
TwitterUtils.DownloadVideo(lastUrl, lastUsername);
|
||||
break;
|
||||
|
||||
|
@@ -24,7 +24,7 @@ namespace TweetDuck.Core.Notification.Example{
|
||||
private readonly TweetNotification exampleNotification;
|
||||
|
||||
public FormNotificationExample(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, false){
|
||||
string exampleTweetHTML = ScriptLoader.LoadResource("pages/example.html", true).Replace("{avatar}", TweetNotification.AppLogoLink);
|
||||
string exampleTweetHTML = ScriptLoader.LoadResource("pages/example.html", true).Replace("{avatar}", TweetNotification.AppLogo.Url);
|
||||
|
||||
#if DEBUG
|
||||
exampleTweetHTML = exampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:256px'>Scrollbar test padding...</div>");
|
||||
|
@@ -12,7 +12,7 @@ using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
partial class FormNotificationBase : Form{
|
||||
partial class FormNotificationBase : Form, AnalyticsFile.IProvider{
|
||||
protected static int FontSizeLevel{
|
||||
get{
|
||||
switch(TweetDeckBridge.FontSize){
|
||||
@@ -90,6 +90,8 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
}
|
||||
|
||||
public AnalyticsFile AnalyticsFile => owner.AnalyticsFile;
|
||||
|
||||
protected override bool ShowWithoutActivation => true;
|
||||
|
||||
protected float DpiScale { get; }
|
||||
@@ -140,7 +142,7 @@ namespace TweetDuck.Core.Notification{
|
||||
DpiScale = this.GetDPIScale();
|
||||
|
||||
browser.SetupResourceHandler(TwitterUtils.TweetDeckURL, this.resourceHandler);
|
||||
browser.SetupResourceHandler(TweetNotification.AppLogoLink, TweetNotification.AppLogoHandler);
|
||||
browser.SetupResourceHandler(TweetNotification.AppLogo);
|
||||
|
||||
Controls.Add(browser);
|
||||
|
||||
@@ -161,10 +163,6 @@ namespace TweetDuck.Core.Notification{
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
public void TriggerAnalyticsEvent(AnalyticsFile.Event e){
|
||||
owner.TriggerAnalyticsEvent(e);
|
||||
}
|
||||
|
||||
// event handlers
|
||||
|
||||
private void owner_FormClosed(object sender, FormClosedEventArgs e){
|
||||
|
@@ -5,7 +5,6 @@ using System.Windows.Forms;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Plugins;
|
||||
@@ -128,7 +127,7 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
|
||||
blockXButtonUp = true;
|
||||
this.InvokeAsyncSafe(() => TriggerAnalyticsEvent(AnalyticsFile.Event.NotificationExtraMouseButton));
|
||||
this.InvokeAsyncSafe(AnalyticsFile.NotificationExtraMouseButtons.Trigger);
|
||||
return NativeMethods.HOOK_HANDLED;
|
||||
}
|
||||
else if (eventType == NativeMethods.WM_XBUTTONUP && blockXButtonUp){
|
||||
|
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using TweetDuck.Plugins;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Utils;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
@@ -94,7 +93,7 @@ namespace TweetDuck.Core.Notification{
|
||||
}
|
||||
|
||||
needsTrim |= tweetQueue.Count >= TrimMinimum;
|
||||
TriggerAnalyticsEvent(AnalyticsFile.Event.DesktopNotification);
|
||||
AnalyticsFile.DesktopNotifications.Trigger();
|
||||
}
|
||||
|
||||
public override void HideNotification(){
|
||||
|
@@ -8,7 +8,7 @@ using TweetDuck.Core.Other.Settings;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
static class SoundNotification{
|
||||
public const string SupportedFormats = "*.wav;*.ogg;*.flac;*.opus;*.weba;*.webm"; // TODO add mp3 when supported
|
||||
public const string SupportedFormats = "*.wav;*.ogg;*.mp3;*.flac;*.opus;*.weba;*.webm";
|
||||
|
||||
public static IResourceHandler CreateFileHandler(string path){
|
||||
string mimeType;
|
||||
@@ -18,36 +18,33 @@ namespace TweetDuck.Core.Notification{
|
||||
case ".webm": mimeType = "audio/webm"; break;
|
||||
case ".wav": mimeType = "audio/wav"; break;
|
||||
case ".ogg": mimeType = "audio/ogg"; break;
|
||||
case ".mp3": mimeType = "audio/mp3"; break;
|
||||
case ".flac": mimeType = "audio/flac"; break;
|
||||
case ".opus": mimeType = "audio/ogg; codecs=opus"; break;
|
||||
case ".mp3": TryShowError("MP3 sound notifications are temporarily unsupported, please convert the file to another format, such as .ogg, .wav, or .flac."); return null;
|
||||
default: mimeType = null; break;
|
||||
}
|
||||
|
||||
try{
|
||||
return ResourceHandler.FromFilePath(path, mimeType);
|
||||
}catch{
|
||||
TryShowError("Could not find custom notification sound file:\n"+path);
|
||||
FormBrowser browser = FormManager.TryFind<FormBrowser>();
|
||||
|
||||
browser?.InvokeAsyncSafe(() => {
|
||||
using(FormMessage form = new FormMessage("Sound Notification Error", "Could not find custom notification sound file:\n"+path, MessageBoxIcon.Error)){
|
||||
form.AddButton(FormMessage.Ignore, ControlType.Cancel | ControlType.Focused);
|
||||
|
||||
Button btnViewOptions = form.AddButton("View Options");
|
||||
btnViewOptions.Width += 16;
|
||||
btnViewOptions.Location = new Point(btnViewOptions.Location.X-16, btnViewOptions.Location.Y);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK && form.ClickedButton == btnViewOptions){
|
||||
browser.OpenSettings(typeof(TabSettingsSounds));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void TryShowError(string message){
|
||||
FormBrowser browser = FormManager.TryFind<FormBrowser>();
|
||||
|
||||
browser?.InvokeAsyncSafe(() => {
|
||||
using(FormMessage form = new FormMessage("Sound Notification Error", message, MessageBoxIcon.Error)){
|
||||
form.AddButton(FormMessage.Ignore, ControlType.Cancel | ControlType.Focused);
|
||||
|
||||
Button btnViewOptions = form.AddButton("View Options");
|
||||
btnViewOptions.Width += 16;
|
||||
btnViewOptions.Location = new Point(btnViewOptions.Location.X-16, btnViewOptions.Location.Y);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK && form.ClickedButton == btnViewOptions){
|
||||
browser.OpenSettings(typeof(TabSettingsSounds));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,15 +2,14 @@
|
||||
using System.Text;
|
||||
using CefSharp;
|
||||
using TweetDuck.Core.Bridge;
|
||||
using TweetDuck.Data;
|
||||
using TweetDuck.Resources;
|
||||
|
||||
namespace TweetDuck.Core.Notification{
|
||||
sealed class TweetNotification{
|
||||
private const string DefaultHeadLayout = @"<html id='tduck' class='os-windows txt-size--14' data-td-font='medium' data-td-theme='dark'><head><meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'><style type='text/css'>body{background:#222426}</style>";
|
||||
private static readonly string CustomCSS = ScriptLoader.LoadResource("styles/notification.css");
|
||||
|
||||
public const string AppLogoLink = "https://ton.twimg.com/tduck/avatar";
|
||||
public static readonly IResourceHandler AppLogoHandler = ResourceHandler.FromByteArray(Properties.Resources.avatar, "image/png");
|
||||
public static readonly ResourceLink AppLogo = new ResourceLink("https://ton.twimg.com/tduck/avatar", ResourceHandler.FromByteArray(Properties.Resources.avatar, "image/png"));
|
||||
|
||||
public static TweetNotification Example(string html, int characters){
|
||||
return new TweetNotification(string.Empty, string.Empty, "Home", html, characters, string.Empty, string.Empty, true);
|
||||
|
@@ -1,7 +1,11 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using TweetDuck.Data.Serialization;
|
||||
|
||||
namespace TweetDuck.Core.Other.Analytics{
|
||||
[SuppressMessage("ReSharper", "AutoPropertyCanBeMadeGetOnly.Local")]
|
||||
sealed class AnalyticsFile{
|
||||
private static readonly FileSerializer<AnalyticsFile> Serializer = new FileSerializer<AnalyticsFile>();
|
||||
|
||||
@@ -10,15 +14,14 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
ConvertToString = value => value.ToBinary().ToString(),
|
||||
ConvertToObject = value => DateTime.FromBinary(long.Parse(value))
|
||||
});
|
||||
|
||||
Serializer.RegisterTypeConverter(typeof(Counter), new SingleTypeConverter<Counter>{
|
||||
ConvertToString = value => value.Value.ToString(),
|
||||
ConvertToObject = value => int.Parse(value)
|
||||
});
|
||||
}
|
||||
|
||||
public enum Event{
|
||||
OpenOptions, OpenPlugins, OpenAbout, OpenGuide,
|
||||
DesktopNotification, SoundNotification, MuteNotification,
|
||||
BrowserContextMenu, BrowserExtraMouseButton,
|
||||
NotificationContextMenu, NotificationExtraMouseButton, NotificationKeyboardShortcut,
|
||||
TweetScreenshot, TweetDetail, VideoPlay
|
||||
}
|
||||
public static readonly AnalyticsFile Dummy = new AnalyticsFile(null);
|
||||
|
||||
// STATE PROPERTIES
|
||||
|
||||
@@ -28,57 +31,57 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
|
||||
// USAGE DATA
|
||||
|
||||
public int CountOpenOptions { get; private set; } = 0;
|
||||
public int CountOpenPlugins { get; private set; } = 0;
|
||||
public int CountOpenAbout { get; private set; } = 0;
|
||||
public int CountOpenGuide { get; private set; } = 0;
|
||||
public Counter OpenOptions { get; private set; } = 0;
|
||||
public Counter OpenPlugins { get; private set; } = 0;
|
||||
public Counter OpenAbout { get; private set; } = 0;
|
||||
public Counter OpenGuide { get; private set; } = 0;
|
||||
|
||||
public int CountDesktopNotifications { get; private set; } = 0;
|
||||
public int CountSoundNotifications { get; private set; } = 0;
|
||||
public int CountMuteNotifications { get; private set; } = 0;
|
||||
public Counter DesktopNotifications { get; private set; } = 0;
|
||||
public Counter SoundNotifications { get; private set; } = 0;
|
||||
public Counter NotificationMutes { get; private set; } = 0;
|
||||
|
||||
public int CountBrowserContextMenus { get; private set; } = 0;
|
||||
public int CountBrowserExtraMouseButtons { get; private set; } = 0;
|
||||
public int CountNotificationContextMenus { get; private set; } = 0;
|
||||
public int CountNotificationExtraMouseButtons { get; private set; } = 0;
|
||||
public int CountNotificationKeyboardShortcuts { get; private set; } = 0;
|
||||
public Counter BrowserContextMenus { get; private set; } = 0;
|
||||
public Counter BrowserExtraMouseButtons { get; private set; } = 0;
|
||||
public Counter NotificationContextMenus { get; private set; } = 0;
|
||||
public Counter NotificationExtraMouseButtons { get; private set; } = 0;
|
||||
public Counter NotificationKeyboardShortcuts { get; private set; } = 0;
|
||||
|
||||
public int CountTweetScreenshots { get; private set; } = 0;
|
||||
public int CountTweetDetails { get; private set; } = 0;
|
||||
public int CountVideoPlays { get; private set; } = 0;
|
||||
public Counter BrowserReloads { get; private set; } = 0;
|
||||
public Counter CopiedUsernames { get; private set; } = 0;
|
||||
public Counter ViewedImages { get; private set; } = 0;
|
||||
public Counter DownloadedImages { get; private set; } = 0;
|
||||
public Counter DownloadedVideos { get; private set; } = 0;
|
||||
public Counter UsedROT13 { get; private set; } = 0;
|
||||
|
||||
public Counter TweetScreenshots { get; private set; } = 0;
|
||||
public Counter TweetDetails { get; private set; } = 0;
|
||||
public Counter VideoPlays { get; private set; } = 0;
|
||||
|
||||
// END OF DATA
|
||||
|
||||
public event EventHandler PropertyChanged;
|
||||
|
||||
private readonly string file;
|
||||
|
||||
private AnalyticsFile(string file){
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public void TriggerEvent(Event e){
|
||||
switch(e){
|
||||
case Event.OpenOptions: ++CountOpenOptions; break;
|
||||
case Event.OpenPlugins: ++CountOpenPlugins; break;
|
||||
case Event.OpenAbout: ++CountOpenAbout; break;
|
||||
case Event.OpenGuide: ++CountOpenGuide; break;
|
||||
|
||||
case Event.DesktopNotification: ++CountDesktopNotifications; break;
|
||||
case Event.SoundNotification: ++CountSoundNotifications; break;
|
||||
case Event.MuteNotification: ++CountMuteNotifications; break;
|
||||
|
||||
case Event.BrowserContextMenu: ++CountBrowserContextMenus; break;
|
||||
case Event.BrowserExtraMouseButton: ++CountBrowserExtraMouseButtons; break;
|
||||
case Event.NotificationContextMenu: ++CountNotificationContextMenus; break;
|
||||
case Event.NotificationExtraMouseButton: ++CountNotificationExtraMouseButtons; break;
|
||||
case Event.NotificationKeyboardShortcut: ++CountNotificationKeyboardShortcuts; break;
|
||||
|
||||
case Event.TweetScreenshot: ++CountTweetScreenshots; break;
|
||||
case Event.TweetDetail: ++CountTweetDetails; break;
|
||||
case Event.VideoPlay: ++CountVideoPlays; break;
|
||||
private void SetupProperties(){
|
||||
foreach(Counter counter in GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).Where(prop => prop.PropertyType == typeof(Counter)).Select(prop => (Counter)prop.GetValue(this))){
|
||||
counter.SetOwner(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPropertyChanged(){
|
||||
PropertyChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void Save(){
|
||||
if (file == null){
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
Serializer.Write(file, this);
|
||||
}catch(Exception e){
|
||||
@@ -95,7 +98,34 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
Program.Reporter.HandleException("Analytics File Error", "Could not open the analytics file.", true, e);
|
||||
}
|
||||
|
||||
config.SetupProperties();
|
||||
return config;
|
||||
}
|
||||
|
||||
public interface IProvider{
|
||||
AnalyticsFile AnalyticsFile { get; }
|
||||
}
|
||||
|
||||
public sealed class Counter{
|
||||
public int Value { get; private set; }
|
||||
|
||||
private AnalyticsFile owner;
|
||||
|
||||
public Counter(int value){
|
||||
this.Value = value;
|
||||
}
|
||||
|
||||
public void SetOwner(AnalyticsFile owner){
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public void Trigger(){
|
||||
++Value;
|
||||
owner?.OnPropertyChanged();
|
||||
}
|
||||
|
||||
public static implicit operator int(Counter counter) => counter.Value;
|
||||
public static implicit operator Counter(int value) => new Counter(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,8 @@
|
||||
using System;
|
||||
// Uncomment to debug reports locally
|
||||
// #define ANALYTICS_LOCALHOST
|
||||
// #define ANALYTICS_INSTANT
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
@@ -8,8 +12,15 @@ using TweetDuck.Plugins;
|
||||
|
||||
namespace TweetDuck.Core.Other.Analytics{
|
||||
sealed class AnalyticsManager : IDisposable{
|
||||
private static readonly TimeSpan CollectionInterval = TimeSpan.FromDays(7);
|
||||
private static readonly Uri CollectionUrl = new Uri("https://tweetduck.chylex.com/breadcrumb/report");
|
||||
private static readonly TimeSpan CollectionInterval = TimeSpan.FromDays(14);
|
||||
|
||||
private static readonly Uri CollectionUrl = new Uri(
|
||||
#if (DEBUG && ANALYTICS_LOCALHOST)
|
||||
"http://localhost/newhome/tweetduck/~breadcrumb/request.php?type=report"
|
||||
#else
|
||||
"https://tweetduck.chylex.com/breadcrumb/report"
|
||||
#endif
|
||||
);
|
||||
|
||||
public AnalyticsFile File { get; }
|
||||
|
||||
@@ -20,7 +31,9 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
public AnalyticsManager(FormBrowser browser, PluginManager plugins, string file){
|
||||
this.browser = browser;
|
||||
this.plugins = plugins;
|
||||
|
||||
this.File = AnalyticsFile.Load(file);
|
||||
this.File.PropertyChanged += File_PropertyChanged;
|
||||
|
||||
this.currentTimer = new Timer{ SynchronizingObject = browser };
|
||||
this.currentTimer.Elapsed += currentTimer_Elapsed;
|
||||
@@ -34,9 +47,15 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
else{
|
||||
RestartTimer();
|
||||
}
|
||||
|
||||
#if (DEBUG && ANALYTICS_INSTANT)
|
||||
SendReport();
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Dispose(){
|
||||
File.PropertyChanged -= File_PropertyChanged;
|
||||
|
||||
if (saveTimer.Enabled){
|
||||
File.Save();
|
||||
}
|
||||
@@ -45,8 +64,7 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
saveTimer.Dispose();
|
||||
}
|
||||
|
||||
public void TriggerEvent(AnalyticsFile.Event e){
|
||||
File.TriggerEvent(e);
|
||||
private void File_PropertyChanged(object sender, EventArgs e){
|
||||
saveTimer.Enabled = true;
|
||||
}
|
||||
|
||||
@@ -95,7 +113,7 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
Task.Factory.StartNew(() => {
|
||||
AnalyticsReport report = AnalyticsReportGenerator.Create(File, info, plugins);
|
||||
|
||||
#if DEBUG
|
||||
#if (DEBUG && !ANALYTICS_INSTANT)
|
||||
System.Diagnostics.Debugger.Break();
|
||||
#endif
|
||||
|
||||
@@ -122,6 +140,14 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
message = "HTTP Error "+(response != null ? $"{(int)response.StatusCode} ({response.StatusDescription})" : "(unknown code)");
|
||||
break;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
System.IO.Stream responseStream = e.Response.GetResponseStream();
|
||||
|
||||
if (responseStream != null){
|
||||
System.Diagnostics.Debug.WriteLine(new System.IO.StreamReader(responseStream).ReadToEnd());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ScheduleReportIn(TimeSpan.FromHours(4), message ?? "Error: "+(task.Exception.InnerException?.Message ?? task.Exception.Message));
|
||||
|
@@ -12,6 +12,7 @@ using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
|
||||
namespace TweetDuck.Core.Other.Analytics{
|
||||
static class AnalyticsReportGenerator{
|
||||
@@ -36,15 +37,24 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
{ "Screen Resolution" , info.Resolution ?? "(unknown)" },
|
||||
{ "Screen DPI" , info.DPI != null ? Exact(info.DPI.Value) : "(unknown)" },
|
||||
0,
|
||||
{ "Hardware Acceleration" , Bool(SysConfig.HardwareAcceleration) },
|
||||
{ "Hardware Acceleration" , Bool(SysConfig.HardwareAcceleration) },
|
||||
{ "Clear Cache Automatically" , Bool(SysConfig.ClearCacheAutomatically) },
|
||||
{ "Clear Cache Threshold" , Exact(SysConfig.ClearCacheThreshold) },
|
||||
0,
|
||||
{ "Expand Links" , Bool(UserConfig.ExpandLinksOnHover) },
|
||||
{ "Switch Account Selectors" , Bool(UserConfig.SwitchAccountSelectors) },
|
||||
{ "Search In First Column" , Bool(UserConfig.OpenSearchInFirstColumn) },
|
||||
{ "Keep Like Follow Dialogs Open" , Bool(UserConfig.KeepLikeFollowDialogsOpen) },
|
||||
{ "Best Image Quality" , Bool(UserConfig.BestImageQuality) },
|
||||
{ "Spell Check" , Bool(UserConfig.EnableSpellCheck) },
|
||||
{ "Zoom" , Exact(UserConfig.ZoomLevel) },
|
||||
{ "Animated Images" , Bool(UserConfig.EnableAnimatedImages) },
|
||||
0,
|
||||
{ "Smooth Scrolling" , Bool(UserConfig.EnableSmoothScrolling) },
|
||||
{ "Custom Browser" , CustomBrowser },
|
||||
{ "Zoom" , Exact(UserConfig.ZoomLevel) },
|
||||
0,
|
||||
{ "Spell Check" , Bool(UserConfig.EnableSpellCheck) },
|
||||
{ "Spell Check Language" , UserConfig.SpellCheckLanguage.ToLower() },
|
||||
{ "Translation Target Language" , UserConfig.TranslationTarget },
|
||||
0,
|
||||
{ "Updates" , Bool(UserConfig.EnableUpdateCheck) },
|
||||
{ "Update Dismissed" , Bool(!string.IsNullOrEmpty(UserConfig.DismissedUpdate)) },
|
||||
@@ -70,8 +80,8 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
{ "Custom Browser CSS" , RoundUp((UserConfig.CustomBrowserCSS ?? string.Empty).Length, 50) },
|
||||
{ "Custom Notification CSS" , RoundUp((UserConfig.CustomNotificationCSS ?? string.Empty).Length, 50) },
|
||||
0,
|
||||
{ "Plugins All" , List(plugins.Plugins.Select(plugin => plugin.Identifier)) },
|
||||
{ "Plugins Enabled" , List(plugins.Plugins.Where(plugin => plugins.Config.IsEnabled(plugin)).Select(plugin => plugin.Identifier)) },
|
||||
{ "Plugins All" , List(plugins.Plugins.Select(Plugin)) },
|
||||
{ "Plugins Enabled" , List(plugins.Plugins.Where(plugin => plugins.Config.IsEnabled(plugin)).Select(Plugin)) },
|
||||
0,
|
||||
{ "Theme" , Dict(editLayoutDesign, "_theme", "light/def") },
|
||||
{ "Column Width" , Dict(editLayoutDesign, "columnWidth", "310px/def") },
|
||||
@@ -87,21 +97,27 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
{ "Reply Account Mode" , ReplyAccountConfigFromPlugin },
|
||||
{ "Template Count" , Exact(TemplateCountFromPlugin) },
|
||||
0,
|
||||
{ "Opened Options" , LogRound(file.CountOpenOptions, 4) },
|
||||
{ "Opened Plugins" , LogRound(file.CountOpenPlugins, 4) },
|
||||
{ "Opened About" , LogRound(file.CountOpenAbout, 4) },
|
||||
{ "Opened Guide" , LogRound(file.CountOpenGuide, 4) },
|
||||
{ "Desktop Notifications" , LogRound(file.CountDesktopNotifications, 5) },
|
||||
{ "Sound Notifications" , LogRound(file.CountSoundNotifications, 5) },
|
||||
{ "Mute Notifications" , LogRound(file.CountMuteNotifications, 2) },
|
||||
{ "Browser Context Menus" , LogRound(file.CountBrowserContextMenus, 2) },
|
||||
{ "Browser Extra Mouse Buttons" , LogRound(file.CountBrowserExtraMouseButtons, 2) },
|
||||
{ "Notification Context Menus" , LogRound(file.CountNotificationContextMenus, 2) },
|
||||
{ "Notification Extra Mouse Buttons" , LogRound(file.CountNotificationExtraMouseButtons, 2) },
|
||||
{ "Notification Keyboard Shortcuts" , LogRound(file.CountNotificationKeyboardShortcuts, 2) },
|
||||
{ "Tweet Screenshots" , LogRound(file.CountTweetScreenshots, 2) },
|
||||
{ "Tweet Details" , LogRound(file.CountTweetDetails, 2) },
|
||||
{ "Video Plays" , LogRound(file.CountVideoPlays, 4) }
|
||||
{ "Opened Options" , LogRound(file.OpenOptions, 4) },
|
||||
{ "Opened Plugins" , LogRound(file.OpenPlugins, 4) },
|
||||
{ "Opened About" , LogRound(file.OpenAbout, 4) },
|
||||
{ "Opened Guide" , LogRound(file.OpenGuide, 4) },
|
||||
{ "Desktop Notifications" , LogRound(file.DesktopNotifications, 5) },
|
||||
{ "Sound Notifications" , LogRound(file.SoundNotifications, 5) },
|
||||
{ "Notification Mutes" , LogRound(file.NotificationMutes, 2) },
|
||||
{ "Browser Context Menus" , LogRound(file.BrowserContextMenus, 2) },
|
||||
{ "Browser Extra Mouse Buttons" , LogRound(file.BrowserExtraMouseButtons, 2) },
|
||||
{ "Notification Context Menus" , LogRound(file.NotificationContextMenus, 2) },
|
||||
{ "Notification Extra Mouse Buttons" , LogRound(file.NotificationExtraMouseButtons, 2) },
|
||||
{ "Notification Keyboard Shortcuts" , LogRound(file.NotificationKeyboardShortcuts, 2) },
|
||||
{ "Browser Reloads" , LogRound(file.BrowserReloads, 2) },
|
||||
{ "Copied Usernames" , LogRound(file.CopiedUsernames, 2) },
|
||||
{ "Viewed Images" , LogRound(file.ViewedImages, 2) },
|
||||
{ "Downloaded Images" , LogRound(file.DownloadedImages, 2) },
|
||||
{ "Downloaded Videos" , LogRound(file.DownloadedVideos, 2) },
|
||||
{ "Used ROT13" , LogRound(file.UsedROT13, 2) },
|
||||
{ "Tweet Screenshots" , LogRound(file.TweetScreenshots, 2) },
|
||||
{ "Tweet Details" , LogRound(file.TweetDetails, 2) },
|
||||
{ "Video Plays" , LogRound(file.VideoPlays, 4) }
|
||||
}.FinalizeReport();
|
||||
}
|
||||
|
||||
@@ -112,6 +128,7 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
private static string Exact(int value) => value.ToString();
|
||||
private static string RoundUp(int value, int multiple) => (multiple*(int)Math.Ceiling((double)value/multiple)).ToString();
|
||||
private static string LogRound(int value, int logBase) => (value <= 0 ? 0 : (int)Math.Pow(logBase, Math.Floor(Math.Log(value, logBase)))).ToString();
|
||||
private static string Plugin(Plugin plugin) => plugin.Group.GetIdentifierPrefixShort()+plugin.Identifier.Substring(plugin.Group.GetIdentifierPrefix().Length);
|
||||
private static string Dict(Dictionary<string, string> dict, string key, string def = "(unknown)") => dict.TryGetValue(key, out string value) ? value : def;
|
||||
private static string List(IEnumerable<string> list) => string.Join("|", list.DefaultIfEmpty("(none)"));
|
||||
|
||||
@@ -182,6 +199,12 @@ namespace TweetDuck.Core.Other.Analytics{
|
||||
ProgramArguments = args.Keys.Select(key => key.TrimStart('-')).ToArray();
|
||||
}
|
||||
|
||||
private static string CustomBrowser{
|
||||
get{
|
||||
return Path.GetFileName(UserConfig.BrowserPath) ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static string TrayMode{
|
||||
get{
|
||||
switch(UserConfig.TrayBehavior){
|
||||
|
@@ -6,7 +6,6 @@ using CefSharp.WinForms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Other.Analytics;
|
||||
using TweetDuck.Core.Utils;
|
||||
using System.Text.RegularExpressions;
|
||||
using TweetDuck.Resources;
|
||||
@@ -43,7 +42,7 @@ namespace TweetDuck.Core.Other{
|
||||
FormBrowser owner = FormManager.TryFind<FormBrowser>();
|
||||
|
||||
if (owner != null){
|
||||
owner.TriggerAnalyticsEvent(AnalyticsFile.Event.OpenGuide);
|
||||
owner.AnalyticsFile.OpenGuide.Trigger();
|
||||
new FormGuide(url, owner).Show(owner);
|
||||
}
|
||||
}
|
||||
@@ -55,7 +54,7 @@ namespace TweetDuck.Core.Other{
|
||||
|
||||
private readonly ChromiumWebBrowser browser;
|
||||
|
||||
private FormGuide(string url, Form owner){
|
||||
private FormGuide(string url, FormBrowser owner){
|
||||
InitializeComponent();
|
||||
|
||||
Text = Program.BrandName+" Guide";
|
||||
@@ -66,7 +65,7 @@ namespace TweetDuck.Core.Other{
|
||||
}
|
||||
|
||||
this.browser = new ChromiumWebBrowser(url){
|
||||
MenuHandler = new ContextMenuGuide(),
|
||||
MenuHandler = new ContextMenuGuide(owner),
|
||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||
LifeSpanHandler = new LifeSpanHandler(),
|
||||
RequestHandler = new RequestHandlerBrowser()
|
||||
|
@@ -76,7 +76,7 @@ namespace TweetDuck.Core.Other{
|
||||
}
|
||||
|
||||
private void btnOpenFolder_Click(object sender, EventArgs e){
|
||||
using(Process.Start("explorer.exe", "\""+pluginManager.PathCustomPlugins+"\"")){}
|
||||
using(Process.Start("explorer.exe", '"'+pluginManager.PathCustomPlugins+'"')){}
|
||||
}
|
||||
|
||||
private void btnReload_Click(object sender, EventArgs e){
|
||||
|
@@ -67,10 +67,13 @@ namespace TweetDuck.Core.Other{
|
||||
FormClosing -= FormSettings_FormClosing;
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.OK){
|
||||
browser.ResumeNotification();
|
||||
if (!dialog.IsRestarting){
|
||||
browser.ResumeNotification();
|
||||
|
||||
BrowserProcessHandler.UpdatePrefs();
|
||||
ShouldReloadBrowser = dialog.ShouldReloadBrowser;
|
||||
}
|
||||
|
||||
BrowserProcessHandler.UpdatePrefs();
|
||||
ShouldReloadBrowser = dialog.ShouldReloadBrowser;
|
||||
Close();
|
||||
}
|
||||
else{
|
||||
|
@@ -26,16 +26,17 @@
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.btnContinue = new System.Windows.Forms.Button();
|
||||
this.cbConfig = new System.Windows.Forms.CheckBox();
|
||||
this.cbProgramConfig = new System.Windows.Forms.CheckBox();
|
||||
this.cbSession = new System.Windows.Forms.CheckBox();
|
||||
this.cbPluginData = new System.Windows.Forms.CheckBox();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.panelExport = new System.Windows.Forms.Panel();
|
||||
this.panelDecision = new System.Windows.Forms.Panel();
|
||||
this.radioReset = new System.Windows.Forms.RadioButton();
|
||||
this.radioExport = new System.Windows.Forms.RadioButton();
|
||||
this.cbSystemConfig = new System.Windows.Forms.CheckBox();
|
||||
this.panelSelection = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.panelDecision = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.radioImport = new System.Windows.Forms.RadioButton();
|
||||
this.panelExport.SuspendLayout();
|
||||
this.radioExport = new System.Windows.Forms.RadioButton();
|
||||
this.radioReset = new System.Windows.Forms.RadioButton();
|
||||
this.panelSelection.SuspendLayout();
|
||||
this.panelDecision.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -56,95 +57,92 @@
|
||||
this.btnContinue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnContinue.AutoSize = true;
|
||||
this.btnContinue.Enabled = false;
|
||||
this.btnContinue.Location = new System.Drawing.Point(125, 97);
|
||||
this.btnContinue.Location = new System.Drawing.Point(119, 97);
|
||||
this.btnContinue.Name = "btnContinue";
|
||||
this.btnContinue.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.btnContinue.Size = new System.Drawing.Size(45, 23);
|
||||
this.btnContinue.Size = new System.Drawing.Size(51, 23);
|
||||
this.btnContinue.TabIndex = 3;
|
||||
this.btnContinue.Text = "Next";
|
||||
this.btnContinue.UseVisualStyleBackColor = true;
|
||||
this.btnContinue.Click += new System.EventHandler(this.btnContinue_Click);
|
||||
//
|
||||
// cbConfig
|
||||
// cbProgramConfig
|
||||
//
|
||||
this.cbConfig.AutoSize = true;
|
||||
this.cbConfig.Location = new System.Drawing.Point(0, 3);
|
||||
this.cbConfig.Name = "cbConfig";
|
||||
this.cbConfig.Size = new System.Drawing.Size(104, 17);
|
||||
this.cbConfig.TabIndex = 0;
|
||||
this.cbConfig.Text = "Program Options";
|
||||
this.toolTip.SetToolTip(this.cbConfig, "Interface, notification, and update options.");
|
||||
this.cbConfig.UseVisualStyleBackColor = true;
|
||||
this.cbConfig.CheckedChanged += new System.EventHandler(this.cbConfig_CheckedChanged);
|
||||
this.cbProgramConfig.AutoSize = true;
|
||||
this.cbProgramConfig.Location = new System.Drawing.Point(3, 3);
|
||||
this.cbProgramConfig.Name = "cbProgramConfig";
|
||||
this.cbProgramConfig.Size = new System.Drawing.Size(104, 17);
|
||||
this.cbProgramConfig.TabIndex = 0;
|
||||
this.cbProgramConfig.Text = "Program Options";
|
||||
this.toolTip.SetToolTip(this.cbProgramConfig, "Interface, notification, and update options.");
|
||||
this.cbProgramConfig.UseVisualStyleBackColor = true;
|
||||
this.cbProgramConfig.CheckedChanged += new System.EventHandler(this.checkBoxSelection_CheckedChanged);
|
||||
//
|
||||
// cbSession
|
||||
//
|
||||
this.cbSession.AutoSize = true;
|
||||
this.cbSession.Location = new System.Drawing.Point(0, 27);
|
||||
this.cbSession.Location = new System.Drawing.Point(3, 49);
|
||||
this.cbSession.Name = "cbSession";
|
||||
this.cbSession.Size = new System.Drawing.Size(92, 17);
|
||||
this.cbSession.TabIndex = 1;
|
||||
this.cbSession.TabIndex = 2;
|
||||
this.cbSession.Text = "Login Session";
|
||||
this.toolTip.SetToolTip(this.cbSession, "A token that allows logging into the\r\ncurrent TweetDeck account.");
|
||||
this.cbSession.UseVisualStyleBackColor = true;
|
||||
this.cbSession.CheckedChanged += new System.EventHandler(this.cbSession_CheckedChanged);
|
||||
this.cbSession.CheckedChanged += new System.EventHandler(this.checkBoxSelection_CheckedChanged);
|
||||
//
|
||||
// cbPluginData
|
||||
//
|
||||
this.cbPluginData.AutoSize = true;
|
||||
this.cbPluginData.Location = new System.Drawing.Point(0, 51);
|
||||
this.cbPluginData.Location = new System.Drawing.Point(3, 72);
|
||||
this.cbPluginData.Name = "cbPluginData";
|
||||
this.cbPluginData.Size = new System.Drawing.Size(81, 17);
|
||||
this.cbPluginData.TabIndex = 2;
|
||||
this.cbPluginData.TabIndex = 3;
|
||||
this.cbPluginData.Text = "Plugin Data";
|
||||
this.toolTip.SetToolTip(this.cbPluginData, "Data files generated by plugins.\r\nDoes not include the plugins themselves.");
|
||||
this.cbPluginData.UseVisualStyleBackColor = true;
|
||||
this.cbPluginData.CheckedChanged += new System.EventHandler(this.cbPluginData_CheckedChanged);
|
||||
this.cbPluginData.CheckedChanged += new System.EventHandler(this.checkBoxSelection_CheckedChanged);
|
||||
//
|
||||
// panelExport
|
||||
// cbSystemConfig
|
||||
//
|
||||
this.panelExport.Controls.Add(this.cbConfig);
|
||||
this.panelExport.Controls.Add(this.cbPluginData);
|
||||
this.panelExport.Controls.Add(this.cbSession);
|
||||
this.panelExport.Location = new System.Drawing.Point(12, 12);
|
||||
this.panelExport.Name = "panelExport";
|
||||
this.panelExport.Size = new System.Drawing.Size(220, 79);
|
||||
this.panelExport.TabIndex = 5;
|
||||
this.panelExport.Visible = false;
|
||||
this.cbSystemConfig.AutoSize = true;
|
||||
this.cbSystemConfig.Location = new System.Drawing.Point(3, 26);
|
||||
this.cbSystemConfig.Name = "cbSystemConfig";
|
||||
this.cbSystemConfig.Size = new System.Drawing.Size(99, 17);
|
||||
this.cbSystemConfig.TabIndex = 1;
|
||||
this.cbSystemConfig.Text = "System Options";
|
||||
this.toolTip.SetToolTip(this.cbSystemConfig, "Hardware acceleration and cache options.");
|
||||
this.cbSystemConfig.UseVisualStyleBackColor = true;
|
||||
this.cbSystemConfig.CheckedChanged += new System.EventHandler(this.checkBoxSelection_CheckedChanged);
|
||||
//
|
||||
// panelSelection
|
||||
//
|
||||
this.panelSelection.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panelSelection.Controls.Add(this.cbProgramConfig);
|
||||
this.panelSelection.Controls.Add(this.cbSystemConfig);
|
||||
this.panelSelection.Controls.Add(this.cbSession);
|
||||
this.panelSelection.Controls.Add(this.cbPluginData);
|
||||
this.panelSelection.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.panelSelection.Location = new System.Drawing.Point(12, 12);
|
||||
this.panelSelection.Name = "panelSelection";
|
||||
this.panelSelection.Size = new System.Drawing.Size(220, 89);
|
||||
this.panelSelection.TabIndex = 2;
|
||||
this.panelSelection.Visible = false;
|
||||
this.panelSelection.WrapContents = false;
|
||||
//
|
||||
// panelDecision
|
||||
//
|
||||
this.panelDecision.Controls.Add(this.radioReset);
|
||||
this.panelDecision.Controls.Add(this.radioExport);
|
||||
this.panelDecision.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panelDecision.Controls.Add(this.radioImport);
|
||||
this.panelDecision.Controls.Add(this.radioExport);
|
||||
this.panelDecision.Controls.Add(this.radioReset);
|
||||
this.panelDecision.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.panelDecision.Location = new System.Drawing.Point(12, 12);
|
||||
this.panelDecision.Name = "panelDecision";
|
||||
this.panelDecision.Size = new System.Drawing.Size(220, 79);
|
||||
this.panelDecision.TabIndex = 6;
|
||||
//
|
||||
// radioReset
|
||||
//
|
||||
this.radioReset.AutoSize = true;
|
||||
this.radioReset.Location = new System.Drawing.Point(3, 49);
|
||||
this.radioReset.Name = "radioReset";
|
||||
this.radioReset.Size = new System.Drawing.Size(104, 17);
|
||||
this.radioReset.TabIndex = 2;
|
||||
this.radioReset.TabStop = true;
|
||||
this.radioReset.Text = "Restore Defaults";
|
||||
this.radioReset.UseVisualStyleBackColor = true;
|
||||
this.radioReset.CheckedChanged += new System.EventHandler(this.radioDecision_CheckedChanged);
|
||||
//
|
||||
// radioExport
|
||||
//
|
||||
this.radioExport.AutoSize = true;
|
||||
this.radioExport.Location = new System.Drawing.Point(3, 26);
|
||||
this.radioExport.Name = "radioExport";
|
||||
this.radioExport.Size = new System.Drawing.Size(87, 17);
|
||||
this.radioExport.TabIndex = 1;
|
||||
this.radioExport.TabStop = true;
|
||||
this.radioExport.Text = "Export Profile";
|
||||
this.radioExport.UseVisualStyleBackColor = true;
|
||||
this.radioExport.CheckedChanged += new System.EventHandler(this.radioDecision_CheckedChanged);
|
||||
this.panelDecision.Size = new System.Drawing.Size(220, 71);
|
||||
this.panelDecision.TabIndex = 0;
|
||||
this.panelDecision.WrapContents = false;
|
||||
//
|
||||
// radioImport
|
||||
//
|
||||
@@ -158,25 +156,49 @@
|
||||
this.radioImport.UseVisualStyleBackColor = true;
|
||||
this.radioImport.CheckedChanged += new System.EventHandler(this.radioDecision_CheckedChanged);
|
||||
//
|
||||
// radioExport
|
||||
//
|
||||
this.radioExport.AutoSize = true;
|
||||
this.radioExport.Location = new System.Drawing.Point(3, 26);
|
||||
this.radioExport.Name = "radioExport";
|
||||
this.radioExport.Size = new System.Drawing.Size(87, 17);
|
||||
this.radioExport.TabIndex = 1;
|
||||
this.radioExport.TabStop = true;
|
||||
this.radioExport.Text = "Export Profile";
|
||||
this.radioExport.UseVisualStyleBackColor = true;
|
||||
this.radioExport.CheckedChanged += new System.EventHandler(this.radioDecision_CheckedChanged);
|
||||
//
|
||||
// radioReset
|
||||
//
|
||||
this.radioReset.AutoSize = true;
|
||||
this.radioReset.Location = new System.Drawing.Point(3, 49);
|
||||
this.radioReset.Name = "radioReset";
|
||||
this.radioReset.Size = new System.Drawing.Size(104, 17);
|
||||
this.radioReset.TabIndex = 2;
|
||||
this.radioReset.TabStop = true;
|
||||
this.radioReset.Text = "Restore Defaults";
|
||||
this.radioReset.UseVisualStyleBackColor = true;
|
||||
this.radioReset.CheckedChanged += new System.EventHandler(this.radioDecision_CheckedChanged);
|
||||
//
|
||||
// DialogSettingsManage
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(244, 132);
|
||||
this.Controls.Add(this.panelDecision);
|
||||
this.Controls.Add(this.panelExport);
|
||||
this.Controls.Add(this.btnContinue);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.panelDecision);
|
||||
this.Controls.Add(this.panelSelection);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(200, 170);
|
||||
this.MinimumSize = new System.Drawing.Size(260, 170);
|
||||
this.Name = "DialogSettingsManage";
|
||||
this.ShowIcon = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Manage Options";
|
||||
this.panelExport.ResumeLayout(false);
|
||||
this.panelExport.PerformLayout();
|
||||
this.panelSelection.ResumeLayout(false);
|
||||
this.panelSelection.PerformLayout();
|
||||
this.panelDecision.ResumeLayout(false);
|
||||
this.panelDecision.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
@@ -188,12 +210,13 @@
|
||||
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Button btnContinue;
|
||||
private System.Windows.Forms.CheckBox cbConfig;
|
||||
private System.Windows.Forms.CheckBox cbProgramConfig;
|
||||
private System.Windows.Forms.CheckBox cbSystemConfig;
|
||||
private System.Windows.Forms.CheckBox cbSession;
|
||||
private System.Windows.Forms.CheckBox cbPluginData;
|
||||
private System.Windows.Forms.ToolTip toolTip;
|
||||
private System.Windows.Forms.Panel panelExport;
|
||||
private System.Windows.Forms.Panel panelDecision;
|
||||
private System.Windows.Forms.FlowLayoutPanel panelSelection;
|
||||
private System.Windows.Forms.FlowLayoutPanel panelDecision;
|
||||
private System.Windows.Forms.RadioButton radioReset;
|
||||
private System.Windows.Forms.RadioButton radioExport;
|
||||
private System.Windows.Forms.RadioButton radioImport;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Configuration;
|
||||
@@ -16,15 +17,17 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
|
||||
set{
|
||||
// this will call events and SetFlag, which also updates the UI
|
||||
cbConfig.Checked = value.HasFlag(ProfileManager.Items.UserConfig);
|
||||
cbSession.Checked = value.HasFlag(ProfileManager.Items.Session);
|
||||
cbPluginData.Checked = value.HasFlag(ProfileManager.Items.PluginData);
|
||||
foreach(KeyValuePair<CheckBox, ProfileManager.Items> kvp in checkBoxMap){
|
||||
kvp.Key.Checked = value.HasFlag(kvp.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRestarting { get; private set; }
|
||||
public bool ShouldReloadBrowser { get; private set; }
|
||||
|
||||
private readonly PluginManager plugins;
|
||||
private readonly Dictionary<CheckBox, ProfileManager.Items> checkBoxMap = new Dictionary<CheckBox, ProfileManager.Items>(4);
|
||||
|
||||
private State currentState;
|
||||
private ProfileManager importManager;
|
||||
@@ -36,22 +39,20 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
|
||||
this.plugins = plugins;
|
||||
this.currentState = State.Deciding;
|
||||
|
||||
this.checkBoxMap[cbProgramConfig] = ProfileManager.Items.UserConfig;
|
||||
this.checkBoxMap[cbSystemConfig] = ProfileManager.Items.SystemConfig;
|
||||
this.checkBoxMap[cbSession] = ProfileManager.Items.Session;
|
||||
this.checkBoxMap[cbPluginData] = ProfileManager.Items.PluginData;
|
||||
}
|
||||
|
||||
private void radioDecision_CheckedChanged(object sender, EventArgs e){
|
||||
btnContinue.Enabled = true;
|
||||
}
|
||||
|
||||
private void cbConfig_CheckedChanged(object sender, EventArgs e){
|
||||
SetFlag(ProfileManager.Items.UserConfig, cbConfig.Checked);
|
||||
}
|
||||
|
||||
private void cbSession_CheckedChanged(object sender, EventArgs e){
|
||||
SetFlag(ProfileManager.Items.Session, cbSession.Checked);
|
||||
}
|
||||
|
||||
private void cbPluginData_CheckedChanged(object sender, EventArgs e){
|
||||
SetFlag(ProfileManager.Items.PluginData, cbPluginData.Checked);
|
||||
private void checkBoxSelection_CheckedChanged(object sender, EventArgs e){
|
||||
CheckBox cb = (CheckBox)sender;
|
||||
SetFlag(checkBoxMap[cb], cb.Checked);
|
||||
}
|
||||
|
||||
private void btnContinue_Click(object sender, EventArgs e){
|
||||
@@ -88,9 +89,9 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
Text = "Import Profile";
|
||||
SelectedItems = importManager.FindImportItems();
|
||||
|
||||
cbConfig.Enabled = cbConfig.Checked;
|
||||
cbSession.Enabled = cbSession.Checked;
|
||||
cbPluginData.Enabled = cbPluginData.Checked;
|
||||
foreach(CheckBox cb in checkBoxMap.Keys){
|
||||
cb.Enabled = cb.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
// Export
|
||||
@@ -99,12 +100,13 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
|
||||
Text = "Export Profile";
|
||||
btnContinue.Text = "Export Profile";
|
||||
SelectedItems = ProfileManager.Items.All & ~ProfileManager.Items.Session;
|
||||
SelectedItems = ProfileManager.Items.UserConfig | ProfileManager.Items.PluginData;
|
||||
}
|
||||
|
||||
// Continue...
|
||||
panelDecision.Visible = false;
|
||||
panelExport.Visible = true;
|
||||
panelSelection.Visible = true;
|
||||
Height += panelSelection.Height-panelDecision.Height;
|
||||
break;
|
||||
|
||||
case State.Reset:
|
||||
@@ -131,10 +133,10 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
}
|
||||
|
||||
if (SelectedItems.HasFlag(ProfileManager.Items.Session)){
|
||||
Program.Restart(Arguments.ArgDeleteCookies);
|
||||
RestartProgram(Arguments.ArgDeleteCookies);
|
||||
}
|
||||
else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
|
||||
Program.Restart();
|
||||
RestartProgram();
|
||||
}
|
||||
else{
|
||||
ShouldReloadBrowser = true;
|
||||
@@ -152,10 +154,10 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
|
||||
if (importManager.IsRestarting){
|
||||
if (SelectedItems.HasFlag(ProfileManager.Items.Session)){
|
||||
Program.Restart(Arguments.ArgImportCookies);
|
||||
RestartProgram(Arguments.ArgImportCookies);
|
||||
}
|
||||
else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
|
||||
Program.Restart();
|
||||
RestartProgram();
|
||||
}
|
||||
}
|
||||
else{
|
||||
@@ -212,11 +214,16 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||
btnContinue.Enabled = _selectedItems != ProfileManager.Items.None;
|
||||
|
||||
if (currentState == State.Import){
|
||||
btnContinue.Text = _selectedItems.HasFlag(ProfileManager.Items.Session) ? "Import && Restart" : "Import Profile";
|
||||
btnContinue.Text = _selectedItems.NeedsRestart() ? "Import && Restart" : "Import Profile";
|
||||
}
|
||||
else if (currentState == State.Reset){
|
||||
btnContinue.Text = _selectedItems.HasFlag(ProfileManager.Items.Session) ? "Restore && Restart" : "Restore Defaults";
|
||||
btnContinue.Text = _selectedItems.NeedsRestart() ? "Restore && Restart" : "Restore Defaults";
|
||||
}
|
||||
}
|
||||
|
||||
private void RestartProgram(params string[] extraArgs){
|
||||
IsRestarting = true;
|
||||
Program.Restart(extraArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,14 +9,10 @@ using TweetDuck.Core.Handling;
|
||||
using TweetDuck.Core.Handling.General;
|
||||
using TweetDuck.Core.Notification;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Plugins;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetDuck.Resources;
|
||||
using TweetDuck.Updates;
|
||||
|
||||
namespace TweetDuck.Core{
|
||||
sealed class TweetDeckBrowser : IDisposable{
|
||||
sealed class TweetDeckBrowser : ITweetDeckBrowser, IDisposable{
|
||||
public bool Ready { get; private set; }
|
||||
|
||||
public bool Enabled{
|
||||
@@ -33,11 +29,10 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
private readonly ChromiumWebBrowser browser;
|
||||
private readonly PluginManager plugins;
|
||||
|
||||
private string prevSoundNotificationPath = null;
|
||||
|
||||
public TweetDeckBrowser(FormBrowser owner, PluginManager plugins, TweetDeckBridge bridge){
|
||||
public TweetDeckBrowser(FormBrowser owner, TweetDeckBridge bridge){
|
||||
this.browser = new ChromiumWebBrowser(TwitterUtils.TweetDeckURL){
|
||||
DialogHandler = new FileDialogHandler(),
|
||||
DragHandler = new DragHandlerBrowser(),
|
||||
@@ -58,19 +53,16 @@ namespace TweetDuck.Core{
|
||||
this.browser.LoadError += browser_LoadError;
|
||||
|
||||
this.browser.RegisterAsyncJsObject("$TD", bridge);
|
||||
this.browser.RegisterAsyncJsObject("$TDP", plugins.Bridge);
|
||||
|
||||
this.browser.BrowserSettings.BackgroundColor = (uint)TwitterUtils.BackgroundColor.ToArgb();
|
||||
this.browser.Dock = DockStyle.None;
|
||||
this.browser.Location = ControlExtensions.InvisibleLocation;
|
||||
|
||||
this.browser.SetupResourceHandler(TweetNotification.AppLogoLink, TweetNotification.AppLogoHandler);
|
||||
this.browser.SetupResourceHandler(TweetNotification.AppLogo);
|
||||
this.browser.SetupResourceHandler(TwitterUtils.LoadingSpinner);
|
||||
|
||||
owner.Controls.Add(browser);
|
||||
|
||||
this.plugins = plugins;
|
||||
this.plugins.PluginChangedState += plugins_PluginChangedState;
|
||||
|
||||
Program.UserConfig.MuteToggled += UserConfig_MuteToggled;
|
||||
Program.UserConfig.ZoomLevelChanged += UserConfig_ZoomLevelChanged;
|
||||
Program.UserConfig.SoundNotificationChanged += UserConfig_SoundNotificationInfoChanged;
|
||||
@@ -91,8 +83,6 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
public void Dispose(){
|
||||
plugins.PluginChangedState -= plugins_PluginChangedState;
|
||||
|
||||
Program.UserConfig.MuteToggled -= UserConfig_MuteToggled;
|
||||
Program.UserConfig.ZoomLevelChanged -= UserConfig_ZoomLevelChanged;
|
||||
Program.UserConfig.SoundNotificationChanged -= UserConfig_SoundNotificationInfoChanged;
|
||||
@@ -100,6 +90,24 @@ namespace TweetDuck.Core{
|
||||
browser.Dispose();
|
||||
}
|
||||
|
||||
void ITweetDeckBrowser.RegisterBridge(string name, object obj){
|
||||
browser.RegisterAsyncJsObject(name, obj);
|
||||
}
|
||||
|
||||
void ITweetDeckBrowser.OnFrameLoaded(Action<IFrame> callback){
|
||||
browser.FrameLoadEnd += (sender, args) => {
|
||||
IFrame frame = args.Frame;
|
||||
|
||||
if (frame.IsMain && TwitterUtils.IsTweetDeckWebsite(frame)){
|
||||
callback(frame);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void ITweetDeckBrowser.ExecuteFunction(string name, params object[] args){
|
||||
browser.ExecuteScriptAsync(name, args);
|
||||
}
|
||||
|
||||
// event handlers
|
||||
|
||||
private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||
@@ -126,24 +134,22 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
|
||||
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||
if (e.Frame.IsMain && TwitterUtils.IsTweetDeckWebsite(e.Frame)){
|
||||
e.Frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorFix);
|
||||
IFrame frame = e.Frame;
|
||||
|
||||
if (frame.IsMain && TwitterUtils.IsTweetDeckWebsite(frame)){
|
||||
frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorOverride);
|
||||
|
||||
UpdateProperties();
|
||||
TweetDeckBridge.RestoreSessionData(e.Frame);
|
||||
ScriptLoader.ExecuteFile(e.Frame, "code.js");
|
||||
TweetDeckBridge.RestoreSessionData(frame);
|
||||
ScriptLoader.ExecuteFile(frame, "code.js");
|
||||
InjectBrowserCSS();
|
||||
ReinjectCustomCSS(Program.UserConfig.CustomBrowserCSS);
|
||||
UserConfig_SoundNotificationInfoChanged(null, EventArgs.Empty);
|
||||
plugins.ExecutePlugins(e.Frame, PluginEnvironment.Browser);
|
||||
|
||||
TweetDeckBridge.ResetStaticProperties();
|
||||
|
||||
if (Program.UserConfig.FirstRun){
|
||||
ScriptLoader.ExecuteFile(e.Frame, "introduction.js");
|
||||
}
|
||||
else if (Program.UserConfig.ShowFollowNotification){
|
||||
ScriptLoader.ExecuteFile(e.Frame, "introduction.follow.js");
|
||||
ScriptLoader.ExecuteFile(frame, "introduction.js");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,10 +168,6 @@ namespace TweetDuck.Core{
|
||||
}
|
||||
}
|
||||
|
||||
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||
browser.ExecuteScriptAsync("TDPF_setPluginState", e.Plugin, e.IsEnabled);
|
||||
}
|
||||
|
||||
private void UserConfig_MuteToggled(object sender, EventArgs e){
|
||||
UpdateProperties();
|
||||
}
|
||||
@@ -188,10 +190,6 @@ namespace TweetDuck.Core{
|
||||
|
||||
// external handling
|
||||
|
||||
public UpdateHandler CreateUpdateHandler(UpdaterSettings settings){
|
||||
return new UpdateHandler(browser, settings);
|
||||
}
|
||||
|
||||
public void HideVideoOverlay(bool focus){
|
||||
if (focus){
|
||||
browser.GetBrowser().GetHost().SendFocusEvent(true);
|
||||
|
@@ -7,6 +7,7 @@ using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using CefSharp.WinForms;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Data;
|
||||
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class BrowserUtils{
|
||||
@@ -49,6 +50,10 @@ namespace TweetDuck.Core.Utils{
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetupResourceHandler(this ChromiumWebBrowser browser, ResourceLink resource){
|
||||
browser.SetupResourceHandler(resource.Url, resource.Handler);
|
||||
}
|
||||
|
||||
private const string TwitterTrackingUrl = "t.co";
|
||||
|
||||
public enum UrlCheckResult{
|
||||
|
@@ -6,13 +6,16 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Other;
|
||||
using TweetDuck.Data;
|
||||
|
||||
namespace TweetDuck.Core.Utils{
|
||||
static class TwitterUtils{
|
||||
public const string TweetDeckURL = "https://tweetdeck.twitter.com";
|
||||
|
||||
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
||||
public const string BackgroundColorFix = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body::before{background:#1c6399!important}'";
|
||||
public const string BackgroundColorOverride = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body,body::before{background:#1c6399!important}'";
|
||||
|
||||
public static readonly ResourceLink LoadingSpinner = new ResourceLink("https://ton.twimg.com/tduck/spinner", ResourceHandler.FromByteArray(Properties.Resources.spinner, "image/apng"));
|
||||
|
||||
private static readonly Lazy<Regex> RegexAccountLazy = new Lazy<Regex>(() => new Regex(@"^https?://twitter\.com/(?!signup$|tos$|privacy$)([^/]+)/?$", RegexOptions.Compiled), false);
|
||||
public static Regex RegexAccount => RegexAccountLazy.Value;
|
||||
|
13
Data/ResourceLink.cs
Normal file
13
Data/ResourceLink.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using CefSharp;
|
||||
|
||||
namespace TweetDuck.Data{
|
||||
sealed class ResourceLink{
|
||||
public string Url { get; }
|
||||
public IResourceHandler Handler { get; }
|
||||
|
||||
public ResourceLink(string url, IResourceHandler handler){
|
||||
this.Url = url;
|
||||
this.Handler = handler;
|
||||
}
|
||||
}
|
||||
}
|
24
Plugins/Controls/PluginControl.Designer.cs
generated
24
Plugins/Controls/PluginControl.Designer.cs
generated
@@ -31,7 +31,7 @@
|
||||
this.flowLayoutInfo = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.labelWebsite = new System.Windows.Forms.Label();
|
||||
this.labelVersion = new System.Windows.Forms.Label();
|
||||
this.btnOpenConfig = new System.Windows.Forms.Button();
|
||||
this.btnConfigure = new System.Windows.Forms.Button();
|
||||
this.labelType = new TweetDuck.Core.Controls.LabelVertical();
|
||||
this.panelDescription.SuspendLayout();
|
||||
this.flowLayoutInfo.SuspendLayout();
|
||||
@@ -135,16 +135,16 @@
|
||||
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
this.labelVersion.UseMnemonic = false;
|
||||
//
|
||||
// btnOpenConfig
|
||||
// btnConfigure
|
||||
//
|
||||
this.btnOpenConfig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnOpenConfig.Location = new System.Drawing.Point(382, 80);
|
||||
this.btnOpenConfig.Name = "btnOpenConfig";
|
||||
this.btnOpenConfig.Size = new System.Drawing.Size(68, 23);
|
||||
this.btnOpenConfig.TabIndex = 4;
|
||||
this.btnOpenConfig.Text = "Configure";
|
||||
this.btnOpenConfig.UseVisualStyleBackColor = true;
|
||||
this.btnOpenConfig.Click += new System.EventHandler(this.btnOpenConfig_Click);
|
||||
this.btnConfigure.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnConfigure.Location = new System.Drawing.Point(382, 80);
|
||||
this.btnConfigure.Name = "btnConfigure";
|
||||
this.btnConfigure.Size = new System.Drawing.Size(68, 23);
|
||||
this.btnConfigure.TabIndex = 4;
|
||||
this.btnConfigure.Text = "Configure";
|
||||
this.btnConfigure.UseVisualStyleBackColor = true;
|
||||
this.btnConfigure.Click += new System.EventHandler(this.btnConfigure_Click);
|
||||
//
|
||||
// labelType
|
||||
//
|
||||
@@ -163,7 +163,7 @@
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.labelType);
|
||||
this.Controls.Add(this.btnOpenConfig);
|
||||
this.Controls.Add(this.btnConfigure);
|
||||
this.Controls.Add(this.flowLayoutInfo);
|
||||
this.Controls.Add(this.panelDescription);
|
||||
this.Controls.Add(this.labelName);
|
||||
@@ -194,7 +194,7 @@
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutInfo;
|
||||
private System.Windows.Forms.Label labelWebsite;
|
||||
private System.Windows.Forms.Label labelVersion;
|
||||
private System.Windows.Forms.Button btnOpenConfig;
|
||||
private System.Windows.Forms.Button btnConfigure;
|
||||
private Core.Controls.LabelVertical labelType;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
@@ -57,8 +55,9 @@ namespace TweetDuck.Plugins.Controls{
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOpenConfig_Click(object sender, EventArgs e){
|
||||
using(Process.Start("explorer.exe", "/select,\""+plugin.ConfigPath.Replace('/', '\\')+"\"")){}
|
||||
private void btnConfigure_Click(object sender, EventArgs e){
|
||||
pluginManager.ConfigurePlugin(plugin);
|
||||
ParentForm?.Close();
|
||||
}
|
||||
|
||||
private void btnToggleState_Click(object sender, EventArgs e){
|
||||
@@ -87,14 +86,13 @@ namespace TweetDuck.Plugins.Controls{
|
||||
labelName.ForeColor = textColor;
|
||||
labelDescription.ForeColor = textColor;
|
||||
btnToggleState.Text = isEnabled ? "Disable" : "Enable";
|
||||
btnOpenConfig.Visible = plugin.HasConfig;
|
||||
btnOpenConfig.Enabled = btnOpenConfig.Visible && File.Exists(plugin.ConfigPath);
|
||||
btnConfigure.Visible = isEnabled && pluginManager.IsPluginConfigurable(plugin);
|
||||
}
|
||||
else{
|
||||
labelName.ForeColor = Color.DarkRed;
|
||||
labelDescription.ForeColor = Color.DarkRed;
|
||||
btnToggleState.Visible = false;
|
||||
btnOpenConfig.Visible = false;
|
||||
btnConfigure.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,5 +11,13 @@
|
||||
default: return "unknown/";
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetIdentifierPrefixShort(this PluginGroup group){
|
||||
switch(group){
|
||||
case PluginGroup.Official: return "o/";
|
||||
case PluginGroup.Custom: return "c/";
|
||||
default: return "?/";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,14 +15,15 @@ namespace TweetDuck.Plugins{
|
||||
|
||||
private readonly PluginManager manager;
|
||||
private readonly TwoKeyDictionary<int, string, string> fileCache = new TwoKeyDictionary<int, string, string>(4, 2);
|
||||
private readonly TwoKeyDictionary<int, string, InjectedHTML> notificationInjections = new TwoKeyDictionary<int,string,InjectedHTML>(4, 1);
|
||||
private readonly TwoKeyDictionary<int, string, InjectedHTML> notificationInjections = new TwoKeyDictionary<int, string, InjectedHTML>(4, 1);
|
||||
|
||||
public IEnumerable<InjectedHTML> NotificationInjections => notificationInjections.InnerValues;
|
||||
public HashSet<Plugin> WithConfigureFunction { get; } = new HashSet<Plugin>();
|
||||
|
||||
public PluginBridge(PluginManager manager){
|
||||
this.manager = manager;
|
||||
this.manager.Reloaded += manager_Reloaded;
|
||||
this.manager.PluginChangedState += manager_PluginChangedState;
|
||||
this.manager.Config.PluginChangedState += Config_PluginChangedState;
|
||||
}
|
||||
|
||||
// Event handlers
|
||||
@@ -31,7 +32,7 @@ namespace TweetDuck.Plugins{
|
||||
fileCache.Clear();
|
||||
}
|
||||
|
||||
private void manager_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||
private void Config_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||
if (!e.IsEnabled){
|
||||
int token = manager.GetTokenFromPlugin(e.Plugin);
|
||||
|
||||
@@ -114,5 +115,13 @@ namespace TweetDuck.Plugins{
|
||||
public void InjectIntoNotificationsAfter(int token, string key, string search, string html){
|
||||
notificationInjections[token, key] = new InjectedHTML(InjectedHTML.Position.After, search, html);
|
||||
}
|
||||
|
||||
public void SetConfigurable(int token){
|
||||
Plugin plugin = manager.GetPluginFromToken(token);
|
||||
|
||||
if (plugin != null){
|
||||
WithConfigureFunction.Add(plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ using TweetDuck.Plugins.Events;
|
||||
|
||||
namespace TweetDuck.Plugins{
|
||||
sealed class PluginConfig{
|
||||
public event EventHandler<PluginChangedStateEventArgs> InternalPluginChangedState; // should only be accessed from PluginManager
|
||||
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
|
||||
|
||||
public IEnumerable<string> DisabledPlugins => disabled;
|
||||
public bool AnyDisabled => disabled.Count > 0;
|
||||
@@ -20,7 +20,7 @@ namespace TweetDuck.Plugins{
|
||||
|
||||
public void SetEnabled(Plugin plugin, bool enabled){
|
||||
if ((enabled && disabled.Remove(plugin.Identifier)) || (!enabled && disabled.Add(plugin.Identifier))){
|
||||
InternalPluginChangedState?.Invoke(this, new PluginChangedStateEventArgs(plugin, enabled));
|
||||
PluginChangedState?.Invoke(this, new PluginChangedStateEventArgs(plugin, enabled));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,10 @@
|
||||
using CefSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using TweetDuck.Core;
|
||||
using TweetDuck.Plugins.Enums;
|
||||
using TweetDuck.Plugins.Events;
|
||||
using TweetDuck.Resources;
|
||||
@@ -24,8 +26,8 @@ namespace TweetDuck.Plugins{
|
||||
|
||||
public event EventHandler<PluginErrorEventArgs> Reloaded;
|
||||
public event EventHandler<PluginErrorEventArgs> Executed;
|
||||
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
|
||||
|
||||
private readonly ITweetDeckBrowser browser;
|
||||
private readonly string rootPath;
|
||||
private readonly string configPath;
|
||||
|
||||
@@ -33,22 +35,30 @@ namespace TweetDuck.Plugins{
|
||||
private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>();
|
||||
private readonly Random rand = new Random();
|
||||
|
||||
public PluginManager(string rootPath, string configPath){
|
||||
public PluginManager(ITweetDeckBrowser browser, string rootPath, string configPath){
|
||||
this.browser = browser;
|
||||
this.rootPath = rootPath;
|
||||
this.configPath = configPath;
|
||||
|
||||
this.Config = new PluginConfig();
|
||||
this.Bridge = new PluginBridge(this);
|
||||
|
||||
this.browser.OnFrameLoaded(OnFrameLoaded);
|
||||
this.browser.RegisterBridge("$TDP", Bridge);
|
||||
|
||||
Config.Load(configPath);
|
||||
Config.InternalPluginChangedState += Config_InternalPluginChangedState;
|
||||
Config.PluginChangedState += Config_PluginChangedState;
|
||||
}
|
||||
|
||||
private void Config_InternalPluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||
PluginChangedState?.Invoke(this, e);
|
||||
private void Config_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||
browser.ExecuteFunction("TDPF_setPluginState", e.Plugin, e.IsEnabled);
|
||||
Config.Save(configPath);
|
||||
}
|
||||
|
||||
private void OnFrameLoaded(IFrame frame){
|
||||
ExecutePlugins(frame, PluginEnvironment.Browser);
|
||||
}
|
||||
|
||||
public bool IsPluginInstalled(string identifier){
|
||||
return plugins.Any(plugin => plugin.Identifier.Equals(identifier));
|
||||
}
|
||||
@@ -57,6 +67,24 @@ namespace TweetDuck.Plugins{
|
||||
return plugins.Any(plugin => plugin.Environments.HasFlag(environment));
|
||||
}
|
||||
|
||||
public bool IsPluginConfigurable(Plugin plugin){
|
||||
return plugin.HasConfig || Bridge.WithConfigureFunction.Contains(plugin);
|
||||
}
|
||||
|
||||
public void ConfigurePlugin(Plugin plugin){
|
||||
if (Bridge.WithConfigureFunction.Contains(plugin)){
|
||||
browser.ExecuteFunction("TDPF_configurePlugin", plugin);
|
||||
}
|
||||
else if (plugin.HasConfig){
|
||||
if (File.Exists(plugin.ConfigPath)){
|
||||
using(Process.Start("explorer.exe", "/select,\""+plugin.ConfigPath.Replace('/', '\\')+"\"")){}
|
||||
}
|
||||
else{
|
||||
using(Process.Start("explorer.exe", '"'+plugin.GetPluginFolder(PluginFolder.Data).Replace('/', '\\')+'"')){}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetTokenFromPlugin(Plugin plugin){
|
||||
foreach(KeyValuePair<int, Plugin> kvp in tokens){
|
||||
if (kvp.Value.Equals(plugin)){
|
||||
|
@@ -20,7 +20,7 @@ namespace TweetDuck{
|
||||
public const string BrandName = "TweetDuck";
|
||||
public const string Website = "https://tweetduck.chylex.com";
|
||||
|
||||
public const string VersionTag = "1.12.5";
|
||||
public const string VersionTag = "1.13";
|
||||
|
||||
public static readonly bool IsPortable = File.Exists("makeportable");
|
||||
|
||||
@@ -129,7 +129,9 @@ namespace TweetDuck{
|
||||
}
|
||||
|
||||
BrowserCache.RefreshTimer();
|
||||
|
||||
CefSharpSettings.WcfEnabled = false;
|
||||
CefSharpSettings.LegacyJavascriptBindingEnabled = true;
|
||||
|
||||
CefSettings settings = new CefSettings{
|
||||
UserAgent = BrowserUtils.HeaderUserAgent,
|
||||
|
10
Properties/Resources.Designer.cs
generated
10
Properties/Resources.Designer.cs
generated
@@ -99,5 +99,15 @@ namespace TweetDuck.Properties {
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] spinner {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("spinner", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -130,4 +130,7 @@
|
||||
<data name="icon_tray_new" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\icon-tray-new.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="spinner" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\spinner.apng;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
@@ -42,6 +42,14 @@ enabled(){
|
||||
col.model.setHasSound(prevSound);
|
||||
}, 1);
|
||||
}
|
||||
|
||||
// ========================
|
||||
// D key - trigger debugger
|
||||
// ========================
|
||||
|
||||
else if (e.keyCode === 68){
|
||||
debugger;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ Edit layout & design
|
||||
chylex
|
||||
|
||||
[version]
|
||||
1.2.1
|
||||
1.2.3
|
||||
|
||||
[website]
|
||||
https://tweetduck.chylex.com
|
||||
|
@@ -126,7 +126,7 @@ enabled(){
|
||||
let itemEditDesign = $('<li class="is-selectable"><a href="#" data-action>Edit layout & design</a></li>');
|
||||
itemEditDesign.insertAfter(itemTD);
|
||||
|
||||
itemEditDesign.on("click", "a", this.openEditDesignDialog);
|
||||
itemEditDesign.on("click", "a", this.configure.bind(this));
|
||||
|
||||
itemEditDesign.hover(function(){
|
||||
$(this).addClass("is-selected");
|
||||
@@ -148,7 +148,7 @@ enabled(){
|
||||
}, 1); // delays the slight lag caused by saving and reinjection
|
||||
};
|
||||
|
||||
var customDesignModal = TD.components.BaseModal.extend(function(){
|
||||
this.customDesignModal = TD.components.BaseModal.extend(function(){
|
||||
let modal = $("#td-design-plugin-modal");
|
||||
this.setAndShowContainer(modal, false);
|
||||
|
||||
@@ -275,8 +275,6 @@ enabled(){
|
||||
}
|
||||
});
|
||||
|
||||
this.openEditDesignDialog = () => new customDesignModal();
|
||||
|
||||
// animation optimization
|
||||
this.optimizations = null;
|
||||
this.optimizationTimer = null;
|
||||
@@ -433,87 +431,87 @@ enabled(){
|
||||
|
||||
if (this.config.revertIcons){
|
||||
let iconData = [
|
||||
[ ".icon-twitter-bird", "00" ],
|
||||
[ ".icon-mention", "01" ],
|
||||
[ ".icon-following", "02" ],
|
||||
[ ".icon-message", "03" ],
|
||||
[ ".icon-home", "04" ],
|
||||
[ ".icon-hashtag", "05" ],
|
||||
[ ".icon-reply", "06" ],
|
||||
[ ".icon-favorite", "55" ],
|
||||
[ ".icon-retweet", "08" ],
|
||||
[ ".icon-drafts", "09" ],
|
||||
[ ".icon-search", "0a" ],
|
||||
[ ".icon-trash", "0c" ],
|
||||
[ ".icon-close", "0d" ],
|
||||
[ ".icon-arrow-r:before,.Icon--caretRight", "0e" ],
|
||||
[ ".icon-arrow-l:before,.Icon--caretLeft", "0f" ],
|
||||
[ ".icon-protected", "13" ],
|
||||
[ ".icon-list", "14" ],
|
||||
[ ".icon-camera", "15" ],
|
||||
[ ".icon-more", "16" ],
|
||||
[ ".icon-settings", "18" ],
|
||||
[ ".icon-notifications", "19" ],
|
||||
[ ".icon-user-dd", "1a" ],
|
||||
[ ".icon-activity", "1c" ],
|
||||
[ ".icon-trending", "1d" ],
|
||||
[ ".icon-minus", "1e" ],
|
||||
[ ".icon-plus", "1f" ],
|
||||
[ ".icon-geo", "20" ],
|
||||
[ ".icon-check", "21" ],
|
||||
[ ".icon-schedule", "22" ],
|
||||
[ ".icon-dot", "23" ],
|
||||
[ ".icon-user", "24" ],
|
||||
[ ".icon-content", "25" ],
|
||||
[ ".icon-arrow-d:before,.Icon--caretDown", "26" ],
|
||||
[ ".icon-arrow-u", "27" ],
|
||||
[ ".icon-share", "28" ],
|
||||
[ ".icon-info", "29" ],
|
||||
[ ".icon-verified", "2a" ],
|
||||
[ ".icon-translator", "2b" ],
|
||||
[ ".icon-blocked", "2c" ],
|
||||
[ ".icon-constrain", "2d" ],
|
||||
[ ".icon-play-video", "2e" ],
|
||||
[ ".icon-empty", "2f" ],
|
||||
[ ".icon-clear-input", "30" ],
|
||||
[ ".icon-compose", "31" ],
|
||||
[ ".icon-mark-read", "32" ],
|
||||
[ ".icon-arrow-r-double", "33" ],
|
||||
[ ".icon-arrow-l-double", "34" ],
|
||||
[ ".icon-follow", "35" ],
|
||||
[ ".icon-image", "36" ],
|
||||
[ ".icon-popout", "37" ],
|
||||
[ ".icon-move", "39" ],
|
||||
[ ".icon-compose-grid", "3a" ],
|
||||
[ ".icon-compose-minigrid", "3b" ],
|
||||
[ ".icon-compose-list", "3c" ],
|
||||
[ ".icon-edit", "40" ],
|
||||
[ ".icon-clear-timeline", "41" ],
|
||||
[ ".icon-sliders", "42" ],
|
||||
[ ".icon-custom-timeline", "43" ],
|
||||
[ ".icon-compose-dm", "44" ],
|
||||
[ ".icon-bg-dot", "45" ],
|
||||
[ ".icon-user-team-mgr", "46" ],
|
||||
[ ".icon-user-switch", "47" ],
|
||||
[ ".icon-conversation", "48" ],
|
||||
[ ".icon-dataminr", "49" ],
|
||||
[ ".icon-link", "4a", ],
|
||||
[ ".icon-flash", "50" ],
|
||||
[ ".icon-pointer-u", "51" ],
|
||||
[ ".icon-analytics", "54" ],
|
||||
[ ".icon-heart", "55" ],
|
||||
[ ".icon-calendar", "56" ],
|
||||
[ ".icon-attachment", "57" ],
|
||||
[ ".icon-play", "58" ],
|
||||
[ ".icon-bookmark", "59" ],
|
||||
[ ".icon-play-badge", "60" ],
|
||||
[ ".icon-gif-badge", "61" ],
|
||||
[ ".icon-poll", "62" ],
|
||||
[ "twitter-bird", "00" ],
|
||||
[ "mention", "01" ],
|
||||
[ "following", "02" ],
|
||||
[ "message", "03" ],
|
||||
[ "home", "04" ],
|
||||
[ "hashtag", "05" ],
|
||||
[ "reply", "06" ],
|
||||
[ "favorite", "55" ],
|
||||
[ "retweet", "08" ],
|
||||
[ "drafts", "09" ],
|
||||
[ "search", "0a" ],
|
||||
[ "trash", "0c" ],
|
||||
[ "close", "0d" ],
|
||||
[ "arrow-r:before,.Icon--caretRight", "0e" ],
|
||||
[ "arrow-l:before,.Icon--caretLeft", "0f" ],
|
||||
[ "protected", "13" ],
|
||||
[ "list", "14" ],
|
||||
[ "camera", "15" ],
|
||||
[ "more", "16" ],
|
||||
[ "settings", "18" ],
|
||||
[ "notifications", "19" ],
|
||||
[ "user-dd", "1a" ],
|
||||
[ "activity", "1c" ],
|
||||
[ "trending", "1d" ],
|
||||
[ "minus", "1e" ],
|
||||
[ "plus", "1f" ],
|
||||
[ "geo", "20" ],
|
||||
[ "check", "21" ],
|
||||
[ "schedule", "22" ],
|
||||
[ "dot", "23" ],
|
||||
[ "user", "24" ],
|
||||
[ "content", "25" ],
|
||||
[ "arrow-d:before,.Icon--caretDown", "26" ],
|
||||
[ "arrow-u", "27" ],
|
||||
[ "share", "28" ],
|
||||
[ "info", "29" ],
|
||||
[ "verified", "2a" ],
|
||||
[ "translator", "2b" ],
|
||||
[ "blocked", "2c" ],
|
||||
[ "constrain", "2d" ],
|
||||
[ "play-video", "2e" ],
|
||||
[ "empty", "2f" ],
|
||||
[ "clear-input", "30" ],
|
||||
[ "compose", "31" ],
|
||||
[ "mark-read", "32" ],
|
||||
[ "arrow-r-double", "33" ],
|
||||
[ "arrow-l-double", "34" ],
|
||||
[ "follow", "35" ],
|
||||
[ "image", "36" ],
|
||||
[ "popout", "37" ],
|
||||
[ "move", "39" ],
|
||||
[ "compose-grid", "3a" ],
|
||||
[ "compose-minigrid", "3b" ],
|
||||
[ "compose-list", "3c" ],
|
||||
[ "edit", "40" ],
|
||||
[ "clear-timeline", "41" ],
|
||||
[ "sliders", "42" ],
|
||||
[ "custom-timeline", "43" ],
|
||||
[ "compose-dm", "44" ],
|
||||
[ "bg-dot", "45" ],
|
||||
[ "user-team-mgr", "46" ],
|
||||
[ "user-switch", "47" ],
|
||||
[ "conversation", "48" ],
|
||||
[ "dataminr", "49" ],
|
||||
[ "link", "4a", ],
|
||||
[ "flash", "50" ],
|
||||
[ "pointer-u", "51" ],
|
||||
[ "analytics", "54" ],
|
||||
[ "heart", "55" ],
|
||||
[ "calendar", "56" ],
|
||||
[ "attachment", "57" ],
|
||||
[ "play", "58" ],
|
||||
[ "bookmark", "59" ],
|
||||
[ "play-badge", "60" ],
|
||||
[ "gif-badge", "61" ],
|
||||
[ "poll", "62" ],
|
||||
|
||||
[ ".icon-heart-filled", "55" ],
|
||||
[ ".icon-retweet-filled", "08" ],
|
||||
[ ".icon-list-filled", "14" ],
|
||||
[ ".icon-user-filled", "35" ],
|
||||
[ "heart-filled", "55" ],
|
||||
[ "retweet-filled", "08" ],
|
||||
[ "list-filled", "14" ],
|
||||
[ "user-filled", "35" ],
|
||||
];
|
||||
|
||||
this.icons = document.createElement("style");
|
||||
@@ -525,9 +523,12 @@ enabled(){
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
${iconData.map(entry => `#tduck ${entry[0]}:before{content:\"\\f0${entry[1]}\";font-family:_of!important}`).join("")}
|
||||
${iconData.map(entry => `#tduck .icon-${entry[0]}:before{content:\"\\f0${entry[1]}\";font-family:_of!important}`).join("")}
|
||||
|
||||
.drawer .btn .icon, .app-header .btn .icon { line-height: 1em !important }
|
||||
.app-search-fake .icon { margin-top: -3px !important }
|
||||
#tduck .search-input-control .icon { font-size: 20px !important; top: -4px !important }
|
||||
|
||||
.column-header .column-type-icon { bottom: 26px !important }
|
||||
.is-options-open .column-type-icon { bottom: 25px !important }
|
||||
|
||||
@@ -598,6 +599,8 @@ ${this.config.revertIcons ? `
|
||||
` : ``}
|
||||
|
||||
${this.config.themeOverride === "black" ? `
|
||||
html.dark a, html.dark a:hover, html.dark a:focus, html.dark a:active { color: #8bd }
|
||||
.btn-neutral-positive { color: #8bd !important }
|
||||
.quoted-tweet { border-color: #292f33 !important }
|
||||
` : ``}
|
||||
|
||||
@@ -645,7 +648,7 @@ ready(){
|
||||
|
||||
TD.components.GlobalSettings.prototype.switchTab = function(tab){
|
||||
if (tab === "tdp-edit-design"){
|
||||
me.openEditDesignDialog();
|
||||
me.configure();
|
||||
}
|
||||
else{
|
||||
return me.prevFuncSettingsSwitchTab.apply(this, arguments);
|
||||
@@ -653,6 +656,10 @@ ready(){
|
||||
};
|
||||
}
|
||||
|
||||
configure(){
|
||||
new this.customDesignModal();
|
||||
}
|
||||
|
||||
disabled(){
|
||||
if (this.css){
|
||||
this.css.remove();
|
||||
|
@@ -1,27 +1,30 @@
|
||||
html.dark{color:#e1e8ed}
|
||||
html.dark .is-inverted-dark .stream-item{background-color:#fff}
|
||||
html.dark body{background-color:#1c6399}
|
||||
html.dark body:before{background-image:radial-gradient(circle,#1c6399,#274256)}
|
||||
html.dark::selection{background:#e1e8ed;color:#111}
|
||||
html.dark a{color:#8bd}
|
||||
html.dark a:hover,html.dark a:focus,html.dark a:active{color:#8bd}
|
||||
html.dark .txt-mute{color:#8899a6}
|
||||
html.dark .txt-mute a:not(:hover):not(:focus){color:#8899a6}
|
||||
html.dark .txt-mute-text-only{color:#8899a6}
|
||||
html.dark .txt-twitter-darker-gray{color:#657786}
|
||||
html.dark .txt-twitter-gray{color:#AAB8C2}
|
||||
html.dark .txt-twitter-emphasis-gray{color:#AAB8C2}
|
||||
html.dark .txt-twitter-blue{color:#1DA1F2}
|
||||
html.dark .bg-twitter-blue{background-color:#1DA1F2}
|
||||
html.dark .txt-twitter-red{color:#E0245E}
|
||||
html.dark .txt-twitter-green{color:#17BF63}
|
||||
html.dark .txt-twitter-deep-black{color:#14171A}
|
||||
html.dark .txt-twitter-dark-black{color:#292F33}
|
||||
html.dark .txt-twitter-dark-gray{color:#8899A6}
|
||||
html.dark .bg-twitter-deep-black{background-color:#292F33}
|
||||
html.dark .txt-twitter-black{color:#000}
|
||||
html.dark .txt-twitter-yellow{color:#FFAD1F}
|
||||
html.dark .bg-twitter-lightest-gray{background-color:#F5F8FA}
|
||||
html.dark .color-twitter-darker-gray{color:#657786}
|
||||
html.dark .color-twitter-white{color:#fff}
|
||||
html.dark .color-twitter-gray{color:#AAB8C2}
|
||||
html.dark .color-twitter-blue{color:#1DA1F2}
|
||||
html.dark .color-twitter-red{color:#E0245E}
|
||||
html.dark .color-twitter-deep-red{color:#A01744}
|
||||
html.dark .color-twitter-green{color:#17BF63}
|
||||
html.dark .color-twitter-deep-green{color:#008951}
|
||||
html.dark .color-twitter-deep-black{color:#14171A}
|
||||
html.dark .color-twitter-dark-black{color:#292F33}
|
||||
html.dark .color-twitter-dark-gray{color:#8899A6}
|
||||
html.dark .color-twitter-black{color:#000}
|
||||
html.dark .color-twitter-yellow{color:#FFAD1F}
|
||||
html.dark .bg-color-twitter-white{background-color:#fff}
|
||||
html.dark .bg-color-twitter-blue{background-color:#1DA1F2}
|
||||
html.dark .bg-color-twitter-medium-blue{background-color:#1DA1F2}
|
||||
html.dark .bg-color-twitter-faded-yellow{background-color:#FFE8B6}
|
||||
html.dark .bg-color-twitter-deep-black{background-color:#292F33}
|
||||
html.dark .bg-color-twitter-lightest-gray{background-color:#F5F8FA}
|
||||
html.dark .link-hover-override:hover .link-hover-target{color:#8bd}
|
||||
html.dark .scroll-styled-v::-webkit-scrollbar-track,html.dark .scroll-styled-h::-webkit-scrollbar-track{border-left:1px solid #292F33}
|
||||
html.dark .scroll-styled-v::-webkit-scrollbar-thumb,html.dark .scroll-styled-h::-webkit-scrollbar-thumb{background-color:#657786}
|
||||
@@ -85,7 +88,7 @@ html.dark .icon-twitter-blue-color{color:#2b7bb9}
|
||||
html.dark .btn:hover{color:#1DA1F2;background-color:#292F33}
|
||||
html.dark .btn:focus{color:#1DA1F2;background-color:#292F33;box-shadow:0 0 0 1px #fff,0 0 0 3px #71C9F8}
|
||||
html.dark .btn:active,html.dark .btn.is-selected{color:#1DA1F2;background-color:#292F33}
|
||||
html.dark .btn[disabled],html.dark .btn[disabled]:hover,html.dark .btn[disabled]:active,html.dark .btn.is-disabled,html.dark .btn.is-disabled:hover,html.dark .btn.is-disabled:focus,html.dark .btn.is-disabled:active{border:1px solid #1DA1F2;color:#1DA1F2}
|
||||
html.dark .btn[disabled],html.dark .btn[disabled]:hover,html.dark .btn[disabled]:active,html.dark .btn.is-disabled,html.dark .btn.is-disabled:hover,html.dark .btn.is-disabled:focus,html.dark .btn.is-disabled:active{color:#1DA1F2}
|
||||
html.dark .btn-on-dark:focus{box-shadow:0 0 0 1px #292F33,0 0 0 3px #71C9F8}
|
||||
html.dark .mdl-content .btn-on-dark:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px #71C9F8}
|
||||
html.dark .is-inverted-dark .btn:hover,html.dark .is-inverted-dark .btn:focus,html.dark .is-inverted-dark .btn:active,html.dark .is-inverted-dark .btn.is-selected{background-color:#F2F9FF}
|
||||
@@ -428,9 +431,8 @@ html.dark .s-minimal .mdl-header{border-bottom:1px solid #e1e8ed}
|
||||
html.dark .lst-launcher .top-row{border-bottom:1px solid #e1e8ed}
|
||||
html.dark .lst-launcher .is-disabled a,html.dark .lst-launcher .is-disabled a:hover,html.dark .lst-launcher .is-disabled a:focus,html.dark .lst-launcher .is-disabled a:active{background:#fff}
|
||||
html.dark .lst-launcher a:hover,html.dark .lst-launcher a:focus,html.dark .lst-launcher a:active{background:#f2f9ff;border:1px solid #bbddf5}
|
||||
html.dark .lst-profile a,html.dark .lst-profile a:hover,html.dark .lst-profile a:focus,html.dark .lst-profile a:active{border:1px solid #ccd6dd;color:#657786}
|
||||
html.dark .lst-profile a,html.dark .lst-profile a:hover,html.dark .lst-profile a:focus,html.dark .lst-profile a:active{color:#657786}
|
||||
html.dark .mdl-col-settings{background-color:#fff;border-left:1px solid #E1E8ED}
|
||||
html.dark .lst-profile.l-grouped{border-top:1px solid #ccd6dd}
|
||||
html.dark .mdl-links{color:#8899a6}
|
||||
html.dark .mdl-links a{color:#8899a6}
|
||||
html.dark .mdl-account-shared-warning .mdl-content{background:#fff}
|
||||
@@ -844,3 +846,6 @@ html.dark .DatePicker.date-unselected .is-rangeStart,html.dark .DatePicker.date-
|
||||
html.dark .DatePicker.date-unselected .is-rangeStart:hover,html.dark .DatePicker.date-unselected .is-rangeEnd:hover{background-color:#005091;color:#ffffff}
|
||||
html.dark .NotificationList .Notification-body{color:#14171A}
|
||||
html.dark .DrawerModal{color:#14171A}
|
||||
/* fixes */
|
||||
html.dark .app-search-fake{border-color:transparent}
|
||||
html.dark .spinner-small,html.dark .spinner-large{filter:grayscale(80%)brightness(93%)}
|
||||
|
@@ -157,7 +157,6 @@
|
||||
thumbSizeClass: "media-size-medium"
|
||||
}));
|
||||
|
||||
html.css("border", "0");
|
||||
html.find("footer").last().remove(); // apparently withTweetActions breaks for certain tweets, nice
|
||||
html.find(".js-quote-detail").removeClass("is-actionable margin-b--8"); // prevent quoted tweets from changing the cursor and reduce bottom margin
|
||||
|
||||
@@ -186,6 +185,12 @@
|
||||
return $(this).text() === "Show this thread";
|
||||
}).first().each(function(){
|
||||
this.id = "tduck-show-thread";
|
||||
|
||||
let moveBefore = html.find(".tweet-body > .js-media, .tweet-body > .js-media-preview-container, .quoted-tweet");
|
||||
|
||||
if (moveBefore){
|
||||
$(this).css("margin-top", "5px").removeClass("margin-b--5").parent("span").detach().insertBefore(moveBefore);
|
||||
}
|
||||
});
|
||||
|
||||
let type = tweet.getChirpType();
|
||||
@@ -194,6 +199,9 @@
|
||||
html.find(".js-user-actions-menu").parent().remove();
|
||||
html.find(".account-bio").removeClass("padding-t--5").css("padding-top", "2px");
|
||||
}
|
||||
else if (type.startsWith("favorite") || type.startsWith("retweet")){
|
||||
html.children().first().addClass("td-notification-padded");
|
||||
}
|
||||
else if (type.includes("list_member")){
|
||||
html.find(".activity-header").css("margin-top", "2px");
|
||||
html.find(".avatar").first().css("margin-bottom", "0");
|
||||
@@ -289,9 +297,9 @@
|
||||
tags.push("a[data-full-url] { word-break: break-all !important }"); // break long urls
|
||||
tags.push(".media-item, .media-preview { border-radius: 1px !important }"); // square-ify media
|
||||
tags.push(".quoted-tweet { border-radius: 0 !important }"); // square-ify quoted tweets
|
||||
tags.push(".tweet-context .nbfc { text-overflow: ellipsis !important; white-space: nowrap !important }"); // force ellipsis on long usernames
|
||||
tags.push(".activity-header { align-items: center !important; margin-bottom: 4px !important }"); // tweak alignment of avatar and text in notifications
|
||||
tags.push(".activity-header .tweet-timestamp { line-height: unset !important }"); // fix timestamp position in notifications
|
||||
tags.push(".activity-header.has-source-avatar { margin-bottom: 4px !important }"); // tweak distance between avatar and text
|
||||
tags.push(".activity-header .tweet-timestamp { line-height: unset !important }"); // fix timestamp position
|
||||
tags.push(".activity-header .icon-user-filled { vertical-align: sub !important; }"); // fix follow icon position
|
||||
tags.push("#tduck-show-thread { display: inline-block !important; cursor: pointer }");
|
||||
|
||||
if (fontSizeName === "smallest"){
|
||||
|
@@ -1,91 +0,0 @@
|
||||
(function($, $TD){
|
||||
$(document).one("TD.ready", function(){
|
||||
let css = $(`
|
||||
<style>
|
||||
#td-introduction-modal {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#td-introduction-modal .mdl {
|
||||
width: 90%;
|
||||
max-width: 626px;
|
||||
height: 244px;
|
||||
}
|
||||
|
||||
#td-introduction-modal .mdl-header-title {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#td-introduction-modal .mdl-content {
|
||||
padding: 4px 16px 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#td-introduction-modal p {
|
||||
margin: 12px 0;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
#td-introduction-modal p strong {
|
||||
font-weight: normal;
|
||||
text-shadow: 0 0 #000;
|
||||
}
|
||||
|
||||
#td-introduction-modal footer {
|
||||
padding: 10px 0;
|
||||
}
|
||||
</style>`).appendTo(document.head);
|
||||
|
||||
let ele = $(`
|
||||
<div id="td-introduction-modal" class="ovl">
|
||||
<div class="mdl is-inverted-dark">
|
||||
<header class="mdl-header">
|
||||
<h3 class="mdl-header-title">Quick message</h3>
|
||||
<a href="#" class="mdl-dismiss link-normal-dark"><i class="icon icon-close"></i></a>
|
||||
</header>
|
||||
<div class="mdl-inner">
|
||||
<div class="mdl-content">
|
||||
<p>Hi! Unfortunately the old <strong>@TryTweetDuck</strong> account was suspended.</p>
|
||||
<p>If you were following it before, or if you want to keep up with the latest news and updates about TweetDuck, please <a id="td-introduction-follow" href="#">follow @TryMyAwesomeApp</a>.</p>
|
||||
<p>Thanks for your support!</p>
|
||||
</div>
|
||||
<footer class="txt-right">
|
||||
<button class="btn btn-positive"><span class="label">Close</span</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>`).appendTo(".js-app");
|
||||
|
||||
let tdUser = null;
|
||||
let loadTweetDuckUser = (onSuccess, onError) => {
|
||||
if (tdUser !== null){
|
||||
onSuccess(tdUser);
|
||||
}
|
||||
else{
|
||||
TD.controller.clients.getPreferredClient().getUsersByIds([ "957608948189880320" ], users => onSuccess(users[0]), onError);
|
||||
}
|
||||
};
|
||||
|
||||
loadTweetDuckUser(user => tdUser = user);
|
||||
|
||||
ele.find("#td-introduction-follow").click(function(){
|
||||
loadTweetDuckUser(user => {
|
||||
$(document).trigger("uiShowFollowFromOptions", { userToFollow: user });
|
||||
|
||||
$(".js-modals-container").find("header a[rel='user']").each(function(){
|
||||
this.outerHTML = "TweetDuck";
|
||||
});
|
||||
}, () => {
|
||||
alert("An error occurred when retrieving the account information.");
|
||||
});
|
||||
});
|
||||
|
||||
ele.find("button, a.mdl-dismiss").click(function(){
|
||||
ele.fadeOut(200, function(){
|
||||
$TD.onIntroductionClosed(false, false);
|
||||
ele.remove();
|
||||
css.remove();
|
||||
});
|
||||
});
|
||||
});
|
||||
})($, $TD);
|
@@ -12,6 +12,10 @@
|
||||
height: 328px;
|
||||
}
|
||||
|
||||
#td-introduction-modal .mdl-inner {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#td-introduction-modal .mdl-header-title {
|
||||
cursor: default;
|
||||
}
|
||||
|
@@ -35,6 +35,10 @@
|
||||
install(plugin){
|
||||
this.installed.push(plugin);
|
||||
|
||||
if (typeof plugin.obj.configure === "function"){
|
||||
$TDP.setConfigurable(plugin.obj.$token);
|
||||
}
|
||||
|
||||
if (!this.isDisabled(plugin)){
|
||||
plugin.obj.enabled();
|
||||
this.runWhenReady(plugin);
|
||||
@@ -93,6 +97,13 @@
|
||||
window.TD_PLUGINS.setState(window.TD_PLUGINS.findObject(identifier), enable);
|
||||
};
|
||||
|
||||
//
|
||||
// Block: Setup a function to trigger plugin configuration.
|
||||
//
|
||||
window.TDPF_configurePlugin = function(identifier){
|
||||
window.TD_PLUGINS.findObject(identifier).obj.configure();
|
||||
};
|
||||
|
||||
//
|
||||
// Block: Setup a function to reload the page.
|
||||
//
|
||||
|
@@ -38,7 +38,7 @@
|
||||
/* Square-ify stuff */
|
||||
/********************/
|
||||
|
||||
.btn, .mdl, .mdl-content, .app-search-fake, .app-search-input, .popover, .lst-modal, .tooltip-inner {
|
||||
.btn, .mdl, .mdl-content, .popover, .lst-modal, .tooltip-inner {
|
||||
border-radius: 1px !important;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
border-radius: 1px !important;
|
||||
}
|
||||
|
||||
.compose-text-container, .compose-reply-tweet, .compose-message-recipient-input-container, .compose-message-recipient, .compose-media-bar-holder, .media-grid-container, .js-quote-tweet-holder, .detail-view-inline-text {
|
||||
.btn-compose, .app-search-fake, .app-search-input, .compose-text-container, .compose-reply-tweet, .compose-message-recipient-input-container, .compose-message-recipient, .compose-media-bar-holder, .media-grid-container, .js-quote-tweet-holder, .detail-view-inline-text {
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
|
||||
@@ -94,23 +94,16 @@
|
||||
/* Tweak notification layout and design */
|
||||
/****************************************/
|
||||
|
||||
.tweet-context .nbfc {
|
||||
text-overflow: ellipsis !important;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
.activity-header {
|
||||
align-items: center !important;
|
||||
margin-bottom: 4px !important;
|
||||
.activity-header.has-source-avatar {
|
||||
margin-bottom: 4px !important
|
||||
}
|
||||
|
||||
.activity-header .tweet-timestamp {
|
||||
line-height: unset !important;
|
||||
}
|
||||
|
||||
.account-bio.padding-t--5 {
|
||||
/* follow notification padding */
|
||||
padding-top: 2px !important;
|
||||
.activity-header .icon-user-filled {
|
||||
vertical-align: sub !important;
|
||||
}
|
||||
|
||||
html[data-td-theme='light'] .stream-item:not(:hover) .js-user-actions-menu {
|
||||
@@ -125,6 +118,23 @@ html[data-td-theme='dark'] .stream-item:not(:hover) .js-user-actions-menu {
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
.stream-item[data-key^="favorite"] .item-img, .stream-item[data-key^="retweet"] .item-img {
|
||||
position: absolute;
|
||||
left: 21px;
|
||||
top: 48px;
|
||||
width: 0 !important;
|
||||
}
|
||||
|
||||
.stream-item[data-key^="favorite"] .activity-header > .nbfc, .stream-item[data-key^="retweet"] .activity-header > .nbfc {
|
||||
margin-left: 46px;
|
||||
line-height: unset !important;
|
||||
}
|
||||
|
||||
.stream-item[data-key^="favorite"] .activity-header > .nbfc > .avatar, .stream-item[data-key^="retweet"] .activity-header > .nbfc > .avatar {
|
||||
position: absolute;
|
||||
margin-left: -34px;
|
||||
}
|
||||
|
||||
/***********************/
|
||||
/* Tweaks for features */
|
||||
/***********************/
|
||||
@@ -209,6 +219,17 @@ html[data-td-font='smallest'] .tweet-detail-wrapper .badge-verified:before {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.inline-reply .btn-square, .rpl-actions .btn-square {
|
||||
/* remove effects from buttons under reply input... this keeps happening for some stupid reason */
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.js-add-to-customtimeline-input {
|
||||
/* the custom timeline input shadow is behaving super weird when focused */
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* Fix glaring visual issues that twitter hasn't fixed yet smh */
|
||||
/***************************************************************/
|
||||
@@ -287,3 +308,15 @@ html[data-td-font='smallest'] .tweet-detail-wrapper .badge-verified:before {
|
||||
.column-type-message.is-shifted-1 .username {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
/******************************/
|
||||
/* Hide unused Settings items */
|
||||
/******************************/
|
||||
|
||||
#show-startup-notifications, #show-startup-notifications + span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#auto-play-gifs, #auto-play-gifs + span {
|
||||
display: none;
|
||||
}
|
||||
|
@@ -38,13 +38,34 @@ body {
|
||||
vertical-align: -10% !important;
|
||||
}
|
||||
|
||||
/************************************/
|
||||
/* Favorite & retweet notifications */
|
||||
/************************************/
|
||||
|
||||
.td-notification-padded .item-img {
|
||||
position: absolute;
|
||||
left: 21px;
|
||||
top: 48px;
|
||||
width: 0 !important;
|
||||
}
|
||||
|
||||
.td-notification-padded .activity-header > .nbfc {
|
||||
margin-left: 46px;
|
||||
line-height: unset !important;
|
||||
}
|
||||
|
||||
.td-notification-padded .activity-header > .nbfc > .avatar {
|
||||
position: absolute;
|
||||
margin-left: -34px;
|
||||
}
|
||||
|
||||
/*********/
|
||||
/* Media */
|
||||
/*********/
|
||||
|
||||
.media-size-medium {
|
||||
max-height: 240px;
|
||||
height: calc(100vh - 16px) !important;
|
||||
height: calc(100vh - 20px) !important;
|
||||
border-radius: 1px !important;
|
||||
}
|
||||
|
||||
@@ -53,6 +74,11 @@ body {
|
||||
}
|
||||
|
||||
#tduck .js-media, #tduck .js-media-preview-container {
|
||||
padding-top: 1px;
|
||||
margin-bottom: 2px !important;
|
||||
}
|
||||
|
||||
#tduck .js-quote-detail .js-media, #tduck .js-quote-detail .js-media-preview-container {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
|
BIN
Resources/spinner.apng
Normal file
BIN
Resources/spinner.apng
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@@ -1,7 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="packages\CefSharp.WinForms.63.0.0-pre01\build\CefSharp.WinForms.props" Condition="Exists('packages\CefSharp.WinForms.63.0.0-pre01\build\CefSharp.WinForms.props')" />
|
||||
<Import Project="packages\CefSharp.Common.63.0.0-pre01\build\CefSharp.Common.props" Condition="Exists('packages\CefSharp.Common.63.0.0-pre01\build\CefSharp.Common.props')" />
|
||||
<Import Project="packages\CefSharp.WinForms.64.0.0-CI2497\build\CefSharp.WinForms.props" Condition="Exists('packages\CefSharp.WinForms.64.0.0-CI2497\build\CefSharp.WinForms.props')" />
|
||||
<Import Project="packages\CefSharp.Common.64.0.0-CI2497\build\CefSharp.Common.props" Condition="Exists('packages\CefSharp.Common.64.0.0-CI2497\build\CefSharp.Common.props')" />
|
||||
<Import Project="packages\cef.redist.x86.3.3282.1731\build\cef.redist.x86.props" Condition="Exists('packages\cef.redist.x86.3.3282.1731\build\cef.redist.x86.props')" />
|
||||
<Import Project="packages\cef.redist.x64.3.3282.1731\build\cef.redist.x64.props" Condition="Exists('packages\cef.redist.x64.3.3282.1731\build\cef.redist.x64.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -105,6 +107,7 @@
|
||||
<Compile Include="Core\Handling\RequestHandlerBase.cs" />
|
||||
<Compile Include="Core\Handling\RequestHandlerBrowser.cs" />
|
||||
<Compile Include="Core\Handling\ResourceHandlerNotification.cs" />
|
||||
<Compile Include="Core\ITweetDeckBrowser.cs" />
|
||||
<Compile Include="Core\Notification\Example\FormNotificationExample.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -247,6 +250,7 @@
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Core\Notification\Screenshot\TweetScreenshotManager.cs" />
|
||||
<Compile Include="Data\ResourceLink.cs" />
|
||||
<Compile Include="Data\Serialization\FileSerializer.cs" />
|
||||
<Compile Include="Data\InjectedHTML.cs" />
|
||||
<Compile Include="Data\Serialization\ITypeConverter.cs" />
|
||||
@@ -354,6 +358,7 @@
|
||||
<None Include="Resources\icon-tray-new.ico" />
|
||||
<None Include="Resources\icon-tray.ico" />
|
||||
<None Include="Resources\PostBuild.ps1" />
|
||||
<None Include="Resources\spinner.apng" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\Plugins\" />
|
||||
@@ -361,7 +366,6 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\avatar.png" />
|
||||
<Content Include="Resources\Scripts\code.js" />
|
||||
<Content Include="Resources\Scripts\introduction.follow.js" />
|
||||
<Content Include="Resources\Scripts\introduction.js" />
|
||||
<Content Include="Resources\Scripts\notification.js" />
|
||||
<Content Include="Resources\Scripts\pages\error.html" />
|
||||
@@ -434,19 +438,17 @@ powershell -ExecutionPolicy Unrestricted -File "$(ProjectDir)Resources\PostBuild
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>powershell Get-Process TweetDuck.Browser -ErrorAction SilentlyContinue ^| Where-Object {$_.Path -eq '$(TargetDir)TweetDuck.Browser.exe'} ^| Stop-Process; Exit 0</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="packages\cef.redist.x64.3.3239.1716\build\cef.redist.x64.targets" Condition="Exists('packages\cef.redist.x64.3.3239.1716\build\cef.redist.x64.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('packages\cef.redist.x64.3.3239.1716\build\cef.redist.x64.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x64.3.3239.1716\build\cef.redist.x64.targets'))" />
|
||||
<Error Condition="!Exists('packages\cef.redist.x86.3.3239.1716\build\cef.redist.x86.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x86.3.3239.1716\build\cef.redist.x86.targets'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.Common.63.0.0-pre01\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.63.0.0-pre01\build\CefSharp.Common.props'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.Common.63.0.0-pre01\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.63.0.0-pre01\build\CefSharp.Common.targets'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.WinForms.63.0.0-pre01\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.63.0.0-pre01\build\CefSharp.WinForms.props'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.WinForms.63.0.0-pre01\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.63.0.0-pre01\build\CefSharp.WinForms.targets'))" />
|
||||
<Error Condition="!Exists('packages\cef.redist.x64.3.3282.1731\build\cef.redist.x64.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x64.3.3282.1731\build\cef.redist.x64.props'))" />
|
||||
<Error Condition="!Exists('packages\cef.redist.x86.3.3282.1731\build\cef.redist.x86.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x86.3.3282.1731\build\cef.redist.x86.props'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.Common.64.0.0-CI2497\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.64.0.0-CI2497\build\CefSharp.Common.props'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.Common.64.0.0-CI2497\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.64.0.0-CI2497\build\CefSharp.Common.targets'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.WinForms.64.0.0-CI2497\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.64.0.0-CI2497\build\CefSharp.WinForms.props'))" />
|
||||
<Error Condition="!Exists('packages\CefSharp.WinForms.64.0.0-CI2497\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.64.0.0-CI2497\build\CefSharp.WinForms.targets'))" />
|
||||
</Target>
|
||||
<Import Project="packages\cef.redist.x86.3.3239.1716\build\cef.redist.x86.targets" Condition="Exists('packages\cef.redist.x86.3.3239.1716\build\cef.redist.x86.targets')" />
|
||||
<Import Project="packages\CefSharp.Common.63.0.0-pre01\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.63.0.0-pre01\build\CefSharp.Common.targets')" />
|
||||
<Import Project="packages\CefSharp.WinForms.63.0.0-pre01\build\CefSharp.WinForms.targets" Condition="Exists('packages\CefSharp.WinForms.63.0.0-pre01\build\CefSharp.WinForms.targets')" />
|
||||
<Import Project="packages\CefSharp.Common.64.0.0-CI2497\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.64.0.0-CI2497\build\CefSharp.Common.targets')" />
|
||||
<Import Project="packages\CefSharp.WinForms.64.0.0-CI2497\build\CefSharp.WinForms.targets" Condition="Exists('packages\CefSharp.WinForms.64.0.0-CI2497\build\CefSharp.WinForms.targets')" />
|
||||
</Project>
|
@@ -1,6 +1,6 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26430.16
|
||||
VisualStudioVersion = 15.0.27130.2027
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TweetDuck", "TweetDuck.csproj", "{2389A7CD-E0D3-4706-8294-092929A33A2D}"
|
||||
EndProject
|
||||
@@ -20,7 +20,6 @@ Global
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Debug|x86.Build.0 = Debug|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Release|x86.ActiveCfg = Release|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Release|x86.Build.0 = Release|x86
|
||||
{B10B0017-819E-4F71-870F-8256B36A26AA}.Debug|x86.ActiveCfg = Debug|x86
|
||||
@@ -42,4 +41,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {43936FDB-CBF7-493D-A99A-24B516646584}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@@ -1,14 +1,14 @@
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core;
|
||||
using TweetDuck.Core.Controls;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetDuck.Resources;
|
||||
|
||||
namespace TweetDuck.Updates{
|
||||
sealed class UpdateHandler{
|
||||
private readonly ChromiumWebBrowser browser;
|
||||
private readonly ITweetDeckBrowser browser;
|
||||
private readonly UpdaterSettings settings;
|
||||
|
||||
public event EventHandler<UpdateEventArgs> UpdateAccepted;
|
||||
@@ -18,19 +18,17 @@ namespace TweetDuck.Updates{
|
||||
private int lastEventId;
|
||||
private UpdateInfo lastUpdateInfo;
|
||||
|
||||
public UpdateHandler(ChromiumWebBrowser browser, UpdaterSettings settings){
|
||||
public UpdateHandler(ITweetDeckBrowser browser, UpdaterSettings settings){
|
||||
this.browser = browser;
|
||||
this.settings = settings;
|
||||
|
||||
browser.FrameLoadEnd += browser_FrameLoadEnd;
|
||||
browser.RegisterAsyncJsObject("$TDU", new Bridge(this));
|
||||
browser.OnFrameLoaded(OnFrameLoaded);
|
||||
browser.RegisterBridge("$TDU", new Bridge(this));
|
||||
}
|
||||
|
||||
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||
if (e.Frame.IsMain && TwitterUtils.IsTweetDeckWebsite(e.Frame)){
|
||||
ScriptLoader.ExecuteFile(e.Frame, "update.js");
|
||||
Check(false);
|
||||
}
|
||||
private void OnFrameLoaded(IFrame frame){
|
||||
ScriptLoader.ExecuteFile(frame, "update.js");
|
||||
Check(false);
|
||||
}
|
||||
|
||||
public int Check(bool force){
|
||||
@@ -39,7 +37,7 @@ namespace TweetDuck.Updates{
|
||||
settings.DismissedUpdate = null;
|
||||
}
|
||||
|
||||
browser.ExecuteScriptAsync("TDUF_runUpdateCheck", ++lastEventId, Program.VersionTag, settings.DismissedUpdate ?? string.Empty, settings.AllowPreReleases);
|
||||
browser.ExecuteFunction("TDUF_runUpdateCheck", ++lastEventId, Program.VersionTag, settings.DismissedUpdate ?? string.Empty, settings.AllowPreReleases);
|
||||
return lastEventId;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@@ -60,6 +60,7 @@ Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"
|
||||
|
||||
[InstallDelete]
|
||||
Type: files; Name: "{app}\TweetLib.Audio.dll"
|
||||
Type: filesandordirs; Name: "{app}\scripts"
|
||||
Type: filesandordirs; Name: "{app}\plugins\official"
|
||||
Type: files; Name: "{app}\locales\am.pak"
|
||||
Type: files; Name: "{app}\locales\ar.pak"
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="cef.redist.x64" version="3.3239.1716" targetFramework="net452" xmlns="" />
|
||||
<package id="cef.redist.x86" version="3.3239.1716" targetFramework="net452" xmlns="" />
|
||||
<package id="CefSharp.Common" version="63.0.0-pre01" targetFramework="net452" xmlns="" />
|
||||
<package id="CefSharp.WinForms" version="63.0.0-pre01" targetFramework="net452" xmlns="" />
|
||||
<package id="cef.redist.x64" version="3.3282.1731" targetFramework="net452" xmlns="" />
|
||||
<package id="cef.redist.x86" version="3.3282.1731" targetFramework="net452" xmlns="" />
|
||||
<package id="CefSharp.Common" version="64.0.0-CI2497" targetFramework="net452" xmlns="" />
|
||||
<package id="CefSharp.WinForms" version="64.0.0-CI2497" targetFramework="net452" xmlns="" />
|
||||
<package id="Microsoft.VC120.CRT.JetBrains" version="12.0.21005.2" targetFramework="net452" xmlns="" />
|
||||
</packages>
|
@@ -3,7 +3,7 @@ using CefSharp.BrowserSubprocess;
|
||||
|
||||
namespace TweetDuck.Browser{
|
||||
static class Program{
|
||||
internal const string Version = "1.4.0.0";
|
||||
internal const string Version = "1.4.1.0";
|
||||
|
||||
private static int Main(string[] args){
|
||||
SubProcess.EnableHighDPISupport();
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="CefSharp.BrowserSubprocess.Core, Version=63.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\CefSharp.Common.63.0.0-pre01\CefSharp\x86\CefSharp.BrowserSubprocess.Core.dll</HintPath>
|
||||
<HintPath>..\packages\CefSharp.Common.64.0.0-CI2497\CefSharp\x86\CefSharp.BrowserSubprocess.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
|
Reference in New Issue
Block a user