diff --git a/data/src/main/java/one/nem/lacerta/data/impl/CommonsImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/CommonsImpl.java index bef046fd..26a6c71b 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/CommonsImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/CommonsImpl.java @@ -1,4 +1,30 @@ package one.nem.lacerta.data.impl; -public class CommonsImpl { +import android.content.Context; + +import java.nio.file.Path; + +import javax.inject.Inject; + +import dagger.hilt.android.qualifiers.ApplicationContext; +import one.nem.lacerta.data.repository.Commons; + +public class CommonsImpl implements Commons{ + + private Context applicationContext; + + @Inject + public CommonsImpl(@ApplicationContext Context applicationContext) { + this.applicationContext = applicationContext; + } + + + public Path getExternalFilesDirPath(String type) { + return applicationContext.getExternalFilesDir(type).toPath(); + } + + public Path getExternalFilesDirPath() { + return applicationContext.getExternalFilesDir(null).toPath(); + } + } diff --git a/data/src/main/java/one/nem/lacerta/data/repository/Commons.java b/data/src/main/java/one/nem/lacerta/data/repository/Commons.java index d1bc7db9..54d46f07 100644 --- a/data/src/main/java/one/nem/lacerta/data/repository/Commons.java +++ b/data/src/main/java/one/nem/lacerta/data/repository/Commons.java @@ -4,6 +4,8 @@ import java.nio.file.Path; public interface Commons { - Path getExternalFilesDir(String type); + Path getExternalFilesDirPath(String type); + + Path getExternalFilesDirPath(); }