mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-01 21:30:16 +02:00
Multi-host support + add '.net' host to APKPure source (#1250)
This commit is contained in:
@@ -59,7 +59,9 @@ class AddAppPageState extends State<AddAppPage> {
|
||||
if (updateUrlInput) {
|
||||
urlInputKey++;
|
||||
}
|
||||
var prevHost = pickedSource?.host;
|
||||
var prevHost = pickedSource?.hosts.isNotEmpty == true
|
||||
? pickedSource?.hosts[0]
|
||||
: null;
|
||||
try {
|
||||
var naturalSource =
|
||||
valid ? sourceProvider.getSource(userInput) : null;
|
||||
@@ -77,7 +79,7 @@ class AddAppPageState extends State<AddAppPage> {
|
||||
overrideSource: pickedSourceOverride)
|
||||
: null;
|
||||
if (pickedSource.runtimeType != source.runtimeType ||
|
||||
(prevHost != null && prevHost != source?.host)) {
|
||||
(prevHost != null && prevHost != source?.hosts[0])) {
|
||||
pickedSource = source;
|
||||
additionalSettings = source != null
|
||||
? getDefaultValuesFromFormItems(
|
||||
@@ -508,16 +510,16 @@ class AddAppPageState extends State<AddAppPage> {
|
||||
height: 16,
|
||||
),
|
||||
...sourceProvider.sources.map((e) => GestureDetector(
|
||||
onTap: e.host != null
|
||||
onTap: e.hosts.isNotEmpty
|
||||
? () {
|
||||
launchUrlString('https://${e.host}',
|
||||
launchUrlString('https://${e.hosts[0]}',
|
||||
mode: LaunchMode.externalApplication);
|
||||
}
|
||||
: null,
|
||||
child: Text(
|
||||
'${e.name}${e.enforceTrackOnly ? ' ${tr('trackOnlyInBrackets')}' : ''}${e.canSearch ? ' ${tr('searchableInBrackets')}' : ''}',
|
||||
style: TextStyle(
|
||||
decoration: e.host != null
|
||||
decoration: e.hosts.isNotEmpty
|
||||
? TextDecoration.underline
|
||||
: TextDecoration.none,
|
||||
fontStyle: FontStyle.italic),
|
||||
|
@@ -199,10 +199,11 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
...source.searchQuerySettingFormItems.map((e) => [e]),
|
||||
[
|
||||
GeneratedFormTextField('url',
|
||||
label: source.host != null
|
||||
label: source.hosts.isNotEmpty
|
||||
? tr('overrideSource')
|
||||
: plural('url', 1).substring(2),
|
||||
defaultValue: source.host ?? '',
|
||||
defaultValue:
|
||||
source.hosts.isNotEmpty ? source.hosts[0] : '',
|
||||
required: true)
|
||||
],
|
||||
],
|
||||
@@ -212,7 +213,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
setState(() {
|
||||
importInProgress = true;
|
||||
});
|
||||
if (values['url'] != source.host) {
|
||||
if (values['url'] != source.hosts[0]) {
|
||||
source = sourceProvider.getSource(values['url'],
|
||||
overrideSource: source.runtimeType.toString());
|
||||
}
|
||||
|
Reference in New Issue
Block a user