Skip to content

Commit

Permalink
fix: wallet_kit crash on linux (#427)
Browse files Browse the repository at this point in the history
* feat(secure_store): add BiometricsStore.isSupportedPlatform static method

* fix(wallet_kit): don't crash when platform is not supported by BiometricsStore

* wallet_kit: replace deprecated withOpacity by withValues

* CI: use same flutter version for all workflows

* CI: use checkout@v4 instead of checkout@v3
  • Loading branch information
ptisserand authored Dec 29, 2024
1 parent e1672c5 commit 27bdcb0
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FLUTTER_VERSION=3.27.1
STARKNET_RPC=http://localhost:5050
DEVNET_DUMP_PATH=/devnet-dump.json
41 changes: 28 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: 3.24.3
version: ${{ steps.load-env.outputs.flutter_version }}
cache: true
cache-sdk: true
- uses: bluefireteam/melos-action@v3
Expand All @@ -26,11 +30,15 @@ jobs:
test-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: 3.24.3
version: ${{ steps.load-env.outputs.flutter_version }}
cache: true
cache-sdk: true
- uses: bluefireteam/melos-action@v3
Expand All @@ -40,11 +48,15 @@ jobs:
test-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: 3.24.3
version: ${{ steps.load-env.outputs.flutter_version }}
cache: true
cache-sdk: true
- uses: bluefireteam/melos-action@v3
Expand Down Expand Up @@ -73,8 +85,12 @@ jobs:
check-contracts-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v4
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- name: Check for changes
uses: dorny/paths-filter@v3
id: changes
Expand All @@ -84,8 +100,7 @@ jobs:
- 'contracts/v2.6.2/**'
- uses: flutter-actions/setup-flutter@v3
with:
channel: stable
version: 3.24.3
version: ${{ steps.load-env.outputs.flutter_version }}
cache: true
cache-sdk: true
- uses: bluefireteam/melos-action@v3
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/code_health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ steps.load-env.outputs.flutter_version }}
cache: true
- uses: bluefireteam/melos-action@v3
- name: "Run Analyze"
Expand All @@ -33,9 +38,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ steps.load-env.outputs.flutter_version }}
cache: true
- uses: bluefireteam/melos-action@v3
- name: "Pub Check"
Expand All @@ -47,9 +57,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ steps.load-env.outputs.flutter_version }}
cache: true
- uses: bluefireteam/melos-action@v3
- name: "flutter pub get"
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.load-env.outputs.flutter_version }}
- uses: bluefireteam/melos-action@v3
with:
run-versioning: ${{ inputs.prerelease == false }}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.load-env.outputs.flutter_version }}
- uses: bluefireteam/melos-action@v3
with:
publish: true
7 changes: 7 additions & 0 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Dotenv Action
id: load-env
uses: falti/[email protected]
with:
path: .env.ci
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.load-env.outputs.flutter_version }}
- uses: bluefireteam/melos-action@v3
with:
tag: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ coverage/

.env
.env.*
!.env.ci
!.env.example
!.env.mainnet.example
!.env.devnet.example
Expand Down
7 changes: 6 additions & 1 deletion packages/secure_store/lib/src/biometrics_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ import 'package:secure_store/src/utils.dart';
class BiometricsStore implements SecureStore {
final BiometricOptions? options;

static bool isSupportedPlatform() {
return !kIsWeb &&
(Platform.isIOS || Platform.isMacOS || Platform.isAndroid);
}

BiometricsStore([this.options]) {
if (kIsWeb || !(Platform.isIOS || Platform.isMacOS || Platform.isAndroid)) {
if (!isSupportedPlatform()) {
throw Exception('Biometric store not available');
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet_kit/lib/ui/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class CustomButton extends HookWidget {
boxShadow: onPressed != null
? [
BoxShadow(
color: charcoal.withOpacity(shadowOpacity),
color: charcoal.withValues(alpha: shadowOpacity),
offset: const Offset(0, 8),
blurRadius: 24,
)
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet_kit/lib/ui/input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TextInput extends StatelessWidget {
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: charcoal.withOpacity(0.2),
color: charcoal.withValues(alpha: 0.2),
offset: const Offset(0, 8),
blurRadius: 24,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class ProtectWalletScreen extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final isLoading = useState(false);
final isBiometryAvailable = useFuture(BiometricsStore().isAvailable()).data;
final isBiometryAvailable = BiometricsStore.isSupportedPlatform()
? useFuture(BiometricsStore().isAvailable()).data
: false;
return Layout2(
sideMargin: 32,
children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class _SettingsSection extends StatelessWidget {
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: charcoal.withOpacity(0.1),
color: charcoal.withValues(alpha: 0.1),
offset: const Offset(0, 8),
blurRadius: 24,
),
Expand Down
4 changes: 2 additions & 2 deletions packages/wallet_kit/lib/widgets/nft_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class NftCard extends StatelessWidget {
offset: const Offset(0, 4),
blurStyle: BlurStyle.normal,
blurRadius: 16,
color: Colors.black.withOpacity(0.10),
color: Colors.black.withValues(alpha: 0.10),
),
],
),
Expand Down Expand Up @@ -141,7 +141,7 @@ class MarketplaceNftCard extends StatelessWidget {
offset: const Offset(0, 4),
blurStyle: BlurStyle.normal,
blurRadius: 16,
color: Colors.black.withOpacity(0.10),
color: Colors.black.withValues(alpha: 0.10),
),
],
),
Expand Down
5 changes: 3 additions & 2 deletions packages/wallet_kit/lib/widgets/wallet_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class WalletCell extends HookConsumerWidget {
return ExpandableNotifier(
child: Container(
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.1),
color: Colors.grey.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(16.0),
),
child: Expandable(
Expand Down Expand Up @@ -212,7 +212,8 @@ class AccountCell extends HookConsumerWidget {
),
backgroundColor: WidgetStateProperty.all(Colors.white),
side: WidgetStateProperty.all(BorderSide.none),
overlayColor: WidgetStateProperty.all(Colors.grey.withOpacity(0.05)),
overlayColor:
WidgetStateProperty.all(Colors.grey.withValues(alpha: 0.05)),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.0),
Expand Down

0 comments on commit 27bdcb0

Please sign in to comment.