-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace
StorageManager
with DatabaseFilesProvider
- Loading branch information
Showing
17 changed files
with
106 additions
and
393 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
legacy/core/src/main/java/com/fsck/k9/mailstore/AndroidDatabaseFilesProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.fsck.k9.mailstore | ||
|
||
import android.content.Context | ||
import java.io.File | ||
|
||
internal class AndroidDatabaseFilesProvider( | ||
private val context: Context, | ||
private val accountId: String, | ||
) : DatabaseFilesProvider { | ||
override fun getDatabaseFile(): File { | ||
return context.getDatabasePath("$accountId.db") | ||
} | ||
|
||
override fun getAttachmentDirectory(): File { | ||
return context.getDatabasePath("$accountId.db_att") | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
legacy/core/src/main/java/com/fsck/k9/mailstore/AndroidDatabaseFilesProviderFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.fsck.k9.mailstore | ||
|
||
import android.content.Context | ||
|
||
class AndroidDatabaseFilesProviderFactory( | ||
private val context: Context, | ||
) : DatabaseFilesProviderFactory { | ||
override fun createDatabaseFilesProvider(accountId: String): DatabaseFilesProvider { | ||
return AndroidDatabaseFilesProvider(context, accountId) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
legacy/core/src/main/java/com/fsck/k9/mailstore/DatabaseFilesProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.fsck.k9.mailstore | ||
|
||
import java.io.File | ||
|
||
interface DatabaseFilesProvider { | ||
/** | ||
* Returns the file that should be used for the message store database. | ||
*/ | ||
fun getDatabaseFile(): File | ||
|
||
/** | ||
* Returns the directory under which to store attachments. | ||
*/ | ||
fun getAttachmentDirectory(): File | ||
} |
5 changes: 5 additions & 0 deletions
5
legacy/core/src/main/java/com/fsck/k9/mailstore/DatabaseFilesProviderFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.fsck.k9.mailstore | ||
|
||
interface DatabaseFilesProviderFactory { | ||
fun createDatabaseFilesProvider(accountId: String): DatabaseFilesProvider | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.