Skip to content

Commit 24c8585

Browse files
Merge branch 'development' into issue1359
2 parents 5dbdbc0 + f36ef45 commit 24c8585

File tree

9 files changed

+166
-107
lines changed

9 files changed

+166
-107
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Badge Magic PR CI
22

33
on:
44
pull_request:
5-
branches: [ "flutter_app" ]
5+
branches: [ "development" ]
66

77
env:
88
ANDROID_EMULATOR_API: 34

.github/workflows/pull_request_closed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Delete Screenshots
22

33
on:
44
pull_request_target:
5-
branches: [ "flutter_app" ]
5+
branches: [ "development" ]
66
types:
77
- closed
88

.github/workflows/push.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,24 @@ name: Badge Magic Push CI
22

33
on:
44
push:
5-
branches: ["flutter_app"]
5+
branches: ["development"]
66

77
env:
88
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99
ANDROID_EMULATOR_API: 34
1010
ANDROID_EMULATOR_ARCH: x86_64
1111
IPHONE_DEVICE_MODEL: iPhone 16 Pro Max
1212
IPAD_DEVICE_MODEL: iPad Pro 13-inch (M4)
13+
BARECHECK_GITHUB_APP_TOKEN: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
14+
ENCRYPTED_F10B5E0E5262_IV: ${{ secrets.ENCRYPTED_F10B5E0E5262_IV }}
15+
ENCRYPTED_F10B5E0E5262_KEY: ${{ secrets.ENCRYPTED_F10B5E0E5262_KEY }}
16+
ENCRYPTED_IOS_IV: ${{ secrets.ENCRYPTED_IOS_IV }}
17+
ENCRYPTED_IOS_KEY: ${{ secrets.ENCRYPTED_IOS_KEY }}
18+
STORE_PASS: ${{ secrets.STORE_PASS }}
19+
ALIAS: ${{ secrets.ALIAS }}
20+
KEY_PASS: ${{ secrets.KEY_PASS }}
21+
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
22+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
1323

1424
jobs:
1525
common:
@@ -23,7 +33,7 @@ jobs:
2333

2434
- name: Common Workflow
2535
uses: ./.github/actions/common
26-
36+
2737
- name: Hydrate and Update Version
2838
id: flutter-version
2939
run: |
@@ -102,14 +112,14 @@ jobs:
102112
name: AAB Generated
103113
path: build/app/outputs/bundle
104114

105-
- name: Upload APK/AAB to apk branch
115+
- name: Upload APK/AAB to app branch
106116
if: ${{ github.repository == 'fossasia/badgemagic-app' }}
107117
run: |
108118
git config --global user.name "github-actions[bot]"
109119
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
110120
111-
git clone --branch=apk https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} apk
112-
cd apk
121+
git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
122+
cd app
113123
114124
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
115125
@@ -134,14 +144,14 @@ jobs:
134144
135145
ls
136146
137-
echo "Pushing to apk branch"
147+
echo "Pushing to app branch"
138148
139149
git checkout --orphan temporary
140150
git add --all .
141151
git commit -am "[Auto] Update APK/AAB's from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
142-
git branch -D apk
143-
git branch -m apk
144-
git push --force origin apk
152+
git branch -D app
153+
git branch -m app
154+
git push --force origin app
145155
146156
- name: Push app in open testing track
147157
if: ${{ github.repository == 'fossasia/badgemagic-app' }}
@@ -220,8 +230,8 @@ jobs:
220230
- name: Create and Upload Assets
221231
run: |
222232
echo "${{ needs.common.outputs.VERSION_CODE }}" > ./versionCode.txt
223-
git clone --branch=apk https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} apk
224-
gh release upload ${{ steps.run-release-drafter.outputs.tag_name }} apk/badge-magic-flutter_app-release.apk ./versionCode.txt --clobber
233+
git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
234+
gh release upload ${{ steps.run-release-drafter.outputs.tag_name }} app/badge-magic-development-release.apk ./versionCode.txt --clobber
225235
226236
screenshots-android:
227237
name: Screenshots (Android)

README.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<img height="200px" src="./docs/images/app_icon.png" align="right" />
22

