-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: fix copy paste error and option new * feat: rebuild CardSave from slot * fix: add freq chooser, recover card POC * Improve card export and code quality * Expose CardSearchDelegate * Update saved card (finish card export), improve code quality * Legacy linux workflow (seems to be frequently asked) * Modify new card name --------- Co-authored-by: GameTec_live <[email protected]>
- Loading branch information
1 parent
32d985e
commit ca21210
Showing
13 changed files
with
669 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,17 @@ on: | |
pull_request: | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
found: ${{ steps.PR.outputs.pr_found }} | ||
steps: | ||
- uses: 8BitJonny/[email protected] | ||
id: PR | ||
|
||
build-android: | ||
needs: check | ||
if: needs.check.outputs.found == 'false' && github.event_name == 'push' || github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
|
@@ -29,6 +39,8 @@ jobs: | |
path: chameleonultragui/build/app/outputs/flutter-apk/app-release.apk | ||
|
||
build-windows: | ||
needs: check | ||
if: needs.check.outputs.found == 'false' && github.event_name == 'push' || github.event_name == 'pull_request' | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
|
@@ -55,6 +67,8 @@ jobs: | |
path: chameleonultragui-setup-win.exe | ||
|
||
build-linux: | ||
needs: check | ||
if: needs.check.outputs.found == 'false' && github.event_name == 'push' || github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
|
@@ -79,7 +93,30 @@ jobs: | |
name: linux-debian | ||
path: chameleonultragui/debian/packages | ||
|
||
build-linux-legacy: | ||
needs: check | ||
if: needs.check.outputs.found == 'false' && github.event_name == 'push' || github.event_name == 'pull_request' | ||
runs-on: ubuntu-20.04 | ||
defaults: | ||
run: | ||
working-directory: ./chameleonultragui | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
channel: 'stable' | ||
- run: sudo apt-get update -y && sudo apt-get install -y ninja-build libgtk-3-dev clang | ||
- run: flutter config --enable-linux-desktop | ||
- run: flutter build linux --build-number ${{ github.run_number }} | ||
- run: flutter test | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: linux-legacy | ||
path: chameleonultragui/build/linux/x64/release | ||
|
||
build-macos: | ||
needs: check | ||
if: needs.check.outputs.found == 'false' && github.event_name == 'push' || github.event_name == 'pull_request' | ||
runs-on: macos-latest | ||
defaults: | ||
run: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,6 @@ jobs: | |
body: "Update translations" | ||
commit-message: "feat: Update translations" | ||
title: "feat: Update translations" | ||
author: "Chameleon Helper <[email protected]>" | ||
committer: "Chameleon Helper <[email protected]>" | ||
delete-branch: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
import 'package:chameleonultragui/bridge/chameleon.dart'; | ||
import 'package:chameleonultragui/helpers/general.dart'; | ||
import 'package:chameleonultragui/helpers/mifare_classic/general.dart'; | ||
import 'package:chameleonultragui/sharedprefsprovider.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
// Localizations | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
|
||
enum SearchFilter { all, hf, lf } | ||
|
||
class CardSearchDelegate extends SearchDelegate<String> { | ||
final List<CardSave> cards; | ||
final dynamic onTap; | ||
SearchFilter filter; | ||
|
||
CardSearchDelegate( | ||
{required this.cards, | ||
required this.onTap, | ||
this.filter = SearchFilter.all}); | ||
|
||
@override | ||
List<Widget> buildActions(BuildContext context) { | ||
var localizations = AppLocalizations.of(context)!; | ||
|
||
return [ | ||
StatefulBuilder( | ||
builder: (BuildContext context, StateSetter setState) { | ||
return DropdownButton( | ||
items: [ | ||
DropdownMenuItem( | ||
value: SearchFilter.all, | ||
child: Text( | ||
localizations.all, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
), | ||
DropdownMenuItem( | ||
value: SearchFilter.hf, | ||
child: Text( | ||
localizations.hf, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
), | ||
DropdownMenuItem( | ||
value: SearchFilter.lf, | ||
child: Text( | ||
localizations.lf, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
), | ||
], | ||
onChanged: (SearchFilter? value) { | ||
if (value != null) { | ||
setState(() { | ||
filter = value; | ||
}); | ||
} | ||
}, | ||
value: filter, | ||
); | ||
}, | ||
), | ||
IconButton( | ||
icon: const Icon(Icons.clear), | ||
onPressed: () { | ||
query = ''; | ||
}, | ||
), | ||
]; | ||
} | ||
|
||
@override | ||
Widget buildLeading(BuildContext context) { | ||
return IconButton( | ||
icon: const Icon(Icons.arrow_back), | ||
onPressed: () { | ||
close(context, ''); | ||
}, | ||
); | ||
} | ||
|
||
@override | ||
Widget buildResults(BuildContext context) { | ||
final results = cards.where((card) => | ||
(((card.name.toLowerCase().contains(query.toLowerCase())) || | ||
(chameleonTagToString(card.tag) | ||
.toLowerCase() | ||
.contains(query.toLowerCase()))) && | ||
((filter == SearchFilter.all) || | ||
(filter == SearchFilter.hf && | ||
chameleonTagToFrequency(card.tag) == TagFrequency.hf) || | ||
(filter == SearchFilter.lf && | ||
chameleonTagToFrequency(card.tag) == TagFrequency.lf)))); | ||
|
||
return ListView.builder( | ||
itemCount: results.length, | ||
itemBuilder: (BuildContext context, int index) { | ||
final card = results.elementAt(index); | ||
return Column( | ||
children: [ | ||
ElevatedButton( | ||
onPressed: () { | ||
// Set card here | ||
Navigator.pop(context); | ||
}, | ||
child: ListTile( | ||
leading: Icon( | ||
(chameleonTagToFrequency(card.tag) == TagFrequency.hf) | ||
? Icons.credit_card | ||
: Icons.wifi, | ||
color: card.color), | ||
title: Text( | ||
card.name, | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
subtitle: Text( | ||
chameleonTagToString(card.tag), | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
), | ||
), | ||
const SizedBox(height: 10), | ||
], | ||
); | ||
}, | ||
); | ||
} | ||
|
||
@override | ||
Widget buildSuggestions(BuildContext context) { | ||
final results = cards.where((card) => | ||
(((card.name.toLowerCase().contains(query.toLowerCase())) || | ||
(chameleonTagToString(card.tag) | ||
.toLowerCase() | ||
.contains(query.toLowerCase()))) && | ||
((filter == SearchFilter.all) || | ||
(filter == SearchFilter.hf && | ||
chameleonTagToFrequency(card.tag) == TagFrequency.hf) || | ||
(filter == SearchFilter.lf && | ||
chameleonTagToFrequency(card.tag) == TagFrequency.lf)))); | ||
|
||
return ListView.builder( | ||
itemCount: results.length, | ||
itemBuilder: (BuildContext context, int index) { | ||
final card = results.elementAt(index); | ||
return ListTile( | ||
leading: Icon( | ||
(chameleonTagToFrequency(card.tag) == TagFrequency.hf) | ||
? Icons.credit_card | ||
: Icons.wifi, | ||
color: card.color), | ||
title: Text(card.name), | ||
subtitle: Text( | ||
chameleonTagToString(card.tag) + | ||
((chameleonTagSaveCheckForMifareClassicEV1(card)) | ||
? " EV1" | ||
: ""), | ||
maxLines: 2, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
onTap: () async { | ||
onTap(card, close); | ||
}, | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.