@@ -50,9 +50,6 @@ import com.zeapo.pwdstore.ui.dialogs.FolderCreationDialogFragment
5050import com.zeapo.pwdstore.ui.onboarding.activity.OnboardingActivity
5151import com.zeapo.pwdstore.utils.PasswordItem
5252import com.zeapo.pwdstore.utils.PasswordRepository
53- import com.zeapo.pwdstore.utils.PasswordRepository.Companion.getRepository
54- import com.zeapo.pwdstore.utils.PasswordRepository.Companion.getRepositoryDirectory
55- import com.zeapo.pwdstore.utils.PasswordRepository.Companion.initialize
5653import com.zeapo.pwdstore.utils.PreferenceKeys
5754import com.zeapo.pwdstore.utils.base64
5855import com.zeapo.pwdstore.utils.commitChange
@@ -101,7 +98,7 @@ class PasswordStore : BaseGitActivity() {
10198 val intentData = result.data ? : return @registerForActivityResult
10299 val filesToMove = requireNotNull(intentData.getStringArrayExtra(" Files" ))
103100 val target = File (requireNotNull(intentData.getStringExtra(" SELECTED_FOLDER_PATH" )))
104- val repositoryPath = getRepositoryDirectory().absolutePath
101+ val repositoryPath = PasswordRepository . getRepositoryDirectory().absolutePath
105102 if (! target.isDirectory) {
106103 e { " Tried moving passwords to a non-existing folder." }
107104 return @registerForActivityResult
@@ -158,7 +155,7 @@ class PasswordStore : BaseGitActivity() {
158155 }
159156 }
160157 else -> {
161- val repoDir = getRepositoryDirectory().absolutePath
158+ val repoDir = PasswordRepository . getRepositoryDirectory().absolutePath
162159 val relativePath = getRelativePath(" ${target.absolutePath} /" , repoDir)
163160 withContext(Dispatchers .Main ) {
164161 commitChange(
@@ -204,7 +201,7 @@ class PasswordStore : BaseGitActivity() {
204201 setContentView(R .layout.activity_pwdstore)
205202
206203 model.currentDir.observe(this ) { dir ->
207- val basePath = getRepositoryDirectory().absoluteFile
204+ val basePath = PasswordRepository . getRepositoryDirectory().absoluteFile
208205 supportActionBar!! .apply {
209206 if (dir != basePath)
210207 title = dir.name
@@ -384,11 +381,11 @@ class PasswordStore : BaseGitActivity() {
384381 }
385382
386383 private fun checkLocalRepository () {
387- val repo = initialize()
384+ val repo = PasswordRepository . initialize()
388385 if (repo == null ) {
389386 directorySelectAction.launch(UserPreference .createDirectorySelectionIntent(this ))
390387 } else {
391- checkLocalRepository(getRepositoryDirectory())
388+ checkLocalRepository(PasswordRepository . getRepositoryDirectory())
392389 }
393390 }
394391
@@ -400,7 +397,7 @@ class PasswordStore : BaseGitActivity() {
400397 settings.getBoolean(PreferenceKeys .REPO_CHANGED , false )) {
401398 settings.edit { putBoolean(PreferenceKeys .REPO_CHANGED , false ) }
402399 val args = Bundle ()
403- args.putString(REQUEST_ARG_PATH , getRepositoryDirectory().absolutePath)
400+ args.putString(REQUEST_ARG_PATH , PasswordRepository . getRepositoryDirectory().absolutePath)
404401
405402 // if the activity was started from the autofill settings, the
406403 // intent is to match a clicked pwd with app. pass this to fragment
@@ -426,8 +423,8 @@ class PasswordStore : BaseGitActivity() {
426423 }
427424
428425 private fun getLastChangedTimestamp (fullPath : String ): Long {
429- val repoPath = getRepositoryDirectory()
430- val repository = getRepository(repoPath)
426+ val repoPath = PasswordRepository . getRepositoryDirectory()
427+ val repository = PasswordRepository . getRepository(repoPath)
431428 if (repository == null ) {
432429 d { " getLastChangedTimestamp: No git repository" }
433430 return File (fullPath).lastModified()
@@ -450,7 +447,7 @@ class PasswordStore : BaseGitActivity() {
450447 for (intent in arrayOf(decryptIntent, authDecryptIntent)) {
451448 intent.putExtra(" NAME" , item.toString())
452449 intent.putExtra(" FILE_PATH" , item.file.absolutePath)
453- intent.putExtra(" REPO_PATH" , getRepositoryDirectory().absolutePath)
450+ intent.putExtra(" REPO_PATH" , PasswordRepository . getRepositoryDirectory().absolutePath)
454451 intent.putExtra(" LAST_CHANGED_TIMESTAMP" , getLastChangedTimestamp(item.file.absolutePath))
455452 }
456453 // Needs an action to be a shortcut intent
@@ -494,7 +491,7 @@ class PasswordStore : BaseGitActivity() {
494491 i { " Adding file to : ${currentDir.absolutePath} " }
495492 val intent = Intent (this , PasswordCreationActivity ::class .java)
496493 intent.putExtra(" FILE_PATH" , currentDir.absolutePath)
497- intent.putExtra(" REPO_PATH" , getRepositoryDirectory().absolutePath)
494+ intent.putExtra(" REPO_PATH" , PasswordRepository . getRepositoryDirectory().absolutePath)
498495 listRefreshAction.launch(intent)
499496 }
500497
@@ -530,7 +527,7 @@ class PasswordStore : BaseGitActivity() {
530527 refreshPasswordList()
531528 AutofillMatcher .updateMatches(applicationContext, delete = filesToDelete)
532529 val fmt = selectedItems.joinToString(separator = " , " ) { item ->
533- item.file.toRelativeString(getRepositoryDirectory())
530+ item.file.toRelativeString(PasswordRepository . getRepositoryDirectory())
534531 }
535532 lifecycleScope.launch {
536533 commitChange(
@@ -644,7 +641,7 @@ class PasswordStore : BaseGitActivity() {
644641 }
645642
646643 private val currentDir: File
647- get() = getPasswordFragment()?.currentDir ? : getRepositoryDirectory()
644+ get() = getPasswordFragment()?.currentDir ? : PasswordRepository . getRepositoryDirectory()
648645
649646 private suspend fun moveFile (source : File , destinationFile : File ) {
650647 val sourceDestinationMap = if (source.isDirectory) {
@@ -674,7 +671,7 @@ class PasswordStore : BaseGitActivity() {
674671 fun matchPasswordWithApp (item : PasswordItem ) {
675672 val path = item.file
676673 .absolutePath
677- .replace(getRepositoryDirectory().toString() + " /" , " " )
674+ .replace(PasswordRepository . getRepositoryDirectory().toString() + " /" , " " )
678675 .replace(" .gpg" , " " )
679676 val data = Intent ()
680677 data.putExtra(" path" , path)
0 commit comments