Compare commits

...

34 Commits

Author SHA1 Message Date
ad8463ac8b Update README.md 2024-01-03 20:28:49 -05:00
7843de240a Merge pull request #1241 from ImranR98/dev
Don't use numpad for version extraction match group
2024-01-03 20:19:18 -05:00
0037a08017 Don't use numpad for version extraction match group 2024-01-03 20:18:59 -05:00
92ba432992 Merge pull request #1240 from ImranR98/dev
- Remove reference to old plugin to avoid crashes (#1221)
- Confirmation box for link-based imports (#1232)
- Construct extracted versions from match groups (#1235)
- Fix the WebView 'cleartext' error caused by HTTP sites (#1235)
- Make GitHub's (and Codeberg's) "fallback" work with the APK filter (#1236)
- Make version extraction universal (#1237)
- HTML Bugfix (#1238)
2024-01-03 20:16:19 -05:00
3a521f4014 Update packages, increment version 2024-01-03 20:13:47 -05:00
e8bbc9799c Fix the WebView 'cleartext' error caused by HTTP sites 2024-01-03 20:11:52 -05:00
96a48b4813 Construct extracted versions from match groups (#1235) 2024-01-03 20:02:44 -05:00
355450e82d Merge duplicate version extraction code into one function 2024-01-03 19:28:45 -05:00
99307c5b0c Make version extraction universal (#1237) 2024-01-03 19:20:03 -05:00
ace8be6514 Remove reference to old plugin to avoid crashes (#1221) 2024-01-03 19:04:36 -05:00
1b538931b1 Confirmation box for link-based imports (#1232) 2024-01-03 19:03:05 -05:00
7ccd08ee2b Make GitHub's (and Codeberg's) "fallback" work with the APK filter (#1236) 2024-01-03 18:32:09 -05:00
104beed594 HTML Bugfix (#1238) 2024-01-03 18:25:02 -05:00
e8df594edb Merge pull request #1233 from iDazai/main
added missing strings in some languages, translated for DE
2024-01-03 18:06:29 -05:00
6e922a84f8 Merge pull request #1230 from re7gog/re7gog
Fixes and system font
2024-01-03 18:06:04 -05:00
b74bf86277 Corrections 2024-01-03 14:39:33 +03:00
6cbe50c9ef Update vi.json 2024-01-02 07:57:32 +01:00
14fcca040b Update tr.json 2024-01-02 07:57:21 +01:00
7bb545cff9 Update sv.json 2024-01-02 07:57:07 +01:00
f52b1a246c Update pl.json 2024-01-02 07:56:41 +01:00
273dfd89cc Update nl.json 2024-01-02 07:56:17 +01:00
52d72d287b Update ja.json 2024-01-02 07:56:01 +01:00
e8d8fcbe69 Update hu.json 2024-01-02 07:55:44 +01:00
30c6c1afd3 Update fr.json 2024-01-02 07:55:16 +01:00
c8c8093b3a Update fa.json 2024-01-02 07:55:03 +01:00
c970b2cf2e Update es.json 2024-01-02 07:54:23 +01:00
0815283d31 Update bs.json 2024-01-02 07:53:32 +01:00
55ee2d93b8 Update de.json
added missing strings and translated
2024-01-02 07:53:07 +01:00
c9e17ed42b Merge branch 'main' into re7gog 2024-01-01 18:50:24 +03:00
76a91b7fe0 Don't load font if loaded 2024-01-01 18:42:38 +03:00
f9b3169b6a Update README.md 2024-01-01 07:55:00 -05:00
0f74195255 Replace okay with ok 2023-12-31 19:42:28 +03:00
5ba33786ab System font and newer dependencies 2023-12-31 19:33:33 +03:00
1fc8ee6fee Fix all 2023-12-28 17:50:12 +03:00
36 changed files with 348 additions and 137 deletions

View File

@ -1,12 +1,14 @@
# ![Obtainium Icon](./assets/graphics/icon_small.png) Obtainium
[![Ceasefire Now](https://badge.techforpalestine.org/default)](https://techforpalestine.org/learn-more)
Get Android App Updates Directly From the Source.
Obtainium allows you to install and update Apps directly from their releases pages, and receive notifications when new releases are made available.
Motivation: [Side Of Burritos - You should use this instead of F-Droid | How to use app RSS feed](https://youtu.be/FFz57zNR_M0)
Wiki: [https://github.com/ImranR98/Obtainium/wiki](https://github.com/ImranR98/Obtainium/wiki)
Read the Wiki: [https://github.com/ImranR98/Obtainium/wiki](https://github.com/ImranR98/Obtainium/wiki)
Currently supported App sources:
- Open Source - General:
@ -30,6 +32,7 @@ Currently supported App sources:
- [Signal](https://signal.org/)
- [VLC](https://videolan.org/)
- Other - App-Specific:
- [WhatsApp](https://whatsapp.com)
- [Telegram App](https://telegram.org)
- [Steam Mobile Apps](https://store.steampowered.com/mobile)
- [Neutron Code](https://neutroncode.com)

View File

@ -96,19 +96,15 @@ repositories {
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
def shizuku_version = '13.1.5'
implementation "dev.rikka.shizuku:api:$shizuku_version"
implementation "dev.rikka.shizuku:provider:$shizuku_version"
def hidden_api_version = '4.1.0'
// DO NOT UPDATE Hidden API without updating the Android tools
// and do not update Android tools without updating the whole Flutter
// (also in android/build.gradle)
def hidden_api_version = '4.3.1'
implementation "dev.rikka.tools.refine:runtime:$hidden_api_version"
implementation "dev.rikka.hidden:compat:$hidden_api_version"
compileOnly "dev.rikka.hidden:stub:$hidden_api_version"
implementation "org.lsposed.hiddenapibypass:hiddenapibypass:4.3"
implementation "com.github.topjohnwu.libsu:core:5.2.2"
}

View File

@ -5,7 +5,8 @@
android:label="Obtainium"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true">
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:exported="true"
@ -44,21 +45,6 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<service
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false" />
<receiver
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmBroadcastReceiver"
android:exported="false" />
<receiver
android:name="dev.fluttercommunity.plus.androidalarmmanager.RebootBroadcastReceiver"
android:enabled="false"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="dev.imranr.obtainium"

View File

@ -0,0 +1,44 @@
package dev.imranr.obtainium
import android.util.Xml
import org.xmlpull.v1.XmlPullParser
import java.io.File
import java.io.FileInputStream
class DefaultSystemFont {
fun get(): String {
return try {
val file = File("/system/etc/fonts.xml")
val fileStream = FileInputStream(file)
parseFontsFileStream(fileStream)
} catch (e: Exception) {
e.message ?: "Unknown fonts.xml parsing exception"
}
}
private fun parseFontsFileStream(fileStream: FileInputStream): String {
fileStream.use { stream ->
val parser = Xml.newPullParser()
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false)
parser.setInput(stream, null)
parser.nextTag()
return parseFonts(parser)
}
}
private fun parseFonts(parser: XmlPullParser): String {
while (!((parser.next() == XmlPullParser.END_TAG) && (parser.name == "family"))) {
if ((parser.eventType == XmlPullParser.START_TAG) && (parser.name == "font")
&& (parser.getAttributeValue(null, "style") == "normal")
&& (parser.getAttributeValue(null, "weight") == "400")) {
break
}
}
parser.next()
val fontFile = parser.text.trim()
if (fontFile == "") {
throw NoSuchFieldException("The font filename couldn't be found in fonts.xml")
}
return "/system/fonts/$fontFile"
}
}

View File

@ -22,12 +22,13 @@ import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.Result
import java.io.IOException
import java.util.concurrent.CountDownLatch
import org.lsposed.hiddenapibypass.HiddenApiBypass
import rikka.shizuku.Shizuku
import rikka.shizuku.Shizuku.OnRequestPermissionResultListener
import rikka.shizuku.ShizukuBinderWrapper
class MainActivity: FlutterActivity() {
private var installersChannel: MethodChannel? = null
private var nativeChannel: MethodChannel? = null
private val SHIZUKU_PERMISSION_REQUEST_CODE = (10..200).random()
private fun shizukuCheckPermission(result: Result) {
@ -51,7 +52,7 @@ class MainActivity: FlutterActivity() {
requestCode: Int, grantResult: Int ->
if (requestCode == SHIZUKU_PERMISSION_REQUEST_CODE) {
val res = if (grantResult == PackageManager.PERMISSION_GRANTED) 1 else 0
installersChannel!!.invokeMethod("resPermShizuku", mapOf("res" to res))
nativeChannel!!.invokeMethod("resPermShizuku", mapOf("res" to res))
}
}
@ -76,7 +77,8 @@ class MainActivity: FlutterActivity() {
val params =
PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL)
var installFlags: Int = PackageInstallerUtils.getInstallFlags(params)
installFlags = installFlags or 0x00000004 // PackageManager.INSTALL_ALLOW_TEST
installFlags = installFlags or (0x00000002/*PackageManager.INSTALL_REPLACE_EXISTING*/
or 0x00000004 /*PackageManager.INSTALL_ALLOW_TEST*/)
PackageInstallerUtils.setInstallFlags(params, installFlags)
val sessionId = packageInstaller.createSession(params)
val iSession = IPackageInstallerSession.Stub.asInterface(
@ -136,7 +138,7 @@ class MainActivity: FlutterActivity() {
}
private fun rootInstallApk(apkFilePath: String, result: Result) {
Shell.sh("pm install -R -t " + apkFilePath).submit { out ->
Shell.sh("pm install -r -t " + apkFilePath).submit { out ->
val builder = StringBuilder()
for (data in out.getOut()) { builder.append(data) }
result.success(builder.toString().endsWith("Success"))
@ -145,12 +147,18 @@ class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
HiddenApiBypass.addHiddenApiExemptions("")
}
Shizuku.addRequestPermissionResultListener(shizukuRequestPermissionResultListener)
installersChannel = MethodChannel(
flutterEngine.dartExecutor.binaryMessenger, "installers")
installersChannel!!.setMethodCallHandler {
nativeChannel = MethodChannel(
flutterEngine.dartExecutor.binaryMessenger, "native")
nativeChannel!!.setMethodCallHandler {
call, result ->
if (call.method == "checkPermissionShizuku") {
if (call.method == "getSystemFont") {
val res = DefaultSystemFont().get()
result.success(res)
} else if (call.method == "checkPermissionShizuku") {
shizukuCheckPermission(result)
} else if (call.method == "checkPermissionRoot") {
rootCheckPermission(result)

View File

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.8.10'
ext {
compileSdkVersion = 34 // or latest
targetSdkVersion = 34 // or latest
@ -11,9 +11,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "com.android.tools.build:gradle:7.4.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'dev.rikka.tools.refine:gradle-plugin:4.1.0' // Do not update!
classpath "dev.rikka.tools.refine:gradle-plugin:4.3.1"
}
}

View File

@ -103,7 +103,6 @@
"importErrors": "Uvezi greške",
"importedXOfYApps": "{} od {} aplikacija uvezeno.",
"followingURLsHadErrors": "Sljedeći URL-ovi su imali greške:",
"okay": "Dobro",
"selectURL": "Odaberite URL",
"selectURLs": "Odaberite URL-ove",
"pick": "Odaberi",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "Podržite fiksne APK URL-ove",
"selectX": "Izaberite {}",
"parallelDownloads": "Allow parallel downloads",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "Želite li ukloniti aplikaciju?",
"other": "Želite li ukloniti aplikacije?"

View File

@ -103,7 +103,6 @@
"importErrors": "Chyba importu",
"importedXOfYApps": "{}importováno z {} aplikací.",
"followingURLsHadErrors": "U následujících adres došlo k chybám:",
"okay": "Okay",
"selectURL": "Vybrat adresu",
"selectURLs": "Select adresy",
"pick": "Vybrat",

View File

@ -103,7 +103,6 @@
"importErrors": "Importfehler",
"importedXOfYApps": "{} von {} Apps importiert.",
"followingURLsHadErrors": "Bei folgenden URLs traten Fehler auf:",
"okay": "Okay",
"selectURL": "URL auswählen",
"selectURLs": "URLs auswählen",
"pick": "Auswählen",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "neuere Version anhand der ersten dreißig Zahlen der Checksumme der APK URL erraten, wenn anderweitig nicht unterstützt",
"selectX": "Wähle {}",
"parallelDownloads": "Erlaube parallele Downloads",
"installMethod": "Installationsmethode",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku läuft nicht",
"removeAppQuestion": {
"one": "App entfernen?",
"other": "Apps entfernen?"

View File

@ -103,7 +103,6 @@
"importErrors": "Import Errors",
"importedXOfYApps": "{} of {} Apps imported.",
"followingURLsHadErrors": "The following URLs had errors:",
"okay": "Okay",
"selectURL": "Select URL",
"selectURLs": "Select URLs",
"pick": "Pick",
@ -287,7 +286,9 @@
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"shizukuBinderNotFound": "Сompatible Shizuku service wasn't found",
"useSystemFont": "Use the system font",
"systemFontError": "Error loading the system font: {}",
"removeAppQuestion": {
"one": "Remove App?",
"other": "Remove Apps?"

View File

@ -103,7 +103,6 @@
"importErrors": "Errores de Importación",
"importedXOfYApps": "{} de {} Aplicaciones importadas.",
"followingURLsHadErrors": "Las siguientes URLs han tenido problemas:",
"okay": "Aceptar",
"selectURL": "Seleccionar URL",
"selectURLs": "Seleccionar URLs",
"pick": "Escoger",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "Soporte para URLs fijas de APK",
"selectX": "Selecciona {}",
"parallelDownloads": "Permitir descargas paralelas",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "¿Eliminar Aplicación?",
"other": "¿Eliminar Aplicaciones?"

View File

@ -103,7 +103,6 @@
"importErrors": "خطاهای وارد کردن",
"importedXOfYApps": "{} از {} برنامه وارد شد.",
"followingURLsHadErrors": "آدرس های اینترنتی زیر دارای خطا بودند:",
"okay": "باشه",
"selectURL": "آدرس اینترنتی انتخاب شده",
"selectURLs": "آدرس های اینترنتی انتخاب شده",
"pick": "انتخاب",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "پشتیبانی از URL های APK ثابت",
"selectX": "انتخاب کنید {}",
"parallelDownloads": "Allow parallel downloads",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "برنامه حذف شود؟",
"other": "برنامه ها حذف شوند؟"

View File

@ -103,7 +103,6 @@
"importErrors": "Erreurs d'importation",
"importedXOfYApps": "{} sur {} applications importées.",
"followingURLsHadErrors": "Les URL suivantes comportaient des erreurs :",
"okay": "Okay",
"selectURL": "Sélectionnez l'URL",
"selectURLs": "Sélectionnez les URLs",
"pick": "Prendre",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "Support fixed APK URLs",
"selectX": "Select {}",
"parallelDownloads": "Allow parallel downloads",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "Supprimer l'application ?",
"other": "Supprimer les applications ?"
@ -335,4 +339,4 @@
"one": "{} and 1 more app may have been updated.",
"other": "{} and {} more apps may have been updated."
}
}
}

View File

@ -103,7 +103,6 @@
"importErrors": "Importálási hibák",
"importedXOfYApps": "{}/{} app importálva.",
"followingURLsHadErrors": "A következő URL-ek hibákat tartalmaztak:",
"okay": "Oké",
"selectURL": "Válassza ki az URL-t",
"selectURLs": "Kiválasztott URL-ek",
"pick": "Válasszon",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "Támogatja a rögzített APK URL-eket",
"selectX": "Kiválaszt {}",
"parallelDownloads": "Párhuzamos letöltéseket enged",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "Eltávolítja az alkalmazást?",
"other": "Eltávolítja az alkalmazást?"

View File

@ -103,7 +103,6 @@
"importErrors": "Errori di importazione",
"importedXOfYApps": "{} app di {} importate.",
"followingURLsHadErrors": "I seguenti URL contengono errori:",
"okay": "Va bene",
"selectURL": "Seleziona l'URL",
"selectURLs": "Seleziona gli URL",
"pick": "Seleziona",

View File

@ -103,7 +103,6 @@
"importErrors": "インポートエラー",
"importedXOfYApps": "{} / {} アプリをインポートしました",
"followingURLsHadErrors": "以下のURLでエラーが発生しました:",
"okay": "OK",
"selectURL": "URLを選択",
"selectURLs": "URLを選択",
"pick": "選択",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "Support fixed APK URLs",
"selectX": "Select {}",
"parallelDownloads": "Allow parallel downloads",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "アプリを削除しますか?",
"other": "アプリを削除しますか?"
@ -335,4 +339,4 @@
"one": "{} とさらに 1 個のアプリがアップデートされた可能性があります。",
"other": "{} とさらに {} 個のアプリがアップデートされた可能性があります。"
}
}
}

View File

@ -103,7 +103,6 @@
"importErrors": "Import foutmeldingen",
"importedXOfYApps": "{} van {} apps geïmporteerd.",
"followingURLsHadErrors": "De volgende URL's bevatten fouten:",
"okay": "Ok",
"selectURL": "Selecteer URL",
"selectURLs": "Selecteer URL's",
"pick": "Kies",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "Support fixed APK URLs",
"selectX": "Select {}",
"parallelDownloads": "Allow parallel downloads",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "App verwijderen?",
"other": "Apps verwijderen?"

View File

@ -103,7 +103,6 @@
"importErrors": "Błędy importowania",
"importedXOfYApps": "Zaimportowano {} z {} aplikacji.",
"followingURLsHadErrors": "Następujące adresy URL zawierały błędy:",
"okay": "Okej",
"selectURL": "Wybierz adres URL",
"selectURLs": "Wybierz adresy URL",
"pick": "Wybierz",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "Obsługuj stałe adresy URL APK",
"selectX": "Wybierz {}",
"parallelDownloads": "Allow parallel downloads",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "Usunąć aplikację?",
"few": "Usunąć aplikacje?",
@ -361,4 +365,4 @@
"many": "{} i {} innych apek mogło zostać zaktualizowanych.",
"other": "{} i {} inne apki mogły zostać zaktualizowane."
}
}
}

View File

@ -103,7 +103,6 @@
"importErrors": "Erros de Importação",
"importedXOfYApps": "{} de {} Apps importados.",
"followingURLsHadErrors": "As seguintes URLs apresentaram erros:",
"okay": "Ok",
"selectURL": "Selecionar URL",
"selectURLs": "Selecionar URLs",
"pick": "Escolher",

View File

@ -103,7 +103,6 @@
"importErrors": "Ошибка импорта",
"importedXOfYApps": "Импортировано приложений: {} из {}",
"followingURLsHadErrors": "При импорте следующие URL-адреса содержали ошибки:",
"okay": "Ok",
"selectURL": "Выбрать URL-адрес",
"selectURLs": "Выбрать URL-адреса",
"pick": "Выбрать",
@ -287,7 +286,9 @@
"normal": "Нормальный",
"shizuku": "Shizuku",
"root": "Суперпользователь",
"shizukuBinderNotFound": "Shizuku не запущен",
"shizukuBinderNotFound": "Совместимый сервис Shizuku не найден",
"useSystemFont": "Использовать системный шрифт",
"systemFontError": "Ошибка загрузки системного шрифта: {}",
"removeAppQuestion": {
"one": "Удалить приложение?",
"other": "Удалить приложения?"

View File

@ -103,7 +103,6 @@
"importErrors": "Importfel",
"importedXOfYApps": "{} av {} Appar importerade.",
"followingURLsHadErrors": "Följande URL:er hade fel:",
"okay": "Okej",
"selectURL": "Välj URL",
"selectURLs": "Välj URL:er",
"pick": "Välj",
@ -269,6 +268,11 @@
"bgTaskStarted": "Background task started - check logs.",
"runBgCheckNow": "Kör Bakgrundsuppdateringskoll Nu",
"parallelDownloads": "Allow parallel downloads",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "Ta Bort App?",
"other": "Ta Bort Appar?"

View File

@ -103,7 +103,6 @@
"importErrors": "İçe Aktarma Hataları",
"importedXOfYApps": "{}'den {} Uygulama İçe Aktarıldı.",
"followingURLsHadErrors": "Aşağıdaki URL'lerde hatalar oluştu:",
"okay": "Tamam",
"selectURL": "URL Seç",
"selectURLs": "URL'leri Seç",
"pick": "Seç",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "Support fixed APK URLs",
"selectX": "Select {}",
"parallelDownloads": "Allow parallel downloads",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion": {
"one": "Uygulamayı Kaldır?",
"other": "Uygulamaları Kaldır?"
@ -335,4 +339,4 @@
"one": "{} ve 1 diğer uygulama muhtemelen güncellendi.",
"other": "{} ve {} daha fazla uygulama muhtemelen güncellendi."
}
}
}

View File

@ -103,7 +103,6 @@
"importErrors": "Lỗi nhập",
"importedXOfYApps": "{} trong số {} Ứng dụng đã được nhập.",
"followingURLsHadErrors": "Các URL sau có lỗi:",
"okay": "Ôkê",
"selectURL": "Chọn URL",
"selectURLs": "Chọn URL",
"pick": "Chọn",
@ -283,6 +282,11 @@
"supportFixedAPKURL": "Support fixed APK URLs",
"selectX": "Select {}",
"parallelDownloads": "Allow parallel downloads",
"installMethod": "Installation method",
"normal": "Normal",
"shizuku": "Shizuku",
"root": "Root",
"shizukuBinderNotFound": "Shizuku is not running",
"removeAppQuestion":{
"one": "Gỡ ứng dụng?",
"other": "Gỡ ứng dụng?"

View File

@ -103,7 +103,6 @@
"importErrors": "导入错误",
"importedXOfYApps": "已导入 {} 中的 {} 个应用。",
"followingURLsHadErrors": "下列 URL 存在错误:",
"okay": "好的",
"selectURL": "选择 URL",
"selectURLs": "选择 URL",
"pick": "选择",

View File

@ -346,6 +346,11 @@ class GitHub extends AppSource {
continue;
}
var apkUrls = getReleaseAPKUrls(releases[i]);
if (additionalSettings['apkFilterRegEx'] != null) {
var reg = RegExp(additionalSettings['apkFilterRegEx']);
apkUrls =
apkUrls.where((element) => reg.hasMatch(element.key)).toList();
}
if (apkUrls.isEmpty && additionalSettings['trackOnly'] != true) {
continue;
}

View File

@ -1,5 +1,4 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:html/parser.dart';
import 'package:http/http.dart';
import 'package:obtainium/components/generated_form.dart';
@ -100,28 +99,6 @@ class HTML extends AppSource {
}
])
],
[
GeneratedFormTextField('versionExtractionRegEx',
label: tr('versionExtractionRegEx'),
required: false,
additionalValidators: [(value) => regExValidator(value)]),
],
[
GeneratedFormTextField('matchGroupToUse',
label: tr('matchGroupToUse'),
required: false,
hint: '0',
textInputType: const TextInputType.numberWithOptions(),
additionalValidators: [
(value) {
if (value?.isEmpty == true) {
value = null;
}
value ??= '0';
return intValidator(value);
}
])
],
[
GeneratedFormSwitch('versionExtractWholePage',
label: tr('versionExtractWholePage'))
@ -242,9 +219,14 @@ class HTML extends AppSource {
Map<String, dynamic> additionalSettings,
) async {
var currentUrl = standardUrl;
for (int i = 0;
i < (additionalSettings['intermediateLink']?.length ?? 0);
i++) {
if (additionalSettings['intermediateLink']?.isNotEmpty != true) {
additionalSettings['intermediateLink'] = [];
}
additionalSettings['intermediateLink'] =
additionalSettings['intermediateLink']
.where((l) => l['customLinkFilterRegex'].isNotEmpty == true)
.toList();
for (int i = 0; i < (additionalSettings['intermediateLink'].length); i++) {
var intLinks = await grabLinksCommon(await sourceRequest(currentUrl),
additionalSettings['intermediateLink'][i]);
if (intLinks.isEmpty) {
@ -270,26 +252,12 @@ class HTML extends AppSource {
if (additionalSettings['supportFixedAPKURL'] != true) {
version = rel.hashCode.toString();
}
var versionExtractionRegEx =
additionalSettings['versionExtractionRegEx'] as String?;
if (versionExtractionRegEx?.isNotEmpty == true) {
var match = RegExp(versionExtractionRegEx!).allMatches(
additionalSettings['versionExtractWholePage'] == true
? res.body.split('\r\n').join('\n').split('\n').join('\\n')
: rel);
if (match.isEmpty) {
throw NoVersionError();
}
String matchGroupString =
(additionalSettings['matchGroupToUse'] as String).trim();
if (matchGroupString.isEmpty) {
matchGroupString = "0";
}
version = match.last.group(int.parse(matchGroupString));
if (version?.isEmpty == true) {
throw NoVersionError();
}
}
version = extractVersion(
additionalSettings['versionExtractionRegEx'] as String?,
additionalSettings['matchGroupToUse'] as String?,
additionalSettings['versionExtractWholePage'] == true
? res.body.split('\r\n').join('\n').split('\n').join('\\n')
: rel);
rel = ensureAbsoluteUrl(rel, uri);
version ??= (await checkDownloadHash(rel)).toString();
return APKDetails(version, [rel].map((e) => MapEntry(e, e)).toList(),

View File

@ -19,7 +19,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
// ignore: implementation_imports
import 'package:easy_localization/src/localization.dart';
const String currentVersion = '0.15.3';
const String currentVersion = '0.15.4';
const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
@ -36,7 +36,7 @@ List<MapEntry<Locale, String>> supportedLocales = const [
MapEntry(Locale('fr'), 'Français'),
MapEntry(Locale('es'), 'Español'),
MapEntry(Locale('pl'), 'Polski'),
MapEntry(Locale('ru'), 'Русский язык'),
MapEntry(Locale('ru'), 'Русский'),
MapEntry(Locale('bs'), 'Bosanski'),
MapEntry(Locale('pt'), 'Brasileiro'),
MapEntry(Locale('cs'), 'Česky'),
@ -236,13 +236,17 @@ class _ObtainiumState extends State<Obtainium> {
colorScheme: settingsProvider.theme == ThemeSettings.dark
? darkColorScheme
: lightColorScheme,
fontFamily: 'Metropolis'),
fontFamily: settingsProvider.useSystemFont
? 'SystemFont'
: 'Metropolis'),
darkTheme: ThemeData(
useMaterial3: true,
colorScheme: settingsProvider.theme == ThemeSettings.light
? lightColorScheme
: darkColorScheme,
fontFamily: 'Metropolis'),
fontFamily: settingsProvider.useSystemFont
? 'SystemFont'
: 'Metropolis'),
home: Shortcuts(shortcuts: <LogicalKeySet, Intent>{
LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(),
}, child: const HomePage()));

View File

@ -5,6 +5,7 @@ import 'package:app_links/app_links.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:obtainium/components/generated_form_modal.dart';
import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/pages/add_app.dart';
import 'package:obtainium/pages/apps.dart';
@ -76,14 +77,39 @@ class _HomePageState extends State<HomePage> {
try {
if (action == 'add') {
await goToAddApp(data);
} else if (action == 'app') {
await context
.read<AppsProvider>()
.import('{ "apps": [${Uri.decodeComponent(data)}] }');
} else if (action == 'apps') {
await context
.read<AppsProvider>()
.import('{ "apps": ${Uri.decodeComponent(data)} }');
} else if (action == 'app' || action == 'apps') {
var dataStr = Uri.decodeComponent(data);
if (await showDialog(
context: context,
builder: (BuildContext ctx) {
return GeneratedFormModal(
title: tr('importX', args: [
action == 'app' ? tr('app') : tr('appsString')
]),
items: const [],
additionalWidgets: [
ExpansionTile(
title: const Text('Raw JSON'),
children: [
Text(
dataStr,
style: const TextStyle(fontFamily: 'monospace'),
)
],
)
],
);
}) !=
null) {
// ignore: use_build_context_synchronously
var result = await context.read<AppsProvider>().import(
action == 'app'
? '{ "apps": [$dataStr] }'
: '{ "apps": $dataStr }');
// ignore: use_build_context_synchronously
showMessage(
tr('importedX', args: [plural('apps', result.key)]), context);
}
} else {
throw ObtainiumError(tr('unknown'));
}

View File

@ -590,7 +590,7 @@ class _ImportErrorDialogState extends State<ImportErrorDialog> {
onPressed: () {
Navigator.of(context).pop(null);
},
child: Text(tr('okay')))
child: Text(tr('ok')))
],
);
}

View File

@ -7,6 +7,7 @@ import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/main.dart';
import 'package:obtainium/providers/apps_provider.dart';
import 'package:obtainium/providers/logs_provider.dart';
import 'package:obtainium/providers/native_provider.dart';
import 'package:obtainium/providers/settings_provider.dart';
import 'package:obtainium/providers/source_provider.dart';
import 'package:provider/provider.dart';
@ -350,8 +351,6 @@ class _SettingsPageState extends State<SettingsPage> {
],
),
height16,
installMethodDropdown,
height16,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -364,6 +363,7 @@ class _SettingsPageState extends State<SettingsPage> {
})
],
),
installMethodDropdown,
height32,
Text(
tr('sourceSpecific'),
@ -408,6 +408,30 @@ class _SettingsPageState extends State<SettingsPage> {
height16,
localeDropdown,
height16,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: Text(tr('useSystemFont'))),
Switch(
value: settingsProvider.useSystemFont,
onChanged: (useSystemFont) {
if (useSystemFont) {
NativeFeatures.loadSystemFont().then((fontLoadRes) {
if (fontLoadRes == 'ok') {
settingsProvider.useSystemFont = true;
} else {
showError(ObtainiumError(
tr('systemFontError', args: [fontLoadRes])
), context);
}
});
} else {
settingsProvider.useSystemFont = false;
}
})
],
),
height16,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [

View File

@ -32,7 +32,7 @@ import 'package:http/http.dart';
import 'package:android_intent_plus/android_intent.dart';
import 'package:flutter_archive/flutter_archive.dart';
import 'package:shared_storage/shared_storage.dart' as saf;
import 'installers_provider.dart';
import 'native_provider.dart';
final pm = AndroidPackageManager();
@ -522,12 +522,12 @@ class AppsProvider with ChangeNotifier {
code = await AndroidPackageInstaller.installApk(
apkFilePath: file.file.path);
case InstallMethodSettings.shizuku:
code = (await Installers.installWithShizuku(
code = (await NativeFeatures.installWithShizuku(
apkFileUri: file.file.uri.toString()))
? 0
: 1;
case InstallMethodSettings.root:
code = (await Installers.installWithRoot(apkFilePath: file.file.path))
code = (await NativeFeatures.installWithRoot(apkFilePath: file.file.path))
? 0
: 1;
}
@ -694,14 +694,14 @@ class AppsProvider with ChangeNotifier {
throw ObtainiumError(tr('cancelled'));
}
case InstallMethodSettings.shizuku:
int code = await Installers.checkPermissionShizuku();
int code = await NativeFeatures.checkPermissionShizuku();
if (code == -1) {
throw ObtainiumError(tr('shizukuBinderNotFound'));
} else if (code == 0) {
throw ObtainiumError(tr('cancelled'));
}
case InstallMethodSettings.root:
if (!(await Installers.checkPermissionRoot())) {
if (!(await NativeFeatures.checkPermissionRoot())) {
throw ObtainiumError(tr('cancelled'));
}
}

View File

@ -1,12 +1,26 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart';
class Installers {
static const MethodChannel _channel = MethodChannel('installers');
class NativeFeatures {
static const MethodChannel _channel = MethodChannel('native');
static bool _systemFontLoaded = false;
static bool _callbacksApplied = false;
static int _resPermShizuku = -2; // not set
static Future waitWhile(bool Function() test,
static Future<ByteData> _readFileBytes(String path) async {
var file = File(path);
var bytes = await file.readAsBytes();
return ByteData.view(bytes.buffer);
}
static Future _handleCalls(MethodCall call) async {
if (call.method == 'resPermShizuku') {
_resPermShizuku = call.arguments['res'];
}
}
static Future _waitWhile(bool Function() test,
[Duration pollInterval = const Duration(milliseconds: 250)]) {
var completer = Completer();
check() {
@ -20,20 +34,25 @@ class Installers {
return completer.future;
}
static Future handleCalls(MethodCall call) async {
if (call.method == 'resPermShizuku') {
_resPermShizuku = call.arguments['res'];
}
static Future<String> loadSystemFont() async {
if (_systemFontLoaded) { return "ok"; }
var getFontRes = await _channel.invokeMethod('getSystemFont');
if (getFontRes[0] != '/') { return getFontRes; } // Error
var fontLoader = FontLoader('SystemFont');
fontLoader.addFont(_readFileBytes(getFontRes));
await fontLoader.load();
_systemFontLoaded = true;
return "ok";
}
static Future<int> checkPermissionShizuku() async {
if (!_callbacksApplied) {
_channel.setMethodCallHandler(handleCalls);
_channel.setMethodCallHandler(_handleCalls);
_callbacksApplied = true;
}
int res = await _channel.invokeMethod('checkPermissionShizuku');
if(res == -2) {
await waitWhile(() => _resPermShizuku == -2);
if (res == -2) {
await _waitWhile(() => _resPermShizuku == -2);
res = _resPermShizuku;
_resPermShizuku = -2;
}

View File

@ -51,6 +51,15 @@ class SettingsProvider with ChangeNotifier {
notifyListeners();
}
bool get useSystemFont {
return prefs?.getBool('useSystemFont') ?? false;
}
set useSystemFont(bool useSystemFont) {
prefs?.setBool('useSystemFont', useSystemFont);
notifyListeners();
}
InstallMethodSettings get installMethod {
return InstallMethodSettings.values[
prefs?.getInt('installMethod') ?? InstallMethodSettings.normal.index];

View File

@ -444,6 +444,16 @@ abstract class AppSource {
label: tr('trackOnly'),
)
],
[
GeneratedFormTextField('versionExtractionRegEx',
label: tr('versionExtractionRegEx'),
required: false,
additionalValidators: [(value) => regExValidator(value)]),
],
[
GeneratedFormTextField('matchGroupToUse',
label: tr('matchGroupToUse'), required: false, hint: '\$0')
],
[
GeneratedFormDropdown(
'versionDetection',
@ -580,6 +590,57 @@ bool isTempId(App app) {
return RegExp('^[0-9]+\$').hasMatch(app.id);
}
replaceMatchGroupsInString(RegExpMatch match, String matchGroupString) {
if (RegExp('^\\d+\$').hasMatch(matchGroupString)) {
matchGroupString = '\$$matchGroupString';
}
// Regular expression to match numbers in the input string
final numberRegex = RegExp(r'\$\d+');
// Extract all numbers from the input string
final numbers = numberRegex.allMatches(matchGroupString);
if (numbers.isEmpty) {
// If no numbers found, return the original string
return null;
}
// Replace numbers with corresponding match groups
var outputString = matchGroupString;
for (final numberMatch in numbers) {
final number = numberMatch.group(0)!;
final matchGroup = match.group(int.parse(number.substring(1))) ?? '';
// Check if the number is preceded by a single backslash
final isEscaped = outputString.contains('\\$number');
// Replace the number with the corresponding match group
if (!isEscaped) {
outputString = outputString.replaceAll(number, matchGroup);
} else {
outputString = outputString.replaceAll('\\$number', number);
}
}
return outputString;
}
String? extractVersion(String? versionExtractionRegEx, String? matchGroupString,
String stringToCheck) {
if (versionExtractionRegEx?.isNotEmpty == true) {
String? version = stringToCheck;
var match = RegExp(versionExtractionRegEx!).allMatches(version);
if (match.isEmpty) {
throw NoVersionError();
}
matchGroupString = matchGroupString?.trim() ?? '';
if (matchGroupString.isEmpty) {
matchGroupString = "0";
}
version = replaceMatchGroupsInString(match.last, matchGroupString);
if (version?.isNotEmpty != true) {
throw NoVersionError();
}
return version!;
} else {
return null;
}
}
class SourceProvider {
// Add more source classes here so they are available via the service
List<AppSource> get sources => [
@ -679,6 +740,18 @@ class SourceProvider {
String standardUrl = source.standardizeUrl(url);
APKDetails apk =
await source.getLatestAPKDetails(standardUrl, additionalSettings);
if (source.runtimeType != HTML().runtimeType) {
// HTML does it separately
String? extractedVersion = extractVersion(
additionalSettings['versionExtractionRegEx'] as String?,
additionalSettings['matchGroupToUse'] as String?,
apk.version);
if (extractedVersion != null) {
apk.version = extractedVersion;
}
}
if (additionalSettings['versionDetection'] == 'releaseDateAsVersion' &&
apk.releaseDate != null) {
apk.version = apk.releaseDate!.microsecondsSinceEpoch.toString();

View File

@ -46,10 +46,10 @@ packages:
dependency: transitive
description:
name: archive
sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b"
sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
url: "https://pub.dev"
source: hosted
version: "3.4.9"
version: "3.4.10"
args:
dependency: transitive
description:

View File

@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.15.3+239 # When changing this, update the tag in main() accordingly
version: 0.15.4+240 # When changing this, update the tag in main() accordingly
environment:
sdk: '>=3.0.0 <4.0.0'