1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-09-14 19:32:10 +02:00

Compare commits

...

39 Commits

Author SHA1 Message Date
8d1c07d6b2 Release 1.13 2018-02-12 18:48:42 +01:00
c32462cc9e Update TweetDeck color selectors in CSS for black theme 2018-02-12 18:23:16 +01:00
ec94ea3273 Refactor PluginManager to use ITweetDeckBrowser & do some cleanup 2018-02-12 15:26:21 +01:00
41acd8c15b Refactor UpdateHandler to reference ITweetDeckBrowser 2018-02-12 11:35:39 +01:00
155a79f2ec Add ITweetDeckBrowser for refactoring 2018-02-12 11:34:23 +01:00
9197cb9be6 Add support for 'Configure' button to edit-design plugin 2018-02-12 11:26:50 +01:00
03d50c847b Add 'Configure' button to plugins with a configure() method & close dialog afterwards 2018-02-12 10:40:00 +01:00
bf45c40365 Make analytics debugging easier & tweak Counter serialization 2018-02-12 06:13:08 +01:00
679e126194 Reset all analytics counters 2018-02-12 05:41:03 +01:00
50e39164bd Update and add analytics data points & increase report interval to 14 days 2018-02-11 20:01:57 +01:00
cb9f75e968 Refactor AnalyticsFile events and usage 2018-02-11 16:59:02 +01:00
aa7f6cc3b1 Fix loading spinner sometimes being visible before getting replaced 2018-02-10 23:20:34 +01:00
fe601aed41 Redesign favorite/retweet notifications to be more compact and show full text 2018-02-10 13:09:09 +01:00
2282a9df28 Move 'Show this thread' in desktop notifications above media/quotes & fix hover color w/ black theme 2018-02-10 08:29:59 +01:00
2b54627750 Tweak media size and margins in desktop notifications 2018-02-10 07:54:50 +01:00
16051a0d25 Forgot this 2018-02-10 07:13:56 +01:00
66d5f0d790 Refactor IResourceHandler usage 2018-02-10 07:07:11 +01:00
07d29207f0 Restore loading background color and spinner from before the TweetDeck update 2018-02-10 06:50:52 +01:00
a60be2afcc More Visual Studio shit 2018-02-07 21:58:21 +01:00
027f3ee253 Remove recently added follow notification 2018-02-07 03:22:50 +01:00
04774815e4 Fix bad padding in introduction modal 2018-02-07 03:20:58 +01:00
61a73c055b Fix weird alignment of stuff in notification columns 2018-02-07 00:39:05 +01:00
7731534ffc Save some space in edit-design plugin 2018-02-07 00:21:57 +01:00
ed7bf99610 Prevent dev tools from leaking info in all request headers 2018-02-06 21:10:29 +01:00
cbe4272556 Hide unused items in TweetDeck Settings modal (startup notifications, gif autoplay) 2018-02-06 20:43:18 +01:00
8f5e3dfdcc Merge pull request #203 from chylex/cefsharp64
Update CefSharp to 64 & re-enable mp3s in sound notifications
2018-02-06 18:40:23 +01:00
35500c51f1 Allow export/import/restoring system options & refactor Manage Options dialog 2018-02-06 18:35:36 +01:00
629f873bb2 Add a debugger trigger shortcut to debug plugin 2018-02-06 18:25:11 +01:00
a44cb884c4 Fix a crash when restarting after importing/resetting profile & refactor 2018-02-06 17:04:32 +01:00
d5ad1d0daa Fix loading spinners, and links in notifications when using black theme
Closes #202
2018-02-06 04:38:57 +01:00
61ae7e3b6a Fix 'Show this thread' being too close to media thumbnails in notifications 2018-02-06 04:37:45 +01:00
01583e424f Re-add mp3 support in sound notifications 2018-02-06 04:10:03 +01:00
5c0aa1b3da Update CefSharp to 64 (early build) 2018-02-06 04:06:18 +01:00
07391efa70 Fix more visual issues (remove DM reply button background w/ black theme) 2018-02-02 23:13:43 +01:00
b80f1bfc7c Fix more visual issues (remove disabled button border w/ black theme) 2018-02-02 22:31:01 +01:00
ad310db86c Fix more visual issues (profile modal w/ black theme, timeline input shadow) 2018-02-02 21:57:28 +01:00
4ce0122a29 Fix hover/click effects on buttons under reply input box 2018-02-02 19:15:44 +01:00
a8894f7054 Fix visual issues with search input and buttons 2018-02-02 18:01:11 +01:00
1d1515351b Release 1.12.5.1 2018-02-02 16:57:28 +01:00
58 changed files with 806 additions and 564 deletions

View File

