And again a clone of the Telegram desktop client

It would seem that there are so many of them already, why one more? But a coincidence of many things happened – I had free time, a desire to do something, dissatisfaction with the work of the official client and an unwillingness to study existing alternative versions and the list of their differences. As a result, I implemented my own Luna Park, with the features I needed. More details under the cut.


A Minute of Philosophy

I understand perfectly well that it is impossible to please everyone. And, when developing a mass software product, you can constantly add and complicate the settings that determine its operation. But this is an extensive path, by and large. Someone wants a dark theme, someone a choice of notification sounds, someone custom emoji and animations… And I suspect that such decisions are not made just like that based on the mood of the manager when he gets up in the morning, but a focus group of representative users of the product is recruited, their priorities are found out, then the time and financial costs of implementation are analyzed, etc. And as a result, the product is overgrown with new features and settings, gradually turning into a clumsy, difficult to support monster.

I never needed 90% of Telegram's bells and whistles and features. Moreover, I frankly don't like the presence and inability to disable some of them. But no one asked me, I'm not a member of the focus group. On the other hand, I'm not satisfied with the app's operation in certain moments, but again, no one is in a hurry to implement my wishes. And here it's time to remember the words of the great breeder Ivan Michurin: “If the mountain does not go to Mohammed…” no, it seemed to be different for him, but the essence is the same: “We cannot expect favors from nature. Taking them from her is our task.” And this decision is made by many users, as far as I can judge from the abundance of custom clients for this API. So I decided to join their ranks.

Get to the point

One of my complaints about Telegram is that we understand the term “blocked user” differently. I would like that if I block a user, then I would not receive notifications about his actions (I know that there is a separate checkbox “Disable notifications”), so that pictures with new mentions and reactions from him would not appear, so that new stories would not appear (! ) from him (I know that you can delete from your contact list or hide stories personally), so that messages from him are not visible in all chats and groups (with the ability to view if desired), so that…. In short, so that his full and absolute absence in nature.

Telegram even goes to meet me halfway in terms of my wishes – for example, if a blocked user mentions me in a group or chat, the client will not show that a new mention has appeared. I suspect because the server (!) will not send the MentionMe flag in the set of flags for this message. Do you think that a blocked user now has no way to mention me? It turns out that there is – if he quotes or replies to my messages, the mentions will be shown perfectly by the client. I think that this is a bug on the server side, but who am I to give such assessments 🙂 The focus group participants are apparently satisfied with this logic of the application, or they consider it not as important as, for example, the animation of reactions. Here I recall the words of the great poet Vladimir Mayakovsky (as translated by De Morgan): “If the stars do not light up in the sky, then no one needs it!”

Technical details and difficulties encountered

In general, I decided to modify the existing client to suit my needs. I started with the desktop one, and I plan to add a mobile one. Fortunately, the product is open source, the license allows it, the API is open, and the documentation is available. And I ran into some difficulties – the existing API does not provide for my wishes. This was predictable, but it did not scare me – I decided that I would do the maximum I could within these insurmountable limitations. For example, when the application starts (as well as during other events, but this is not important), a request is made to the API for some summaries of the user's groups and channels, to demonstrate the presence/absence of mentions in the channel, new reactions, the number of new messages, etc. Of course, the server does not want to think about which mentions were from blocked users and which were not. The same applies to messages with reactions. As a result, I am forced to request details of all unread mentions and reactions in the background, analyze them from authors, and all just to make a binary decision – to show or not an icon with the presence of mentions in the group. With reactions, the situation is even more complicated – in addition to the list of messages with unread reactions, I also request details of all unread reactions for each message in terms of reactors (who reacted) in order to decide whether there are unread reactions to this message from unblocked users or not. Fortunately, the corresponding methods are present in the API, and this is good. But if the server was consistent, and did not consider as mentions from blocked users not only the writing of my nickname in the text, but also replies and quotes from my messages, life would be a little easier)

In online mode, problems similar to those described above arise – for example, when there is an event from the server “new reactions have appeared,” their authors also need to be in detail requested and checked. And in certain cases, send notifications to the server that the content of the message has been read, otherwise the server will naively believe that we need to be reminded all the time that we have important unread messages, and carefully do this at every opportunity.

There were also purely client-side issues: for example, grouping “bubbles” of individual messages from one user into packs, where the avatar and the elongated nose of the bubble are shown only at the very bottom message in the pack, and large radii of curvature are at the very top, creating the illusion of one common multi-bubble of the entire pack. Or, for example, a rigid orientation to a strictly defined height of message previews in the search results list – to the point that the Repaint method determines the area of ​​its redrawing exclusively by the message number in the list, calculating the offset as the number (the number of elements above it) multiplied by the strictly defined height of each widget, which does not make the task of skipping and hiding messages from blocked users from search results any easier. But at least the problem here is not in the API, which means it can be solved in principle.

But I believe that to a large extent I was able to realize my ideas and wishes, even within the framework of such restrictions. At some points I had to make compromises, but the work is not finished, maybe I can implement it better.

A separate issue was with the assembly of the release binary. I'm on Ubuntu, and oddly enough, this added problems and non-obvious moments during assembly. Of course, no one will be allowed to compile production builds of official releases on their knees, and the scripts and scenarios of katom builds in the project are not updated and updated every time, because they are obviously not used by the developers of Telegram itself. To top it off, instructions for assembling even a custom release binary are simply not included in the documentation of the official client, there is only a version for debugging. As a result, I had to ask some points from the gurus, which, to their credit, helped.

Happy (hopefully not) ending

As a result, I currently have a working alpha version of the pre-release of my custom client, which I called Kilogram. There were no code examples in the article, but they are abundantly presented in the project repository on Github: https://github.com/Ivana-/kilogram-desktop

It briefly lists the changes in the interface and features implemented to date.

For those who just need to criticize the code, the repository is enough.
If you want to build your own version, the readme says how.
Who should download and try – there is a ready-made binary for Ubuntu on the Releases tab. I didn’t add any viruses or Trojans, I didn’t drag any libs into the project, and knocking on Major and Colonel will be no more than an official Telegram client. But if your computer explodes or they come for you, then I have nothing to do with it)

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *