Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Add analyze and format GitHub action (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
orhoj authored Oct 23, 2023
2 parents fc50989 + 6361a96 commit 1a3e361
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 17 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/analyze-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Analyze and format

on:
# Trigger the workflow on pushes to the main and feature branches as well as PRs targeting them.
push:
branches: [main, feature/**]
pull_request:
branches: [main, feature/**]

# Allows us to run the workflow manually from the Actions tab
workflow_dispatch:

env:
flutter_version: 3.13.6

jobs:
analyze-format:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.flutter_version }}
channel: 'stable'
cache: true
- name: Analyze (lint)
run: flutter analyze

- name: Check format
run: dart format --output=none --set-exit-if-changed . -l 150
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ migrate_working_dir/
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# VS Code related
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/home/screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tacLastCheckedAt = context.select((AppState state) => state.termsAndConditionsLastVerifiedAt);
print('tacLastCheckedAt: $tacLastCheckedAt');
//print('tacLastCheckedAt: $tacLastCheckedAt');

// Temporary...
final state = context.watch<AppState>();
var lastAcceptedVersion = state.sharedPreferences.termsAndConditionsAcceptedVersion;
// print('lastAcceptedVersion: $lastAcceptedVersion');

// Force recheck after 1 min.
print('diff: ${DateTime.now().difference(tacLastCheckedAt).inMinutes}');
// print('diff: ${DateTime.now().difference(tacLastCheckedAt).inMinutes}');
if (DateTime.now().difference(tacLastCheckedAt).inMinutes > 1) {
return const RefreshTermsAndConditionsScreen();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/terms_and_conditions/refresh_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RefreshTermsAndConditionsScreen extends StatelessWidget {
if (currentTac != null) {
// TODO It feels wrong to have this business logic in the widget builder.
if (currentTac.version == acceptedTacVersion) {
print('already accepted; dismissing');
// print('already accepted; dismissing');
// Current T&C is already accepted; update the T&C check time to make the home screen replace this widget.
Future.microtask(() => _markCheckPerformed(context));
} else {
Expand Down
7 changes: 2 additions & 5 deletions lib/screens/terms_and_conditions/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ class ToggleAcceptedWidget extends StatelessWidget {
final bool isAccepted;
final Function(bool) setAccepted;

ToggleAcceptedWidget(
{super.key, required this.isAccepted, required this.setAccepted});
ToggleAcceptedWidget({super.key, required this.isAccepted, required this.setAccepted});

final MaterialStateProperty<Icon?> icon =
MaterialStateProperty.resolveWith<Icon?>(
(states) => Icon(_iconData(states)));
final MaterialStateProperty<Icon?> icon = MaterialStateProperty.resolveWith<Icon?>((states) => Icon(_iconData(states)));

static IconData _iconData(Set<MaterialState> states) {
if (states.contains(MaterialState.selected)) {
Expand Down
6 changes: 2 additions & 4 deletions lib/services/wallet_proxy/model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ final testnet = Network(
),
);

class AppSharedPreferences { // TODO: Extend ChangeNotifier?
// TODO: Extend ChangeNotifier?
class AppSharedPreferences {
static const _tacAcceptedVersionKey = 'tac:accepted_version';

final SharedPreferences _prefs;
Expand Down

0 comments on commit 1a3e361

Please sign in to comment.