Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ import javax.inject.Singleton
* Pure, unit-tested.
*/
object ChatFeatureHint {
/** Every key of the `features` object this app knows (Messenger ≤ 1.4.0). */
/** Every key of the `features` object this app knows (Messenger ≤ 1.11.0). */
val KNOWN: Set<String> = setOf(
"direct", "groups", "voice", "files", "location", "reactions", "edit", "search", "disappearing",
"bridges", "e2e",
ChatFeatures.VIDEO_META, ChatFeatures.FILE_THUMBS,
// 1.5.0: Freigaben anfragen (approvers), „Am Ende ausschalten“
"action_requests", "grant_off",
// 1.6.0: „Wo Mitteilungen erscheinen“ (NotifyRoutesScreen)
"notice_routes",
// 1.11.0: Virenscan an Dateien (`media.scan`, MediaScan)
"scan",
) + ChatFeatures14.ALL

/** The keys the server switches on that this app does not know. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ class ChatMessenger14Test {
assertEquals(emptySet<String>(), ChatFeatureHint.unknown(f), "all 1.4 keys are known to this app")
}

/** Everything Messenger 1.11.0 can switch on (GET me features, all options on): no update hint. */
@Test
fun `no update hint for the full feature set of messenger 1_11`() {
val all = listOf(
"direct", "groups", "voice", "files", "location", "reactions", "edit", "search", "disappearing",
"video_meta", "file_thumbs", "scan",
"status", "stories", "story_duration", "polls", "events", "arrival", "msg_tools", "privacy2",
"actions", "action_requests", "grant_off", "notices", "notice_routes",
)
val f = ChatJson.features(json(all.joinToString(",", "{", "}") { "\"$it\":true" }))
assertEquals(emptySet<String>(), ChatFeatureHint.unknown(f))
assertFalse(ChatFeatureHint.show(f, null))
val newer = ChatJson.features(json(all.joinToString(",", "{", ",\"later\":true}") { "\"$it\":true" }))
assertEquals(setOf("later"), ChatFeatureHint.unknown(newer), "a key of a newer messenger still shows the hint")
}

// ─── polls ──────────────────────────────────────────────────────

@Test
Expand Down
Loading