ubports / telegram-app

Unofficial Telegram App for Ubuntu Desktop & Mobile
GNU General Public License v3.0
55 stars 23 forks source link

Refactor telegram-app: remove protocol-specific magic numbers from qml files #101

Closed Flohack74 closed 6 years ago

Flohack74 commented 6 years ago

Example from MessageReplyItem.qml:

    property real typeMessageMediaEmpty: 0x3ded6320
    property real typeMessageMediaPhoto: 0x3d8ce53d
    property real typeMessageMediaVideo: 0x5bcf1675
    property real typeMessageMediaGeo: 0x56e0d474
    property real typeMessageMediaContact: 0x5e7d2f39
    property real typeMessageMediaUnsupported: 0x9f84f49e
    property real typeMessageMediaDocument: 0x2fda2204
    property real typeMessageMediaAudio: 0xc6b68300

These properties encode values that can change with each API layer update by Telegram. This is a leaky abstraction, and needs to be replaced with a QML Enum schema, which actually is translated in TelegramQML´s types.h file.

Take the example I checked in https://github.com/ubports/TelegramQML/commit/aea727812dca4d33e44a68b2c9fabeac1dd86110 and work this out for:

grafik