Skip to content
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

Merged
merged 2 commits into from
Dec 2, 2018
Merged

Clean up LocalKeyStore and related #3772

merged 2 commits into from
Dec 2, 2018

Conversation

Valodim
Copy link
Contributor

@Valodim Valodim commented Nov 30, 2018

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.

Valodim added a commit that referenced this pull request Dec 1, 2018
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.
Valodim added a commit that referenced this pull request Dec 1, 2018
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) {
Copy link
Member

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();
Copy link
Member

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.

Copy link
Contributor Author

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?

@Valodim
Copy link
Contributor Author

Valodim commented Dec 2, 2018

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.

@Valodim Valodim merged commit e6e0d7c into master Dec 2, 2018
@Valodim Valodim deleted the cleanup-localkeystore branch December 2, 2018 04:08
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.

2 participants