Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutter": "3.44.2",
"flavors": {}
}
100 changes: 100 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: CI

on:
push:
branches: [main]
pull_request:

# Cancel superseded runs for the same ref.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
# Resolves the Flutter version from .fvmrc once and exposes it to the build
# jobs, so the toolchain is driven by fvm — never hardcoded in the workflow.
analyze-and-test:
name: Format · Analyze · Test
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
flutter-version: ${{ steps.fvm.outputs.FLUTTER_VERSION }}
flutter-channel: ${{ steps.fvm.outputs.FLUTTER_CHANNEL }}
steps:
- uses: actions/checkout@v7

- id: fvm
name: Read Flutter version from .fvmrc
uses: kuhnroyal/flutter-fvm-config-action@v3

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.fvm.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm.outputs.FLUTTER_CHANNEL }}
cache: true

- run: flutter pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed lib test
- name: Analyze
run: flutter analyze
- name: Test
run: flutter test

build-example:
name: Build example APK
needs: analyze-and-test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7

- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "17"

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ needs.analyze-and-test.outputs.flutter-version }}
channel: ${{ needs.analyze-and-test.outputs.flutter-channel }}
cache: true

- run: flutter pub get
working-directory: example
- run: flutter build apk --debug
working-directory: example

pana:
name: pana score gate
needs: analyze-and-test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ needs.analyze-and-test.outputs.flutter-version }}
channel: ${{ needs.analyze-and-test.outputs.flutter-channel }}
cache: true

- run: flutter pub get
- name: Run pana
run: dart pub global activate pana && dart pub global run pana --no-warning --json . > pana.json
- name: Enforce score threshold
# Baseline gate. Raise toward the 150/160 target as the package matures.
env:
THRESHOLD: "120"
run: |
python3 - <<'PY'
import json, os, sys
data = json.load(open("pana.json"))
granted = data["scores"]["grantedPoints"]
maximum = data["scores"]["maxPoints"]
threshold = int(os.environ["THRESHOLD"])
print(f"pana score: {granted}/{maximum} (threshold {threshold})")
if granted < threshold:
print(f"::error::pana score {granted} is below the threshold of {threshold}")
sys.exit(1)
PY
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ migrate_working_dir/
.flutter-plugins-dependencies
/build/
/coverage/

# FVM Version Cache
.fvm/

# Internal roadmap — kept locally, never published.
IMPROVEMENT_PLAN.md
1 change: 0 additions & 1 deletion android/settings.gradle

This file was deleted.

This file was deleted.

14 changes: 7 additions & 7 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
url: "https://pub.dev"
source: hosted
version: "1.17.0"
version: "1.18.0"
path:
dependency: transitive
description:
Expand Down Expand Up @@ -194,10 +194,10 @@ packages:
dependency: transitive
description:
name: permission_handler_apple
sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023
sha256: "79dfa1df734798aa3cfdad166d3a3698c206d8813de13516ea1071b5d7e2f420"
url: "https://pub.dev"
source: hosted
version: "9.4.7"
version: "9.4.10"
permission_handler_html:
dependency: transitive
description:
Expand Down Expand Up @@ -303,10 +303,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
version: "0.7.11"
vector_math:
dependency: transitive
description:
Expand Down Expand Up @@ -340,5 +340,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=3.9.0 <4.0.0"
dart: ">=3.10.0-0 <4.0.0"
flutter: ">=3.24.0"
3 changes: 1 addition & 2 deletions lib/flutter_android_cdm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class FlutterAndroidCdm {
/// Shared singleton instance.
static final FlutterAndroidCdm instance = FlutterAndroidCdm._();

FlutterAndroidCdmPlatform get _platform =>
FlutterAndroidCdmPlatform.instance;
FlutterAndroidCdmPlatform get _platform => FlutterAndroidCdmPlatform.instance;

/// Shows the CDM system picker filtered by [request] and resolves to the
/// device the user selects.
Expand Down
3 changes: 2 additions & 1 deletion lib/src/cdm_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class CdmException implements Exception {
CdmException(this.code, this.message, {this.details});

/// Convenience constructor that resolves the wire string to the enum.
factory CdmException.fromWire(String wire, String message, {Object? details}) =>
factory CdmException.fromWire(String wire, String message,
{Object? details}) =>
CdmException(CdmErrorCode.fromWire(wire), message, details: details);

/// Type-safe error code.
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description: >-
pattern, or raw advertising data — without rolling your own scan UI or
requesting runtime BLUETOOTH_SCAN / location permissions.
version: 0.0.1
homepage: https://github.com/withintent/flutter_android_cdm
repository: https://github.com/withintent/flutter_android_cdm
issue_tracker: https://github.com/withintent/flutter_android_cdm/issues
homepage: https://github.com/dotintent/flutter-android-cdm
repository: https://github.com/dotintent/flutter-android-cdm
issue_tracker: https://github.com/dotintent/flutter-android-cdm/issues
topics:
- bluetooth
- ble
Expand Down
23 changes: 23 additions & 0 deletions test/cdm_request_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@ void main() {
expect(a, isNot(equals(c)));
expect(a.hashCode, equals(b.hashCode));
});

test('toMap carries all fields', () {
const r = CdmRequest(
serviceUuid: 'uuid',
namePattern: 'pat',
singleDevice: true,
);
expect(r.toMap(), <String, Object?>{
'serviceUuid': 'uuid',
'namePattern': 'pat',
'singleDevice': true,
});
});

test('toMap defaults singleDevice to false and omitted filters to null',
() {
const r = CdmRequest(namePattern: 'pat');
expect(r.toMap(), <String, Object?>{
'serviceUuid': null,
'namePattern': 'pat',
'singleDevice': false,
});
});
});

group('AssociatedDevice', () {
Expand Down
Loading