bitfireAT / davx5-ose

DAVx⁵ is an open-source CalDAV/CardDAV suite and sync app for Android. You can also access your online files (WebDAV) with it.
https://www.davx5.com
GNU General Public License v3.0
1.25k stars 69 forks source link

Fix login detail pages loosing user changes on rotation / re-creation (closes #775) #778

Closed sunkup closed 1 week ago

sunkup commented 2 weeks ago

Purpose

Previously view models of the login details compose screens were initialized using LaunchedEffect, which had LoginDetails screens loose user made changes on screen rotation/re-compose. This is because the LaunchedEffect was called on every re-composition, even when called with a constant like LaunchedEffect(true).

Injecting the view models with hilt allows to initialize the model directly when created by the hilt factory, thus circumventing the problem.

Short description

See also: https://developer.android.com/develop/ui/compose/libraries#hilt https://developer.android.com/develop/ui/compose/libraries#viewmodel

Checklist