Compare commits

...

15 Commits

Author SHA1 Message Date
84b512f282 Merge pull request #530 from ImranR98/dev
Added F-Droid search (#526) + search UI improvements
2023-05-03 18:41:44 -04:00
6f9aa85a72 Merge remote-tracking branch 'origin/main' into dev 2023-05-03 18:41:03 -04:00
639fc20fcb Added F-Droid search (#526) + search UI improvements 2023-05-03 18:40:34 -04:00
75631e5c5a Merge pull request #529 from ImranR98/dev
SourceForge URL flexibility (#525), Add language names, enable Spanish
2023-05-03 18:02:05 -04:00
9ec345761e Actually increment version 2023-05-03 18:01:47 -04:00
1f9c2c1699 Update packages, increment version 2023-05-03 18:00:57 -04:00
cbec486ad1 Add language names and enable Spanish 2023-05-03 18:00:24 -04:00
85ef60d4a8 Merge pull request #524 from mehdijahann/main
Update fa.json
2023-05-03 17:50:54 -04:00
44bde571bf Merge pull request #522 from markus-gitdev/main
Update de.json
2023-05-03 17:50:46 -04:00
eaaee5e7cd Merge pull request #523 from bluefly000/japanese-translation
Update ja.json
2023-05-03 17:50:38 -04:00
e1980f4de2 SourceForge URL flexibility (#525) 2023-05-03 17:49:50 -04:00
be9c671a56 Update fa.json 2023-05-03 09:06:44 +08:00
0404449842 Update fa.json 2023-05-03 09:03:55 +08:00
d6366a145e Update ja.json 2023-05-02 13:38:22 +09:00
0a751cf545 Update de.json
Correction of "changeX".
New translations for:
- "overrideSource"
- "dontShowAgain"
- "dontShowTrackOnlyWarnings"
- "dontShowAPKOriginWarnings"
2023-05-01 13:58:46 +02:00
16 changed files with 130 additions and 75 deletions

View File

@ -71,7 +71,7 @@
"updateX": "Aktualisiere {}",
"installX": "Installiere {}",
"markXTrackOnlyAsUpdated": "Markiere {}\n(Nur Nachverfolgen)\nals aktualisiert",
"changeX": "Ändern {}",
"changeX": "Ändere {}",
"installUpdateApps": "Apps installieren/aktualisieren",
"installUpdateSelectedApps": "Ausgewählte Apps installieren/aktualisieren",
"markXSelectedAppsAsUpdated": "Markiere {} ausgewählte Apps als aktuell?",
@ -224,10 +224,10 @@
"standardVersionDetection": "Standardversionserkennung",
"groupByCategory": "Nach Kategorie gruppieren",
"autoApkFilterByArch": "Nach Möglichkeit versuchen, APKs nach CPU-Architektur zu filtern",
"overrideSource": "Override Source",
"dontShowAgain": "Don't show this again",
"dontShowTrackOnlyWarnings": "Don't Show the 'Track-Only' Warning",
"dontShowAPKOriginWarnings": "Don't Show APK Origin Warnings",
"overrideSource": "Quelle überschreiben",
"dontShowAgain": "Nicht noch einmal zeigen",
"dontShowTrackOnlyWarnings": "Warnung für 'Nur Nachverfolgen' nicht anzeigen",
"dontShowAPKOriginWarnings": "Warnung für APK-Herkunft nicht anzeigen",
"removeAppQuestion": {
"one": "App entfernen?",
"other": "Apps entfernen?"

View File

@ -122,7 +122,7 @@
"followSystem": "هماهنگ با سیستم",
"obtainium": "Obtainium",
"materialYou": "Material You",
"useBlackTheme": "Use pure black dark theme",
"useBlackTheme": "استفاده از تم تیره سیاه خالص",
"appSortBy": "مرتب سازی برنامه بر اساس",
"authorName": "سازنده/اسم",
"nameAuthor": "اسم/سازنده",
@ -224,10 +224,10 @@
"standardVersionDetection": "تشخیص نسخه استاندارد",
"groupByCategory": "گروه بر اساس دسته",
"autoApkFilterByArch": "در صورت امکان سعی کنید APKها را بر اساس معماری CPU فیلتر کنید",
"overrideSource": "Override Source",
"dontShowAgain": "Don't show this again",
"dontShowTrackOnlyWarnings": "Don't Show the 'Track-Only' Warning",
"dontShowAPKOriginWarnings": "Don't Show APK Origin Warnings",
"overrideSource": "نادیده گرفتن منبع",
"dontShowAgain": "دوباره این را نشان نده",
"dontShowTrackOnlyWarnings": "هشدار 'فقط ردیابی' را نشان ندهید",
"dontShowAPKOriginWarnings": "هشدارهای منبع APK را نشان ندهید",
"removeAppQuestion": {
"one": "برنامه حذف شود؟",
"other": "برنامه ها حذف شوند؟"

View File

@ -122,7 +122,7 @@
"followSystem": "システムに従う",
"obtainium": "Obtainium",
"materialYou": "Material You",
"useBlackTheme": "Use pure black dark theme",
"useBlackTheme": "ピュアブラックダークテーマを使用する",
"appSortBy": "アプリの並び方",
"authorName": "作者名/アプリ名",
"nameAuthor": "アプリ名/作者名",
@ -224,10 +224,10 @@
"standardVersionDetection": "標準のバージョン検出",
"groupByCategory": "カテゴリ別にグループ化する",
"autoApkFilterByArch": "可能であればCPUアーキテクチャによるAPKのフィルタリングを試みる",
"overrideSource": "Override Source",
"dontShowAgain": "Don't show this again",
"dontShowTrackOnlyWarnings": "Don't Show the 'Track-Only' Warning",
"dontShowAPKOriginWarnings": "Don't Show APK Origin Warnings",
"overrideSource": "ソースの上書き",
"dontShowAgain": "二度と表示しない",
"dontShowTrackOnlyWarnings": "「追跡のみ」の警告を表示しない",
"dontShowAPKOriginWarnings": "APK Originの警告を表示しない",
"removeAppQuestion": {
"one": "アプリを削除しますか?",
"other": "アプリを削除しますか?"

View File

@ -70,7 +70,7 @@ class Codeberg extends AppSource {
}
@override
Future<Map<String, String>> search(String query) async {
Future<Map<String, List<String>>> search(String query) async {
return gh.searchCommon(
query,
'https://$host/api/v1/repos/search?q=${Uri.encodeQueryComponent(query)}&limit=100',

View File

@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:easy_localization/easy_localization.dart';
import 'package:html/parser.dart';
import 'package:http/http.dart';
import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/providers/source_provider.dart';
@ -9,6 +10,7 @@ class FDroid extends AppSource {
FDroid() {
host = 'f-droid.org';
name = tr('fdroid');
canSearch = true;
}
@override
@ -68,4 +70,32 @@ class FDroid extends AppSource {
'https://$host/repo/$appId',
standardUrl);
}
@override
Future<Map<String, List<String>>> search(String query) async {
Response res = await get(Uri.parse('https://search.$host/?q=$query'));
if (res.statusCode == 200) {
Map<String, List<String>> urlsWithDescriptions = {};
parse(res.body).querySelectorAll('.package-header').forEach((e) {
String? url = e.attributes['href'];
if (url != null) {
try {
standardizeUrl(url);
} catch (e) {
url = null;
}
}
if (url != null) {
urlsWithDescriptions[url] = [
e.querySelector('.package-name')?.text.trim() ?? '',
e.querySelector('.package-summary')?.text.trim() ??
tr('noDescription')
];
}
});
return urlsWithDescriptions;
} else {
throw getObtainiumHttpError(res);
}
}
}

View File

@ -213,19 +213,21 @@ class GitHub extends AppSource {
return AppNames(names[0], names[1]);
}
Future<Map<String, String>> searchCommon(
Future<Map<String, List<String>>> searchCommon(
String query, String requestUrl, String rootProp,
{Function(Response)? onHttpErrorCode}) async {
Response res = await get(Uri.parse(requestUrl));
if (res.statusCode == 200) {
Map<String, String> urlsWithDescriptions = {};
Map<String, List<String>> urlsWithDescriptions = {};
for (var e in (jsonDecode(res.body)[rootProp] as List<dynamic>)) {
urlsWithDescriptions.addAll({
e['html_url'] as String:
((e['archived'] == true ? '[ARCHIVED] ' : '') +
(e['description'] != null
? e['description'] as String
: tr('noDescription')))
e['html_url'] as String: [
e['full_name'] as String,
((e['archived'] == true ? '[ARCHIVED] ' : '') +
(e['description'] != null
? e['description'] as String
: tr('noDescription')))
]
});
}
return urlsWithDescriptions;
@ -238,7 +240,7 @@ class GitHub extends AppSource {
}
@override
Future<Map<String, String>> search(String query) async {
Future<Map<String, List<String>>> search(String query) async {
return searchCommon(
query,
'https://${await getCredentialPrefixIfAny()}api.$host/search/repositories?q=${Uri.encodeQueryComponent(query)}&per_page=100',

View File

@ -10,8 +10,14 @@ class SourceForge extends AppSource {
@override
String sourceSpecificStandardizeURL(String url) {
RegExp standardUrlRegEx = RegExp('^https?://$host/projects/[^/]+');
RegExpMatch? match = standardUrlRegEx.firstMatch(url.toLowerCase());
RegExp standardUrlRegExB = RegExp('^https?://$host/p/[^/]+');
RegExpMatch? match = standardUrlRegExB.firstMatch(url.toLowerCase());
if (match != null) {
url =
'https://${Uri.parse(url.substring(0, match.end)).host}/projects/${url.substring(Uri.parse(url.substring(0, match.end)).host.length + '/projects/'.length + 1)}';
}
RegExp standardUrlRegExA = RegExp('^https?://$host/projects/[^/]+');
match = standardUrlRegExA.firstMatch(url.toLowerCase());
if (match == null) {
throw InvalidURLError(name);
}

View File

@ -21,21 +21,22 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
// ignore: implementation_imports
import 'package:easy_localization/src/localization.dart';
const String currentVersion = '0.12.2';
const String currentVersion = '0.12.3';
const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
const int bgUpdateCheckAlarmId = 666;
const supportedLocales = [
Locale('en'),
Locale('zh'),
Locale('it'),
Locale('ja'),
Locale('hu'),
Locale('de'),
Locale('fa'),
Locale('fr')
List<MapEntry<Locale, String>> supportedLocales = const [
MapEntry(Locale('en'), 'English'),
MapEntry(Locale('zh'), '汉语'),
MapEntry(Locale('it'), 'Italiano'),
MapEntry(Locale('ja'), '日本語'),
MapEntry(Locale('hu'), 'Magyar'),
MapEntry(Locale('de'), 'Deutsch'),
MapEntry(Locale('fa'), 'فارسی'),
MapEntry(Locale('fr'), 'Français'),
MapEntry(Locale('es'), 'Español'),
];
const fallbackLocale = Locale('en');
const localeDir = 'assets/translations';
@ -52,7 +53,7 @@ Future<void> loadTranslations() async {
saveLocale: true,
forceLocale: forceLocale != null ? Locale(forceLocale) : null,
fallbackLocale: fallbackLocale,
supportedLocales: supportedLocales,
supportedLocales: supportedLocales.map((e) => e.key).toList(),
assetLoader: const RootBundleAssetLoader(),
useOnlyLangCode: true,
useFallbackTranslations: true,
@ -171,7 +172,7 @@ void main() async {
Provider(create: (context) => LogsProvider())
],
child: EasyLocalization(
supportedLocales: supportedLocales,
supportedLocales: supportedLocales.map((e) => e.key).toList(),
path: localeDir,
fallbackLocale: fallbackLocale,
useOnlyLangCode: true,
@ -221,7 +222,7 @@ class _ObtainiumState extends State<Obtainium> {
], onlyIfExists: false);
}
if (!supportedLocales
.map((e) => e.languageCode)
.map((e) => e.key.languageCode)
.contains(context.locale.languageCode) ||
settingsProvider.forcedLocale == null &&
context.deviceLocale.languageCode !=

View File

@ -13,17 +13,20 @@ class GitHubStars implements MassAppUrlSource {
@override
late List<String> requiredArgs = [tr('uname')];
Future<Map<String, String>> getOnePageOfUserStarredUrlsWithDescriptions(
Future<Map<String, List<String>>> getOnePageOfUserStarredUrlsWithDescriptions(
String username, int page) async {
Response res = await get(Uri.parse(
'https://${await GitHub().getCredentialPrefixIfAny()}api.github.com/users/$username/starred?per_page=100&page=$page'));
if (res.statusCode == 200) {
Map<String, String> urlsWithDescriptions = {};
Map<String, List<String>> urlsWithDescriptions = {};
for (var e in (jsonDecode(res.body) as List<dynamic>)) {
urlsWithDescriptions.addAll({
e['html_url'] as String: e['description'] != null
? e['description'] as String
: tr('noDescription')
e['html_url'] as String: [
e['full_name'] as String,
e['description'] != null
? e['description'] as String
: tr('noDescription')
]
});
}
return urlsWithDescriptions;
@ -35,11 +38,12 @@ class GitHubStars implements MassAppUrlSource {
}
@override
Future<Map<String, String>> getUrlsWithDescriptions(List<String> args) async {
Future<Map<String, List<String>>> getUrlsWithDescriptions(
List<String> args) async {
if (args.length != requiredArgs.length) {
throw ObtainiumError(tr('wrongArgNum'));
}
Map<String, String> urlsWithDescriptions = {};
Map<String, List<String>> urlsWithDescriptions = {};
var page = 1;
while (true) {
var pageUrls =

View File

@ -254,7 +254,7 @@ class _AddAppPageState extends State<AddAppPage> {
// .then((results) async {
// Interleave results instead of simple reduce
Map<String, String> res = {};
Map<String, List<String>> res = {};
var si = 0;
var done = false;
while (!done) {

View File

@ -470,7 +470,7 @@ class UrlSelectionModal extends StatefulWidget {
this.selectedByDefault = true,
this.onlyOneSelectionAllowed = false});
Map<String, String> urlsWithDescriptions;
Map<String, List<String>> urlsWithDescriptions;
bool selectedByDefault;
bool onlyOneSelectionAllowed;
@ -479,7 +479,7 @@ class UrlSelectionModal extends StatefulWidget {
}
class _UrlSelectionModalState extends State<UrlSelectionModal> {
Map<MapEntry<String, String>, bool> urlWithDescriptionSelections = {};
Map<MapEntry<String, List<String>>, bool> urlWithDescriptionSelections = {};
@override
void initState() {
super.initState();
@ -522,16 +522,28 @@ class _UrlSelectionModalState extends State<UrlSelectionModal> {
launchUrlString(urlWithD.key,
mode: LaunchMode.externalApplication);
},
child: Text(
Uri.parse(urlWithD.key).path.substring(1),
style: const TextStyle(decoration: TextDecoration.underline),
textAlign: TextAlign.start,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
urlWithD.value[0],
style: const TextStyle(
decoration: TextDecoration.underline,
fontWeight: FontWeight.bold),
textAlign: TextAlign.start,
),
Text(
Uri.parse(urlWithD.key).host,
style: const TextStyle(
decoration: TextDecoration.underline, fontSize: 12),
)
],
));
var descriptionText = Text(
urlWithD.value.length > 128
? '${urlWithD.value.substring(0, 128)}...'
: urlWithD.value,
urlWithD.value[1].length > 128
? '${urlWithD.value[1].substring(0, 128)}...'
: urlWithD.value[1],
style: const TextStyle(fontStyle: FontStyle.italic, fontSize: 12),
);

View File

@ -144,8 +144,8 @@ class _SettingsPageState extends State<SettingsPage> {
child: Text(tr('followSystem')),
),
...supportedLocales.map((e) => DropdownMenuItem(
value: e.toLanguageTag(),
child: Text(e.toLanguageTag().toUpperCase()),
value: e.key.toLanguageTag(),
child: Text(e.value),
))
],
onChanged: (value) {

View File

@ -216,7 +216,7 @@ class SettingsProvider with ChangeNotifier {
String? get forcedLocale {
var fl = prefs?.getString('forcedLocale');
return supportedLocales
.where((element) => element.toLanguageTag() == fl)
.where((element) => element.key.toLanguageTag() == fl)
.isNotEmpty
? fl
: null;
@ -226,7 +226,7 @@ class SettingsProvider with ChangeNotifier {
if (fl == null) {
prefs?.remove('forcedLocale');
} else if (supportedLocales
.where((element) => element.toLanguageTag() == fl)
.where((element) => element.key.toLanguageTag() == fl)
.isNotEmpty) {
prefs?.setString('forcedLocale', fl);
}

View File

@ -415,7 +415,7 @@ abstract class AppSource {
}
bool canSearch = false;
Future<Map<String, String>> search(String query) {
Future<Map<String, List<String>>> search(String query) {
throw NotImplementedError();
}
@ -433,7 +433,7 @@ ObtainiumError getObtainiumHttpError(Response res) {
abstract class MassAppUrlSource {
late String name;
late List<String> requiredArgs;
Future<Map<String, String>> getUrlsWithDescriptions(List<String> args);
Future<Map<String, List<String>>> getUrlsWithDescriptions(List<String> args);
}
regExValidator(String? value) {

View File

@ -38,10 +38,10 @@ packages:
dependency: transitive
description:
name: args
sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440"
sha256: c372bb384f273f0c2a8aaaa226dad84dc27c8519a691b888725dec59518ad53a
url: "https://pub.dev"
source: hosted
version: "2.4.0"
version: "2.4.1"
async:
dependency: transitive
description:
@ -282,18 +282,18 @@ packages:
dependency: "direct main"
description:
name: html
sha256: "79d498e6d6761925a34ee5ea8fa6dfef38607781d2fa91e37523474282af55cb"
sha256: "58e3491f7bf0b6a4ea5110c0c688877460d1a6366731155c4a4580e7ded773e8"
url: "https://pub.dev"
source: hosted
version: "0.15.2"
version: "0.15.3"
http:
dependency: "direct main"
description:
name: http
sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482"
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
url: "https://pub.dev"
source: hosted
version: "0.13.5"
version: "0.13.6"
http_parser:
dependency: transitive
description:
@ -338,10 +338,10 @@ packages:
dependency: transitive
description:
name: markdown
sha256: d95a9d12954aafc97f984ca29baaa7690ed4d9ec4140a23ad40580bcdb6c87f5
sha256: "8e332924094383133cee218b676871f42db2514f1f6ac617b6cf6152a7faab8e"
url: "https://pub.dev"
source: hosted
version: "7.0.2"
version: "7.1.0"
matcher:
dependency: transitive
description:
@ -791,10 +791,10 @@ packages:
dependency: transitive
description:
name: webview_flutter_android
sha256: d6cf18cd6c809c5a9294cd99707a21986aac4e08c87e1916ce2590315fb55d3a
sha256: "1acea8def62592123e2fbbca164ed8681a98a890bdcbb88f916d5b4a22687759"
url: "https://pub.dev"
source: hosted
version: "3.6.2"
version: "3.7.0"
webview_flutter_platform_interface:
dependency: transitive
description:
@ -807,10 +807,10 @@ packages:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: c94d242d8cbe1012c06ba7ac790c46d6e6b68723b7d34f8c74ed19f68d166f49
sha256: "61f33512810bf1ee9ac89761a4b02663ff64e8227b7dc80654642acd660fd49d"
url: "https://pub.dev"
source: hosted
version: "3.4.0"
version: "3.4.2"
win32:
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.12.2+162 # When changing this, update the tag in main() accordingly
version: 0.12.3+163 # When changing this, update the tag in main() accordingly
environment:
sdk: '>=2.18.2 <3.0.0'