Merged like/unlike action for windows 10 users in invisible interface

This commit is contained in:
Manuel Cortez 2018-01-10 09:23:20 -06:00
parent 51c5820719
commit 0bbbb3f1b6
2 changed files with 14 additions and 3 deletions

View File

@ -157,7 +157,7 @@ class Controller(object):
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.post_reply, self.view.reply)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.post_retweet, self.view.retweet)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.add_to_favourites, self.view.fav)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.remove_from_favourites, self.view.unfav)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.remove_from_favourites, self.view.fav)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.view_item, self.view.view)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.reverse_geocode, menuitem=self.view.view_coordinates)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.delete, self.view.delete)
@ -782,6 +782,18 @@ class Controller(object):
id = buffer.get_tweet()["id"]
call_threaded(buffer.session.api_call, call_name="destroy_favorite", id=id)
def toggle_like(self, *args, **kwargs):
buffer = self.get_current_buffer()
if buffer.type == "dm" or buffer.type == "people" or buffer.type == "events":
return
else:
id = buffer.get_tweet()["id"]
tweet = buffer.session.twitter.twitter.show_status(id=id, include_ext_alt_text=True, tweet_mode="extended")
if tweet["favorited"] == False:
call_threaded(buffer.session.api_call, call_name="create_favorite", _sound="favourite.ogg", id=id)
else:
call_threaded(buffer.session.api_call, call_name="destroy_favorite", id=id)
def view_item(self, *args, **kwargs):
buffer = self.get_current_buffer()
if buffer.type == "baseBuffer" or buffer.type == "favourites_timeline" or buffer.type == "list" or buffer.type == "search":

View File

@ -16,8 +16,7 @@ post_tweet = string(default="alt+win+n")
post_reply = string(default="control+win+r")
post_retweet = string(default="alt+win+shift+r")
send_dm = string(default="alt+win+shift+d")
add_to_favourites = string(default="control+alt+win+f")
remove_from_favourites = string(default="alt+shift+win+f")
toggle_like = string(default="control+alt+win+f")
follow = string(default="alt+win+shift+s")
user_details = string(default="alt+win+shift+n")
view_item = string(default="alt+win+v")