Compare commits

...

7 Commits

Author SHA1 Message Date
02f374fdf0 Merge pull request #969 from ImranR98/dev
Enabled WhatsApp Source (#357)
2023-10-07 13:31:45 -04:00
3536dcd775 Increment version 2023-10-07 13:31:02 -04:00
6fa887e536 Merge pull request #967 from JohnBetaro/main
Better version detection for F-Droid
2023-10-07 13:16:39 -04:00
71755763b9 Enabled WhatsApp Source (#357) 2023-10-07 13:15:22 -04:00
5aabcccfd4 Update fdroid.dart 2023-10-07 09:53:34 +01:00
1e009e2211 Update release.yml 2023-10-07 02:03:18 -04:00
811bc6434b Update release.yml 2023-10-07 02:00:13 -04:00
6 changed files with 22 additions and 52 deletions

View File

@ -1,4 +1,4 @@
name: Release (as Draft)
name: Build and Release
on:
workflow_dispatch:
@ -42,18 +42,16 @@ jobs:
done
rm apksign.keystore
PGP_KEY_FINGERPRINT="${{ steps.import_pgp_key.outputs.fingerprint }}"
gpg --batch --yes --delete-secret-keys "$PGP_KEY_FINGERPRINT"
gpg --batch --yes --delete-keys "$PGP_KEY_FINGERPRINT"
- name: Extract Version
id: extract_version
run: |
VERSION=$(grep -oP "currentVersion = '\K[^']+" lib/main.dart)
echo "::set-output name=version::$VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
TAG=$(grep -oP "'.*\\\$currentVersion.*'" lib/main.dart | head -c -2 | tail -c +2 | sed "s/\$currentVersion/$VERSION/g")
echo "::set-output name=tag::$TAG"
echo "tag=$TAG" >> $GITHUB_OUTPUT
if [ -n "$(echo $TAG | grep -oP '\-beta$')" ]; then BETA=true; else BETA=false; fi
echo "::set-output name=beta::$BETA"
echo "beta=$BETA" >> $GITHUB_OUTPUT
- name: Create Tag
uses: mathieudutour/github-tag-action@v6.1
@ -70,11 +68,3 @@ jobs:
prerelease: "${{ steps.extract_version.outputs.beta }}"
artifacts: ./build/app/outputs/flutter-apk/*-release*.apk*
generateReleaseNotes: true
draft: true
- name: Archive Reports For Job
uses: actions/upload-artifact@v3
with:
name: reports
path: '*/build/reports'
if: ${{ always() }}

View File

@ -11,6 +11,7 @@ class FDroid extends AppSource {
FDroid() {
host = 'f-droid.org';
name = tr('fdroid');
naiveStandardVersionDetection = true;
canSearch = true;
additionalSourceAppSpecificSettingFormItems = [
[

View File

@ -16,14 +16,13 @@ class WhatsApp extends AppSource {
@override
Future<String> apkUrlPrefetchModifier(
String apkUrl, String standardUrl) async {
Response res = await sourceRequest('https://www.whatsapp.com/android');
Response res = await sourceRequest('$standardUrl/android');
if (res.statusCode == 200) {
var targetLinks = parse(res.body)
.querySelectorAll('a')
.map((e) => e.attributes['href'] ?? '')
.where((e) => e.isNotEmpty)
.where((e) =>
e.contains('content.whatsapp.net') && e.contains('WhatsApp.apk'))
.where((e) => e.contains('WhatsApp.apk'))
.toList();
if (targetLinks.isEmpty) {
throw NoAPKError();
@ -39,37 +38,16 @@ class WhatsApp extends AppSource {
String standardUrl,
Map<String, dynamic> additionalSettings,
) async {
Response res = await sourceRequest('https://www.whatsapp.com/android');
if (res.statusCode == 200) {
var targetElements = parse(res.body)
.querySelectorAll('p')
.where((element) => element.innerHtml.contains('Version '))
.toList();
if (targetElements.isEmpty) {
throw NoVersionError();
}
var vLines = targetElements[0]
.innerHtml
.split('\n')
.where((element) => element.contains('Version '))
.toList();
if (vLines.isEmpty) {
throw NoVersionError();
}
var versionMatch = RegExp('[0-9]+(\\.[0-9]+)+').firstMatch(vLines[0]);
if (versionMatch == null) {
throw NoVersionError();
}
String version =
vLines[0].substring(versionMatch.start, versionMatch.end);
return APKDetails(
version,
getApkUrlsFromUrls([
'https://www.whatsapp.com/android?v=$version&=thisIsaPlaceholder&a=realURLPrefetchedAtDownloadTime'
]),
AppNames('Meta', 'WhatsApp'));
} else {
throw getObtainiumHttpError(res);
}
// This is a CDN link that is consistent per version
// But it has query params that change constantly
Uri apkUri =
Uri.parse(await apkUrlPrefetchModifier(standardUrl, standardUrl));
var unusableApkUrl = '${apkUri.origin}/${apkUri.path}';
// So we use the param-less URL is a pseudo-version to add the app and check for updates
// See #357 for why we can't scrape the version number directly
// But we re-fetch the URL again with its latest query params at the actual download time
String version = unusableApkUrl.hashCode.toString();
return APKDetails(version, getApkUrlsFromUrls([unusableApkUrl]),
AppNames('Meta', 'WhatsApp'));
}
}

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.14.23';
const String currentVersion = '0.14.24';
const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES

View File

@ -28,6 +28,7 @@ import 'package:obtainium/app_sources/steammobile.dart';
import 'package:obtainium/app_sources/telegramapp.dart';
import 'package:obtainium/app_sources/uptodown.dart';
import 'package:obtainium/app_sources/vlc.dart';
import 'package:obtainium/app_sources/whatsapp.dart';
import 'package:obtainium/components/generated_form.dart';
import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/mass_app_sources/githubstars.dart';
@ -557,7 +558,7 @@ class SourceProvider {
Mullvad(),
Signal(),
VLC(),
// WhatsApp(), // As of 2023-03-20 this is unusable as the version on the webpage is months out of date
WhatsApp(), // As of 2023-03-20 this is unusable as the version on the webpage is months out of date
TelegramApp(),
SteamMobile(),
NeutronCode(),

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.14.23+215 # When changing this, update the tag in main() accordingly
version: 0.14.24+216 # When changing this, update the tag in main() accordingly
environment:
sdk: '>=3.0.0 <4.0.0'