-
-
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 StorageFilesProvider
- 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/AndroidStorageFilesProvider.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 AndroidStorageFilesProvider( | ||
private val context: Context, | ||
private val accountId: String, | ||
) : StorageFilesProvider { | ||
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/AndroidStorageFilesProviderFactory.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 AndroidStorageFilesProviderFactory( | ||
private val context: Context, | ||
) : StorageFilesProviderFactory { | ||
override fun createStorageFilesProvider(accountId: String): StorageFilesProvider { | ||
return AndroidStorageFilesProvider(context, accountId) | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
legacy/core/src/main/java/com/fsck/k9/mailstore/StorageFilesProvider.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 StorageFilesProvider { | ||
/** | ||
* 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/StorageFilesProviderFactory.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 StorageFilesProviderFactory { | ||
fun createStorageFilesProvider(accountId: String): StorageFilesProvider | ||
} |
Oops, something went wrong.