@@ -37,7 +37,6 @@ namespace TweetDuck.Configuration{
public bool FirstRun { get; set; } = true; public bool FirstRun { get; set; } = true;
public bool AllowDataCollection { get; set; } = false; public bool AllowDataCollection { get; set; } = false;
public bool ShowFollowNotification { get; set; } = true;
public WindowState BrowserWindow { get; set; } = new WindowState(); public WindowState BrowserWindow { get; set; } = new WindowState();
public WindowState PluginsWindow { get; set; } = new WindowState(); public WindowState PluginsWindow { get; set; } = new WindowState();

View File

@@ -16,7 +16,7 @@ using TweetDuck.Plugins.Events;
using TweetDuck.Updates; using TweetDuck.Updates;
namespace TweetDuck.Core{ namespace TweetDuck.Core{
sealed partial class FormBrowser : Form{ sealed partial class FormBrowser : Form, AnalyticsFile.IProvider{
private static UserConfig Config => Program.UserConfig; private static UserConfig Config => Program.UserConfig;
public bool IsWaiting{ public bool IsWaiting{
@@ -38,6 +38,8 @@ namespace TweetDuck.Core{
public string UpdateInstallerPath { get; private set; } public string UpdateInstallerPath { get; private set; }
public AnalyticsFile AnalyticsFile => analytics?.File ?? AnalyticsFile.Dummy;
private readonly TweetDeckBrowser browser; private readonly TweetDeckBrowser browser;
private readonly PluginManager plugins; private readonly PluginManager plugins;
private readonly UpdateHandler updates; private readonly UpdateHandler updates;
@@ -56,7 +58,10 @@ namespace TweetDuck.Core{
Text = Program.BrandName; 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.Reloaded += plugins_Reloaded;
this.plugins.Executed += plugins_Executed; this.plugins.Executed += plugins_Executed;
this.plugins.Reload(); this.plugins.Reload();
@@ -64,9 +69,6 @@ namespace TweetDuck.Core{
this.notification = new FormNotificationTweet(this, plugins); this.notification = new FormNotificationTweet(this, plugins);
this.notification.Show(); 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 Controls.Add(new MenuStrip{ Visible = false }); // fixes Alt freezing the program in Win 10 Anniversary Update
Disposed += (sender, args) => { Disposed += (sender, args) => {
@@ -89,7 +91,7 @@ namespace TweetDuck.Core{
UpdateTrayIcon(); UpdateTrayIcon();
this.updates = browser.CreateUpdateHandler(updaterSettings); this.updates = new UpdateHandler(browser, updaterSettings);
this.updates.UpdateAccepted += updates_UpdateAccepted; this.updates.UpdateAccepted += updates_UpdateAccepted;
this.updates.UpdateDismissed += updates_UpdateDismissed; this.updates.UpdateDismissed += updates_UpdateDismissed;
@@ -193,7 +195,7 @@ namespace TweetDuck.Core{
} }
private void Config_MuteToggled(object sender, EventArgs e){ private void Config_MuteToggled(object sender, EventArgs e){
TriggerAnalyticsEvent(AnalyticsFile.Event.MuteNotification); AnalyticsFile.NotificationMutes.Trigger();
} }
private void Config_TrayBehaviorChanged(object sender, EventArgs e){ private void Config_TrayBehaviorChanged(object sender, EventArgs e){
@@ -217,7 +219,7 @@ namespace TweetDuck.Core{
} }
if (isLoaded){ if (isLoaded){
ReloadToTweetDeck(); browser.ReloadToTweetDeck();
} }
} }
@@ -268,7 +270,7 @@ namespace TweetDuck.Core{
} }
else{ else{
browser.OnMouseClickExtra(m.WParam); browser.OnMouseClickExtra(m.WParam);
TriggerAnalyticsEvent(AnalyticsFile.Event.BrowserExtraMouseButton); AnalyticsFile.BrowserExtraMouseButtons.Trigger();
} }
return; return;
@@ -293,6 +295,7 @@ namespace TweetDuck.Core{
public void ReloadToTweetDeck(){ public void ReloadToTweetDeck(){
browser.ReloadToTweetDeck(); browser.ReloadToTweetDeck();
AnalyticsFile.BrowserReloads.Trigger();
} }
public void TriggerTweetScreenshot(){ public void TriggerTweetScreenshot(){
@@ -309,10 +312,7 @@ namespace TweetDuck.Core{
public void ApplyROT13(){ public void ApplyROT13(){
browser.ApplyROT13(); browser.ApplyROT13();
} AnalyticsFile.UsedROT13.Trigger();
public void TriggerAnalyticsEvent(AnalyticsFile.Event e){
analytics?.TriggerEvent(e);
} }
// callback handlers // callback handlers
@@ -320,7 +320,6 @@ namespace TweetDuck.Core{
public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){ public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){
if (Config.FirstRun){ if (Config.FirstRun){
Config.FirstRun = false; Config.FirstRun = false;
Config.ShowFollowNotification = false;
Config.AllowDataCollection = allowDataCollection; Config.AllowDataCollection = allowDataCollection;
Config.Save(); Config.Save();
@@ -328,10 +327,6 @@ namespace TweetDuck.Core{
analytics = new AnalyticsManager(this, plugins, Program.AnalyticsFilePath); analytics = new AnalyticsManager(this, plugins, Program.AnalyticsFilePath);
} }
} }
else if (Config.ShowFollowNotification){
Config.ShowFollowNotification = false;
Config.Save();
}
if (showGuide){ if (showGuide){
FormGuide.Show(); FormGuide.Show();
@@ -388,21 +383,21 @@ namespace TweetDuck.Core{
form.Dispose(); form.Dispose();
}; };
TriggerAnalyticsEvent(AnalyticsFile.Event.OpenOptions); AnalyticsFile.OpenOptions.Trigger();
ShowChildForm(form); ShowChildForm(form);
} }
} }
public void OpenAbout(){ public void OpenAbout(){
if (!FormManager.TryBringToFront<FormAbout>()){ if (!FormManager.TryBringToFront<FormAbout>()){
TriggerAnalyticsEvent(AnalyticsFile.Event.OpenAbout); AnalyticsFile.OpenAbout.Trigger();
ShowChildForm(new FormAbout()); ShowChildForm(new FormAbout());
} }
} }
public void OpenPlugins(){ public void OpenPlugins(){
if (!FormManager.TryBringToFront<FormPlugins>()){ if (!FormManager.TryBringToFront<FormPlugins>()){
TriggerAnalyticsEvent(AnalyticsFile.Event.OpenPlugins); AnalyticsFile.OpenPlugins.Trigger();
ShowChildForm(new FormPlugins(plugins)); ShowChildForm(new FormPlugins(plugins));
} }
} }
@@ -414,7 +409,7 @@ namespace TweetDuck.Core{
} }
public void OnTweetSound(){ public void OnTweetSound(){
TriggerAnalyticsEvent(AnalyticsFile.Event.SoundNotification); AnalyticsFile.SoundNotifications.Trigger();
} }
public void PlayVideo(string url, string username){ public void PlayVideo(string url, string username){
@@ -432,7 +427,7 @@ namespace TweetDuck.Core{
} }
videoPlayer.Launch(url, username); videoPlayer.Launch(url, username);
TriggerAnalyticsEvent(AnalyticsFile.Event.VideoPlay); AnalyticsFile.VideoPlays.Trigger();
} }
public bool ProcessBrowserKey(Keys key){ public bool ProcessBrowserKey(Keys key){
@@ -454,7 +449,7 @@ namespace TweetDuck.Core{
notification.FinishCurrentNotification(); notification.FinishCurrentNotification();
browser.ShowTweetDetail(columnId, chirpId, fallbackUrl); browser.ShowTweetDetail(columnId, chirpId, fallbackUrl);
TriggerAnalyticsEvent(AnalyticsFile.Event.TweetDetail); AnalyticsFile.TweetDetails.Trigger();
} }
public void OnTweetScreenshotReady(string html, int width, int height){ public void OnTweetScreenshotReady(string html, int width, int height){
@@ -463,7 +458,7 @@ namespace TweetDuck.Core{
} }
notificationScreenshotManager.Trigger(html, width, height); notificationScreenshotManager.Trigger(html, width, height);
TriggerAnalyticsEvent(AnalyticsFile.Event.TweetScreenshot); AnalyticsFile.TweetScreenshots.Trigger();
} }
public void DisplayTooltip(string text){ public void DisplayTooltip(string text){

View File

@@ -11,6 +11,7 @@ using System.Linq;
using TweetDuck.Core.Management; using TweetDuck.Core.Management;
using TweetDuck.Core.Notification; using TweetDuck.Core.Notification;
using TweetDuck.Core.Other; using TweetDuck.Core.Other;
using TweetDuck.Core.Other.Analytics;
namespace TweetDuck.Core.Handling{ namespace TweetDuck.Core.Handling{
abstract class ContextMenuBase : IContextMenuHandler{ abstract class ContextMenuBase : IContextMenuHandler{
@@ -44,6 +45,12 @@ namespace TweetDuck.Core.Handling{
private string[] lastHighlightedTweetAuthors; private string[] lastHighlightedTweetAuthors;
private string[] lastHighlightedTweetImageList; 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){ public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
if (!TwitterUtils.IsTweetDeckWebsite(frame) || browser.IsLoading){ if (!TwitterUtils.IsTweetDeckWebsite(frame) || browser.IsLoading){
lastHighlightedTweetAuthors = StringUtils.EmptyArray; lastHighlightedTweetAuthors = StringUtils.EmptyArray;
@@ -82,7 +89,7 @@ namespace TweetDuck.Core.Handling{
model.AddItem(MenuSaveMedia, TextSave("video")); model.AddItem(MenuSaveMedia, TextSave("video"));
model.AddSeparator(); 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(MenuViewImage, "View image in photo viewer");
model.AddItem(MenuOpenMediaUrl, TextOpen("image")); model.AddItem(MenuOpenMediaUrl, TextOpen("image"));
model.AddItem(MenuCopyMediaUrl, TextCopy("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){ public virtual bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags){
Control control = browserControl.AsControl();
switch(commandId){ switch(commandId){
case MenuOpenLinkUrl: case MenuOpenLinkUrl:
OpenBrowser(browserControl.AsControl(), IsLink ? ContextInfo.Value : parameters.LinkUrl); OpenBrowser(control, IsLink ? ContextInfo.Value : parameters.LinkUrl);
break; break;
case MenuCopyLinkUrl: case MenuCopyLinkUrl:
SetClipboardText(browserControl.AsControl(), IsLink ? ContextInfo.Value : parameters.UnfilteredLinkUrl); SetClipboardText(control, IsLink ? ContextInfo.Value : parameters.UnfilteredLinkUrl);
break; break;
case MenuCopyUsername: case MenuCopyUsername:
Match match = TwitterUtils.RegexAccount.Match(parameters.UnfilteredLinkUrl); 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; break;
case MenuOpenMediaUrl: case MenuOpenMediaUrl:
OpenBrowser(browserControl.AsControl(), TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality)); OpenBrowser(control, TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality));
break; break;
case MenuCopyMediaUrl: case MenuCopyMediaUrl:
SetClipboardText(browserControl.AsControl(), TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality)); SetClipboardText(control, TwitterUtils.GetMediaLink(GetMediaLink(parameters), ImageQuality));
break; break;
case MenuViewImage: case MenuViewImage:
@@ -138,6 +148,8 @@ namespace TweetDuck.Core.Handling{
ViewFile(); ViewFile();
} }
else{ else{
control.InvokeAsyncSafe(analytics.AnalyticsFile.ViewedImages.Trigger);
BrowserUtils.DownloadFileAsync(TwitterUtils.GetMediaLink(url, ImageQuality), file, ViewFile, ex => { BrowserUtils.DownloadFileAsync(TwitterUtils.GetMediaLink(url, ImageQuality), file, ViewFile, ex => {
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK); 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: case MenuSaveMedia:
if (IsVideo){ if (IsVideo){
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedVideos.Trigger);
TwitterUtils.DownloadVideo(GetMediaLink(parameters), lastHighlightedTweetAuthors.LastOrDefault()); TwitterUtils.DownloadVideo(GetMediaLink(parameters), lastHighlightedTweetAuthors.LastOrDefault());
} }
else{ else{
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedImages.Trigger);
TwitterUtils.DownloadImage(GetMediaLink(parameters), lastHighlightedTweetAuthors.LastOrDefault(), ImageQuality); TwitterUtils.DownloadImage(GetMediaLink(parameters), lastHighlightedTweetAuthors.LastOrDefault(), ImageQuality);
} }
break; break;
case MenuSaveTweetImages: case MenuSaveTweetImages:
control.InvokeAsyncSafe(analytics.AnalyticsFile.DownloadedImages.Trigger);
TwitterUtils.DownloadImages(lastHighlightedTweetImageList, lastHighlightedTweetAuthors.LastOrDefault(), ImageQuality); TwitterUtils.DownloadImages(lastHighlightedTweetImageList, lastHighlightedTweetAuthors.LastOrDefault(), ImageQuality);
break; break;

View File

@@ -2,7 +2,6 @@
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core.Bridge; using TweetDuck.Core.Bridge;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Other.Analytics;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
namespace TweetDuck.Core.Handling{ namespace TweetDuck.Core.Handling{
@@ -31,7 +30,7 @@ namespace TweetDuck.Core.Handling{
private string lastHighlightedTweetUrl; private string lastHighlightedTweetUrl;
private string lastHighlightedQuoteUrl; private string lastHighlightedQuoteUrl;
public ContextMenuBrowser(FormBrowser form){ public ContextMenuBrowser(FormBrowser form) : base(form){
this.form = form; this.form = form;
} }
@@ -97,7 +96,7 @@ namespace TweetDuck.Core.Handling{
RemoveSeparatorIfLast(model); 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){ 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.Popup += (sender, args) => {
menu.MenuItems[1].Checked = Program.UserConfig.MuteNotifications; menu.MenuItems[1].Checked = Program.UserConfig.MuteNotifications;
form.TriggerAnalyticsEvent(AnalyticsFile.Event.BrowserContextMenu); form.AnalyticsFile.BrowserContextMenus.Trigger();
}; };
return menu; return menu;

View File

@@ -1,7 +1,10 @@
using CefSharp; using CefSharp;
using TweetDuck.Core.Other.Analytics;
namespace TweetDuck.Core.Handling{ namespace TweetDuck.Core.Handling{
sealed class ContextMenuGuide : ContextMenuBase{ 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){ public override void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
model.Clear(); model.Clear();
base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model); base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model);

View File

@@ -1,7 +1,6 @@
using CefSharp; using CefSharp;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Notification; using TweetDuck.Core.Notification;
using TweetDuck.Core.Other.Analytics;
namespace TweetDuck.Core.Handling{ namespace TweetDuck.Core.Handling{
sealed class ContextMenuNotification : ContextMenuBase{ sealed class ContextMenuNotification : ContextMenuBase{
@@ -14,7 +13,7 @@ namespace TweetDuck.Core.Handling{
private readonly FormNotificationBase form; private readonly FormNotificationBase form;
private readonly bool enableCustomMenu; private readonly bool enableCustomMenu;
public ContextMenuNotification(FormNotificationBase form, bool enableCustomMenu){ public ContextMenuNotification(FormNotificationBase form, bool enableCustomMenu) : base(form){
this.form = form; this.form = form;
this.enableCustomMenu = enableCustomMenu; this.enableCustomMenu = enableCustomMenu;
} }
@@ -57,7 +56,7 @@ namespace TweetDuck.Core.Handling{
form.InvokeAsyncSafe(() => { form.InvokeAsyncSafe(() => {
form.ContextMenuOpen = true; form.ContextMenuOpen = true;
form.TriggerAnalyticsEvent(AnalyticsFile.Event.NotificationContextMenu); form.AnalyticsFile.NotificationContextMenus.Trigger();
}); });
} }

View File

@@ -2,7 +2,6 @@
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Notification; using TweetDuck.Core.Notification;
using TweetDuck.Core.Other.Analytics;
namespace TweetDuck.Core.Handling { namespace TweetDuck.Core.Handling {
sealed class KeyboardHandlerNotification : IKeyboardHandler{ sealed class KeyboardHandlerNotification : IKeyboardHandler{
@@ -13,7 +12,7 @@ namespace TweetDuck.Core.Handling {
} }
private void TriggerKeyboardShortcutAnalytics(){ 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){ bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){

View File

@@ -1,4 +1,5 @@
using CefSharp; using System.Collections.Specialized;
using CefSharp;
using CefSharp.Handler; using CefSharp.Handler;
using TweetDuck.Core.Handling.General; 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){ public override bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture){
return LifeSpanHandler.HandleLinkClick(browserControl, targetDisposition, targetUrl); 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);
}
} }
} }

View File

@@ -1,4 +1,5 @@
using CefSharp; using CefSharp;
using TweetDuck.Core.Utils;
namespace TweetDuck.Core.Handling{ namespace TweetDuck.Core.Handling{
sealed class RequestHandlerBrowser : RequestHandlerBase{ 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){ public override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
if (request.ResourceType == ResourceType.Script && request.Url.Contains("analytics.")){ if (request.ResourceType == ResourceType.Script && request.Url.Contains("analytics.")){
callback.Dispose();
return CefReturnValue.Cancel; 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
View 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);
}
}

View File

@@ -16,7 +16,7 @@ namespace TweetDuck.Core.Management{
public enum Items{ public enum Items{
None = 0, None = 0,
UserConfig = 1, UserConfig = 1,
SystemConfig = 2, // TODO implement later SystemConfig = 2,
Session = 4, Session = 4,
PluginData = 8, PluginData = 8,
All = UserConfig|SystemConfig|Session|PluginData All = UserConfig|SystemConfig|Session|PluginData
@@ -210,4 +210,10 @@ namespace TweetDuck.Core.Management{
public string Relative { get; set; } 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);
}
}
} }

View File

@@ -22,7 +22,7 @@ namespace TweetDuck.Core.Management{
public event EventHandler ProcessExited; public event EventHandler ProcessExited;
private readonly Form owner; private readonly FormBrowser owner;
private string lastUrl; private string lastUrl;
private string lastUsername; private string lastUsername;
@@ -30,7 +30,7 @@ namespace TweetDuck.Core.Management{
private DuplexPipe.Server currentPipe; private DuplexPipe.Server currentPipe;
private bool isClosing; private bool isClosing;
public VideoPlayer(Form owner){ public VideoPlayer(FormBrowser owner){
this.owner = owner; this.owner = owner;
this.owner.FormClosing += owner_FormClosing; this.owner.FormClosing += owner_FormClosing;
} }
@@ -83,6 +83,7 @@ namespace TweetDuck.Core.Management{
break; break;
case "download": case "download":
owner.AnalyticsFile.DownloadedVideos.Trigger();
TwitterUtils.DownloadVideo(lastUrl, lastUsername); TwitterUtils.DownloadVideo(lastUrl, lastUsername);
break; break;

View File

@@ -24,7 +24,7 @@ namespace TweetDuck.Core.Notification.Example{
private readonly TweetNotification exampleNotification; private readonly TweetNotification exampleNotification;
public FormNotificationExample(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, false){ 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 #if DEBUG
exampleTweetHTML = exampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:256px'>Scrollbar test padding...</div>"); exampleTweetHTML = exampleTweetHTML.Replace("</p>", @"</p><div style='margin-top:256px'>Scrollbar test padding...</div>");

View File

@@ -12,7 +12,7 @@ using TweetDuck.Core.Other.Analytics;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
namespace TweetDuck.Core.Notification{ namespace TweetDuck.Core.Notification{
partial class FormNotificationBase : Form{ partial class FormNotificationBase : Form, AnalyticsFile.IProvider{
protected static int FontSizeLevel{ protected static int FontSizeLevel{
get{ get{
switch(TweetDeckBridge.FontSize){ switch(TweetDeckBridge.FontSize){
@@ -90,6 +90,8 @@ namespace TweetDuck.Core.Notification{
} }
} }
public AnalyticsFile AnalyticsFile => owner.AnalyticsFile;
protected override bool ShowWithoutActivation => true; protected override bool ShowWithoutActivation => true;
protected float DpiScale { get; } protected float DpiScale { get; }
@@ -140,7 +142,7 @@ namespace TweetDuck.Core.Notification{
DpiScale = this.GetDPIScale(); DpiScale = this.GetDPIScale();
browser.SetupResourceHandler(TwitterUtils.TweetDeckURL, this.resourceHandler); browser.SetupResourceHandler(TwitterUtils.TweetDeckURL, this.resourceHandler);
browser.SetupResourceHandler(TweetNotification.AppLogoLink, TweetNotification.AppLogoHandler); browser.SetupResourceHandler(TweetNotification.AppLogo);
Controls.Add(browser); Controls.Add(browser);
@@ -161,10 +163,6 @@ namespace TweetDuck.Core.Notification{
base.WndProc(ref m); base.WndProc(ref m);
} }
public void TriggerAnalyticsEvent(AnalyticsFile.Event e){
owner.TriggerAnalyticsEvent(e);
}
// event handlers // event handlers
private void owner_FormClosed(object sender, FormClosedEventArgs e){ private void owner_FormClosed(object sender, FormClosedEventArgs e){

View File

@@ -5,7 +5,6 @@ using System.Windows.Forms;
using TweetDuck.Core.Bridge; using TweetDuck.Core.Bridge;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Handling; using TweetDuck.Core.Handling;
using TweetDuck.Core.Other.Analytics;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
using TweetDuck.Data; using TweetDuck.Data;
using TweetDuck.Plugins; using TweetDuck.Plugins;
@@ -128,7 +127,7 @@ namespace TweetDuck.Core.Notification{
} }
blockXButtonUp = true; blockXButtonUp = true;
this.InvokeAsyncSafe(() => TriggerAnalyticsEvent(AnalyticsFile.Event.NotificationExtraMouseButton)); this.InvokeAsyncSafe(AnalyticsFile.NotificationExtraMouseButtons.Trigger);
return NativeMethods.HOOK_HANDLED; return NativeMethods.HOOK_HANDLED;
} }
else if (eventType == NativeMethods.WM_XBUTTONUP && blockXButtonUp){ else if (eventType == NativeMethods.WM_XBUTTONUP && blockXButtonUp){

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using TweetDuck.Plugins; using TweetDuck.Plugins;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core.Other.Analytics;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
namespace TweetDuck.Core.Notification{ namespace TweetDuck.Core.Notification{
@@ -94,7 +93,7 @@ namespace TweetDuck.Core.Notification{
} }
needsTrim |= tweetQueue.Count >= TrimMinimum; needsTrim |= tweetQueue.Count >= TrimMinimum;
TriggerAnalyticsEvent(AnalyticsFile.Event.DesktopNotification); AnalyticsFile.DesktopNotifications.Trigger();
} }
public override void HideNotification(){ public override void HideNotification(){

View File

@@ -8,7 +8,7 @@ using TweetDuck.Core.Other.Settings;
namespace TweetDuck.Core.Notification{ namespace TweetDuck.Core.Notification{
static class SoundNotification{ 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){ public static IResourceHandler CreateFileHandler(string path){
string mimeType; string mimeType;
@@ -18,25 +18,19 @@ namespace TweetDuck.Core.Notification{
case ".webm": mimeType = "audio/webm"; break; case ".webm": mimeType = "audio/webm"; break;
case ".wav": mimeType = "audio/wav"; break; case ".wav": mimeType = "audio/wav"; break;
case ".ogg": mimeType = "audio/ogg"; break; case ".ogg": mimeType = "audio/ogg"; break;
case ".mp3": mimeType = "audio/mp3"; break;
case ".flac": mimeType = "audio/flac"; break; case ".flac": mimeType = "audio/flac"; break;
case ".opus": mimeType = "audio/ogg; codecs=opus"; 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; default: mimeType = null; break;
} }
try{ try{
return ResourceHandler.FromFilePath(path, mimeType); return ResourceHandler.FromFilePath(path, mimeType);
}catch{ }catch{
TryShowError("Could not find custom notification sound file:\n"+path);
return null;
}
}
private static void TryShowError(string message){
FormBrowser browser = FormManager.TryFind<FormBrowser>(); FormBrowser browser = FormManager.TryFind<FormBrowser>();
browser?.InvokeAsyncSafe(() => { browser?.InvokeAsyncSafe(() => {
using(FormMessage form = new FormMessage("Sound Notification Error", message, MessageBoxIcon.Error)){ 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); form.AddButton(FormMessage.Ignore, ControlType.Cancel | ControlType.Focused);
Button btnViewOptions = form.AddButton("View Options"); Button btnViewOptions = form.AddButton("View Options");
@@ -48,6 +42,9 @@ namespace TweetDuck.Core.Notification{
} }
} }
}); });
return null;
}
} }
} }
} }

View File

@@ -2,15 +2,14 @@
using System.Text; using System.Text;
using CefSharp; using CefSharp;
using TweetDuck.Core.Bridge; using TweetDuck.Core.Bridge;
using TweetDuck.Data;
using TweetDuck.Resources; using TweetDuck.Resources;
namespace TweetDuck.Core.Notification{ namespace TweetDuck.Core.Notification{
sealed class TweetNotification{ 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 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"); private static readonly string CustomCSS = ScriptLoader.LoadResource("styles/notification.css");
public static readonly ResourceLink AppLogo = new ResourceLink("https://ton.twimg.com/tduck/avatar", ResourceHandler.FromByteArray(Properties.Resources.avatar, "image/png"));
public const string AppLogoLink = "https://ton.twimg.com/tduck/avatar";
public static readonly IResourceHandler AppLogoHandler = ResourceHandler.FromByteArray(Properties.Resources.avatar, "image/png");
public static TweetNotification Example(string html, int characters){ public static TweetNotification Example(string html, int characters){
return new TweetNotification(string.Empty, string.Empty, "Home", html, characters, string.Empty, string.Empty, true); return new TweetNotification(string.Empty, string.Empty, "Home", html, characters, string.Empty, string.Empty, true);

View File

@@ -1,7 +1,11 @@
using System; using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using TweetDuck.Data.Serialization; using TweetDuck.Data.Serialization;
namespace TweetDuck.Core.Other.Analytics{ namespace TweetDuck.Core.Other.Analytics{
[SuppressMessage("ReSharper", "AutoPropertyCanBeMadeGetOnly.Local")]
sealed class AnalyticsFile{ sealed class AnalyticsFile{
private static readonly FileSerializer<AnalyticsFile> Serializer = new FileSerializer<AnalyticsFile>(); private static readonly FileSerializer<AnalyticsFile> Serializer = new FileSerializer<AnalyticsFile>();
@@ -10,15 +14,14 @@ namespace TweetDuck.Core.Other.Analytics{
ConvertToString = value => value.ToBinary().ToString(), ConvertToString = value => value.ToBinary().ToString(),
ConvertToObject = value => DateTime.FromBinary(long.Parse(value)) 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{ public static readonly AnalyticsFile Dummy = new AnalyticsFile(null);
OpenOptions, OpenPlugins, OpenAbout, OpenGuide,
DesktopNotification, SoundNotification, MuteNotification,
BrowserContextMenu, BrowserExtraMouseButton,
NotificationContextMenu, NotificationExtraMouseButton, NotificationKeyboardShortcut,
TweetScreenshot, TweetDetail, VideoPlay
}
// STATE PROPERTIES // STATE PROPERTIES
@@ -28,57 +31,57 @@ namespace TweetDuck.Core.Other.Analytics{
// USAGE DATA // USAGE DATA
public int CountOpenOptions { get; private set; } = 0; public Counter OpenOptions { get; private set; } = 0;
public int CountOpenPlugins { get; private set; } = 0; public Counter OpenPlugins { get; private set; } = 0;
public int CountOpenAbout { get; private set; } = 0; public Counter OpenAbout { get; private set; } = 0;
public int CountOpenGuide { get; private set; } = 0; public Counter OpenGuide { get; private set; } = 0;
public int CountDesktopNotifications { get; private set; } = 0; public Counter DesktopNotifications { get; private set; } = 0;
public int CountSoundNotifications { get; private set; } = 0; public Counter SoundNotifications { get; private set; } = 0;
public int CountMuteNotifications { get; private set; } = 0; public Counter NotificationMutes { get; private set; } = 0;
public int CountBrowserContextMenus { get; private set; } = 0; public Counter BrowserContextMenus { get; private set; } = 0;
public int CountBrowserExtraMouseButtons { get; private set; } = 0; public Counter BrowserExtraMouseButtons { get; private set; } = 0;
public int CountNotificationContextMenus { get; private set; } = 0; public Counter NotificationContextMenus { get; private set; } = 0;
public int CountNotificationExtraMouseButtons { get; private set; } = 0; public Counter NotificationExtraMouseButtons { get; private set; } = 0;
public int CountNotificationKeyboardShortcuts { get; private set; } = 0; public Counter NotificationKeyboardShortcuts { get; private set; } = 0;
public int CountTweetScreenshots { get; private set; } = 0; public Counter BrowserReloads { get; private set; } = 0;
public int CountTweetDetails { get; private set; } = 0; public Counter CopiedUsernames { get; private set; } = 0;
public int CountVideoPlays { 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 // END OF DATA
public event EventHandler PropertyChanged;
private readonly string file; private readonly string file;
private AnalyticsFile(string file){ private AnalyticsFile(string file){
this.file = file; this.file = file;
} }
public void TriggerEvent(Event e){ private void SetupProperties(){
switch(e){ foreach(Counter counter in GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).Where(prop => prop.PropertyType == typeof(Counter)).Select(prop => (Counter)prop.GetValue(this))){
case Event.OpenOptions: ++CountOpenOptions; break; counter.SetOwner(this);
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;
} }
} }
public void OnPropertyChanged(){
PropertyChanged?.Invoke(this, EventArgs.Empty);
}
public void Save(){ public void Save(){
if (file == null){
return;
}
try{ try{
Serializer.Write(file, this); Serializer.Write(file, this);
}catch(Exception e){ }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); Program.Reporter.HandleException("Analytics File Error", "Could not open the analytics file.", true, e);
} }
config.SetupProperties();
return config; 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);
}
} }
} }

View File

@@ -1,4 +1,8 @@
using System; // Uncomment to debug reports locally
// #define ANALYTICS_LOCALHOST
// #define ANALYTICS_INSTANT
using System;
using System.Net; using System.Net;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Timers; using System.Timers;
@@ -8,8 +12,15 @@ using TweetDuck.Plugins;
namespace TweetDuck.Core.Other.Analytics{ namespace TweetDuck.Core.Other.Analytics{
sealed class AnalyticsManager : IDisposable{ sealed class AnalyticsManager : IDisposable{
private static readonly TimeSpan CollectionInterval = TimeSpan.FromDays(7); private static readonly TimeSpan CollectionInterval = TimeSpan.FromDays(14);
private static readonly Uri CollectionUrl = new Uri("https://tweetduck.chylex.com/breadcrumb/report");
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; } public AnalyticsFile File { get; }
@@ -20,7 +31,9 @@ namespace TweetDuck.Core.Other.Analytics{
public AnalyticsManager(FormBrowser browser, PluginManager plugins, string file){ public AnalyticsManager(FormBrowser browser, PluginManager plugins, string file){
this.browser = browser; this.browser = browser;
this.plugins = plugins; this.plugins = plugins;
this.File = AnalyticsFile.Load(file); this.File = AnalyticsFile.Load(file);
this.File.PropertyChanged += File_PropertyChanged;
this.currentTimer = new Timer{ SynchronizingObject = browser }; this.currentTimer = new Timer{ SynchronizingObject = browser };
this.currentTimer.Elapsed += currentTimer_Elapsed; this.currentTimer.Elapsed += currentTimer_Elapsed;
@@ -34,9 +47,15 @@ namespace TweetDuck.Core.Other.Analytics{
else{ else{
RestartTimer(); RestartTimer();
} }
#if (DEBUG && ANALYTICS_INSTANT)
SendReport();
#endif
} }
public void Dispose(){ public void Dispose(){
File.PropertyChanged -= File_PropertyChanged;
if (saveTimer.Enabled){ if (saveTimer.Enabled){
File.Save(); File.Save();
} }
@@ -45,8 +64,7 @@ namespace TweetDuck.Core.Other.Analytics{
saveTimer.Dispose(); saveTimer.Dispose();
} }
public void TriggerEvent(AnalyticsFile.Event e){ private void File_PropertyChanged(object sender, EventArgs e){
File.TriggerEvent(e);
saveTimer.Enabled = true; saveTimer.Enabled = true;
} }
@@ -95,7 +113,7 @@ namespace TweetDuck.Core.Other.Analytics{
Task.Factory.StartNew(() => { Task.Factory.StartNew(() => {
AnalyticsReport report = AnalyticsReportGenerator.Create(File, info, plugins); AnalyticsReport report = AnalyticsReportGenerator.Create(File, info, plugins);
#if DEBUG #if (DEBUG && !ANALYTICS_INSTANT)
System.Diagnostics.Debugger.Break(); System.Diagnostics.Debugger.Break();
#endif #endif
@@ -122,6 +140,14 @@ namespace TweetDuck.Core.Other.Analytics{
message = "HTTP Error "+(response != null ? $"{(int)response.StatusCode} ({response.StatusDescription})" : "(unknown code)"); message = "HTTP Error "+(response != null ? $"{(int)response.StatusCode} ({response.StatusDescription})" : "(unknown code)");
break; 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)); ScheduleReportIn(TimeSpan.FromHours(4), message ?? "Error: "+(task.Exception.InnerException?.Message ?? task.Exception.Message));

View File

@@ -12,6 +12,7 @@ using TweetDuck.Core.Handling;
using TweetDuck.Core.Notification; using TweetDuck.Core.Notification;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
using TweetDuck.Plugins; using TweetDuck.Plugins;
using TweetDuck.Plugins.Enums;
namespace TweetDuck.Core.Other.Analytics{ namespace TweetDuck.Core.Other.Analytics{
static class AnalyticsReportGenerator{ static class AnalyticsReportGenerator{
@@ -37,15 +38,24 @@ namespace TweetDuck.Core.Other.Analytics{
{ "Screen DPI" , info.DPI != null ? Exact(info.DPI.Value) : "(unknown)" }, { "Screen DPI" , info.DPI != null ? Exact(info.DPI.Value) : "(unknown)" },
0, 0,
{ "Hardware Acceleration" , Bool(SysConfig.HardwareAcceleration) }, { "Hardware Acceleration" , Bool(SysConfig.HardwareAcceleration) },
{ "Clear Cache Automatically" , Bool(SysConfig.ClearCacheAutomatically) },
{ "Clear Cache Threshold" , Exact(SysConfig.ClearCacheThreshold) },
0, 0,
{ "Expand Links" , Bool(UserConfig.ExpandLinksOnHover) }, { "Expand Links" , Bool(UserConfig.ExpandLinksOnHover) },
{ "Switch Account Selectors" , Bool(UserConfig.SwitchAccountSelectors) }, { "Switch Account Selectors" , Bool(UserConfig.SwitchAccountSelectors) },
{ "Search In First Column" , Bool(UserConfig.OpenSearchInFirstColumn) }, { "Search In First Column" , Bool(UserConfig.OpenSearchInFirstColumn) },
{ "Keep Like Follow Dialogs Open" , Bool(UserConfig.KeepLikeFollowDialogsOpen) }, { "Keep Like Follow Dialogs Open" , Bool(UserConfig.KeepLikeFollowDialogsOpen) },
{ "Best Image Quality" , Bool(UserConfig.BestImageQuality) }, { "Best Image Quality" , Bool(UserConfig.BestImageQuality) },
{ "Spell Check" , Bool(UserConfig.EnableSpellCheck) }, { "Animated Images" , Bool(UserConfig.EnableAnimatedImages) },
0,
{ "Smooth Scrolling" , Bool(UserConfig.EnableSmoothScrolling) },
{ "Custom Browser" , CustomBrowser },
{ "Zoom" , Exact(UserConfig.ZoomLevel) }, { "Zoom" , Exact(UserConfig.ZoomLevel) },
0, 0,
{ "Spell Check" , Bool(UserConfig.EnableSpellCheck) },
{ "Spell Check Language" , UserConfig.SpellCheckLanguage.ToLower() },
{ "Translation Target Language" , UserConfig.TranslationTarget },
0,
{ "Updates" , Bool(UserConfig.EnableUpdateCheck) }, { "Updates" , Bool(UserConfig.EnableUpdateCheck) },
{ "Update Dismissed" , Bool(!string.IsNullOrEmpty(UserConfig.DismissedUpdate)) }, { "Update Dismissed" , Bool(!string.IsNullOrEmpty(UserConfig.DismissedUpdate)) },
0, 0,
@@ -70,8 +80,8 @@ namespace TweetDuck.Core.Other.Analytics{
{ "Custom Browser CSS" , RoundUp((UserConfig.CustomBrowserCSS ?? string.Empty).Length, 50) }, { "Custom Browser CSS" , RoundUp((UserConfig.CustomBrowserCSS ?? string.Empty).Length, 50) },
{ "Custom Notification CSS" , RoundUp((UserConfig.CustomNotificationCSS ?? string.Empty).Length, 50) }, { "Custom Notification CSS" , RoundUp((UserConfig.CustomNotificationCSS ?? string.Empty).Length, 50) },
0, 0,
{ "Plugins All" , List(plugins.Plugins.Select(plugin => plugin.Identifier)) }, { "Plugins All" , List(plugins.Plugins.Select(Plugin)) },
{ "Plugins Enabled" , List(plugins.Plugins.Where(plugin => plugins.Config.IsEnabled(plugin)).Select(plugin => plugin.Identifier)) }, { "Plugins Enabled" , List(plugins.Plugins.Where(plugin => plugins.Config.IsEnabled(plugin)).Select(Plugin)) },
0, 0,
{ "Theme" , Dict(editLayoutDesign, "_theme", "light/def") }, { "Theme" , Dict(editLayoutDesign, "_theme", "light/def") },
{ "Column Width" , Dict(editLayoutDesign, "columnWidth", "310px/def") }, { "Column Width" , Dict(editLayoutDesign, "columnWidth", "310px/def") },
@@ -87,21 +97,27 @@ namespace TweetDuck.Core.Other.Analytics{
{ "Reply Account Mode" , ReplyAccountConfigFromPlugin }, { "Reply Account Mode" , ReplyAccountConfigFromPlugin },
{ "Template Count" , Exact(TemplateCountFromPlugin) }, { "Template Count" , Exact(TemplateCountFromPlugin) },
0, 0,
{ "Opened Options" , LogRound(file.CountOpenOptions, 4) }, { "Opened Options" , LogRound(file.OpenOptions, 4) },
{ "Opened Plugins" , LogRound(file.CountOpenPlugins, 4) }, { "Opened Plugins" , LogRound(file.OpenPlugins, 4) },
{ "Opened About" , LogRound(file.CountOpenAbout, 4) }, { "Opened About" , LogRound(file.OpenAbout, 4) },
{ "Opened Guide" , LogRound(file.CountOpenGuide, 4) }, { "Opened Guide" , LogRound(file.OpenGuide, 4) },
{ "Desktop Notifications" , LogRound(file.CountDesktopNotifications, 5) }, { "Desktop Notifications" , LogRound(file.DesktopNotifications, 5) },
{ "Sound Notifications" , LogRound(file.CountSoundNotifications, 5) }, { "Sound Notifications" , LogRound(file.SoundNotifications, 5) },
{ "Mute Notifications" , LogRound(file.CountMuteNotifications, 2) }, { "Notification Mutes" , LogRound(file.NotificationMutes, 2) },
{ "Browser Context Menus" , LogRound(file.CountBrowserContextMenus, 2) }, { "Browser Context Menus" , LogRound(file.BrowserContextMenus, 2) },
{ "Browser Extra Mouse Buttons" , LogRound(file.CountBrowserExtraMouseButtons, 2) }, { "Browser Extra Mouse Buttons" , LogRound(file.BrowserExtraMouseButtons, 2) },
{ "Notification Context Menus" , LogRound(file.CountNotificationContextMenus, 2) }, { "Notification Context Menus" , LogRound(file.NotificationContextMenus, 2) },
{ "Notification Extra Mouse Buttons" , LogRound(file.CountNotificationExtraMouseButtons, 2) }, { "Notification Extra Mouse Buttons" , LogRound(file.NotificationExtraMouseButtons, 2) },
{ "Notification Keyboard Shortcuts" , LogRound(file.CountNotificationKeyboardShortcuts, 2) }, { "Notification Keyboard Shortcuts" , LogRound(file.NotificationKeyboardShortcuts, 2) },
{ "Tweet Screenshots" , LogRound(file.CountTweetScreenshots, 2) }, { "Browser Reloads" , LogRound(file.BrowserReloads, 2) },
{ "Tweet Details" , LogRound(file.CountTweetDetails, 2) }, { "Copied Usernames" , LogRound(file.CopiedUsernames, 2) },
{ "Video Plays" , LogRound(file.CountVideoPlays, 4) } { "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(); }.FinalizeReport();
} }
@@ -112,6 +128,7 @@ namespace TweetDuck.Core.Other.Analytics{
private static string Exact(int value) => value.ToString(); 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 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 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 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)")); 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(); ProgramArguments = args.Keys.Select(key => key.TrimStart('-')).ToArray();
} }
private static string CustomBrowser{
get{
return Path.GetFileName(UserConfig.BrowserPath) ?? string.Empty;
}
}
private static string TrayMode{ private static string TrayMode{
get{ get{
switch(UserConfig.TrayBehavior){ switch(UserConfig.TrayBehavior){

View File

@@ -6,7 +6,6 @@ using CefSharp.WinForms;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Handling; using TweetDuck.Core.Handling;
using TweetDuck.Core.Handling.General; using TweetDuck.Core.Handling.General;
using TweetDuck.Core.Other.Analytics;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using TweetDuck.Resources; using TweetDuck.Resources;
@@ -43,7 +42,7 @@ namespace TweetDuck.Core.Other{
FormBrowser owner = FormManager.TryFind<FormBrowser>(); FormBrowser owner = FormManager.TryFind<FormBrowser>();
if (owner != null){ if (owner != null){
owner.TriggerAnalyticsEvent(AnalyticsFile.Event.OpenGuide); owner.AnalyticsFile.OpenGuide.Trigger();
new FormGuide(url, owner).Show(owner); new FormGuide(url, owner).Show(owner);
} }
} }
@@ -55,7 +54,7 @@ namespace TweetDuck.Core.Other{
private readonly ChromiumWebBrowser browser; private readonly ChromiumWebBrowser browser;
private FormGuide(string url, Form owner){ private FormGuide(string url, FormBrowser owner){
InitializeComponent(); InitializeComponent();
Text = Program.BrandName+" Guide"; Text = Program.BrandName+" Guide";
@@ -66,7 +65,7 @@ namespace TweetDuck.Core.Other{
} }
this.browser = new ChromiumWebBrowser(url){ this.browser = new ChromiumWebBrowser(url){
MenuHandler = new ContextMenuGuide(), MenuHandler = new ContextMenuGuide(owner),
JsDialogHandler = new JavaScriptDialogHandler(), JsDialogHandler = new JavaScriptDialogHandler(),
LifeSpanHandler = new LifeSpanHandler(), LifeSpanHandler = new LifeSpanHandler(),
RequestHandler = new RequestHandlerBrowser() RequestHandler = new RequestHandlerBrowser()

View File

@@ -76,7 +76,7 @@ namespace TweetDuck.Core.Other{
} }
private void btnOpenFolder_Click(object sender, EventArgs e){ 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){ private void btnReload_Click(object sender, EventArgs e){

View File

@@ -67,10 +67,13 @@ namespace TweetDuck.Core.Other{
FormClosing -= FormSettings_FormClosing; FormClosing -= FormSettings_FormClosing;
if (dialog.ShowDialog() == DialogResult.OK){ if (dialog.ShowDialog() == DialogResult.OK){
if (!dialog.IsRestarting){
browser.ResumeNotification(); browser.ResumeNotification();
BrowserProcessHandler.UpdatePrefs(); BrowserProcessHandler.UpdatePrefs();
ShouldReloadBrowser = dialog.ShouldReloadBrowser; ShouldReloadBrowser = dialog.ShouldReloadBrowser;
}
Close(); Close();
} }
else{ else{

View File

@@ -26,16 +26,17 @@
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.btnCancel = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
this.btnContinue = 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.cbSession = new System.Windows.Forms.CheckBox();
this.cbPluginData = new System.Windows.Forms.CheckBox(); this.cbPluginData = new System.Windows.Forms.CheckBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.panelExport = new System.Windows.Forms.Panel(); this.cbSystemConfig = new System.Windows.Forms.CheckBox();
this.panelDecision = new System.Windows.Forms.Panel(); this.panelSelection = new System.Windows.Forms.FlowLayoutPanel();
this.radioReset = new System.Windows.Forms.RadioButton(); this.panelDecision = new System.Windows.Forms.FlowLayoutPanel();
this.radioExport = new System.Windows.Forms.RadioButton();
this.radioImport = new System.Windows.Forms.RadioButton(); 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.panelDecision.SuspendLayout();
this.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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnContinue.AutoSize = true; this.btnContinue.AutoSize = true;
this.btnContinue.Enabled = false; 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.Name = "btnContinue";
this.btnContinue.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); 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.TabIndex = 3;
this.btnContinue.Text = "Next"; this.btnContinue.Text = "Next";
this.btnContinue.UseVisualStyleBackColor = true; this.btnContinue.UseVisualStyleBackColor = true;
this.btnContinue.Click += new System.EventHandler(this.btnContinue_Click); this.btnContinue.Click += new System.EventHandler(this.btnContinue_Click);
// //
// cbConfig // cbProgramConfig
// //
this.cbConfig.AutoSize = true; this.cbProgramConfig.AutoSize = true;
this.cbConfig.Location = new System.Drawing.Point(0, 3); this.cbProgramConfig.Location = new System.Drawing.Point(3, 3);
this.cbConfig.Name = "cbConfig"; this.cbProgramConfig.Name = "cbProgramConfig";
this.cbConfig.Size = new System.Drawing.Size(104, 17); this.cbProgramConfig.Size = new System.Drawing.Size(104, 17);
this.cbConfig.TabIndex = 0; this.cbProgramConfig.TabIndex = 0;
this.cbConfig.Text = "Program Options"; this.cbProgramConfig.Text = "Program Options";
this.toolTip.SetToolTip(this.cbConfig, "Interface, notification, and update options."); this.toolTip.SetToolTip(this.cbProgramConfig, "Interface, notification, and update options.");
this.cbConfig.UseVisualStyleBackColor = true; this.cbProgramConfig.UseVisualStyleBackColor = true;
this.cbConfig.CheckedChanged += new System.EventHandler(this.cbConfig_CheckedChanged); this.cbProgramConfig.CheckedChanged += new System.EventHandler(this.checkBoxSelection_CheckedChanged);
// //
// cbSession // cbSession
// //
this.cbSession.AutoSize = true; 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.Name = "cbSession";
this.cbSession.Size = new System.Drawing.Size(92, 17); this.cbSession.Size = new System.Drawing.Size(92, 17);
this.cbSession.TabIndex = 1; this.cbSession.TabIndex = 2;
this.cbSession.Text = "Login Session"; this.cbSession.Text = "Login Session";
this.toolTip.SetToolTip(this.cbSession, "A token that allows logging into the\r\ncurrent TweetDeck account."); this.toolTip.SetToolTip(this.cbSession, "A token that allows logging into the\r\ncurrent TweetDeck account.");
this.cbSession.UseVisualStyleBackColor = true; this.cbSession.UseVisualStyleBackColor = true;
this.cbSession.CheckedChanged += new System.EventHandler(this.cbSession_CheckedChanged); this.cbSession.CheckedChanged += new System.EventHandler(this.checkBoxSelection_CheckedChanged);
// //
// cbPluginData // cbPluginData
// //
this.cbPluginData.AutoSize = true; 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.Name = "cbPluginData";
this.cbPluginData.Size = new System.Drawing.Size(81, 17); this.cbPluginData.Size = new System.Drawing.Size(81, 17);
this.cbPluginData.TabIndex = 2; this.cbPluginData.TabIndex = 3;
this.cbPluginData.Text = "Plugin Data"; this.cbPluginData.Text = "Plugin Data";
this.toolTip.SetToolTip(this.cbPluginData, "Data files generated by plugins.\r\nDoes not include the plugins themselves."); this.toolTip.SetToolTip(this.cbPluginData, "Data files generated by plugins.\r\nDoes not include the plugins themselves.");
this.cbPluginData.UseVisualStyleBackColor = true; 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.cbSystemConfig.AutoSize = true;
this.panelExport.Controls.Add(this.cbPluginData); this.cbSystemConfig.Location = new System.Drawing.Point(3, 26);
this.panelExport.Controls.Add(this.cbSession); this.cbSystemConfig.Name = "cbSystemConfig";
this.panelExport.Location = new System.Drawing.Point(12, 12); this.cbSystemConfig.Size = new System.Drawing.Size(99, 17);
this.panelExport.Name = "panelExport"; this.cbSystemConfig.TabIndex = 1;
this.panelExport.Size = new System.Drawing.Size(220, 79); this.cbSystemConfig.Text = "System Options";
this.panelExport.TabIndex = 5; this.toolTip.SetToolTip(this.cbSystemConfig, "Hardware acceleration and cache options.");
this.panelExport.Visible = false; 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 // panelDecision
// //
this.panelDecision.Controls.Add(this.radioReset); this.panelDecision.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.panelDecision.Controls.Add(this.radioExport); | System.Windows.Forms.AnchorStyles.Right)));
this.panelDecision.Controls.Add(this.radioImport); 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.Location = new System.Drawing.Point(12, 12);
this.panelDecision.Name = "panelDecision"; this.panelDecision.Name = "panelDecision";
this.panelDecision.Size = new System.Drawing.Size(220, 79); this.panelDecision.Size = new System.Drawing.Size(220, 71);
this.panelDecision.TabIndex = 6; this.panelDecision.TabIndex = 0;
// this.panelDecision.WrapContents = false;
// 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);
// //
// radioImport // radioImport
// //
@@ -158,25 +156,49 @@
this.radioImport.UseVisualStyleBackColor = true; this.radioImport.UseVisualStyleBackColor = true;
this.radioImport.CheckedChanged += new System.EventHandler(this.radioDecision_CheckedChanged); 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 // DialogSettingsManage
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(244, 132); 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.btnContinue);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
this.Controls.Add(this.panelDecision);
this.Controls.Add(this.panelSelection);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(200, 170); this.MinimumSize = new System.Drawing.Size(260, 170);
this.Name = "DialogSettingsManage"; this.Name = "DialogSettingsManage";
this.ShowIcon = false; this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Manage Options"; this.Text = "Manage Options";
this.panelExport.ResumeLayout(false); this.panelSelection.ResumeLayout(false);
this.panelExport.PerformLayout(); this.panelSelection.PerformLayout();
this.panelDecision.ResumeLayout(false); this.panelDecision.ResumeLayout(false);
this.panelDecision.PerformLayout(); this.panelDecision.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
@@ -188,12 +210,13 @@
private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnContinue; 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 cbSession;
private System.Windows.Forms.CheckBox cbPluginData; private System.Windows.Forms.CheckBox cbPluginData;
private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.Panel panelExport; private System.Windows.Forms.FlowLayoutPanel panelSelection;
private System.Windows.Forms.Panel panelDecision; private System.Windows.Forms.FlowLayoutPanel panelDecision;
private System.Windows.Forms.RadioButton radioReset; private System.Windows.Forms.RadioButton radioReset;
private System.Windows.Forms.RadioButton radioExport; private System.Windows.Forms.RadioButton radioExport;
private System.Windows.Forms.RadioButton radioImport; private System.Windows.Forms.RadioButton radioImport;

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Configuration; using TweetDuck.Configuration;
@@ -16,15 +17,17 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
set{ set{
// this will call events and SetFlag, which also updates the UI // this will call events and SetFlag, which also updates the UI
cbConfig.Checked = value.HasFlag(ProfileManager.Items.UserConfig); foreach(KeyValuePair<CheckBox, ProfileManager.Items> kvp in checkBoxMap){
cbSession.Checked = value.HasFlag(ProfileManager.Items.Session); kvp.Key.Checked = value.HasFlag(kvp.Value);
cbPluginData.Checked = value.HasFlag(ProfileManager.Items.PluginData); }
} }
} }
public bool IsRestarting { get; private set; }
public bool ShouldReloadBrowser { get; private set; } public bool ShouldReloadBrowser { get; private set; }
private readonly PluginManager plugins; private readonly PluginManager plugins;
private readonly Dictionary<CheckBox, ProfileManager.Items> checkBoxMap = new Dictionary<CheckBox, ProfileManager.Items>(4);
private State currentState; private State currentState;
private ProfileManager importManager; private ProfileManager importManager;
@@ -36,22 +39,20 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
this.plugins = plugins; this.plugins = plugins;
this.currentState = State.Deciding; 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){ private void radioDecision_CheckedChanged(object sender, EventArgs e){
btnContinue.Enabled = true; btnContinue.Enabled = true;
} }
private void cbConfig_CheckedChanged(object sender, EventArgs e){ private void checkBoxSelection_CheckedChanged(object sender, EventArgs e){
SetFlag(ProfileManager.Items.UserConfig, cbConfig.Checked); CheckBox cb = (CheckBox)sender;
} SetFlag(checkBoxMap[cb], cb.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 btnContinue_Click(object sender, EventArgs e){ private void btnContinue_Click(object sender, EventArgs e){
@@ -88,9 +89,9 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
Text = "Import Profile"; Text = "Import Profile";
SelectedItems = importManager.FindImportItems(); SelectedItems = importManager.FindImportItems();
cbConfig.Enabled = cbConfig.Checked; foreach(CheckBox cb in checkBoxMap.Keys){
cbSession.Enabled = cbSession.Checked; cb.Enabled = cb.Checked;
cbPluginData.Enabled = cbPluginData.Checked; }
} }
// Export // Export
@@ -99,12 +100,13 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
Text = "Export Profile"; Text = "Export Profile";
btnContinue.Text = "Export Profile"; btnContinue.Text = "Export Profile";
SelectedItems = ProfileManager.Items.All & ~ProfileManager.Items.Session; SelectedItems = ProfileManager.Items.UserConfig | ProfileManager.Items.PluginData;
} }
// Continue... // Continue...
panelDecision.Visible = false; panelDecision.Visible = false;
panelExport.Visible = true; panelSelection.Visible = true;
Height += panelSelection.Height-panelDecision.Height;
break; break;
case State.Reset: case State.Reset:
@@ -131,10 +133,10 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
} }
if (SelectedItems.HasFlag(ProfileManager.Items.Session)){ if (SelectedItems.HasFlag(ProfileManager.Items.Session)){
Program.Restart(Arguments.ArgDeleteCookies); RestartProgram(Arguments.ArgDeleteCookies);
} }
else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){ else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
Program.Restart(); RestartProgram();
} }
else{ else{
ShouldReloadBrowser = true; ShouldReloadBrowser = true;
@@ -152,10 +154,10 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
if (importManager.IsRestarting){ if (importManager.IsRestarting){
if (SelectedItems.HasFlag(ProfileManager.Items.Session)){ if (SelectedItems.HasFlag(ProfileManager.Items.Session)){
Program.Restart(Arguments.ArgImportCookies); RestartProgram(Arguments.ArgImportCookies);
} }
else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){ else if (SelectedItems.HasFlag(ProfileManager.Items.SystemConfig)){
Program.Restart(); RestartProgram();
} }
} }
else{ else{
@@ -212,11 +214,16 @@ namespace TweetDuck.Core.Other.Settings.Dialogs{
btnContinue.Enabled = _selectedItems != ProfileManager.Items.None; btnContinue.Enabled = _selectedItems != ProfileManager.Items.None;
if (currentState == State.Import){ 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){ 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);
}
} }
} }

View File

@@ -9,14 +9,10 @@ using TweetDuck.Core.Handling;
using TweetDuck.Core.Handling.General; using TweetDuck.Core.Handling.General;
using TweetDuck.Core.Notification; using TweetDuck.Core.Notification;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
using TweetDuck.Plugins;
using TweetDuck.Plugins.Enums;
using TweetDuck.Plugins.Events;
using TweetDuck.Resources; using TweetDuck.Resources;
using TweetDuck.Updates;
namespace TweetDuck.Core{ namespace TweetDuck.Core{
sealed class TweetDeckBrowser : IDisposable{ sealed class TweetDeckBrowser : ITweetDeckBrowser, IDisposable{
public bool Ready { get; private set; } public bool Ready { get; private set; }
public bool Enabled{ public bool Enabled{
@@ -33,11 +29,10 @@ namespace TweetDuck.Core{
} }
private readonly ChromiumWebBrowser browser; private readonly ChromiumWebBrowser browser;
private readonly PluginManager plugins;
private string prevSoundNotificationPath = null; private string prevSoundNotificationPath = null;
public TweetDeckBrowser(FormBrowser owner, PluginManager plugins, TweetDeckBridge bridge){ public TweetDeckBrowser(FormBrowser owner, TweetDeckBridge bridge){
this.browser = new ChromiumWebBrowser(TwitterUtils.TweetDeckURL){ this.browser = new ChromiumWebBrowser(TwitterUtils.TweetDeckURL){
DialogHandler = new FileDialogHandler(), DialogHandler = new FileDialogHandler(),
DragHandler = new DragHandlerBrowser(), DragHandler = new DragHandlerBrowser(),
@@ -58,19 +53,16 @@ namespace TweetDuck.Core{
this.browser.LoadError += browser_LoadError; this.browser.LoadError += browser_LoadError;
this.browser.RegisterAsyncJsObject("$TD", bridge); this.browser.RegisterAsyncJsObject("$TD", bridge);
this.browser.RegisterAsyncJsObject("$TDP", plugins.Bridge);
this.browser.BrowserSettings.BackgroundColor = (uint)TwitterUtils.BackgroundColor.ToArgb(); this.browser.BrowserSettings.BackgroundColor = (uint)TwitterUtils.BackgroundColor.ToArgb();
this.browser.Dock = DockStyle.None; this.browser.Dock = DockStyle.None;
this.browser.Location = ControlExtensions.InvisibleLocation; 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); owner.Controls.Add(browser);
this.plugins = plugins;
this.plugins.PluginChangedState += plugins_PluginChangedState;
Program.UserConfig.MuteToggled += UserConfig_MuteToggled; Program.UserConfig.MuteToggled += UserConfig_MuteToggled;
Program.UserConfig.ZoomLevelChanged += UserConfig_ZoomLevelChanged; Program.UserConfig.ZoomLevelChanged += UserConfig_ZoomLevelChanged;
Program.UserConfig.SoundNotificationChanged += UserConfig_SoundNotificationInfoChanged; Program.UserConfig.SoundNotificationChanged += UserConfig_SoundNotificationInfoChanged;
@@ -91,8 +83,6 @@ namespace TweetDuck.Core{
} }
public void Dispose(){ public void Dispose(){
plugins.PluginChangedState -= plugins_PluginChangedState;
Program.UserConfig.MuteToggled -= UserConfig_MuteToggled; Program.UserConfig.MuteToggled -= UserConfig_MuteToggled;
Program.UserConfig.ZoomLevelChanged -= UserConfig_ZoomLevelChanged; Program.UserConfig.ZoomLevelChanged -= UserConfig_ZoomLevelChanged;
Program.UserConfig.SoundNotificationChanged -= UserConfig_SoundNotificationInfoChanged; Program.UserConfig.SoundNotificationChanged -= UserConfig_SoundNotificationInfoChanged;
@@ -100,6 +90,24 @@ namespace TweetDuck.Core{
browser.Dispose(); 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 // event handlers
private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){ private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
@@ -126,24 +134,22 @@ namespace TweetDuck.Core{
} }
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){ private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
if (e.Frame.IsMain && TwitterUtils.IsTweetDeckWebsite(e.Frame)){ IFrame frame = e.Frame;
e.Frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorFix);
if (frame.IsMain && TwitterUtils.IsTweetDeckWebsite(frame)){
frame.ExecuteJavaScriptAsync(TwitterUtils.BackgroundColorOverride);
UpdateProperties(); UpdateProperties();
TweetDeckBridge.RestoreSessionData(e.Frame); TweetDeckBridge.RestoreSessionData(frame);
ScriptLoader.ExecuteFile(e.Frame, "code.js"); ScriptLoader.ExecuteFile(frame, "code.js");
InjectBrowserCSS(); InjectBrowserCSS();
ReinjectCustomCSS(Program.UserConfig.CustomBrowserCSS); ReinjectCustomCSS(Program.UserConfig.CustomBrowserCSS);
UserConfig_SoundNotificationInfoChanged(null, EventArgs.Empty); UserConfig_SoundNotificationInfoChanged(null, EventArgs.Empty);
plugins.ExecutePlugins(e.Frame, PluginEnvironment.Browser);
TweetDeckBridge.ResetStaticProperties(); TweetDeckBridge.ResetStaticProperties();
if (Program.UserConfig.FirstRun){ if (Program.UserConfig.FirstRun){
ScriptLoader.ExecuteFile(e.Frame, "introduction.js"); ScriptLoader.ExecuteFile(frame, "introduction.js");
}
else if (Program.UserConfig.ShowFollowNotification){
ScriptLoader.ExecuteFile(e.Frame, "introduction.follow.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){ private void UserConfig_MuteToggled(object sender, EventArgs e){
UpdateProperties(); UpdateProperties();
} }
@@ -188,10 +190,6 @@ namespace TweetDuck.Core{
// external handling // external handling
public UpdateHandler CreateUpdateHandler(UpdaterSettings settings){
return new UpdateHandler(browser, settings);
}
public void HideVideoOverlay(bool focus){ public void HideVideoOverlay(bool focus){
if (focus){ if (focus){
browser.GetBrowser().GetHost().SendFocusEvent(true); browser.GetBrowser().GetHost().SendFocusEvent(true);

View File

@@ -7,6 +7,7 @@ using System.Net;
using System.Windows.Forms; using System.Windows.Forms;
using CefSharp.WinForms; using CefSharp.WinForms;
using TweetDuck.Core.Other; using TweetDuck.Core.Other;
using TweetDuck.Data;
namespace TweetDuck.Core.Utils{ namespace TweetDuck.Core.Utils{
static class BrowserUtils{ 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"; private const string TwitterTrackingUrl = "t.co";
public enum UrlCheckResult{ public enum UrlCheckResult{

View File

@@ -6,13 +6,16 @@ using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core.Other; using TweetDuck.Core.Other;
using TweetDuck.Data;
namespace TweetDuck.Core.Utils{ namespace TweetDuck.Core.Utils{
static class TwitterUtils{ static class TwitterUtils{
public const string TweetDeckURL = "https://tweetdeck.twitter.com"; public const string TweetDeckURL = "https://tweetdeck.twitter.com";
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153); 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); 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; public static Regex RegexAccount => RegexAccountLazy.Value;

13
Data/ResourceLink.cs Normal file
View 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;
}
}
}

View File

@@ -31,7 +31,7 @@
this.flowLayoutInfo = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutInfo = new System.Windows.Forms.FlowLayoutPanel();
this.labelWebsite = new System.Windows.Forms.Label(); this.labelWebsite = new System.Windows.Forms.Label();
this.labelVersion = 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.labelType = new TweetDuck.Core.Controls.LabelVertical();
this.panelDescription.SuspendLayout(); this.panelDescription.SuspendLayout();
this.flowLayoutInfo.SuspendLayout(); this.flowLayoutInfo.SuspendLayout();
@@ -135,16 +135,16 @@
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight; this.labelVersion.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.labelVersion.UseMnemonic = false; this.labelVersion.UseMnemonic = false;
// //
// btnOpenConfig // btnConfigure
// //
this.btnOpenConfig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnConfigure.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.btnConfigure.Location = new System.Drawing.Point(382, 80);
this.btnOpenConfig.Name = "btnOpenConfig"; this.btnConfigure.Name = "btnConfigure";
this.btnOpenConfig.Size = new System.Drawing.Size(68, 23); this.btnConfigure.Size = new System.Drawing.Size(68, 23);
this.btnOpenConfig.TabIndex = 4; this.btnConfigure.TabIndex = 4;
this.btnOpenConfig.Text = "Configure"; this.btnConfigure.Text = "Configure";
this.btnOpenConfig.UseVisualStyleBackColor = true; this.btnConfigure.UseVisualStyleBackColor = true;
this.btnOpenConfig.Click += new System.EventHandler(this.btnOpenConfig_Click); this.btnConfigure.Click += new System.EventHandler(this.btnConfigure_Click);
// //
// labelType // labelType
// //
@@ -163,7 +163,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.labelType); this.Controls.Add(this.labelType);
this.Controls.Add(this.btnOpenConfig); this.Controls.Add(this.btnConfigure);
this.Controls.Add(this.flowLayoutInfo); this.Controls.Add(this.flowLayoutInfo);
this.Controls.Add(this.panelDescription); this.Controls.Add(this.panelDescription);
this.Controls.Add(this.labelName); this.Controls.Add(this.labelName);
@@ -194,7 +194,7 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutInfo; private System.Windows.Forms.FlowLayoutPanel flowLayoutInfo;
private System.Windows.Forms.Label labelWebsite; private System.Windows.Forms.Label labelWebsite;
private System.Windows.Forms.Label labelVersion; private System.Windows.Forms.Label labelVersion;
private System.Windows.Forms.Button btnOpenConfig; private System.Windows.Forms.Button btnConfigure;
private Core.Controls.LabelVertical labelType; private Core.Controls.LabelVertical labelType;
} }
} }

View File

@@ -1,7 +1,5 @@
using System; using System;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
@@ -57,8 +55,9 @@ namespace TweetDuck.Plugins.Controls{
} }
} }
private void btnOpenConfig_Click(object sender, EventArgs e){ private void btnConfigure_Click(object sender, EventArgs e){
using(Process.Start("explorer.exe", "/select,\""+plugin.ConfigPath.Replace('/', '\\')+"\"")){} pluginManager.ConfigurePlugin(plugin);
ParentForm?.Close();
} }
private void btnToggleState_Click(object sender, EventArgs e){ private void btnToggleState_Click(object sender, EventArgs e){
@@ -87,14 +86,13 @@ namespace TweetDuck.Plugins.Controls{
labelName.ForeColor = textColor; labelName.ForeColor = textColor;
labelDescription.ForeColor = textColor; labelDescription.ForeColor = textColor;
btnToggleState.Text = isEnabled ? "Disable" : "Enable"; btnToggleState.Text = isEnabled ? "Disable" : "Enable";
btnOpenConfig.Visible = plugin.HasConfig; btnConfigure.Visible = isEnabled && pluginManager.IsPluginConfigurable(plugin);
btnOpenConfig.Enabled = btnOpenConfig.Visible && File.Exists(plugin.ConfigPath);
} }
else{ else{
labelName.ForeColor = Color.DarkRed; labelName.ForeColor = Color.DarkRed;
labelDescription.ForeColor = Color.DarkRed; labelDescription.ForeColor = Color.DarkRed;
btnToggleState.Visible = false; btnToggleState.Visible = false;
btnOpenConfig.Visible = false; btnConfigure.Visible = false;
} }
} }
} }

View File

@@ -11,5 +11,13 @@
default: return "unknown/"; default: return "unknown/";
} }
} }
public static string GetIdentifierPrefixShort(this PluginGroup group){
switch(group){
case PluginGroup.Official: return "o/";
case PluginGroup.Custom: return "c/";
default: return "?/";
}
}
} }
} }

View File

@@ -15,14 +15,15 @@ namespace TweetDuck.Plugins{
private readonly PluginManager manager; private readonly PluginManager manager;
private readonly TwoKeyDictionary<int, string, string> fileCache = new TwoKeyDictionary<int, string, string>(4, 2); 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 IEnumerable<InjectedHTML> NotificationInjections => notificationInjections.InnerValues;
public HashSet<Plugin> WithConfigureFunction { get; } = new HashSet<Plugin>();
public PluginBridge(PluginManager manager){ public PluginBridge(PluginManager manager){
this.manager = manager; this.manager = manager;
this.manager.Reloaded += manager_Reloaded; this.manager.Reloaded += manager_Reloaded;
this.manager.PluginChangedState += manager_PluginChangedState; this.manager.Config.PluginChangedState += Config_PluginChangedState;
} }
// Event handlers // Event handlers
@@ -31,7 +32,7 @@ namespace TweetDuck.Plugins{
fileCache.Clear(); fileCache.Clear();
} }
private void manager_PluginChangedState(object sender, PluginChangedStateEventArgs e){ private void Config_PluginChangedState(object sender, PluginChangedStateEventArgs e){
if (!e.IsEnabled){ if (!e.IsEnabled){
int token = manager.GetTokenFromPlugin(e.Plugin); int token = manager.GetTokenFromPlugin(e.Plugin);
@@ -114,5 +115,13 @@ namespace TweetDuck.Plugins{
public void InjectIntoNotificationsAfter(int token, string key, string search, string html){ public void InjectIntoNotificationsAfter(int token, string key, string search, string html){
notificationInjections[token, key] = new InjectedHTML(InjectedHTML.Position.After, search, 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);
}
}
} }
} }

View File

@@ -6,7 +6,7 @@ using TweetDuck.Plugins.Events;
namespace TweetDuck.Plugins{ namespace TweetDuck.Plugins{
sealed class PluginConfig{ 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 IEnumerable<string> DisabledPlugins => disabled;
public bool AnyDisabled => disabled.Count > 0; public bool AnyDisabled => disabled.Count > 0;
@@ -20,7 +20,7 @@ namespace TweetDuck.Plugins{
public void SetEnabled(Plugin plugin, bool enabled){ public void SetEnabled(Plugin plugin, bool enabled){
if ((enabled && disabled.Remove(plugin.Identifier)) || (!enabled && disabled.Add(plugin.Identifier))){ 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));
} }
} }

View File

@@ -1,8 +1,10 @@
using CefSharp; using CefSharp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using TweetDuck.Core;
using TweetDuck.Plugins.Enums; using TweetDuck.Plugins.Enums;
using TweetDuck.Plugins.Events; using TweetDuck.Plugins.Events;
using TweetDuck.Resources; using TweetDuck.Resources;
@@ -24,8 +26,8 @@ namespace TweetDuck.Plugins{
public event EventHandler<PluginErrorEventArgs> Reloaded; public event EventHandler<PluginErrorEventArgs> Reloaded;
public event EventHandler<PluginErrorEventArgs> Executed; public event EventHandler<PluginErrorEventArgs> Executed;
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
private readonly ITweetDeckBrowser browser;
private readonly string rootPath; private readonly string rootPath;
private readonly string configPath; private readonly string configPath;
@@ -33,22 +35,30 @@ namespace TweetDuck.Plugins{
private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>(); private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>();
private readonly Random rand = new Random(); 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.rootPath = rootPath;
this.configPath = configPath; this.configPath = configPath;
this.Config = new PluginConfig(); this.Config = new PluginConfig();
this.Bridge = new PluginBridge(this); this.Bridge = new PluginBridge(this);
this.browser.OnFrameLoaded(OnFrameLoaded);
this.browser.RegisterBridge("$TDP", Bridge);
Config.Load(configPath); Config.Load(configPath);
Config.InternalPluginChangedState += Config_InternalPluginChangedState; Config.PluginChangedState += Config_PluginChangedState;
} }
private void Config_InternalPluginChangedState(object sender, PluginChangedStateEventArgs e){ private void Config_PluginChangedState(object sender, PluginChangedStateEventArgs e){
PluginChangedState?.Invoke(this, e); browser.ExecuteFunction("TDPF_setPluginState", e.Plugin, e.IsEnabled);
Config.Save(configPath); Config.Save(configPath);
} }
private void OnFrameLoaded(IFrame frame){
ExecutePlugins(frame, PluginEnvironment.Browser);
}
public bool IsPluginInstalled(string identifier){ public bool IsPluginInstalled(string identifier){
return plugins.Any(plugin => plugin.Identifier.Equals(identifier)); return plugins.Any(plugin => plugin.Identifier.Equals(identifier));
} }
@@ -57,6 +67,24 @@ namespace TweetDuck.Plugins{
return plugins.Any(plugin => plugin.Environments.HasFlag(environment)); 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){ public int GetTokenFromPlugin(Plugin plugin){
foreach(KeyValuePair<int, Plugin> kvp in tokens){ foreach(KeyValuePair<int, Plugin> kvp in tokens){
if (kvp.Value.Equals(plugin)){ if (kvp.Value.Equals(plugin)){

View File

@@ -20,7 +20,7 @@ namespace TweetDuck{
public const string BrandName = "TweetDuck"; public const string BrandName = "TweetDuck";
public const string Website = "https://tweetduck.chylex.com"; 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"); public static readonly bool IsPortable = File.Exists("makeportable");
@@ -129,7 +129,9 @@ namespace TweetDuck{
} }
BrowserCache.RefreshTimer(); BrowserCache.RefreshTimer();
CefSharpSettings.WcfEnabled = false; CefSharpSettings.WcfEnabled = false;
CefSharpSettings.LegacyJavascriptBindingEnabled = true;
CefSettings settings = new CefSettings{ CefSettings settings = new CefSettings{
UserAgent = BrowserUtils.HeaderUserAgent, UserAgent = BrowserUtils.HeaderUserAgent,

View File

@@ -99,5 +99,15 @@ namespace TweetDuck.Properties {
return ((System.Drawing.Icon)(obj)); 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));
}
}
} }
} }

View File

@@ -130,4 +130,7 @@
<data name="icon_tray_new" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> <value>..\Resources\icon-tray-new.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </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> </root>

View File

@@ -42,6 +42,14 @@ enabled(){
col.model.setHasSound(prevSound); col.model.setHasSound(prevSound);
}, 1); }, 1);
} }
// ========================
// D key - trigger debugger
// ========================
else if (e.keyCode === 68){
debugger;
}
} }
}; };
} }

View File

@@ -8,7 +8,7 @@ Edit layout & design
chylex chylex
[version] [version]
1.2.1 1.2.3
[website] [website]
https://tweetduck.chylex.com https://tweetduck.chylex.com

View File

@@ -126,7 +126,7 @@ enabled(){
let itemEditDesign = $('<li class="is-selectable"><a href="#" data-action>Edit layout &amp; design</a></li>'); let itemEditDesign = $('<li class="is-selectable"><a href="#" data-action>Edit layout &amp; design</a></li>');
itemEditDesign.insertAfter(itemTD); itemEditDesign.insertAfter(itemTD);
itemEditDesign.on("click", "a", this.openEditDesignDialog); itemEditDesign.on("click", "a", this.configure.bind(this));
itemEditDesign.hover(function(){ itemEditDesign.hover(function(){
$(this).addClass("is-selected"); $(this).addClass("is-selected");
@@ -148,7 +148,7 @@ enabled(){
}, 1); // delays the slight lag caused by saving and reinjection }, 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"); let modal = $("#td-design-plugin-modal");
this.setAndShowContainer(modal, false); this.setAndShowContainer(modal, false);
@@ -275,8 +275,6 @@ enabled(){
} }
}); });
this.openEditDesignDialog = () => new customDesignModal();
// animation optimization // animation optimization
this.optimizations = null; this.optimizations = null;
this.optimizationTimer = null; this.optimizationTimer = null;
@@ -433,87 +431,87 @@ enabled(){
if (this.config.revertIcons){ if (this.config.revertIcons){
let iconData = [ let iconData = [
[ ".icon-twitter-bird", "00" ], [ "twitter-bird", "00" ],
[ ".icon-mention", "01" ], [ "mention", "01" ],
[ ".icon-following", "02" ], [ "following", "02" ],
[ ".icon-message", "03" ], [ "message", "03" ],
[ ".icon-home", "04" ], [ "home", "04" ],
[ ".icon-hashtag", "05" ], [ "hashtag", "05" ],
[ ".icon-reply", "06" ], [ "reply", "06" ],
[ ".icon-favorite", "55" ], [ "favorite", "55" ],
[ ".icon-retweet", "08" ], [ "retweet", "08" ],
[ ".icon-drafts", "09" ], [ "drafts", "09" ],
[ ".icon-search", "0a" ], [ "search", "0a" ],
[ ".icon-trash", "0c" ], [ "trash", "0c" ],
[ ".icon-close", "0d" ], [ "close", "0d" ],
[ ".icon-arrow-r:before,.Icon--caretRight", "0e" ], [ "arrow-r:before,.Icon--caretRight", "0e" ],
[ ".icon-arrow-l:before,.Icon--caretLeft", "0f" ], [ "arrow-l:before,.Icon--caretLeft", "0f" ],
[ ".icon-protected", "13" ], [ "protected", "13" ],
[ ".icon-list", "14" ], [ "list", "14" ],
[ ".icon-camera", "15" ], [ "camera", "15" ],
[ ".icon-more", "16" ], [ "more", "16" ],
[ ".icon-settings", "18" ], [ "settings", "18" ],
[ ".icon-notifications", "19" ], [ "notifications", "19" ],
[ ".icon-user-dd", "1a" ], [ "user-dd", "1a" ],
[ ".icon-activity", "1c" ], [ "activity", "1c" ],
[ ".icon-trending", "1d" ], [ "trending", "1d" ],
[ ".icon-minus", "1e" ], [ "minus", "1e" ],
[ ".icon-plus", "1f" ], [ "plus", "1f" ],
[ ".icon-geo", "20" ], [ "geo", "20" ],
[ ".icon-check", "21" ], [ "check", "21" ],
[ ".icon-schedule", "22" ], [ "schedule", "22" ],
[ ".icon-dot", "23" ], [ "dot", "23" ],
[ ".icon-user", "24" ], [ "user", "24" ],
[ ".icon-content", "25" ], [ "content", "25" ],
[ ".icon-arrow-d:before,.Icon--caretDown", "26" ], [ "arrow-d:before,.Icon--caretDown", "26" ],
[ ".icon-arrow-u", "27" ], [ "arrow-u", "27" ],
[ ".icon-share", "28" ], [ "share", "28" ],
[ ".icon-info", "29" ], [ "info", "29" ],
[ ".icon-verified", "2a" ], [ "verified", "2a" ],
[ ".icon-translator", "2b" ], [ "translator", "2b" ],
[ ".icon-blocked", "2c" ], [ "blocked", "2c" ],
[ ".icon-constrain", "2d" ], [ "constrain", "2d" ],
[ ".icon-play-video", "2e" ], [ "play-video", "2e" ],
[ ".icon-empty", "2f" ], [ "empty", "2f" ],
[ ".icon-clear-input", "30" ], [ "clear-input", "30" ],
[ ".icon-compose", "31" ], [ "compose", "31" ],
[ ".icon-mark-read", "32" ], [ "mark-read", "32" ],
[ ".icon-arrow-r-double", "33" ], [ "arrow-r-double", "33" ],
[ ".icon-arrow-l-double", "34" ], [ "arrow-l-double", "34" ],
[ ".icon-follow", "35" ], [ "follow", "35" ],
[ ".icon-image", "36" ], [ "image", "36" ],
[ ".icon-popout", "37" ], [ "popout", "37" ],
[ ".icon-move", "39" ], [ "move", "39" ],
[ ".icon-compose-grid", "3a" ], [ "compose-grid", "3a" ],
[ ".icon-compose-minigrid", "3b" ], [ "compose-minigrid", "3b" ],
[ ".icon-compose-list", "3c" ], [ "compose-list", "3c" ],
[ ".icon-edit", "40" ], [ "edit", "40" ],
[ ".icon-clear-timeline", "41" ], [ "clear-timeline", "41" ],
[ ".icon-sliders", "42" ], [ "sliders", "42" ],
[ ".icon-custom-timeline", "43" ], [ "custom-timeline", "43" ],
[ ".icon-compose-dm", "44" ], [ "compose-dm", "44" ],
[ ".icon-bg-dot", "45" ], [ "bg-dot", "45" ],
[ ".icon-user-team-mgr", "46" ], [ "user-team-mgr", "46" ],
[ ".icon-user-switch", "47" ], [ "user-switch", "47" ],
[ ".icon-conversation", "48" ], [ "conversation", "48" ],
[ ".icon-dataminr", "49" ], [ "dataminr", "49" ],
[ ".icon-link", "4a", ], [ "link", "4a", ],
[ ".icon-flash", "50" ], [ "flash", "50" ],
[ ".icon-pointer-u", "51" ], [ "pointer-u", "51" ],
[ ".icon-analytics", "54" ], [ "analytics", "54" ],
[ ".icon-heart", "55" ], [ "heart", "55" ],
[ ".icon-calendar", "56" ], [ "calendar", "56" ],
[ ".icon-attachment", "57" ], [ "attachment", "57" ],
[ ".icon-play", "58" ], [ "play", "58" ],
[ ".icon-bookmark", "59" ], [ "bookmark", "59" ],
[ ".icon-play-badge", "60" ], [ "play-badge", "60" ],
[ ".icon-gif-badge", "61" ], [ "gif-badge", "61" ],
[ ".icon-poll", "62" ], [ "poll", "62" ],
[ ".icon-heart-filled", "55" ], [ "heart-filled", "55" ],
[ ".icon-retweet-filled", "08" ], [ "retweet-filled", "08" ],
[ ".icon-list-filled", "14" ], [ "list-filled", "14" ],
[ ".icon-user-filled", "35" ], [ "user-filled", "35" ],
]; ];
this.icons = document.createElement("style"); this.icons = document.createElement("style");
@@ -525,9 +523,12 @@ enabled(){
font-style: normal; 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 } .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 } .column-header .column-type-icon { bottom: 26px !important }
.is-options-open .column-type-icon { bottom: 25px !important } .is-options-open .column-type-icon { bottom: 25px !important }
@@ -598,6 +599,8 @@ ${this.config.revertIcons ? `
` : ``} ` : ``}
${this.config.themeOverride === "black" ? ` ${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 } .quoted-tweet { border-color: #292f33 !important }
` : ``} ` : ``}
@@ -645,7 +648,7 @@ ready(){
TD.components.GlobalSettings.prototype.switchTab = function(tab){ TD.components.GlobalSettings.prototype.switchTab = function(tab){
if (tab === "tdp-edit-design"){ if (tab === "tdp-edit-design"){
me.openEditDesignDialog(); me.configure();
} }
else{ else{
return me.prevFuncSettingsSwitchTab.apply(this, arguments); return me.prevFuncSettingsSwitchTab.apply(this, arguments);
@@ -653,6 +656,10 @@ ready(){
}; };
} }
configure(){
new this.customDesignModal();
}
disabled(){ disabled(){
if (this.css){ if (this.css){
this.css.remove(); this.css.remove();

View File

@@ -1,27 +1,30 @@
html.dark{color:#e1e8ed} html.dark{color:#e1e8ed}
html.dark .is-inverted-dark .stream-item{background-color:#fff} 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::selection{background:#e1e8ed;color:#111}
html.dark a{color:#8bd} html.dark a{color:#8bd}
html.dark a:hover,html.dark a:focus,html.dark a:active{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{color:#8899a6}
html.dark .txt-mute a:not(:hover):not(:focus){color:#8899a6} html.dark .txt-mute a:not(:hover):not(:focus){color:#8899a6}
html.dark .txt-mute-text-only{color:#8899a6} html.dark .txt-mute-text-only{color:#8899a6}
html.dark .txt-twitter-darker-gray{color:#657786} html.dark .color-twitter-darker-gray{color:#657786}
html.dark .txt-twitter-gray{color:#AAB8C2} html.dark .color-twitter-white{color:#fff}
html.dark .txt-twitter-emphasis-gray{color:#AAB8C2} html.dark .color-twitter-gray{color:#AAB8C2}
html.dark .txt-twitter-blue{color:#1DA1F2} html.dark .color-twitter-blue{color:#1DA1F2}
html.dark .bg-twitter-blue{background-color:#1DA1F2} html.dark .color-twitter-red{color:#E0245E}
html.dark .txt-twitter-red{color:#E0245E} html.dark .color-twitter-deep-red{color:#A01744}
html.dark .txt-twitter-green{color:#17BF63} html.dark .color-twitter-green{color:#17BF63}
html.dark .txt-twitter-deep-black{color:#14171A} html.dark .color-twitter-deep-green{color:#008951}
html.dark .txt-twitter-dark-black{color:#292F33} html.dark .color-twitter-deep-black{color:#14171A}
html.dark .txt-twitter-dark-gray{color:#8899A6} html.dark .color-twitter-dark-black{color:#292F33}
html.dark .bg-twitter-deep-black{background-color:#292F33} html.dark .color-twitter-dark-gray{color:#8899A6}
html.dark .txt-twitter-black{color:#000} html.dark .color-twitter-black{color:#000}
html.dark .txt-twitter-yellow{color:#FFAD1F} html.dark .color-twitter-yellow{color:#FFAD1F}
html.dark .bg-twitter-lightest-gray{background-color:#F5F8FA} 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 .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-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} 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: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: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: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 .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 .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} 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 .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 .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-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 .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{color:#8899a6}
html.dark .mdl-links a{color:#8899a6} html.dark .mdl-links a{color:#8899a6}
html.dark .mdl-account-shared-warning .mdl-content{background:#fff} 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 .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 .NotificationList .Notification-body{color:#14171A}
html.dark .DrawerModal{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%)}

View File

@@ -157,7 +157,6 @@
thumbSizeClass: "media-size-medium" thumbSizeClass: "media-size-medium"
})); }));
html.css("border", "0");
html.find("footer").last().remove(); // apparently withTweetActions breaks for certain tweets, nice 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 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"; return $(this).text() === "Show this thread";
}).first().each(function(){ }).first().each(function(){
this.id = "tduck-show-thread"; 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(); let type = tweet.getChirpType();
@@ -194,6 +199,9 @@
html.find(".js-user-actions-menu").parent().remove(); html.find(".js-user-actions-menu").parent().remove();
html.find(".account-bio").removeClass("padding-t--5").css("padding-top", "2px"); 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")){ else if (type.includes("list_member")){
html.find(".activity-header").css("margin-top", "2px"); html.find(".activity-header").css("margin-top", "2px");
html.find(".avatar").first().css("margin-bottom", "0"); 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("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(".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(".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.has-source-avatar { margin-bottom: 4px !important }"); // tweak distance between avatar and text
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
tags.push(".activity-header .tweet-timestamp { line-height: unset !important }"); // fix timestamp position in notifications 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 }"); tags.push("#tduck-show-thread { display: inline-block !important; cursor: pointer }");
if (fontSizeName === "smallest"){ if (fontSizeName === "smallest"){

View File

@@ -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);

View File

@@ -12,6 +12,10 @@
height: 328px; height: 328px;
} }
#td-introduction-modal .mdl-inner {
padding-top: 0;
}
#td-introduction-modal .mdl-header-title { #td-introduction-modal .mdl-header-title {
cursor: default; cursor: default;
} }

View File

@@ -35,6 +35,10 @@
install(plugin){ install(plugin){
this.installed.push(plugin); this.installed.push(plugin);
if (typeof plugin.obj.configure === "function"){
$TDP.setConfigurable(plugin.obj.$token);
}
if (!this.isDisabled(plugin)){ if (!this.isDisabled(plugin)){
plugin.obj.enabled(); plugin.obj.enabled();
this.runWhenReady(plugin); this.runWhenReady(plugin);
@@ -93,6 +97,13 @@
window.TD_PLUGINS.setState(window.TD_PLUGINS.findObject(identifier), enable); 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. // Block: Setup a function to reload the page.
// //

View File

@@ -38,7 +38,7 @@
/* Square-ify stuff */ /* 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; border-radius: 1px !important;
} }
@@ -46,7 +46,7 @@
border-radius: 1px !important; 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; border-radius: 0 !important;
} }
@@ -94,23 +94,16 @@
/* Tweak notification layout and design */ /* Tweak notification layout and design */
/****************************************/ /****************************************/
.tweet-context .nbfc { .activity-header.has-source-avatar {
text-overflow: ellipsis !important; margin-bottom: 4px !important
white-space: nowrap !important;
}
.activity-header {
align-items: center !important;
margin-bottom: 4px !important;
} }
.activity-header .tweet-timestamp { .activity-header .tweet-timestamp {
line-height: unset !important; line-height: unset !important;
} }
.account-bio.padding-t--5 { .activity-header .icon-user-filled {
/* follow notification padding */ vertical-align: sub !important;
padding-top: 2px !important;
} }
html[data-td-theme='light'] .stream-item:not(:hover) .js-user-actions-menu { 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; 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 */ /* Tweaks for features */
/***********************/ /***********************/
@@ -209,6 +219,17 @@ html[data-td-font='smallest'] .tweet-detail-wrapper .badge-verified:before {
cursor: pointer; 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 */ /* 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 { .column-type-message.is-shifted-1 .username {
vertical-align: bottom; 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;
}

View File

@@ -38,13 +38,34 @@ body {
vertical-align: -10% !important; 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 */
/*********/ /*********/
.media-size-medium { .media-size-medium {
max-height: 240px; max-height: 240px;
height: calc(100vh - 16px) !important; height: calc(100vh - 20px) !important;
border-radius: 1px !important; border-radius: 1px !important;
} }
@@ -53,6 +74,11 @@ body {
} }
#tduck .js-media, #tduck .js-media-preview-container { #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; margin-bottom: 0 !important;
} }

BIN
Resources/spinner.apng Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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.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.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.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')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -105,6 +107,7 @@
<Compile Include="Core\Handling\RequestHandlerBase.cs" /> <Compile Include="Core\Handling\RequestHandlerBase.cs" />
<Compile Include="Core\Handling\RequestHandlerBrowser.cs" /> <Compile Include="Core\Handling\RequestHandlerBrowser.cs" />
<Compile Include="Core\Handling\ResourceHandlerNotification.cs" /> <Compile Include="Core\Handling\ResourceHandlerNotification.cs" />
<Compile Include="Core\ITweetDeckBrowser.cs" />
<Compile Include="Core\Notification\Example\FormNotificationExample.cs"> <Compile Include="Core\Notification\Example\FormNotificationExample.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -247,6 +250,7 @@
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Core\Notification\Screenshot\TweetScreenshotManager.cs" /> <Compile Include="Core\Notification\Screenshot\TweetScreenshotManager.cs" />
<Compile Include="Data\ResourceLink.cs" />
<Compile Include="Data\Serialization\FileSerializer.cs" /> <Compile Include="Data\Serialization\FileSerializer.cs" />
<Compile Include="Data\InjectedHTML.cs" /> <Compile Include="Data\InjectedHTML.cs" />
<Compile Include="Data\Serialization\ITypeConverter.cs" /> <Compile Include="Data\Serialization\ITypeConverter.cs" />
@@ -354,6 +358,7 @@
<None Include="Resources\icon-tray-new.ico" /> <None Include="Resources\icon-tray-new.ico" />
<None Include="Resources\icon-tray.ico" /> <None Include="Resources\icon-tray.ico" />
<None Include="Resources\PostBuild.ps1" /> <None Include="Resources\PostBuild.ps1" />
<None Include="Resources\spinner.apng" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Resources\Plugins\" /> <Folder Include="Resources\Plugins\" />
@@ -361,7 +366,6 @@
<ItemGroup> <ItemGroup>
<Content Include="Resources\avatar.png" /> <Content Include="Resources\avatar.png" />
<Content Include="Resources\Scripts\code.js" /> <Content Include="Resources\Scripts\code.js" />
<Content Include="Resources\Scripts\introduction.follow.js" />
<Content Include="Resources\Scripts\introduction.js" /> <Content Include="Resources\Scripts\introduction.js" />
<Content Include="Resources\Scripts\notification.js" /> <Content Include="Resources\Scripts\notification.js" />
<Content Include="Resources\Scripts\pages\error.html" /> <Content Include="Resources\Scripts\pages\error.html" />
@@ -434,19 +438,17 @@ powershell -ExecutionPolicy Unrestricted -File "$(ProjectDir)Resources\PostBuild
<PropertyGroup> <PropertyGroup>
<PreBuildEvent>powershell Get-Process TweetDuck.Browser -ErrorAction SilentlyContinue ^| Where-Object {$_.Path -eq '$(TargetDir)TweetDuck.Browser.exe'} ^| Stop-Process; Exit 0</PreBuildEvent> <PreBuildEvent>powershell Get-Process TweetDuck.Browser -ErrorAction SilentlyContinue ^| Where-Object {$_.Path -eq '$(TargetDir)TweetDuck.Browser.exe'} ^| Stop-Process; Exit 0</PreBuildEvent>
</PropertyGroup> </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"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <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> <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> </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.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.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\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.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.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.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.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.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.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.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\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> </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.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.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.64.0.0-CI2497\build\CefSharp.WinForms.targets" Condition="Exists('packages\CefSharp.WinForms.64.0.0-CI2497\build\CefSharp.WinForms.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')" />
</Project> </Project>

View File

@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26430.16 VisualStudioVersion = 15.0.27130.2027
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TweetDuck", "TweetDuck.csproj", "{2389A7CD-E0D3-4706-8294-092929A33A2D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TweetDuck", "TweetDuck.csproj", "{2389A7CD-E0D3-4706-8294-092929A33A2D}"
EndProject EndProject
@@ -20,7 +20,6 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Debug|x86.ActiveCfg = Debug|x86 {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.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.ActiveCfg = Release|x86
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Release|x86.Build.0 = Release|x86 {2389A7CD-E0D3-4706-8294-092929A33A2D}.Release|x86.Build.0 = Release|x86
{B10B0017-819E-4F71-870F-8256B36A26AA}.Debug|x86.ActiveCfg = Debug|x86 {B10B0017-819E-4F71-870F-8256B36A26AA}.Debug|x86.ActiveCfg = Debug|x86
@@ -42,4 +41,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {43936FDB-CBF7-493D-A99A-24B516646584}
EndGlobalSection
EndGlobal EndGlobal

View File

@@ -1,14 +1,14 @@
using CefSharp; using CefSharp;
using CefSharp.WinForms;
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using TweetDuck.Core;
using TweetDuck.Core.Controls; using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
using TweetDuck.Resources; using TweetDuck.Resources;
namespace TweetDuck.Updates{ namespace TweetDuck.Updates{
sealed class UpdateHandler{ sealed class UpdateHandler{
private readonly ChromiumWebBrowser browser; private readonly ITweetDeckBrowser browser;
private readonly UpdaterSettings settings; private readonly UpdaterSettings settings;
public event EventHandler<UpdateEventArgs> UpdateAccepted; public event EventHandler<UpdateEventArgs> UpdateAccepted;
@@ -18,20 +18,18 @@ namespace TweetDuck.Updates{
private int lastEventId; private int lastEventId;
private UpdateInfo lastUpdateInfo; private UpdateInfo lastUpdateInfo;
public UpdateHandler(ChromiumWebBrowser browser, UpdaterSettings settings){ public UpdateHandler(ITweetDeckBrowser browser, UpdaterSettings settings){
this.browser = browser; this.browser = browser;
this.settings = settings; this.settings = settings;
browser.FrameLoadEnd += browser_FrameLoadEnd; browser.OnFrameLoaded(OnFrameLoaded);
browser.RegisterAsyncJsObject("$TDU", new Bridge(this)); browser.RegisterBridge("$TDU", new Bridge(this));
} }
private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){ private void OnFrameLoaded(IFrame frame){
if (e.Frame.IsMain && TwitterUtils.IsTweetDeckWebsite(e.Frame)){ ScriptLoader.ExecuteFile(frame, "update.js");
ScriptLoader.ExecuteFile(e.Frame, "update.js");
Check(false); Check(false);
} }
}
public int Check(bool force){ public int Check(bool force){
if (Program.UserConfig.EnableUpdateCheck || force){ if (Program.UserConfig.EnableUpdateCheck || force){
@@ -39,7 +37,7 @@ namespace TweetDuck.Updates{
settings.DismissedUpdate = null; 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; return lastEventId;
} }

Binary file not shown.

View File

@@ -60,6 +60,7 @@ Type: filesandordirs; Name: "{localappdata}\{#MyAppName}\GPUCache"
[InstallDelete] [InstallDelete]
Type: files; Name: "{app}\TweetLib.Audio.dll" Type: files; Name: "{app}\TweetLib.Audio.dll"
Type: filesandordirs; Name: "{app}\scripts"
Type: filesandordirs; Name: "{app}\plugins\official" Type: filesandordirs; Name: "{app}\plugins\official"
Type: files; Name: "{app}\locales\am.pak" Type: files; Name: "{app}\locales\am.pak"
Type: files; Name: "{app}\locales\ar.pak" Type: files; Name: "{app}\locales\ar.pak"

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="cef.redist.x64" version="3.3239.1716" targetFramework="net452" xmlns="" /> <package id="cef.redist.x64" version="3.3282.1731" targetFramework="net452" xmlns="" />
<package id="cef.redist.x86" version="3.3239.1716" targetFramework="net452" xmlns="" /> <package id="cef.redist.x86" version="3.3282.1731" targetFramework="net452" xmlns="" />
<package id="CefSharp.Common" version="63.0.0-pre01" targetFramework="net452" xmlns="" /> <package id="CefSharp.Common" version="64.0.0-CI2497" targetFramework="net452" xmlns="" />
<package id="CefSharp.WinForms" version="63.0.0-pre01" 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="" /> <package id="Microsoft.VC120.CRT.JetBrains" version="12.0.21005.2" targetFramework="net452" xmlns="" />
</packages> </packages>

View File

@@ -3,7 +3,7 @@ using CefSharp.BrowserSubprocess;
namespace TweetDuck.Browser{ namespace TweetDuck.Browser{
static class Program{ 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){ private static int Main(string[] args){
SubProcess.EnableHighDPISupport(); SubProcess.EnableHighDPISupport();

View File

@@ -26,7 +26,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="CefSharp.BrowserSubprocess.Core, Version=63.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=x86"> <Reference Include="CefSharp.BrowserSubprocess.Core, Version=63.0.0.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion> <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>
<Reference Include="System" /> <Reference Include="System" />
</ItemGroup> </ItemGroup>