Skip to content

Commit

Permalink
Merge pull request #23 from a-mabe/interval-type
Browse files Browse the repository at this point in the history
Refactor with ephemeral DB
  • Loading branch information
a-mabe authored Nov 11, 2024
2 parents bd77bcc + 67218e3 commit c9c2218
Show file tree
Hide file tree
Showing 142 changed files with 2,081 additions and 4,515 deletions.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Tap on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Device and Operating System (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]

**Additional context**
Add any other context about the problem here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/integration-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Integration test
about: Create a new integration test to verify a specific scenario
title: "[Integration Test]"
labels: enhancement, help wanted, test
assignees: ''

---

**Test:**

**Scenario outline:**

**Verify that:**
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/new-feature-improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: New feature/improvement
about: New feature or improvement to be implemented
title: "[Feature/Improvement]"
labels: enhancement
assignees: ''

---

**Purpose:** As a user, I...

**More details:** Some more details on the feature/improvement

**Acceptance Criteria:**
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/refactor-refine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Refactor/refine
about: Refactor or refinement to improve code quality.
title: "[Refactor]"
labels: refine
assignees: ''

---


50 changes: 50 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Test

run-name: ${{ github.actor }} is testing the app

on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
branches:
- 'main'
paths-ignore:
- '**.md'
- '**.yaml'
- 'doc/**'
- '.git/'
- '.vscode/'

jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Check Version
run: flutter --version
- name: Flutter Doctor
run: flutter doctor -v
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
arch: x86_64
script: flutter drive -d emulator-5554
working-directory: example
18 changes: 13 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,39 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2024-11-10

### Changed
- Refactored to use a SQFlite database.
- Implemented IntervalType class - requires a list of intervals to be passed.
- Added skip next and skip previous functions.
- Simplified implementation.

## [1.0.0-dev.6] - 2024-08-10

## Changed
### Changed

- Removed dependency on `flutter_fgbg`.

## [1.0.0-dev.5] - 2024-08-10

## Changed
### Changed

- Simplified timer restart.

## Fixed
### Fixed

- Fixed sound attempting to play when set to `none`.

## [1.0.0-dev.4] - 2024-07-31

## Added
### Added

- Volume control for timer audio.

## [1.0.0-dev.3] - 2024-06-23

## Changed
### Changed

- Upgraded dependencies.

Expand Down
35 changes: 35 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Background HIIT Timer Code of Conduct

## Purpose

The community is built on the dedication of volunteers who contribute their time and expertise. We are committed to fostering a respectful and inclusive environment for all contributors. This Code of Conduct outlines our expectations to ensure a positive and collaborative experience.

## Our Pledge

In the spirit of acknowledging the voluntary contributions made by individuals, we pledge to respect and value the time and effort our contributors invest in the project. Additionally, we are resolute in our stance against rude behavior, ensuring a welcoming community for all.

## Code of Conduct

### 1. Acknowledge Voluntary Contributions

Recognize that all contributors to this project are volunteers who generously offer their time. Appreciate and respect the dedication they bring to the community.

### 2. Zero Tolerance for Rudeness

Rude or disrespectful behavior will not be tolerated. This includes but is not limited to personal attacks, offensive language, and any behavior that disrupts the positive and collaborative atmosphere of the project.

### 3. Be Inclusive

We welcome and encourage participation from individuals of all backgrounds. Be respectful and considerate of differing viewpoints, experiences, and opinions. Treat everyone with kindness and empathy.

### 4. Be Collaborative

Open source thrives on collaboration. Work together to resolve issues, improve code, and enhance the project. Give and receive constructive feedback with a focus on improvement.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be addressed by the project maintainer, who has the right to remove, edit, or reject comments, commits, code, issues, and other contributions that are not aligned with this Code of Conduct.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.0.
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing to background_hiit_timer

Thank you for considering contributing! Contributions of all kinds are welcome, including bug reports, feature suggestions, code contributions, documentation improvements, and more. By participating in this project, you agree to abide by the [Code of Conduct](./CODE_OF_CONDUCT.md).

## How to Contribute

### Reporting Bugs

