Skip to content

Commit 26648a1

Browse files
committed
Update release workflow, docs, and notification service
1 parent 3a3d827 commit 26648a1

3 files changed

Lines changed: 22 additions & 18 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ jobs:
8484
exit 1
8585
fi
8686
VERSION="${{ github.ref_name }}"
87-
ditto -c -k --sequesterRsrc --keepParent "$APP_PATH" "hr_osc-macos-${VERSION}.zip"
87+
ditto -c -k --sequesterRsrc --keepParent "$APP_PATH" "hr-push-macos-${VERSION}.zip"
8888
- name: Upload macOS zip to release
8989
uses: softprops/action-gh-release@v1
9090
with:
91-
files: hr_osc-macos-${{ github.ref_name }}.zip
91+
files: hr-push-macos-${{ github.ref_name }}.zip
9292
env:
9393
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9494

@@ -115,11 +115,11 @@ jobs:
115115
- name: Archive Windows build
116116
run: |
117117
$env:VERSION="${{ github.ref_name }}"
118-
Compress-Archive -Path "build\windows\x64\runner\Release\*" -DestinationPath "hr_osc-windows-$env:VERSION.zip"
118+
Compress-Archive -Path "build\windows\x64\runner\Release\*" -DestinationPath "hr-push-windows-$env:VERSION.zip"
119119
shell: pwsh
120120
- name: Upload Windows zip to release
121121
uses: softprops/action-gh-release@v1
122122
with:
123-
files: hr_osc-windows-${{ github.ref_name }}.zip
123+
files: hr-push-windows-${{ github.ref_name }}.zip
124124
env:
125125
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,21 @@
9090
### 测试截图
9191
<img src="images/vrchat.png" alt="VRChat OSC 测试" width="900" />
9292

93-
## 已测试设备
94-
1. Garmin Enduro 2
95-
93+
#### 安卓设备状态栏
94+
<img src="images/android.jpeg" alt="安卓测试"/>
95+
## 已通过测试的蓝牙相关设备
96+
1. Garmin Enduro 2 (佳明手表 蓝牙广播推送)
97+
2. iPhone15 Pro (穷鬼买不起证书,有能力的开发者可以自己签)
98+
3. OnePlus Ace (ColorOS/Android 14)
99+
4. MacBook Pro M5 macOS Tahoe 26.1
100+
5. Windows (B450I GAMING PLUS AC主板 自带蓝牙的主板)
96101
## 已知问题
97102
在 Windows 平台下中文路径可能会存在运行失败的问题,建议在英文路径目录下执行本程序。
98103

99104
## 平台支持与权限
100105
- Android:需要 BLE 扫描/连接权限(Android 12+ 无需定位,11 及以下需定位权限)。Android 13+ 若想显示常驻通知卡片,请允许通知权限。
101106
- ColorOS/部分国产 ROM:需在系统设置中打开应用通知,并允许后台运行/自启动,否则可能看不到常驻卡片或后台停止更新。
102107
- iOS/macOS:首次启动会请求蓝牙权限。
103-
- Linux/Windows:需设备具备 BLE 硬件与驱动;内置 BLEServer 若检测到临时目录含非 ASCII 字符,会自动解压到 `C:\\Users\\Public\\hr_osc_temp` 以避免中文用户名/路径导致的启动失败。
104-
- Web:暂不支持(`flutter_blue_plus` 尚未覆盖 Web)。
105108

106109
## 开发与构建
107110
- 主要代码:`lib/main.dart`(UI 与交互)、`lib/heart_rate_manager.dart`(扫描、连接、心率订阅与推送)。

lib/hr_notification_service.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'dart:io' show Platform;
33
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
44

55
class HrNotificationService {
6-
static const _channelId = 'hr_osc_live';
6+
static const _channelId = 'hr_push_live';
77
static const _channelName = '心率常驻通知';
88
static const _channelDescription = '显示当前心率与连接状态';
99
static const _notificationId = 1001;
@@ -19,8 +19,10 @@ class HrNotificationService {
1919
const initSettings = InitializationSettings(android: androidInit);
2020
await _plugin.initialize(initSettings);
2121

22-
final androidImpl = _plugin.resolvePlatformSpecificImplementation<
23-
AndroidFlutterLocalNotificationsPlugin>();
22+
final androidImpl = _plugin
23+
.resolvePlatformSpecificImplementation<
24+
AndroidFlutterLocalNotificationsPlugin
25+
>();
2426
if (androidImpl != null) {
2527
const channel = AndroidNotificationChannel(
2628
_channelId,
@@ -42,8 +44,10 @@ class HrNotificationService {
4244
if (!_initialized) {
4345
await initialize();
4446
}
45-
final androidImpl = _plugin.resolvePlatformSpecificImplementation<
46-
AndroidFlutterLocalNotificationsPlugin>();
47+
final androidImpl = _plugin
48+
.resolvePlatformSpecificImplementation<
49+
AndroidFlutterLocalNotificationsPlugin
50+
>();
4751
if (androidImpl == null) return true;
4852
try {
4953
final granted = await androidImpl.requestNotificationsPermission();
@@ -90,10 +94,7 @@ class HrNotificationService {
9094
} catch (_) {}
9195
}
9296

93-
Future<void> _show({
94-
required String title,
95-
required String body,
96-
}) async {
97+
Future<void> _show({required String title, required String body}) async {
9798
if (!_initialized) {
9899
try {
99100
await initialize();

0 commit comments

Comments
 (0)