mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-22 00:15:48 +02:00
Add a notification and way to follow the new TweetDuck account
This commit is contained in:
parent
29d999b8eb
commit
421475ec87
@ -39,6 +39,7 @@ static UserConfig(){
|
|||||||
|
|
||||||
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();
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
using TweetDuck.Core.Notification.Screenshot;
|
using TweetDuck.Core.Notification.Screenshot;
|
||||||
using TweetDuck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
using TweetDuck.Core.Other.Analytics;
|
using TweetDuck.Core.Other.Analytics;
|
||||||
using TweetDuck.Core.Other.Settings;
|
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDuck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDuck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
@ -321,6 +320,7 @@ public void TriggerAnalyticsEvent(AnalyticsFile.Event e){
|
|||||||
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,6 +328,10 @@ public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){
|
|||||||
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();
|
||||||
|
@ -142,6 +142,9 @@ private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
|||||||
if (Program.UserConfig.FirstRun){
|
if (Program.UserConfig.FirstRun){
|
||||||
ScriptLoader.ExecuteFile(e.Frame, "introduction.js");
|
ScriptLoader.ExecuteFile(e.Frame, "introduction.js");
|
||||||
}
|
}
|
||||||
|
else if (Program.UserConfig.ShowFollowNotification){
|
||||||
|
ScriptLoader.ExecuteFile(e.Frame, "introduction.follow.js");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
91
Resources/Scripts/introduction.follow.js
Normal file
91
Resources/Scripts/introduction.follow.js
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
(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);
|
@ -113,7 +113,7 @@
|
|||||||
$(document).trigger("uiShowFollowFromOptions", { userToFollow: user });
|
$(document).trigger("uiShowFollowFromOptions", { userToFollow: user });
|
||||||
|
|
||||||
$(".js-modals-container").find("header a[rel='user']").each(function(){
|
$(".js-modals-container").find("header a[rel='user']").each(function(){
|
||||||
this.outerHTML = this.innerText;
|
this.outerHTML = "TweetDuck";
|
||||||
});
|
});
|
||||||
}, () => {
|
}, () => {
|
||||||
alert("An error occurred when retrieving the account information.");
|
alert("An error occurred when retrieving the account information.");
|
||||||
|
@ -361,6 +361,7 @@
|
|||||||
<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" />
|
||||||
|
Loading…
Reference in New Issue
Block a user