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
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## 0.2.0

**Cash drawer reliability & service binding fixes**

* **Breaking:** `openDrawer()` now completes only once the printer firmware confirms the kick.
It previously resolved as soon as the AIDL call was dispatched, so a drawer that never opened
still reported success. It now throws a `PlatformException` with code `OPERATION_FAILED`,
`PRINTER_EXCEPTION`, `UNAVAILABLE` or `TIMEOUT`.
* **Breaking:** `drawerStatus()` and `drawerTimesOpen()` no longer return `false` / `0` when the
printer service is unreachable — they throw a `PlatformException` with code `UNAVAILABLE`.
A dead binding used to be indistinguishable from a drawer that is simply not attached.
* **Fixed:** Added the `<queries>` declaration for `woyou.aidlservice.jiuiv5` to the plugin
manifest. On Android 11+ with `targetSdk >= 30`, package visibility filtering made the Sunmi
service invisible, so `bindService()` returned `false` and the printer was reported as
"not found" even when installed. Host apps no longer need to declare this themselves.
* **Fixed:** `BIND_SERVICE` could never resolve. The pending `Result` was only completed from
`onServiceConnected`, so a refused or failed bind left the Dart future awaiting forever — which
froze app startup for any host that awaited it before `runApp()`. Every exit path now settles
the result, including a `false` return from `bindService()`, `onNullBinding` and `onBindingDied`.
* **Fixed:** The connection is now re-established after `onBindingDied`, and commands that find the
service missing schedule a reconnect. Previously a service restart left the plugin permanently
broken until the host app was restarted.
* **Fixed:** `unbindService()` now releases a connection that was requested but never completed,
and the plugin cleans up when the Flutter engine detaches.
* In-flight AIDL callbacks are held with a strong reference so they cannot be garbage collected
before the printer replies, and are bounded by a 5s timeout.

## 0.1.0

**Major Architecture Refactor & Modernization**
Expand Down
15 changes: 13 additions & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.francescodema.sunmi_task_printer">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<!--
Android 11+ (targetSdk >= 30) filters which packages an app can see.
Without this declaration bindService() silently returns false and the
Sunmi printer service is reported as "not found" even when installed.
-->
<queries>
<package android:name="woyou.aidlservice.jiuiv5" />
<intent>
<action android:name="woyou.aidlservice.jiuiv5.IWoyouService" />
</intent>
</queries>
</manifest>
Loading
Loading