1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-30 14:34:09 +02:00

Add a quick way to import profile from the login page

Closes 
This commit is contained in:
chylex 2018-07-06 07:03:39 +02:00
parent 4e52102c5c
commit fa407e150b
5 changed files with 42 additions and 3 deletions
Core
Resources/Scripts

View File

@ -50,6 +50,10 @@ public Browser(FormBrowser form, FormNotificationMain notification) : base(form,
public void OpenContextMenu(){ public void OpenContextMenu(){
form.InvokeAsyncSafe(form.OpenContextMenu); form.InvokeAsyncSafe(form.OpenContextMenu);
} }
public void OpenProfileImport(){
form.InvokeAsyncSafe(form.OpenProfileImport);
}
public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){ public void OnIntroductionClosed(bool showGuide, bool allowDataCollection){
form.InvokeAsyncSafe(() => { form.InvokeAsyncSafe(() => {

View File

@ -5,11 +5,13 @@
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.Handling.General;
using TweetDuck.Core.Management; using TweetDuck.Core.Management;
using TweetDuck.Core.Notification; using TweetDuck.Core.Notification;
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.Dialogs;
using TweetDuck.Core.Utils; using TweetDuck.Core.Utils;
using TweetDuck.Plugins; using TweetDuck.Plugins;
using TweetDuck.Plugins.Enums; using TweetDuck.Plugins.Enums;
@ -435,13 +437,13 @@ public void OpenContextMenu(){
public void OpenSettings(){ public void OpenSettings(){
OpenSettings(null); OpenSettings(null);
} }
public void OpenSettings(Type startTab){ public void OpenSettings(Type startTab){
if (!FormManager.TryBringToFront<FormSettings>()){ if (!FormManager.TryBringToFront<FormSettings>()){
bool prevEnableUpdateCheck = Config.EnableUpdateCheck; bool prevEnableUpdateCheck = Config.EnableUpdateCheck;
FormSettings form = new FormSettings(this, plugins, updates, analytics, startTab); FormSettings form = new FormSettings(this, plugins, updates, analytics, startTab);
form.FormClosed += (sender, args) => { form.FormClosed += (sender, args) => {
if (!prevEnableUpdateCheck && Config.EnableUpdateCheck){ if (!prevEnableUpdateCheck && Config.EnableUpdateCheck){
Config.DismissedUpdate = null; Config.DismissedUpdate = null;
@ -497,6 +499,18 @@ public void OpenPlugins(){
} }
} }
public void OpenProfileImport(){
FormManager.TryFind<FormSettings>()?.Close();
using(DialogSettingsManage dialog = new DialogSettingsManage(plugins, true)){
if (dialog.ShowDialog() == DialogResult.OK && !dialog.IsRestarting){
BrowserProcessHandler.UpdatePrefs();
FormManager.TryFind<FormPlugins>()?.Close();
plugins.Reload(); // also reloads the browser
}
}
}
public void OnTweetNotification(){ // may be called multiple times, once for each type of notification public void OnTweetNotification(){ // may be called multiple times, once for each type of notification
if (Config.EnableTrayHighlight && !ContainsFocus){ if (Config.EnableTrayHighlight && !ContainsFocus){
trayIcon.HasNotifications = true; trayIcon.HasNotifications = true;

View File

@ -34,7 +34,7 @@ private ProfileManager.Items SelectedItems{
private ProfileManager.Items _selectedItems = ProfileManager.Items.None; private ProfileManager.Items _selectedItems = ProfileManager.Items.None;
public DialogSettingsManage(PluginManager plugins){ public DialogSettingsManage(PluginManager plugins, bool openImportImmediately = false){
InitializeComponent(); InitializeComponent();
this.plugins = plugins; this.plugins = plugins;
@ -44,6 +44,11 @@ public DialogSettingsManage(PluginManager plugins){
this.checkBoxMap[cbSystemConfig] = ProfileManager.Items.SystemConfig; this.checkBoxMap[cbSystemConfig] = ProfileManager.Items.SystemConfig;
this.checkBoxMap[cbSession] = ProfileManager.Items.Session; this.checkBoxMap[cbSession] = ProfileManager.Items.Session;
this.checkBoxMap[cbPluginData] = ProfileManager.Items.PluginData; this.checkBoxMap[cbPluginData] = ProfileManager.Items.PluginData;
if (openImportImmediately){
radioImport.Checked = true;
btnContinue_Click(null, EventArgs.Empty);
}
} }
private void radioDecision_CheckedChanged(object sender, EventArgs e){ private void radioDecision_CheckedChanged(object sender, EventArgs e){

View File

@ -59,3 +59,9 @@ button[type='submit'] {
border: 1px solid rgba(0, 0, 0, 0.3) !important; border: 1px solid rgba(0, 0, 0, 0.3) !important;
border-radius: 0 !important; border-radius: 0 !important;
} }
.tweetduck-helper {
/* custom login text */
margin-top: 15px !important;
font-weight: bold !important;
}

View File

@ -39,6 +39,16 @@
for(let index = 0; index < links.length; index++){ for(let index = 0; index < links.length; index++){
links[index].addEventListener("click", openLinkExternally); links[index].addEventListener("click", openLinkExternally);
} }
let texts = document.querySelector(".page-canvas > div:last-child");
if (texts){
texts.insertAdjacentHTML("beforeend", `<p class="tweetduck-helper">Used the TweetDuck app before? <a href="#">Import your profile »</a></p>`);
texts.querySelector(".tweetduck-helper > a").addEventListener("click", function(){
$TD.openProfileImport();
});
}
}); });
} }
// //