Skip to content

Commit b3b601f

Browse files
authored
refactor!: rebuild SamsungHealthReporter on the Samsung Health Data SDK (#3)
## Summary Rebuilds the library on the Samsung Health Data SDK 1.1.0 (the old Samsung Health SDK for Android was deprecated on 31.07.2025) with the HealthKitReporter architecture: one `SamsungHealthReporter` with a reader, writer, observer and manager, library-owned types and `@Serializable` payloads, suspend API, no SDK types in the public API. Breaking: releases as 1.0.0. ## Changes - `library/`: facade, services, 25 `HealthType`s, 20 `Aggregation`s, 15 sample payloads + `UserProfile`, 67 unit tests, `api/library.api` - `samsung-health-data-stub/`: never-published stand-in for the login-gated, non-redistributable SDK AAR - `app/`: Jetpack Compose demo with a row per public call, plus permission diagnostics - Build: Gradle 8.14, AGP 8.13.2, Kotlin 2.2.21, ktlint, detekt, Kover, binary-compatibility-validator; CI + release-please; CI fetches the real AAR from the private `kvs-coder/samsung-health-sdk` repo with a read-only deploy key - Docs: `AGENTS.md` (+ `CLAUDE.md`), README with migration table, CONTRIBUTING, ADRs 0001–0003, `ISSUE-*.md` - Removed the 0.0.x sources, the 1.4.0 SDK jar and tracked `.idea/` ## Tests - Unit tests: 67 executed, 0 failed, against the real SDK AAR and the stub; coverage 98.3% (Kover gate 98) - ktlint / detekt / Android lint: clean - apiCheck: passes, `library.api` committed - Example app build: passes; on a Pixel 7a (Samsung Health 7.00.6, developer mode) all 25 read permissions are granted and device/profile reads return real data; writes fail with SDK error 2003 until Samsung's partnership access code is entered 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent dc0985f commit b3b601f

199 files changed

Lines changed: 12918 additions & 4520 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.editorconfig‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
10+
[*.{kt,kts}]
11+
max_line_length = 120
12+
ij_kotlin_allow_trailing_comma = true
13+
ij_kotlin_allow_trailing_comma_on_call_site = true
14+
ktlint_code_style = ktlint_official
15+
ktlint_standard_filename = disabled
16+
ktlint_standard_function-naming = disabled
17+
ktlint_function_naming_ignore_when_annotated_with = Composable
18+
19+
[*.{yml,yaml,json,toml}]
20+
indent_size = 2

‎.github/pull_request_template.md‎

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,13 @@
1-
## Status
2-
READY/IN DEVELOPMENT/HOLD
1+
## Summary
2+
<!-- BLUF: what changes and why, in one or two sentences. -->
33

4-
## Migrations
5-
YES | NO
4+
## Changes
5+
- `<file_path>`: <details>
66

7-
## Description
8-
A few sentences describing the overall goals of the pull request's commits.
7+
## Tests
8+
- Unit tests: <executed / failed>, coverage <percent>
9+
- ktlint / detekt / Android lint: clean
10+
- apiCheck: <passes | library.api regenerated>
11+
- Example app build: <passes | not applicable — no public API change>
912

10-
## Related PRs
11-
List related PRs against other branches:
12-
13-
branch PR
14-
other_pr_production link
15-
other_pr_master link
16-
Todos
17-
Tests
18-
Documentation
19-
20-
## Deploy Notes
21-
Notes regarding deployment the contained body of work. These should note any db migrations, etc.
22-
23-
## Steps to Test or Reproduce
24-
Outline the steps to test or reproduce the PR here.
25-
26-
git pull --prune
27-
git checkout <feature_branch>
28-
29-
## Impacted Areas in Application
30-
Small description about what will be changed in the app if this PR will be merged
31-
32-
## List general components of the application that this PR will affect:
33-
The direct changes inside the app made by this PR
13+
Refs: #<issue>

‎.github/workflows/ci.yml‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
push:
7+
branches: [ master ]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
release-guard:
18+
name: Version / Changelog
19+
runs-on: ubuntu-26.04
20+
steps:
21+
- uses: actions/checkout@v7
22+
- name: Top CHANGELOG.md entry matches the release manifest
23+
run: |
24+
version=$(jq -r '."."' .release-please-manifest.json)
25+
header=$(grep -m1 '^## ' CHANGELOG.md)
26+
echo "manifest: $version, changelog: $header"
27+
[[ "$header" =~ ^"## [$version] - "[0-9]{2}\.[0-9]{2}\.[0-9]{4}\.$ ]] || {
28+
echo "::error file=CHANGELOG.md,line=1::Expected '## [$version] - dd.MM.yyyy.', got '$header'"
29+
exit 1
30+
}
31+
32+
build:
33+
name: Lint, test, API check, build
34+
runs-on: ubuntu-26.04
35+
steps:
36+
- uses: actions/checkout@v7
37+
- uses: actions/setup-java@v6
38+
with:
39+
distribution: corretto
40+
java-version: 17
41+
- uses: gradle/actions/setup-gradle@v6
42+
# Samsung's license forbids redistributing the SDK, so the real AAR lives in the private repository
43+
# kvs-coder/samsung-health-sdk, read with a read-only deploy key. Without the key (fork PRs), the build uses
44+
# the samsung-health-data-stub module written from the SDK's API reference.
45+
- name: Provide the Samsung Health Data SDK
46+
env:
47+
SAMSUNG_HEALTH_SDK_DEPLOY_KEY: ${{ secrets.SAMSUNG_HEALTH_SDK_DEPLOY_KEY }}
48+
run: |
49+
if [ -z "$SAMSUNG_HEALTH_SDK_DEPLOY_KEY" ]; then
50+
echo "::warning::SAMSUNG_HEALTH_SDK_DEPLOY_KEY is not set; building against the SDK stub"
51+
exit 0
52+
fi
53+
key="$RUNNER_TEMP/samsung-health-sdk-key"
54+
printf '%s\n' "$SAMSUNG_HEALTH_SDK_DEPLOY_KEY" > "$key"
55+
chmod 600 "$key"
56+
GIT_SSH_COMMAND="ssh -i $key -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new" \
57+
git clone --depth 1 git@github.com:kvs-coder/samsung-health-sdk.git "$RUNNER_TEMP/samsung-health-sdk"
58+
rm -f "$key"
59+
mkdir -p library/libs
60+
cp "$RUNNER_TEMP"/samsung-health-sdk/samsung-health-data-api-*.aar library/libs/
61+
ls library/libs
62+
- name: Lint
63+
run: ./gradlew ktlintCheck detekt :library:lintDebug
64+
- name: Test with coverage gate
65+
run: ./gradlew :library:testDebugUnitTest :library:koverXmlReport :library:koverVerify
66+
- name: Test against the SDK stub too, so it keeps matching the real SDK
67+
if: hashFiles('library/libs/*.aar') != ''
68+
run: ./gradlew :library:testDebugUnitTest -PsamsungHealthDataStub
69+
- name: Public API check
70+
run: ./gradlew :library:apiCheck
71+
- name: Build library and example app
72+
run: ./gradlew :library:assembleRelease :app:assembleDebug
73+
- name: Upload reports
74+
if: always()
75+
uses: actions/upload-artifact@v7
76+
with:
77+
name: reports
78+
path: |
79+
library/build/reports
80+
library/build/test-results
81+
if-no-files-found: ignore

‎.github/workflows/release.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release-please:
13+
runs-on: ubuntu-26.04
14+
steps:
15+
- uses: googleapis/release-please-action@v5
16+
with:
17+
config-file: release-please-config.json
18+
manifest-file: .release-please-manifest.json

‎.gitignore‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,12 @@ lint/tmp/
8787
# Android Profiling
8888
*.hprof
8989
.idea/jarRepositories.xml
90+
91+
# Samsung Health Data SDK: license forbids redistribution, add it locally (see README)
92+
library/libs/*.aar
93+
94+
# IDE state
95+
.idea/
96+
97+
# Local task notes, not for the repository
98+
ISSUE-*.md

‎.idea/codeStyles/Project.xml‎

Lines changed: 0 additions & 129 deletions
This file was deleted.

‎.idea/codeStyles/codeStyleConfig.xml‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎.idea/compiler.xml‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎.idea/dictionaries/florian.xml‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎.idea/gradle.xml‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)