-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up LocalKeyStore and related #3772
Conversation
This is a permanent error, but apparently not treated as one. I got a certificate error notification every two seconds just now (because LocalKeyStore is broken, see #3772). This PR simply stops the pusher on a certificate error.
This is a permanent error, but apparently not treated as one. I got a certificate error notification every two seconds just now (because LocalKeyStore is broken, see #3772). This PR simply stops the pusher on a certificate error.
val uri: Uri | ||
if (direction === MailServerDirection.INCOMING) { | ||
uri = Uri.parse(account.storeUri) | ||
val uri = if (direction === MailServerDirection.INCOMING) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: Even nicer with the when
keyword. You can use MailServerDirection.INCOMING
and MailServerDirection.OUTGOING
without needing an else case. Builds will automatically fail when another enum value is added without this when
being changed to add the missing case.
public static LocalKeyStore getInstance() { | ||
return LocalKeyStoreHolder.INSTANCE; | ||
public static LocalKeyStore createInstance(Context context) { | ||
String keyStoreLocation = context.getDir("KeyStore", Context.MODE_PRIVATE).toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds a dependency to an Android class. Ideally we want to push these Android dependencies as far "up" as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered this but couldn't find an obvious solution that doesn't add a lot of code. Do you have a suggestion on how to do that here? Introduce a new K9Context interface and specialize it for methods like this?
I'll merge this for now because it breaks master for me. Feel free to fix the small dependency regression, suggest a fix, or leave as is. |
I introduced a bug in #3744 by injecting LocalKeyStore via Koin before the storage path is initialized. This PR cleans up LocalKeyStore and related classes, and they are now properly dependency injected.