1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-21 06:15:47 +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; return false;
} }
public void ShowTweetDetail(string columnKey, string chirpId){ public void ShowTweetDetail(string columnKey, string chirpId, string fallbackUrl){
Activate(); Activate();
using(IFrame frame = browser.GetBrowser().MainFrame){ using(IFrame frame = browser.GetBrowser().MainFrame){
@ -554,7 +554,7 @@ public void ShowTweetDetail(string columnKey, string chirpId){
} }
notification.FinishCurrentNotification(); 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){ public void OnTweetScreenshotReady(string html, int width, int height){

View File

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

View File

@ -221,11 +221,14 @@
$(document).trigger("uiGridClearSelection"); $(document).trigger("uiGridClearSelection");
}; };
window.TDGF_showTweetDetail = function(columnKey, chirpId){ window.TDGF_showTweetDetail = function(columnKey, chirpId, fallbackUrl){
let column = TD.controller.columnManager.get(columnKey); let column = TD.controller.columnManager.get(columnKey); // TODO replace columnKey with something that stays after a reload
if (!column){ 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; return;
} }
@ -238,7 +241,9 @@
TD.controller.clients.getPreferredClient().show(chirpId, function(chirp){ TD.controller.clients.getPreferredClient().show(chirpId, function(chirp){
showTweetDetailInternal(column, chirp); showTweetDetailInternal(column, chirp);
}, function(){ }, 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);
}
}); });
} }
}; };