Threema actions are missing in contact details because Threema's raw contacts have no name

未關閉
#643 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
38/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
android, kotlin
領域
backend, mobile

研究方向

Start with the named ContactsHelper.kt, ViewContactActivity.kt, and Context-contacts.kt references to trace how raw contacts are loaded and how social actions are found. The report says the reporter has already prepared and tested an implementation; coordinate with them before starting. Done means nameless Threema raw contacts appear as contact sources and offer the existing message and call actions.

由索引模型根據 Issue 內容生成。

描述

bug needs triage
Checklist
  • I can reproduce the bug with the latest version given here.
  • I made sure that there are no existing issues - open or closed - to which I could contribute my information.
  • I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
  • I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.
Affected app version

1.6.0

Affected Android/Custom ROM version

GrapheneOS 2026102101 (Android 17)

Affected device model

Pixel 9 Pro XL

How did you install the app?

F-Droid / IzzyOnDroid

Steps to reproduce the bug
  1. Install Threema Libre 6.5.3l (build 1216), enable contact synchronization in Threema and grant it access to contacts.
  2. Make sure a contact in the address book has a phone number or email address that belongs to a Threema user. Threema then links its own raw contact to that contact.
  3. Open this contact in Fossify Contacts (with the "Contact source" field visible).
  4. Optionally open the filter dialog in the contact list.
Expected behavior

The contact sources list a Threema entry with the Threema icon, and tapping it offers "Message" / "Call", like it already works for WhatsApp. The stock contacts app on the same device shows these Threema actions for the same contact.

Actual behavior

There is no Threema entry and no way to reach the Threema actions from the contact details. In the filter dialog, the Threema source is listed and enabled, but with (0) contacts. WhatsApp entries on the same device are shown correctly.

Already ruled out: Threema contact sync is on, Fossify Contacts has full contacts permission, account sync is active, "Show only contacts with phone numbers" is off.

Screenshots/Screen recordings
ignoreImageMinify ignoreImageMinify
Additional information

Root cause

Threema creates one raw contact per linked contact in its own account. That raw contact only has two data rows (vnd.ch.threema.app.profile and vnd.ch.threema.app.call) and is joined to the existing contact with AggregationExceptions.TYPE_KEEP_TOGETHER. The code for a StructuredName row is present but commented out:
https://github.com/threema-ch/threema-android/blob/d44a2b53b2ea2c0bf1065bdaa96987570e5b4e6d/app/src/main/java/ch/threema/app/utils/AndroidContactUtil.java#L157-L219

Fossify only loads raw contacts that have a StructuredName or Organization row, so Threema's raw contacts are never loaded:
https://github.com/FossifyOrg/Commons/blob/675cd53384c9d1c09a8f7308dacb81757599ef50/commons/src/main/kotlin/org/fossify/commons/helpers/ContactsHelper.kt#L141

As a result the filter shows (0), the Threema raw contact never becomes one of the contact's sources, and the existing Threema branch in setupContactSources() is never reached:
https://github.com/FossifyOrg/Contacts/blob/59e96245420f5ed1f6bad5e50c244b0fecd0a36f/app/src/main/kotlin/org/fossify/contacts/activities/ViewContactActivity.kt#L667-L673

Fossify already knows Threema's mimetypes in getSocialActions(), which looks up data rows by raw contact id and does not need a name row:
https://github.com/FossifyOrg/Commons/blob/675cd53384c9d1c09a8f7308dacb81757599ef50/commons/src/main/kotlin/org/fossify/commons/extensions/Context-contacts.kt#L281-L330

WhatsApp is not affected because it writes a name and phone number into its raw contact. The stock contacts app reads all data rows of the aggregated contact, whether a name row exists or not.

I use Threema Libre. It creates its account with the name "Threema Libre" and type ch.threema.app.libre, but uses the same mimetypes as regular Threema, so a fix based on mimetypes covers both. The existing branch in setupContactSources() checks the account name for "threema" and would not match Threema Libre even if its raw contacts were loaded.

Proposed fix

  1. Commons: add a lookup for raw contacts aggregated into a contact (Data.CONTACT_ID) that carry a known messenger mimetype but neither a name nor an organization row.
  2. Contacts: in ViewContactActivity, list those raw contacts as additional contact sources with the messenger icon; tapping them opens the existing social actions dialog.

This keeps contact loading untouched, so no empty entries show up in the contact list. It is not specific to Threema; it covers any supported messenger that links nameless raw contacts. The "(0)" count in the filter dialog stays as it is, since those raw contacts are still not loaded as contacts of their own.

Note on opening the chat

With the fix applied, the dialog offers "Message to <Threema ID>" and "Call …" as expected (the label text comes from Threema's DATA3). On my Pixel, tapping "Message" currently opens an empty Threema screen. The stock GrapheneOS contacts app shows exactly the same behavior for the same contact, so this is not caused by Fossify. On a Samsung Galaxy S20 FE, the same action from the stock contacts app opens the chat normally. I will look into this on the Threema side separately.

Related: in https://github.com/orgs/FossifyOrg/discussions/770 the connected apps (Signal, Threema, WhatsApp) were requested, and the answer was that Fossify Contacts already shows them as contact sources with the app icon. That works for WhatsApp, but not for Threema, for the reason above. #230 is about alternative Telegram/Signal clients that use their own account types, which is a different cause: Threema Libre uses the standard Threema mimetypes, the problem here is the missing name row.

I have prepared an implementation (about 70 lines in Commons, 50 in Contacts) and tested it on my device (see the screenshots above). I would like to submit the PRs if this gets the "help wanted" label.

主要語言
Kotlin
星號
917
分支
73
平均合併
2 天 8 小時
30 天內合併 PR
7

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

FossifyOrg/Contacts 的其他 Issue

查看 FossifyOrg/Contacts 的全部 Issue

相似的 Issue

更多 Kotlin Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。