app/src/main/java/dev/equwal/inkupdate/Watched.kt (2192 bytes)
1 // SPDX-License-Identifier: GPL-3.0-or-later 2 // Copyright (c) 2026 equwal 3 package dev.equwal.inkupdate 4 5 /** 6 * One app that Ink Update watches. 7 * 8 * @param title what the screen calls the app. 9 * @param pkg the package name on the device. 10 * @param fdroidId the id on F-Droid, or null when the app is not there. 11 * @param repo the GitHub repository, as "owner/name". 12 * @param preferAsset a word in the name of the APK to take first, when a 13 * release holds more than one APK. Null takes the first APK. 14 */ 15 data class Watched( 16 val title: String, 17 val pkg: String, 18 val fdroidId: String?, 19 val repo: String, 20 val preferAsset: String? = null 21 ) { 22 /** The page that F-Droid shows for the app. The F-Droid client opens it. */ 23 fun fdroidPage(): String? = fdroidId?.let { "https://f-droid.org/packages/$it/" } 24 25 /** The F-Droid answer about the app. */ 26 fun fdroidApi(): String? = fdroidId?.let { "https://f-droid.org/api/v1/packages/$it" } 27 28 /** The last ten releases of the repository. */ 29 fun githubApi(): String = "https://api.github.com/repos/$repo/releases?per_page=10" 30 31 /** The page in the Play store. The Play client opens it. */ 32 fun playPage(): String = "market://details?id=$pkg" 33 } 34 35 /** 36 * The list of watched apps. To watch one more app, add a line. 37 * 38 * Only the apps that are installed are shown and checked. 39 */ 40 object Watch { 41 42 val ALL: List<Watched> = listOf( 43 Watched( 44 title = "Rebind", 45 pkg = "dev.equwal.assistkey", 46 fdroidId = null, 47 repo = "equwal/rebind", 48 preferAsset = "full" 49 ), 50 Watched( 51 title = "Ink Recents", 52 pkg = "dev.equwal.inkrecents", 53 fdroidId = "dev.equwal.inkrecents", 54 repo = "equwal/ink-recents" 55 ), 56 Watched( 57 title = "Ink Dim", 58 pkg = "dev.equwal.inkdim", 59 fdroidId = "dev.equwal.inkdim", 60 repo = "equwal/ink-dim" 61 ), 62 Watched( 63 title = "Ink Update", 64 pkg = "dev.equwal.inkupdate", 65 fdroidId = "dev.equwal.inkupdate", 66 repo = "equwal/ink-update" 67 ) 68 ) 69 }