Skip to content

4.0.0-beta03 fixes: Fix drag bounds, decimal display, backup warning/corruption, scenario stats, and branded DontKillMyApp link#934

Open
vibhor1102 wants to merge 6 commits into
Nain57:dev-4.0.0-beta03-fixesfrom
vibhor1102:feature/upstream-fix-right-edge-gap
Open

4.0.0-beta03 fixes: Fix drag bounds, decimal display, backup warning/corruption, scenario stats, and branded DontKillMyApp link#934
vibhor1102 wants to merge 6 commits into
Nain57:dev-4.0.0-beta03-fixesfrom
vibhor1102:feature/upstream-fix-right-edge-gap

Conversation

@vibhor1102

@vibhor1102 vibhor1102 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR contains six fixes/improvements for the 4.0.0-beta03 stabilization branch:

  • Fix the small unboundable area on the right edge when opening or creating the first scenario after installation. Reopening the overlay previously made the problem disappear.
  • Address item 7 from v4 Counter issues #926 by removing forced .0 and .00 suffixes from counter-style values across the app.
  • Avoid the false "different screen" warning when a scenario is exported and imported on the same device in different orientations.
  • Fix scenario usage stats database queries to target correct foreign key columns instead of primary keys, solving the bug where scenario uses count does not increment.
  • Use the branded DontKillMyApp link for Klick'r (https://dontkillmyapp.com?app=Klick%27r) to offer users a tailored troubleshooting page.
  • Fix ZIP backup corruption when overwriting an existing backup file by forcing write truncation mode ("wt") and postponing completion notification until the stream is fully closed.

Backup ZIP corruption on overwrite

When overwriting an existing backup file, the default SAF write mode "w" does not truncate the file on some devices (e.g. Xiaomi/MIUI/HyperOS). If the new ZIP file is smaller than the old one, the trailing data of the old ZIP (including its EOCD and Central Directory) remains at the end of the file, leading to multiple EOCDs and structural ZIP corruption.

This change opens the output stream with mode "wt" to guarantee truncation, and moves progress.onCompleted outside the ZipOutputStream block so that completion is only triggered after the stream has written all metadata and closed.

Special thanks to @ohlalayeah for providing the initial corrupted backup file (KlickrSmartAutoClicker-BackupMiPad6SPro.20260704.zip) that helped isolate this truncation issue.

Scenario usage statistics

The stats queries in ScenarioDao and DumbScenarioDao previously queried the stats table using WHERE id = :scenarioId. Since id is the auto-generated primary key of the stats row itself (and not the scenario's ID), the query fetched the wrong stats row (or returned null and inserted duplicates) and misattributed the stats to a different scenario.

This change updates the queries to correctly use WHERE scenario_id = :scenarioId and WHERE dumb_scenario_id = :scenarioId.

Decimal display behavior

Counter values now use a natural display format at UI boundaries:

  • 1.0 is displayed as 1
  • 1.50 is displayed as 1.5
  • 1.25 remains 1.25
  • meaningful longer decimal values remain available where the UI does not intentionally limit summary precision

Storage, parsing, migrations, and counter calculations remain unchanged. Numeric fields still accept decimals as before, and saved decimal precision is preserved when editing.

Backup screen compatibility

The backup check previously compared width and height in their original order. As a result, a scenario exported in landscape at 2400 x 1080 and imported in portrait at 1080 x 2400 was reported as coming from a different screen, even on the same phone.

The check now accepts either the original dimensions or the same dimensions swapped by rotation. A genuinely different resolution still produces the compatibility warning.

Branded DontKillMyApp link

Uses the branded URL https://dontkillmyapp.com?app=Klick%27r in the accessibility troubleshooting dialog so users get the custom-tailored guidance for Klick'r.

Verification

  • Added focused formatter tests covering whole numbers, trailing zeros, negatives, zero, meaningful decimals, and long decimal values.
  • Added backup compatibility tests for matching orientation, rotated orientation, and genuinely different screen dimensions.
  • Scoped smart-config unit test passed locally for the earlier decimal-display change.
  • Hosted arm64 debug APK build passed and was installed and tested successfully on an Android 14 device before the backup compatibility commit.
  • Reproduced the backup warning on the same Android 14 phone and confirmed the source archive stored 2400 x 1080 while the phone reported 1080 x 2400 during import.
  • Inspected SQLite database tables on device before and after reproducing the bug, verifying that opening a scenario now correctly creates/updates the specific scenario's stats row instead of updating a different scenario's row.
  • Verified accessibility dialog button points to the updated URL.
  • Verified backup ZIP file structure from device showing multiple EOCDs on overwrite, and confirmed the fix truncates the file correctly and ensures single-EOCD compliant ZIP format.

The first ever scenario created or opened had a small margin of unboundable area specifically on the right edge. After closing the scenario overlay and reopening it, or during subsequent runs, the dead area disappeared. This first-run bug has been present since 1.5.0 but was never caught.
@vibhor1102 vibhor1102 changed the title 4.0.0-beta03 fixes: Fix right-edge drag bounds gap on first scenario launch 4.0.0-beta03 fixes: Fix first-launch drag bounds and simplify decimal display Jun 27, 2026
@vibhor1102 vibhor1102 mentioned this pull request Jun 27, 2026
@vibhor1102 vibhor1102 changed the title 4.0.0-beta03 fixes: Fix first-launch drag bounds and simplify decimal display 4.0.0-beta03 fixes: Fix drag bounds, decimal display, and backup screen warning Jun 30, 2026
@vibhor1102 vibhor1102 force-pushed the feature/upstream-fix-right-edge-gap branch from 4539a88 to f6bd042 Compare June 30, 2026 07:03
@vibhor1102 vibhor1102 changed the title 4.0.0-beta03 fixes: Fix drag bounds, decimal display, and backup screen warning 4.0.0-beta03 fixes: Fix drag bounds, decimal display, backup warning, and scenario stats Jul 1, 2026
@vibhor1102 vibhor1102 changed the title 4.0.0-beta03 fixes: Fix drag bounds, decimal display, backup warning, and scenario stats 4.0.0-beta03 fixes: Fix drag bounds, decimal display, backup warning, scenario stats, and branded DontKillMyApp link Jul 3, 2026
@vibhor1102 vibhor1102 changed the title 4.0.0-beta03 fixes: Fix drag bounds, decimal display, backup warning, scenario stats, and branded DontKillMyApp link 4.0.0-beta03 fixes: Fix drag bounds, decimal display, backup warning/corruption, scenario stats, and branded DontKillMyApp link Jul 4, 2026
@vibhor1102

Copy link
Copy Markdown
Contributor Author

Thanks @ohlalayeah for helping in discovery of truncation bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant