mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-18 06:15:49 +02:00
Rewrite browser reload to save column notification state in session data
This commit is contained in:
parent
abbdde851e
commit
65b7167b5f
@ -328,7 +328,7 @@ private void trayIcon_ClickClose(object sender, EventArgs e){
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void plugins_Reloaded(object sender, PluginErrorEventArgs e){
|
private void plugins_Reloaded(object sender, PluginErrorEventArgs e){
|
||||||
browser.GetBrowser().Reload();
|
ReloadToTweetDeck();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||||
@ -429,7 +429,7 @@ public void UpdateProperties(PropertyBridge.Environment environment){
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadToTweetDeck(){
|
public void ReloadToTweetDeck(){
|
||||||
browser.ExecuteScriptAsync($"gc&&gc();window.location.href='{TwitterUtils.TweetDeckURL}'");
|
browser.ExecuteScriptAsync($"if(window.TDGF_reload)window.TDGF_reload();else window.location.href='{TwitterUtils.TweetDeckURL}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// callback handlers
|
// callback handlers
|
||||||
|
@ -854,8 +854,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Memory cleanup check and execution.
|
// Block: Custom reload function with memory cleanup.
|
||||||
//
|
//
|
||||||
|
window.TDGF_reload = function(){
|
||||||
|
let session = TD.storage.feedController.getAll()
|
||||||
|
.filter(feed => !!feed.getTopSortIndex())
|
||||||
|
.reduce((obj, feed) => (obj[feed.privateState.key] = feed.getTopSortIndex(), obj), {});
|
||||||
|
|
||||||
|
$TD.setSessionData("gc", JSON.stringify(session)).then(() => {
|
||||||
|
window.gc && window.gc();
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
window.TDGF_tryRunCleanup = function(){
|
window.TDGF_tryRunCleanup = function(){
|
||||||
// all textareas are empty
|
// all textareas are empty
|
||||||
if ($("textarea").is(function(){
|
if ($("textarea").is(function(){
|
||||||
@ -882,8 +893,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
window.gc && window.gc();
|
window.TDGF_reload();
|
||||||
window.location.reload();
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
//
|
//
|
||||||
window.TDPF_requestReload = function(){
|
window.TDPF_requestReload = function(){
|
||||||
if (!isReloading){
|
if (!isReloading){
|
||||||
window.setTimeout(() => location.reload(), 1);
|
window.setTimeout(window.TDGF_reload, 1);
|
||||||
isReloading = true;
|
isReloading = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user