plugins-legacy icon indicating copy to clipboard operation
plugins-legacy copied to clipboard

improved hangouts plugin

Open jantman opened this issue 8 years ago • 14 comments

There doesn't seem to be a way to modify or suggest improvements to the built-in plugins... I assume they're licensed under some proprietary license, but I can't find ANYTHING clearly explaining what license Franz is released under.

This adds a "hangouts-ng" plugin with the following improvements:

  1. it actually updates unread messages count for the badge correctly
  2. may be controversial, but it adds Web Notifications popups for new messages

jantman avatar Dec 17 '16 15:12 jantman

The unread message count badge isn't working here for me (or in the default plugin); possibly Google changed something?

Edit: Actually, I see the notifications popping up for new messages, so your plugin is finding them, but the badge doesn't appear in Franz for some reason

mrozekma avatar Jan 25 '17 21:01 mrozekma

Hmm... the badge is currently working for me... does it update if you get a message when the Franz tab for this plugin isn't focused, but the conversation was left open?

The code for this is pretty hack-ish... it appears that Hangouts has minified everything including the DOM element class and ID strings, and from what I can tell they're not consistent across sessions... so there's some hackery going on to find the right elements...

jantman avatar Jan 25 '17 21:01 jantman

Hmm. It's working when I try to message myself from a second Google account, so not sure what the problem was before. Ironically it's now pretty hard to get rid of the badge, even after I've clicked on the chat window and it's not lit up anymore. But that seems to be Hangouts' fault, I turned on some of the console debugging and I can see the label still saying "1 unread message" long after I've read it, I have to close the chat window and reopen it to make it stop. I might look into it more later to see why that's happening, but your plugin looks right in any case; thanks for the help

mrozekma avatar Jan 25 '17 22:01 mrozekma

Tested on my computer, working fantastically! Thank you!!

yingbo avatar Feb 10 '17 13:02 yingbo

So, the plugin doesn't work for me either. At least not for a Google App account (seems to work on private one though). If I copy / paste the function into the normal Hangouts window, that's the line failing: https://github.com/meetfranz/plugins/pull/111/files#diff-56494438da2bd82c2a1d571d61422d5fR42 ... Particularly, this convo.querySelectorAll('[hovercard-email]') is simply undefined and childNodes then throws an error...

Either way, I hadn't time to investigate more, but if I comment the whole if block (line 40), it works. I don't get the notification anymore, but I still get the counter displayed in Franz, and that's for me the most important.

0cv avatar May 03 '17 10:05 0cv

I'm not sure what's causing that... I have a Google App account (originally a legacy Google For Domains account, opened ~6 years ago) and it works fine for me. That's sort of strange...

If I open hangouts.google.com in Chrome (regular Google Chrome) and use "Inspect" to view the DOM, and then hover over one of my left menu contacts/conversations, the containing div has a hovercard-email attribute on it. Maybe this is because the people are all Google/GMail contacts of mine?

I've attached an anonymized screenshot to illustrate... hangouts_plugin

jantman avatar May 03 '17 11:05 jantman

Right, so similar screenshot from my side: image

I just don't have this hovercard-email attribute

0cv avatar May 03 '17 11:05 0cv

Hmm... that's a bit troublesome. Are any of those other attributes, maybe cpar or cid, unique to only conversation elements? I was just using hovercard-email because it seemed like the easiest attribute that was on all of my contacts, and only my contacts...

jantman avatar May 03 '17 11:05 jantman

cid seems to be unique, as well as id (the attribute on the parent). cpar is, it seems, the concatenation of the UserIds participating in the conversation. I would bet that it's therefore not always unique (e.g. 2 groups with the same participants might have the same cpar... just a guess though)

0cv avatar May 03 '17 14:05 0cv

So I can guarantee that id isn't unique to just conversations. The issue is I needed to find an attribute that was only present on those conversation divs, i.e. a way to find the ones that display the message count. I'll take a peek at cid and cpar... I'd hope that at least one of them is only present on those divs.

jantman avatar May 03 '17 15:05 jantman

do you mean, that's possible to have a duplicate id in a conversation? Or instead, that the same id can be found somewhere else on the page, but not as a direct child of the Conversations? If that's the latter, that may not be a problem, isn't it?

0cv avatar May 03 '17 15:05 0cv

No, I'm saying that the attribute itself, not the value, must be unique. The current code based on the hovercard-email attribute is based on the assumption (which is true for me, but apparently not everyone) that every conversation div has the hovercard-email attribute, and that only conversation divs have that attribute. Since the css used in the Hangouts UI is minified and uses meaningless class names that randomly change (i.e. div class="Klz5ue Bb xZYdOe f0 ko CN Bm b3KmC XP"), we need to find some way of identifying which divs are conversations. If hovercard-email doesn't work, we need something else to use to determine which elements on the page are conversations.

I'm certainly open to suggestions here...

jantman avatar May 03 '17 15:05 jantman

Hello, I'd like to try this plugin, but I'm not sure how to download and implement this plugin? Anyone that can help me out?

Casyi avatar Jun 13 '17 14:06 Casyi

@Casyi basic installation instructions are in the README for this repository. The source code for this pull request can be found at: https://github.com/jantman/franz-plugins/tree/hangouts-ng/hangouts-ng

jantman avatar Jun 13 '17 14:06 jantman