1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-21 15:15:48 +02:00

'View detail' errors now ask user if they want to open the tweet in a browser

This commit is contained in:
chylex 2017-08-28 19:55:10 +02:00
parent 83c962a7a4
commit d5c3ea0862
3 changed files with 12 additions and 7 deletions
Core
Resources/Scripts

View File

@ -543,7 +543,7 @@ public bool ProcessBrowserKey(Keys key){
return false;
}
public void ShowTweetDetail(string columnKey, string chirpId){
public void ShowTweetDetail(string columnKey, string chirpId, string fallbackUrl){
Activate();
using(IFrame frame = browser.GetBrowser().MainFrame){
@ -554,7 +554,7 @@ public void ShowTweetDetail(string columnKey, string chirpId){
}
notification.FinishCurrentNotification();
browser.ExecuteScriptAsync("window.TDGF_showTweetDetail", columnKey, chirpId);
browser.ExecuteScriptAsync("window.TDGF_showTweetDetail", columnKey, chirpId, fallbackUrl);
}
public void OnTweetScreenshotReady(string html, int width, int height){

View File

@ -197,7 +197,7 @@ protected virtual void UpdateTitle(){
}
public void ShowTweetDetail(){
owner.ShowTweetDetail(currentNotification.ColumnKey, currentNotification.ChirpId);
owner.ShowTweetDetail(currentNotification.ColumnKey, currentNotification.ChirpId, currentNotification.TweetUrl);
}
public void MoveToVisibleLocation(){

View File

@ -221,11 +221,14 @@
$(document).trigger("uiGridClearSelection");
};
window.TDGF_showTweetDetail = function(columnKey, chirpId){
let column = TD.controller.columnManager.get(columnKey);
window.TDGF_showTweetDetail = function(columnKey, chirpId, fallbackUrl){
let column = TD.controller.columnManager.get(columnKey); // TODO replace columnKey with something that stays after a reload
if (!column){
$TD.alert("error", "The column which contained the tweet no longer exists.");
if (confirm("error|The column which contained the tweet no longer exists. Would you like to open the tweet in your browser instead?")){
$TD.openBrowser(fallbackUrl);
}
return;
}
@ -238,7 +241,9 @@
TD.controller.clients.getPreferredClient().show(chirpId, function(chirp){
showTweetDetailInternal(column, chirp);
}, function(){
$TD.alert("error", "Could not retrieve the requested tweet.");
if (confirm("error|Could not retrieve the requested tweet. Would you like to open the tweet in your browser instead?")){
$TD.openBrowser(fallbackUrl);
}
});
}
};