[ktx] onNeverAskAgain not called

Author: SammyOdenhovenCreated Mar 15, 2022Updated Jun 16, 2022

Overview

onNeverAskAgain callback is not called when "Don't ask again" is selected.

Expected

onNeverAskAgain callback is called, so I can show the appropriate UI.

Actual

onNeverAskAgain callback is not called.

Environment

  • Running ktx-sample on API 29 and API 30, using ktx v1.1.3

Investigation

After debugging it, I can see that onNeverAskAgain: WeakReference<Fun>? is null in PermissionRequestViewModel.invoke(). After reading through the closed issues, I came across https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/735. Wondering if the weakreference could be the issue? If I downgrade the ktx library to 1.0.4, onNeverAskAgain is successfully called.

Reproducible steps

https://user-images.githubusercontent.com/35034828/158357946-129980bf-6547-4228-82a4-a03399f88269.mp4

Source: permissions-dispatcher/PermissionsDispatcher