Skip to content

Commit

Permalink
Merge pull request #2043 from ImranR98/dev
Browse files Browse the repository at this point in the history
APKPure bugfix, Restore "Telegram App" source (#2025)
  • Loading branch information
ImranR98 authored Dec 20, 2024
2 parents 3ebbd2a + c84f51b commit 18ccd01
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 62 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Currently supported App sources:
- Jenkins Jobs
- [APKMirror](https://apkmirror.com/) (Track-Only)
- Other - App-Specific:
- [Telegram App](https://telegram.org)
- [Neutron Code](https://neutroncode.com)
- Direct APK Link
- "HTML" (Fallback): Any other URL that returns an HTML page with links to APK files
Expand Down
18 changes: 12 additions & 6 deletions lib/app_sources/apkpure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,18 @@ class APKPure extends AppSource {
throw NoAPKError();
}
String version = Uri.parse(link).pathSegments.last;
String author = html
.querySelector('span.info-sdk')
?.text
.trim()
.substring(version.length + 4) ??
Uri.parse(standardUrl).pathSegments.reversed.last;
String? author;
try {
author = html
.querySelector('span.info-sdk')
?.text
.trim()
.substring(version.length + 4) ??
Uri.parse(standardUrl).pathSegments.reversed.last;
} catch (e) {
author = html.querySelector('span.info-sdk')?.text.trim() ??
Uri.parse(standardUrl).pathSegments.reversed.last;
}
String appName =
html.querySelector('h1.info-title')?.text.trim() ?? appId;
String? changeLog = html
Expand Down
4 changes: 3 additions & 1 deletion lib/app_sources/telegramapp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class TelegramApp extends AppSource {
throw NoVersionError();
}
String? apkUrl = 'https://telegram.org/dl/android/apk';
return APKDetails(version, getApkUrlsFromUrls([apkUrl]),
return APKDetails(
version,
[MapEntry<String, String>('telegram-$version.apk', apkUrl)],
AppNames('Telegram', 'Telegram'));
} else {
throw getObtainiumHttpError(res);
Expand Down
18 changes: 2 additions & 16 deletions lib/providers/source_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import 'package:obtainium/app_sources/jenkins.dart';
import 'package:obtainium/app_sources/neutroncode.dart';
import 'package:obtainium/app_sources/sourceforge.dart';
import 'package:obtainium/app_sources/sourcehut.dart';
import 'package:obtainium/app_sources/telegramapp.dart';
import 'package:obtainium/app_sources/tencent.dart';
import 'package:obtainium/app_sources/uptodown.dart';
import 'package:obtainium/components/generated_form.dart';
Expand Down Expand Up @@ -258,22 +259,6 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) {
replacementAdditionalSettings['matchGroupToUse'] = "1";
additionalSettings = replacementAdditionalSettings;
}
// Telegram App from before it was removed should be converted to Direct APK Link (#1943)
if (json['url'] == 'https://telegram.org' &&
json['id'] == 'org.telegram.messenger.web' &&
json['author'] == 'Telegram' &&
json['name'] == 'Telegram' &&
json['overrideSource'] == null &&
additionalSettings['trackOnly'] == false &&
additionalSettings['versionExtractionRegEx'] == '' &&
json['lastUpdateCheck'] != null) {
json['url'] = 'https://telegram.org/dl/android/apk';
var newSource = DirectAPKLink();
json['overrideSource'] = newSource.runtimeType.toString();
var replacementAdditionalSettings = getDefaultValuesFromFormItems(
newSource.combinedAppSpecificSettingFormItems);
additionalSettings = replacementAdditionalSettings;
}
}
json['additionalSettings'] = jsonEncode(additionalSettings);
// F-Droid no longer needs cloudflare exception since override can be used - migrate apps appropriately
Expand Down Expand Up @@ -879,6 +864,7 @@ class SourceProvider {
Tencent(),
Jenkins(),
APKMirror(),
TelegramApp(),
NeutronCode(),
DirectAPKLink(),
HTML() // This should ALWAYS be the last option as they are tried in order
Expand Down
84 changes: 46 additions & 38 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ packages:
dependency: "direct main"
description:
name: android_intent_plus
sha256: "38921ec22ebb3b9a7eb678792cf6fab0b6f458b61b9d327688573449c9b47db3"
sha256: "53136214d506d3128c9f4e5bfce3d026abe7e8038958629811a8d3223b1757c1"
url: "https://pub.dev"
source: hosted
version: "5.2.0"
version: "5.2.1"
android_package_installer:
dependency: "direct main"
description:
Expand Down Expand Up @@ -47,10 +47,10 @@ packages:
dependency: "direct main"
description:
name: app_links
sha256: ad1a6d598e7e39b46a34f746f9a8b011ee147e4c275d407fa457e7a62f84dd99
sha256: "433df2e61b10519407475d7f69e470789d23d593f28224c38ba1068597be7950"
url: "https://pub.dev"
source: hosted
version: "6.3.2"
version: "6.3.3"
app_links_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -79,10 +79,10 @@ packages:
dependency: transitive
description:
name: archive
sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d
sha256: "6199c74e3db4fbfbd04f66d739e72fe11c8a8957d5f219f1f4482dbde6420b5a"
url: "https://pub.dev"
source: hosted
version: "3.6.1"
version: "4.0.2"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -111,10 +111,10 @@ packages:
dependency: "direct main"
description:
name: battery_plus
sha256: "220c8f1961efb01d6870493b5ac5a80afaeaffc8757f7a11ed3025a8570d29e7"
sha256: a0409fe7d21905987eb1348ad57c634f913166f14f0c8936b73d3f5940fac551
url: "https://pub.dev"
source: hosted
version: "6.2.0"
version: "6.2.1"
battery_plus_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -175,10 +175,10 @@ packages:
dependency: "direct main"
description:
name: connectivity_plus
sha256: "876849631b0c7dc20f8b471a2a03142841b482438e3b707955464f5ffca3e4c3"
sha256: e0817759ec6d2d8e57eb234e6e57d2173931367a865850c7acea40d4b4f9c27d
url: "https://pub.dev"
source: hosted
version: "6.1.0"
version: "6.1.1"
connectivity_plus_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -231,18 +231,18 @@ packages:
dependency: "direct main"
description:
name: device_info_plus
sha256: f545ffbadee826f26f2e1a0f0cbd667ae9a6011cc0f77c0f8f00a969655e6e95
sha256: "4fa68e53e26ab17b70ca39f072c285562cfc1589df5bb1e9295db90f6645f431"
url: "https://pub.dev"
source: hosted
version: "11.1.1"
version: "11.2.0"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba"
sha256: "0b04e02b30791224b31969eb1b50d723498f402971bff3630bca2ba839bd1ed2"
url: "https://pub.dev"
source: hosted
version: "7.0.1"
version: "7.0.2"
dynamic_color:
dependency: "direct main"
description:
Expand Down Expand Up @@ -303,10 +303,10 @@ packages:
dependency: "direct main"
description:
name: file_picker
sha256: "16dc141db5a2ccc6520ebb6a2eb5945b1b09e95085c021d9f914f8ded7f1465c"
sha256: c2376a6aae82358a9f9ccdd7d1f4006d08faa39a2767cce01031d9f593a8bd3b
url: "https://pub.dev"
source: hosted
version: "8.1.4"
version: "8.1.6"
fixnum:
dependency: transitive
description:
Expand Down Expand Up @@ -457,10 +457,10 @@ packages:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: "9b78450b89f059e96c9ebb355fa6b3df1d6b330436e0b885fb49594c41721398"
sha256: "615a505aef59b151b46bbeef55b36ce2b6ed299d160c51d84281946f0aa0ce0e"
url: "https://pub.dev"
source: hosted
version: "2.0.23"
version: "2.0.24"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -483,10 +483,10 @@ packages:
dependency: "direct main"
description:
name: fluttertoast
sha256: "95f349437aeebe524ef7d6c9bde3e6b4772717cf46a0eb6a3ceaddc740b297cc"
sha256: "24467dc20bbe49fd63e57d8e190798c4d22cbbdac30e54209d153a15273721d1"
url: "https://pub.dev"
source: hosted
version: "8.2.8"
version: "8.2.10"
fraction:
dependency: transitive
description:
Expand Down Expand Up @@ -539,10 +539,10 @@ packages:
dependency: transitive
description:
name: image
sha256: f31d52537dc417fdcde36088fdf11d191026fd5e4fae742491ebd40e5a8bea7d
sha256: "8346ad4b5173924b5ddddab782fc7d8a6300178c8b1dc427775405a01701c4a6"
url: "https://pub.dev"
source: hosted
version: "4.3.0"
version: "4.5.2"
intl:
dependency: transitive
description:
Expand Down Expand Up @@ -667,10 +667,10 @@ packages:
dependency: transitive
description:
name: path_provider_android
sha256: "8c4967f8b7cb46dc914e178daa29813d83ae502e0529d7b0478330616a691ef7"
sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2"
url: "https://pub.dev"
source: hosted
version: "2.2.14"
version: "2.2.15"
path_provider_foundation:
dependency: transitive
description:
Expand Down Expand Up @@ -807,6 +807,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.10.2+1"
posix:
dependency: transitive
description:
name: posix
sha256: a0117dc2167805aa9125b82eee515cc891819bac2f538c83646d355b16f58b9a
url: "https://pub.dev"
source: hosted
version: "6.0.1"
provider:
dependency: "direct main"
description:
Expand All @@ -819,42 +827,42 @@ packages:
dependency: "direct main"
description:
name: share_plus
sha256: "9c9bafd4060728d7cdb2464c341743adbd79d327cb067ec7afb64583540b47c8"
sha256: "6327c3f233729374d0abaafd61f6846115b2a481b4feddd8534211dc10659400"
url: "https://pub.dev"
source: hosted
version: "10.1.2"
version: "10.1.3"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
sha256: c57c0bbfec7142e3a0f55633be504b796af72e60e3c791b44d5a017b985f7a48
sha256: cc012a23fc2d479854e6c80150696c4a5f5bb62cb89af4de1c505cf78d0a5d0b
url: "https://pub.dev"
source: hosted
version: "5.0.1"
version: "5.0.2"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: "95f9997ca1fb9799d494d0cb2a780fd7be075818d59f00c43832ed112b158a82"
sha256: "3c7e73920c694a436afaf65ab60ce3453d91f84208d761fbd83fc21182134d93"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
version: "2.3.4"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "7f172d1b06de5da47b6264c2692ee2ead20bbbc246690427cdb4fc301cd0c549"
sha256: "02a7d8a9ef346c9af715811b01fbd8e27845ad2c41148eefd31321471b41863d"
url: "https://pub.dev"
source: hosted
version: "2.3.4"
version: "2.4.0"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "07e050c7cd39bad516f8d64c455f04508d09df104be326d8c02551590a0d513d"
sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03"
url: "https://pub.dev"
source: hosted
version: "2.5.3"
version: "2.5.4"
shared_preferences_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -1145,10 +1153,10 @@ packages:
dependency: transitive
description:
name: webview_flutter_android
sha256: "285cedfd9441267f6cca8843458620b5fda1af75b04f5818d0441acda5d7df19"
sha256: "3d535126f7244871542b2f0b0fcf94629c9a14883250461f9abe1a6644c1c379"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
version: "4.2.0"
webview_flutter_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -1201,10 +1209,10 @@ packages:
dependency: transitive
description:
name: yaml
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
url: "https://pub.dev"
source: hosted
version: "3.1.2"
version: "3.1.3"
sdks:
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.24.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 1.1.36+2293
version: 1.1.37+2294

environment:
sdk: '>=3.0.0 <4.0.0'
Expand Down

0 comments on commit 18ccd01

Please sign in to comment.