Skip to content

Commit

Permalink
Merge pull request #1915 from InfiniteCoder06/main
Browse files Browse the repository at this point in the history
Add Custom app ID
  • Loading branch information
ImranR98 authored Oct 25, 2024
2 parents 903fad5 + 9f7c4e2 commit e3fcf6e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
32 changes: 32 additions & 0 deletions lib/pages/add_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,38 @@ class AddAppPageState extends State<AddAppPage> {
});
}
}),
if (pickedSource != null && pickedSource!.enforceTrackOnly)
GeneratedForm(
key: Key(
'${pickedSource.runtimeType.toString()}-${pickedSource?.hostChanged.toString()}-${pickedSource?.hostIdenticalDespiteAnyChange.toString()}-appId'),
items: [
[
GeneratedFormTextField('appId',
label: tr('appId'),
required: false,
additionalValidators: [
(value) {
if (value == null || value.isEmpty) {
return null;
}
final isValid = RegExp(
r'^([A-Za-z]{1}[A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*$')
.hasMatch(value);
if (!isValid) {
return tr('invalidInput');
}
return null;
}
]),
]
],
onValueChanges: (values, valid, isBuilding) {
if (!isBuilding) {
setState(() {
additionalSettings['appId'] = values['appId'];
});
}
}),
],
);

Expand Down
5 changes: 4 additions & 1 deletion lib/providers/source_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ abstract class AppSource {
GeneratedFormSwitch('skipUpdateNotifications',
label: tr('skipUpdateNotifications'))
],
[GeneratedFormTextField('about', label: tr('about'), required: false)]
[GeneratedFormTextField('about', label: tr('about'), required: false)],
];

// Previous 2 variables combined into one at runtime for convenient usage
Expand Down Expand Up @@ -922,6 +922,9 @@ class SourceProvider {
name = name.isNotEmpty ? name : apk.names.name;
App finalApp = App(
currentApp?.id ??
((additionalSettings['appId'] != null)
? additionalSettings['appId']
: null) ??
(!trackOnly &&
(!source.appIdInferIsOptional ||
(source.appIdInferIsOptional && inferAppIdIfOptional))
Expand Down

0 comments on commit e3fcf6e

Please sign in to comment.