mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-23 19:03:46 +02:00
Merge pull request #1280 from ImranR98/dev
- Fix form input issues (related to #1272) - HTML Source bugfix (related to #1259)
This commit is contained in:
@@ -149,6 +149,7 @@ class HTML extends AppSource {
|
|||||||
[
|
[
|
||||||
GeneratedFormTextField('requestHeader',
|
GeneratedFormTextField('requestHeader',
|
||||||
label: tr('requestHeader'),
|
label: tr('requestHeader'),
|
||||||
|
required: false,
|
||||||
additionalValidators: [
|
additionalValidators: [
|
||||||
(value) {
|
(value) {
|
||||||
if ((value ?? 'empty:valid')
|
if ((value ?? 'empty:valid')
|
||||||
@@ -301,16 +302,15 @@ class HTML extends AppSource {
|
|||||||
}
|
}
|
||||||
var rel = links.last.key;
|
var rel = links.last.key;
|
||||||
String? version;
|
String? version;
|
||||||
if (additionalSettings['supportFixedAPKURL'] != true) {
|
|
||||||
version = rel.hashCode.toString();
|
|
||||||
}
|
|
||||||
version = extractVersion(
|
version = extractVersion(
|
||||||
additionalSettings['versionExtractionRegEx'] as String?,
|
additionalSettings['versionExtractionRegEx'] as String?,
|
||||||
additionalSettings['matchGroupToUse'] as String?,
|
additionalSettings['matchGroupToUse'] as String?,
|
||||||
additionalSettings['versionExtractWholePage'] == true
|
additionalSettings['versionExtractWholePage'] == true
|
||||||
? res.body.split('\r\n').join('\n').split('\n').join('\\n')
|
? res.body.split('\r\n').join('\n').split('\n').join('\\n')
|
||||||
: rel);
|
: rel);
|
||||||
version ??= (await checkDownloadHash(rel)).toString();
|
version ??= additionalSettings['supportFixedAPKURL'] != true
|
||||||
|
? rel.hashCode.toString()
|
||||||
|
: (await checkDownloadHash(rel)).toString();
|
||||||
return APKDetails(version, [rel].map((e) => MapEntry(e, e)).toList(),
|
return APKDetails(version, [rel].map((e) => MapEntry(e, e)).toList(),
|
||||||
AppNames(uri.host, tr('app')));
|
AppNames(uri.host, tr('app')));
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@ abstract class GeneratedFormItem {
|
|||||||
late dynamic defaultValue;
|
late dynamic defaultValue;
|
||||||
List<dynamic> additionalValidators;
|
List<dynamic> additionalValidators;
|
||||||
dynamic ensureType(dynamic val);
|
dynamic ensureType(dynamic val);
|
||||||
|
GeneratedFormItem clone();
|
||||||
|
|
||||||
GeneratedFormItem(this.key,
|
GeneratedFormItem(this.key,
|
||||||
{this.label = 'Input',
|
{this.label = 'Input',
|
||||||
@@ -44,6 +45,20 @@ class GeneratedFormTextField extends GeneratedFormItem {
|
|||||||
String ensureType(val) {
|
String ensureType(val) {
|
||||||
return val.toString();
|
return val.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
GeneratedFormTextField clone() {
|
||||||
|
return GeneratedFormTextField(key,
|
||||||
|
label: label,
|
||||||
|
belowWidgets: belowWidgets,
|
||||||
|
defaultValue: defaultValue,
|
||||||
|
additionalValidators: List.from(additionalValidators),
|
||||||
|
required: required,
|
||||||
|
max: max,
|
||||||
|
hint: hint,
|
||||||
|
password: password,
|
||||||
|
textInputType: textInputType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GeneratedFormDropdown extends GeneratedFormItem {
|
class GeneratedFormDropdown extends GeneratedFormItem {
|
||||||
@@ -64,6 +79,20 @@ class GeneratedFormDropdown extends GeneratedFormItem {
|
|||||||
String ensureType(val) {
|
String ensureType(val) {
|
||||||
return val.toString();
|
return val.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
GeneratedFormDropdown clone() {
|
||||||
|
return GeneratedFormDropdown(
|
||||||
|
key,
|
||||||
|
opts?.map((e) => MapEntry(e.key, e.value)).toList(),
|
||||||
|
label: label,
|
||||||
|
belowWidgets: belowWidgets,
|
||||||
|
defaultValue: defaultValue,
|
||||||
|
disabledOptKeys:
|
||||||
|
disabledOptKeys != null ? List.from(disabledOptKeys!) : null,
|
||||||
|
additionalValidators: List.from(additionalValidators),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GeneratedFormSwitch extends GeneratedFormItem {
|
class GeneratedFormSwitch extends GeneratedFormItem {
|
||||||
@@ -79,6 +108,15 @@ class GeneratedFormSwitch extends GeneratedFormItem {
|
|||||||
bool ensureType(val) {
|
bool ensureType(val) {
|
||||||
return val == true || val == 'true';
|
return val == true || val == 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
GeneratedFormSwitch clone() {
|
||||||
|
return GeneratedFormSwitch(key,
|
||||||
|
label: label,
|
||||||
|
belowWidgets: belowWidgets,
|
||||||
|
defaultValue: defaultValue,
|
||||||
|
additionalValidators: List.from(additionalValidators));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GeneratedFormTagInput extends GeneratedFormItem {
|
class GeneratedFormTagInput extends GeneratedFormItem {
|
||||||
@@ -103,6 +141,20 @@ class GeneratedFormTagInput extends GeneratedFormItem {
|
|||||||
Map<String, MapEntry<int, bool>> ensureType(val) {
|
Map<String, MapEntry<int, bool>> ensureType(val) {
|
||||||
return val is Map<String, MapEntry<int, bool>> ? val : {};
|
return val is Map<String, MapEntry<int, bool>> ? val : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
GeneratedFormTagInput clone() {
|
||||||
|
return GeneratedFormTagInput(key,
|
||||||
|
label: label,
|
||||||
|
belowWidgets: belowWidgets,
|
||||||
|
defaultValue: defaultValue,
|
||||||
|
additionalValidators: List.from(additionalValidators),
|
||||||
|
deleteConfirmationMessage: deleteConfirmationMessage,
|
||||||
|
singleSelect: singleSelect,
|
||||||
|
alignment: alignment,
|
||||||
|
emptyMessage: emptyMessage,
|
||||||
|
showLabelWhenNotEmpty: showLabelWhenNotEmpty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef OnValueChanges = void Function(
|
typedef OnValueChanges = void Function(
|
||||||
@@ -119,6 +171,19 @@ class GeneratedForm extends StatefulWidget {
|
|||||||
State<GeneratedForm> createState() => _GeneratedFormState();
|
State<GeneratedForm> createState() => _GeneratedFormState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<List<GeneratedFormItem>> cloneFormItems(
|
||||||
|
List<List<GeneratedFormItem>> items) {
|
||||||
|
List<List<GeneratedFormItem>> clonedItems = [];
|
||||||
|
for (var row in items) {
|
||||||
|
List<GeneratedFormItem> clonedRow = [];
|
||||||
|
for (var it in row) {
|
||||||
|
clonedRow.add(it.clone());
|
||||||
|
}
|
||||||
|
clonedItems.add(clonedRow);
|
||||||
|
}
|
||||||
|
return clonedItems;
|
||||||
|
}
|
||||||
|
|
||||||
class GeneratedFormSubForm extends GeneratedFormItem {
|
class GeneratedFormSubForm extends GeneratedFormItem {
|
||||||
final List<List<GeneratedFormItem>> items;
|
final List<List<GeneratedFormItem>> items;
|
||||||
|
|
||||||
@@ -129,6 +194,12 @@ class GeneratedFormSubForm extends GeneratedFormItem {
|
|||||||
ensureType(val) {
|
ensureType(val) {
|
||||||
return val; // Not easy to validate List<Map<String, dynamic>>
|
return val; // Not easy to validate List<Map<String, dynamic>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
GeneratedFormSubForm clone() {
|
||||||
|
return GeneratedFormSubForm(key, cloneFormItems(items),
|
||||||
|
label: label, belowWidgets: belowWidgets, defaultValue: defaultValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates a color in the HSLuv (Pastel) color space
|
// Generates a color in the HSLuv (Pastel) color space
|
||||||
@@ -510,15 +581,12 @@ class _GeneratedFormState extends State<GeneratedForm> {
|
|||||||
]);
|
]);
|
||||||
} else if (widget.items[r][e] is GeneratedFormSubForm) {
|
} else if (widget.items[r][e] is GeneratedFormSubForm) {
|
||||||
List<Widget> subformColumn = [];
|
List<Widget> subformColumn = [];
|
||||||
var formItems = (widget.items[r][e] as GeneratedFormSubForm).items;
|
var compact = (widget.items[r][e] as GeneratedFormSubForm)
|
||||||
var compact = formItems.length == 1 && formItems[0].length == 1;
|
.items
|
||||||
|
.length ==
|
||||||
|
1 &&
|
||||||
|
(widget.items[r][e] as GeneratedFormSubForm).items[0].length == 1;
|
||||||
for (int i = 0; i < values[fieldKey].length; i++) {
|
for (int i = 0; i < values[fieldKey].length; i++) {
|
||||||
var items = formItems
|
|
||||||
.map((x) => x.map((y) {
|
|
||||||
y.defaultValue = values[fieldKey]?[i]?[y.key];
|
|
||||||
return y;
|
|
||||||
}).toList())
|
|
||||||
.toList();
|
|
||||||
var internalFormKey = ValueKey(generateRandomNumber(
|
var internalFormKey = ValueKey(generateRandomNumber(
|
||||||
values[fieldKey].length,
|
values[fieldKey].length,
|
||||||
seed2: i,
|
seed2: i,
|
||||||
@@ -537,8 +605,17 @@ class _GeneratedFormState extends State<GeneratedForm> {
|
|||||||
),
|
),
|
||||||
GeneratedForm(
|
GeneratedForm(
|
||||||
key: internalFormKey,
|
key: internalFormKey,
|
||||||
items: items,
|
items: cloneFormItems(
|
||||||
|
(widget.items[r][e] as GeneratedFormSubForm).items)
|
||||||
|
.map((x) => x.map((y) {
|
||||||
|
y.defaultValue = values[fieldKey]?[i]?[y.key];
|
||||||
|
y.key = '${y.key.toString()},$internalFormKey';
|
||||||
|
return y;
|
||||||
|
}).toList())
|
||||||
|
.toList(),
|
||||||
onValueChanges: (values, valid, isBuilding) {
|
onValueChanges: (values, valid, isBuilding) {
|
||||||
|
values = values.map(
|
||||||
|
(key, value) => MapEntry(key.split(',')[0], value));
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.values[fieldKey]?[i] = values;
|
this.values[fieldKey]?[i] = values;
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
|
|||||||
// ignore: implementation_imports
|
// ignore: implementation_imports
|
||||||
import 'package:easy_localization/src/localization.dart';
|
import 'package:easy_localization/src/localization.dart';
|
||||||
|
|
||||||
const String currentVersion = '0.15.9';
|
const String currentVersion = '0.15.10';
|
||||||
const String currentReleaseTag =
|
const String currentReleaseTag =
|
||||||
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||||
|
|
||||||
|
20
pubspec.lock
20
pubspec.lock
@@ -410,10 +410,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image
|
name: image
|
||||||
sha256: "028f61960d56f26414eb616b48b04eb37d700cbe477b7fb09bf1d7ce57fd9271"
|
sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.3"
|
version: "4.1.4"
|
||||||
intl:
|
intl:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -530,10 +530,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_foundation
|
name: path_provider_foundation
|
||||||
sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d"
|
sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.1"
|
version: "2.3.2"
|
||||||
path_provider_linux:
|
path_provider_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -682,10 +682,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shared_preferences_foundation
|
name: shared_preferences_foundation
|
||||||
sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7"
|
sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.4"
|
version: "2.3.5"
|
||||||
shared_preferences_linux:
|
shared_preferences_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -847,10 +847,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_ios
|
name: url_launcher_ios
|
||||||
sha256: cdb7b6da34483f9b2c9f8b2b29bc468fa7271d92e2021607ca0c4d3bcb04cdd4
|
sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.2.3"
|
version: "6.2.4"
|
||||||
url_launcher_linux:
|
url_launcher_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -943,10 +943,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: webview_flutter_wkwebview
|
name: webview_flutter_wkwebview
|
||||||
sha256: "02d8f3ebbc842704b2b662377b3ee11c0f8f1bbaa8eab6398262f40049819160"
|
sha256: "4d062ad505390ecef1c4bfb6001cd857a51e00912cc9dfb66edb1886a9ebd80c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.10.1"
|
version: "3.10.2"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@@ -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
|
# 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
|
# 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.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 0.15.9+245 # When changing this, update the tag in main() accordingly
|
version: 0.15.10+246 # When changing this, update the tag in main() accordingly
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.0 <4.0.0'
|
sdk: '>=3.0.0 <4.0.0'
|
||||||
|
Reference in New Issue
Block a user