1. Check the existing [issues](https://github.com/a-mabe/background_hiit_timer/issues) to make sure the bug hasn't been reported yet.
2. Open a new issue and include:
A clear title and description.
Steps to reproduce the issue.
Expected behavior vs. what actually happens.
Screenshots or logs, if applicable.

### Suggesting Features
1. Open an issue labeled as a "feature request".
1. Clearly describe the proposed feature and its benefits.
1. If applicable, include examples or references.

### Code Contributions

1. Fork the repository on GitHub.

2. Create a new branch with a descriptive name for your feature or bug fix.

3. Make your changes and ensure they follow the project's coding style and guidelines.

4. Commit your changes and push them to your forked repository.

5. Test your changes following the [testing documentation](./doc/testing.md).

6. Submit a pull request, detailing the changes you made and explaining their purpose. Please be sure to list what you have tested, as well as the device and OS details you performed tests on.

## License

By contributing, you agree that your contributions will be licensed under the MIT License.
102 changes: 83 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# background_hiit_timer

A Flutter package for creating a background HIIT (High-Intensity Interval Training) timer. This package is based on the [`timer_count_down`](https://pub.dev/packages/timer_count_down) package and extends its functionality to support background execution for interval timers.
A Flutter package for creating a high-intensity interval training (HIIT) timer with background service capabilities. Originally created for [OpenHIIT](https://github.com/a-mabe/OpenHIIT).

![Screenshot 2024-11-10 at 4 22 43 PM](https://github.com/user-attachments/assets/0c990563-d8b0-4240-b11c-c865845c8ce9)

---
## Table of Contents

1. [Installation](#installation)
1. [Basic Usage](#basic-usage)
1. [Example Usage](#example-usage)
1. [Advanced Configuration](#Advanced-Configuration)
1. [Contributing](#Contributing)
1. [Code of Conduct](#Code-of-Conduct)
1. [Credits](#credits)
1. [License](#license)

---

## Installation

Expand All @@ -13,41 +29,89 @@ dependencies:
background_hiit_timer: ^1.0.0
```
## Usage
## Basic Usage
Import `background_hiit_timer` in your Dart file:

```dart
import 'package:background_hiit_timer/background_hiit_timer.dart';
```

Create a `Countdown` widget and configure it with your interval settings:
1. Ensure that your app is properly configured to handle background execution on both Android and iOS platforms. Refer to [flutter_background_service](https://pub.dev/packages/flutter_background_service) for details.

2. Define a set of intervals:

```
final List<IntervalType> intervals = [
IntervalType(
id: "0",
workoutId: "1",
time: 10, // in seconds
name: "Get ready",
color: 0,
intervalIndex: 0,
startSound: "",
halfwaySound: "",
countdownSound: "countdown-beep",
endSound: ""),
...
IntervalType(
id: "4",
workoutId: "1",
time: 10, // in seconds
name: "Cooldown",
color: 0,
intervalIndex: 4,
startSound: "long-rest-beep",
countdownSound: "countdown-beep",
endSound: "horn",
halfwaySound: ""),
];
```

3. Define a controller:

```
final CountdownController _controller = CountdownController(autoStart: true);
```

4. Create a `Countdown` widget and configure it with your interval settings:

```dart
Countdown(
controller: _controller,
workSeconds: 20,
restSeconds: 10,
getreadySeconds: 10,
breakSeconds: 30,
warmupSeconds: 60,
cooldownSeconds: 60,
numberOfWorkIntervals: 8,
iterations: 2,
onFinished: () {},
build: Text(timerData.currentMicroSeconds.toString())
controller: _controller,
intervals: intervals,
onFinished: () {},
build: (_, TimerState timerState) {
Text(timerState.currentMicroSeconds.toString())
}
)
```

Ensure that your app is properly configured to handle background execution on both Android and iOS platforms.
### Example Usage

Check out the [example](example) directory in this repository for a complete example of how to use `background_hiit_timer` in a Flutter app.

## Advanced Configuration

## Example
For more advanced information, view [the advanced configuration documentation](./doc/advanced_configuration.md).

Check out the `example` directory in this repository for a complete example of how to use `background_hiit_timer` in a Flutter app.
## Contributing

View the [contributing documentation](./CONTRIBUTING.md). If contributing code changes, please checkout the [testing documentation](./doc/testing.md).

### Code of Conduct

When contributing, please keep the [Code of Conduct](./CODE_OF_CONDUCT.md) in mind.

## Credits

This package is based on the [`timer_count_down`](https://pub.dev/packages/timer_count_down) package by [Dizoft Team](https://github.com/DizoftTeam).
This package is inspired by the [`timer_count_down`](https://pub.dev/packages/timer_count_down) package by [Dizoft Team](https://github.com/DizoftTeam).

Shoutout to [`flutter_background_service`](https://pub.dev/packages/flutter_background_service) for making the background timer possible.

## License

MIT License. See [LICENSE](LICENSE) for details.
MIT License. See [LICENSE](LICENSE) for details.
Binary file removed assets/audio/countdown-beep.mp3
Binary file not shown.
Binary file removed assets/audio/ding-sequence.mp3
Binary file not shown.
Binary file removed assets/audio/ding.mp3
Binary file not shown.
Binary file removed assets/audio/halfway-beep2.mp3
Binary file not shown.
Binary file removed assets/audio/harsh-beep-sequence.mp3
Binary file not shown.
Binary file removed assets/audio/harsh-beep.mp3
Binary file not shown.
Binary file removed assets/audio/horn.mp3
Binary file not shown.
Binary file removed assets/audio/long-bell.mp3
Binary file not shown.
Binary file removed assets/audio/long-halfway-beep.mp3
Binary file not shown.
Binary file removed assets/audio/long-rest-beep.mp3
Binary file not shown.
Binary file removed assets/audio/long-whistle.mp3
Binary file not shown.
Binary file removed assets/audio/short-halfway-beep.mp3
Binary file not shown.
Binary file removed assets/audio/short-rest-beep.mp3
Binary file not shown.
Binary file removed assets/audio/short-whistle.mp3
Binary file not shown.
Binary file removed assets/audio/thunk.mp3
Binary file not shown.
Binary file removed assets/preview.gif
Binary file not shown.
Loading

0 comments on commit c9c2218

Please sign in to comment.