Skip to content

Commit

Permalink
fix goal update logic and github actions ci
Browse files Browse the repository at this point in the history
  • Loading branch information
NeXTormer committed Feb 7, 2024
1 parent 0a61f3a commit 28debe6
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 124 deletions.
46 changes: 14 additions & 32 deletions .github/workflows/build_for_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,38 @@ jobs:

if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
java-version: '12.x'

# Flutter Setup
- uses: subosito/flutter-action@v1
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.7.9'

flutter-version: '3.13.8'
- run: flutter pub get

- name: Dectypt keys
- name: Decrypt keys
run: |
echo "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" > android/release.keystore.asc
echo "${{ secrets.KEY_PROPERTIES }}" > android/key.properties.asc
gpg -d --passphrase "${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSPHRASE }}" --batch android/release.keystore.asc > android/app/release.keystore
gpg -d --passphrase "${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSPHRASE }}" --batch android/key.properties.asc > android/key.properties
# - run: flutter test

- name: Get Tag name (version code)
uses: olegtarasov/[email protected]
id: tagName
with:
tagRegex: 'v([0-9]+.[0-9]+.[0-9]+)' # Optional. Returns specified group text as tag name. Full tag string is returned if regex is not defined.
tagRegexGroup: 1 # Optional. Default is 1.

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"

- name: Build AAB
run: flutter build appbundle --release --build-number ${{ github.run_number }} --build-name ${{ env.GIT_TAG_NAME }}
run: flutter build appbundle --release --build-number ${{ steps.date.outputs.date }}01 --build-name ${{ env.GIT_TAG_NAME }}

- name: Create Github Release
uses: ncipollo/release-action@v1
Expand All @@ -55,23 +57,3 @@ jobs:
tag: ${{ env.GIT_TAG_NAME }}
name: APPBUNDLE
path: build/app/outputs/bundle/release/app-release.aab

# release_android_beta:
# name: Release Android Artifacts to beta track
# needs: [build_aab]
# runs-on: self-hosted
# steps:
# - uses: actions/checkout@v1
# - name: Get APPBUNDLE from Artifacts
# uses: actions/download-artifact@v2
# with:
# name: APPBUNDLE
# - name: Release APPBUNDLE to internal track
# uses: r0adkll/upload-google-play@v1
# with:
# serviceAccountJsonPlainText: ${{ secrets.GOOGLE_SERVICE_JSONKEY }}
# packageName: io.hawkford.fredericapp
# releaseFile: app-release.aab
# track: beta
# whatsNewDirectory: distribution/whatsnew

1 change: 1 addition & 0 deletions firecms/deploy.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
yarn run build
firebase deploy --only hosting

