Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/release/3.10' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
TranceLove committed Oct 10, 2024
2 parents 5cb924a + f4eec02 commit fc687d0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,15 @@ class SftpConnectDialog : DialogFragment() {

val accentColor = (activity as ThemedActivity).accent

// Use system provided action to get Uri to PEM.
// Use system provided action to get Uri to PEM (mostly via DocumentsUI).
binding.selectPemBTN.setOnClickListener {
val intent =
Intent()
.setType(MimeTypes.ALL_MIME_TYPES)
.setAction(Intent.ACTION_GET_CONTENT)
activityResultHandlerForPemSelection.launch(intent)
activityResultHandlerForPemSelection.launch(
Intent.createChooser(intent, getString(R.string.ssh_select_pem))
)
}

// Define action for buttons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class SftpConnectDialogSshTest : AbstractSftpConnectDialogTests() {
fun testInvokeSftpConnectionDialogWithPasswordAndDefaultPath() {
val uri =
NetCopyClientUtils.encryptFtpPathAsNecessary(
"ssh://root:12345678@127.0.0.1:22/data/incoming",
"ssh://root:12345678@127.0.0.1:22/data/incoming"
)
val verify = Bundle()
verify.putString("address", "127.0.0.1")
Expand All @@ -112,14 +112,16 @@ class SftpConnectDialogSshTest : AbstractSftpConnectDialogTests() {
/**
* Test invoke [SftpConnectDialog] with arguments including password and URL encoded path.
*/
@Suppress("ktlint:standard:max-line-length")
@Suppress("ktlint:standard:max-line-length", "ktlint:standard:no-single-line-block-comment")
@Test
@Throws(GeneralSecurityException::class, IOException::class)
fun testInvokeSftpConnectionDialogWithPasswordAndEncodedDefaultPath() {
/* ktlint-disable max-line-length */
val uri =
NetCopyClientUtils.encryptFtpPathAsNecessary(
"ssh://root:12345678@127.0.0.1:22/Users/TranceLove/My+Documents/%7BReference%7D%20Zobius%20Facro%20%24%24%20%23RFII1",
"ssh://root:12345678@127.0.0.1:22/Users/TranceLove/My+Documents/%7BReference%7D%20Zobius%20Facro%20%24%24%20%23RFII1"
)
/* ktlint-enable max-line-length */
val verify = Bundle()
verify.putString("address", "127.0.0.1")
verify.putInt("port", 22)
Expand All @@ -142,7 +144,7 @@ class SftpConnectDialogSshTest : AbstractSftpConnectDialogTests() {
@Throws(GeneralSecurityException::class, IOException::class)
private fun testOpenSftpConnectDialog(
uri: String,
verify: Bundle,
verify: Bundle
) {
val activity = mock(MainActivity::class.java)
val utilsHandler = mock(UtilsHandler::class.java)
Expand All @@ -163,7 +165,7 @@ class SftpConnectDialogSshTest : AbstractSftpConnectDialogTests() {
val mocked = mc.constructed()[0]
await().atMost(10, TimeUnit.SECONDS).until { mocked.arguments != null }
for (key in BUNDLE_KEYS) {
if (mocked.arguments!!.getString(key) != null) {
if (mocked.arguments?.getString(key) != null) {
if (key == ARG_PASSWORD) {
assertEquals(
verify.getString(key),
Expand All @@ -179,4 +181,18 @@ class SftpConnectDialogSshTest : AbstractSftpConnectDialogTests() {
}
}
}

companion object {
@JvmStatic
private val BUNDLE_KEYS = arrayOf(
"address",
"port",
"keypairName",
"name",
"username",
"password",
"edit",
"defaultPath"
)
}
}
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ allprojects {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://jcenter.bintray.com" }
maven { url "https://repository.liferay.com/nexus/content/repositories/public/"}
}
tasks.withType(Test).tap {
configureEach {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ apacheMina = "2.0.16"
mockito = "4.11.0"
mockitoInline = "4.11.0"
mockitoKotlin = "4.1.0"
androidBilling = "5.0.0"
androidBilling = "6.0.1"
cloudrailSiAndroid = "2.22.4"
junrar = "7.4.0"
vectordrawableAnimated = "1.1.0"
Expand Down

0 comments on commit fc687d0

Please sign in to comment.