33
# Badge Magic
4-
[![Join the chat at https://gitter.im/fossasia/badge-magic](https://badges.gitter.im/fossasia/badge-magic.svg)](https://gitter.im/fossasia/badge-magic?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4+
[![Join the chat at https://gitter.im/fossasia/badge-magic](https://badges.gitter.im/fossasia/badge-magic.svg)](https://gitter.im/fossasia/badge-magic?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
55
![Github](https://img.shields.io/github/license/fossasia/badgemagic-app?logo=github)
66

77
**Python Library to program via desktop https://github.com/fossasia/led-name-badge-ls32**
@@ -29,7 +29,7 @@ The Badge Magic Android app lets you create moving text and draw clipart for LED
2929
* **Bluetooth**: For sending org.fossasia.badgemagic.data to the badge.
3030
* **Storage**: For storing and saving badges.
3131

32-
Up to Android version 11
32+
Up to Android version 11
3333
* **GPS Location**: This has been the standard set by Android for use with Bluetooth Low Energy (BLE) devices. For more information, please read the notes on [Android website](https://source.android.com/devices/bluetooth/ble).
3434

3535
## Communication
@@ -61,21 +61,24 @@ There are a number of devices with Bluetooth on the market. As far as we can tel
6161

6262
## Reverse-Engineering Bluetooth LE Devices
6363

64-
Security in Bluetooth LE devices is optional, and many cheap products you can find on the market are not secured at all. This applies to our Bluetooth LED Badge. While this could lead to some privacy issues, this can also be a source of fun, especially when you want to use an LED Badge in a different way. It also makes it easy for us to get started with the development of a Free and Open Source Android app.
64+
Security in Bluetooth LE devices is optional, and many cheap products you can find on the market are not secured at all. This applies to our Bluetooth LED Badge. While this could lead to some privacy issues, this can also be a source of fun, especially when you want to use an LED Badge in a different way. It also makes it easy for us to get started with the development of a Free and Open Source Android app.
6565

66-
As we understand how the Bluetooth LED badge works, converting a text to multiple byte arrays, we can send using the Bluetooth LE APIs. An indepth blog post about reverse-engineering the Bluetooth community [is here](http://nilhcem.com/iot/reverse-engineering-bluetooth-led-name-badge).
66+
As we understand how the Bluetooth LED badge works, converting a text to multiple byte arrays, we can send using the Bluetooth LE APIs. An indepth blog post about reverse-engineering the Bluetooth community [is here](http://nilhcem.com/iot/reverse-engineering-bluetooth-led-name-badge).
6767

68-
The implementation in the Android app consists of manipulating bits. That may be tricky. A single bit error and nothing will work, plus it will be hard to debug. For those reasons, and since the specs are perfectly clear the reverse engineer Gautier Mechling strongly recommends to start writing unit tests before the code implementation.
68+
The implementation in the Android app consists of manipulating bits. That may be tricky. A single bit error and nothing will work, plus it will be hard to debug. For those reasons, and since the specs are perfectly clear the reverse engineer Gautier Mechling strongly recommends to start writing unit tests before the code implementation.
6969

7070
## Branch Policy
7171

7272
We have the following branches
7373

74-
* **development** All development goes on in this branch. If you're making a contribution, you are supposed to make a pull request to _development_. PRs to development branch must pass a build check on CI/CD.
75-
* **apk** This branch contains many apk files, that are automatically generated on the merged pull request a) debug apk b) release apk
74+
* **development**: All development goes on in this branch. If you're making a contribution, you are supposed to make a pull request to _development_. PRs to development branch must pass a build check on CI/CD.
75+
* **apk**: This branch contains many apk files, that are automatically generated on the merged pull request a) debug apk b) release apk
7676
- There are multiple files in the apk branch of the project, this branch consists of all the APK files and other files that are relevant when an APK is generated.
7777
- Once a pull request is merged, the previous APK branch is deleted and a new APK branch is created.
7878
- If a PR is merged in development branch then the new APKs for the development branch are generated whereas the APKs corresponding to the master branch are not regenerated and simply the previously generated files are added.
79+
* **version**: This branch stores the version information for the APKs (versionName and versionCode). This is used in our workflows for automatic versioning wherein the next version information is automatically fetched from this branch and used for building APKs.
80+
* **fastlane***: These branches contain information and metadata used by fastlane to automate deployment.
81+
* **pr-screenshots**: This branch stores screenshots for every open pull request, which are shown in comments in every pull request.
7982

8083
## Contributions Best Practices
8184

@@ -89,6 +92,27 @@ Please read FOSSASIA's [Best Practices](https://blog.fossasia.org/open-source-de
8992
* Before you join development, please set up the project on your local machine, run it and go through the application completely. Press on any button you can find and see where it leads to. Explore.
9093
* If you would like to work on an issue, drop in a comment at the issue. If it is already assigned to someone, but there is no sign of any work being done, please free to drop in a comment and start working on it.
9194

95+
## Release Process
96+
97+
### Beta Release Flow
98+
* All merged pull requests into the development branch are automatically included in the beta version of the app.
99+
* The beta builds are automatically pushed to:
100+
- Google Play Store (Beta Track)
101+
- Apple TestFlight (iOS Beta)
102+
This allows contributors and testers to try out the latest features and verify stability before the app is released to all users.
103+
104+
### Production Release Flow
105+
* A new GitHub release (using the "Releases" tab) is the trigger for publishing a production version.
106+
* When a GitHub release is created:
107+
- The latest beta APK or iOS build is promoted to the production track on the respective app stores.
108+
- No additional code changes are made unless specified.
109+
This ensures that the version tested in beta is the exact one released to the public.
110+
111+
### Notes
112+
* Please ensure all features and fixes are tested and merged into development before a GitHub release is created.
113+
* Versioning and changelogs should be updated accordingly.
114+
* If any hotfixes are required post-release, they should go through the same flow (PR → beta → release).
115+
92116
## Dev Container usage
93117

94118
Opening this repository in VSCode, GitHub Codespaces or another supported editor/IDE will allow the repository to be opened in a [Dev Container](https://containers.dev/).

android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pluginManagement {
2020
plugins {
2121
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
2222
id "com.android.application" version "8.10.1" apply false
23-
id "org.jetbrains.kotlin.android" version "2.1.21" apply false
23+
id "org.jetbrains.kotlin.android" version "2.2.0" apply false
2424
}
2525

2626
include ":app"

lib/bademagic_module/bluetooth/write_state.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ class WriteState extends NormalBleState {
4747
} catch (e) {
4848
logger.e("Failed to write characteristic: $e");
4949
throw Exception("Failed to transfer data. Please try again.");
50+
} finally {
51+
try {
52+
logger.d("Disconnecting from device after write attempt...");
53+
await device.disconnect();
54+
await Future.delayed(const Duration(milliseconds: 700));
55+
logger.d("Device disconnected and delay complete.");
56+
} catch (e) {
57+
logger.e("Error during disconnect: $e");
58+
}
5059
}
5160
}
5261
}

0 commit comments

Comments
 (0)