https://firecms.co/docs/deployment
5 changes: 3 additions & 2 deletions lib/backend/goals/frederic_goal_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ class FredericGoalManager
FutureOr<void> _onEvent(
FredericGoalEvent event, Emitter<FredericGoalListData> emit) async {
if (event is FredericGoalUpdateEvent) {
// new goals on update get into the list twice
_goals[event.updatedGoal.id] = event.updatedGoal;
if (_goals.containsKey(event.updatedGoal.id)) {
_goals[event.updatedGoal.id] = event.updatedGoal;
}
await _dataInterface.update(event.updatedGoal);
emit(FredericGoalListData(event.changed, _goals));
} else if (event is FredericGoalCreateEvent) {
Expand Down
2 changes: 1 addition & 1 deletion lib/misc/bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Future<void> showFredericBottomSheet(
return showCupertinoModalSheet(
context: context,
builder: builder,
barrierDismissible: isDismissible,
//barrierDismissible: isDismissible,
);

// return Navigator.of(context)
Expand Down
181 changes: 95 additions & 86 deletions lib/screens/edit_goal_data_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,70 +100,81 @@ class _EditGoalDataScreenState extends State<EditGoalDataScreen> {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: theme.backgroundColor,
body: CustomScrollView(
slivers: [
SliverPadding(padding: const EdgeInsets.only(bottom: 12)),
body: Column(
children: [
Padding(padding: const EdgeInsets.only(bottom: 12)),
buildHeaderSegment(),
SliverDivider(),
buildGoalCard(),
SliverDivider(),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: FredericHeading('Title'),
),
),
buildTitleSegment(),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: FredericHeading('Goal State'),
),
),
buildGoalStateSegment(),
buildCurrentStateHeadingAndLinkActivity(),
buildCurrentStateSegment(),
SliverPadding(
padding: const EdgeInsets.only(bottom: 42),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Column(
children: [
buildDatePickerRow('Start Date', Datepicker.Start,
initialDate: DateTime.now()),
const SizedBox(height: 8),
buildDatePickerRow(
'End Date',
Datepicker.End,
initialDate: DateTime.now().add(
Duration(days: 7),
Divider(),
Expanded(
child: CustomScrollView(
slivers: [
buildGoalCard(),
SliverDivider(),
SliverToBoxAdapter(
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: FredericHeading('Title'),
),
),
buildTitleSegment(),
SliverToBoxAdapter(
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: FredericHeading('Goal State'),
),
),
buildGoalStateSegment(),
buildCurrentStateHeadingAndLinkActivity(),
buildCurrentStateSegment(),
SliverPadding(
padding: const EdgeInsets.only(bottom: 42),
),
SliverToBoxAdapter(
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Column(
children: [
buildDatePickerRow('Start Date', Datepicker.Start,
initialDate: DateTime.now()),
const SizedBox(height: 8),
buildDatePickerRow(
'End Date',
Datepicker.End,
initialDate: DateTime.now().add(
Duration(days: 7),
),
),
],
),
),
],
),
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Row(
children: [
Expanded(
flex: 2,
child: FredericButton(
widget.isNewGoal ? 'Create' : 'Save', onPressed: () {
saveData();
Navigator.of(context).pop();
})),
],
),
),
SliverToBoxAdapter(
child: Padding(
padding:
const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Row(
children: [
Expanded(
flex: 2,
child: FredericButton(
widget.isNewGoal ? 'Create' : 'Save',
onPressed: () {
saveData();
Navigator.of(context).pop();
})),
],
),
),
),
SliverToBoxAdapter(
child: SizedBox(height: 16),
),
],
),
),
SliverToBoxAdapter(
child: SizedBox(height: 16),
),
],
),
);
Expand Down Expand Up @@ -311,34 +322,32 @@ class _EditGoalDataScreenState extends State<EditGoalDataScreen> {
}

Widget buildHeaderSegment() {
return SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
children: [
Icon(
ExtraIcons.dumbbell,
color: theme.mainColor,
),
SizedBox(width: 32),
Text(
widget.isNewGoal ? 'Create Goal' : 'Edit Goal',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
children: [
Icon(
ExtraIcons.dumbbell,
color: theme.mainColor,
),
SizedBox(width: 32),
Text(
widget.isNewGoal ? 'Create Goal' : 'Edit Goal',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
),
Expanded(child: Container()),
GestureDetector(
onTap: () {
saveData();
Navigator.of(context).pop();
},
child: Text(
widget.isNewGoal ? 'Create' : 'Save',
style: TextStyle(
color: theme.mainColor, fontWeight: FontWeight.w500),
),
Expanded(child: Container()),
GestureDetector(
onTap: () {
saveData();
Navigator.of(context).pop();
},
child: Text(
widget.isNewGoal ? 'Create' : 'Save',
style: TextStyle(
color: theme.mainColor, fontWeight: FontWeight.w500),
),
)
],
),
)
],
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,11 @@ class _NormalGoalCard extends State<NormalGoalCard> {
)
: showFredericBottomSheet(
context: context,
builder: (c) => Scaffold(
body: EditGoalDataScreen(
builder: (c) => EditGoalDataScreen(
widget.goal,
sets: widget.sets,
activity: widget.activity,
)));
));
}

void handleLongClick(BuildContext context) {
Expand Down

0 comments on commit 28debe6

Please sign in to comment.