Skip to content

Commit

Permalink
Merge pull request #3471 from TeamAmaze/release/3.8
Browse files Browse the repository at this point in the history
Release 3.8 to master
  • Loading branch information
VishalNehra authored Sep 17, 2022
2 parents 0007631 + 3585639 commit 45e82bf
Show file tree
Hide file tree
Showing 219 changed files with 10,676 additions and 3,931 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: "temurin"
distribution: "corretto"
java-version: 11
- name: Check formatting using spotless
uses: gradle/gradle-build-action@v2
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: "temurin"
distribution: "corretto"
java-version: 11
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
Expand Down
33 changes: 22 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
applicationId "com.amaze.filemanager"
minSdkVersion 14
targetSdkVersion 30
versionCode 110
versionName "3.7.2"
versionCode 111
versionName "3.8"
multiDexEnabled true

vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -123,7 +123,7 @@ dependencies {
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.room:room-runtime:$roomVersion"
implementation "com.android.billingclient:billing:$androidBillingVersion"
playImplementation "com.android.billingclient:billing:$androidBillingVersion"
kapt "androidx.room:room-compiler:$roomVersion"
// RxJava support for Room
implementation "androidx.room:room-rxjava2:$roomVersion"
Expand All @@ -146,7 +146,6 @@ dependencies {
testImplementation "org.apache.sshd:sshd-core:1.7.0"
testImplementation "org.awaitility:awaitility:$awaitilityVersion"
testImplementation 'org.jsoup:jsoup:1.11.2'
testImplementation 'commons-net:commons-net:3.6'
testImplementation "androidx.room:room-migration:$roomVersion"
testImplementation "io.mockk:mockk:$mockkVersion"
kaptTest "com.google.auto.service:auto-service:1.0-rc4"
Expand All @@ -166,7 +165,7 @@ dependencies {

implementation "org.apache.commons:commons-compress:$commonsCompressVersion"

implementation "com.github.junrar:junrar:$junrarVersion"
playImplementation "com.github.junrar:junrar:$junrarVersion"

implementation "com.afollestad.material-dialogs:core:$materialDialogsVersion"
implementation "com.afollestad.material-dialogs:commons:$materialDialogsVersion"
Expand All @@ -176,11 +175,11 @@ dependencies {

//implementation files('libs/ftplet-api-1.1.0-SNAPSHOT.jar')
// https://mvnrepository.com/artifact/org.apache.ftpserver/ftplet-api
implementation group: 'org.apache.ftpserver', name: 'ftplet-api', version: '1.1.0'
implementation group: 'org.apache.ftpserver', name: 'ftplet-api', version: '1.1.1'

//implementation files('libs/ftpserver-core-1.1.0-SNAPSHOT.jar')
// https://mvnrepository.com/artifact/org.apache.ftpserver/ftpserver-core
implementation group: 'org.apache.ftpserver', name: 'ftpserver-core', version: '1.1.0'
implementation group: 'org.apache.ftpserver', name: 'ftpserver-core', version: '1.1.1'

implementation 'org.greenrobot:eventbus:3.3.1'

Expand All @@ -189,7 +188,7 @@ dependencies {
implementation "com.github.topjohnwu.libsu:core:${libsuVersion}"
implementation "com.github.topjohnwu.libsu:io:${libsuVersion}"

implementation 'com.cloudrail:cloudrail-si-android:2.22.4'
playImplementation 'com.cloudrail:cloudrail-si-android:2.22.4'

implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'//Nice charts and graphs

Expand All @@ -201,6 +200,9 @@ dependencies {
//smb
implementation "eu.agno3.jcifs:jcifs-ng:$jcifsVersion"

//FTP
implementation "commons-net:commons-net:$commonsNetVersion"

implementation "org.bouncycastle:bcpkix-jdk15on:$bouncyCastleVersion"
implementation "org.bouncycastle:bcprov-jdk15on:$bouncyCastleVersion"

Expand All @@ -225,7 +227,7 @@ dependencies {
//zip4j: support password-protected zips
implementation "net.lingala.zip4j:zip4j:$zip4jVersion"

implementation 'org.tukaani:xz:1.8'
implementation 'org.tukaani:xz:1.9'

implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
// Because RxAndroid releases are few and far between, it is recommended you also
Expand All @@ -238,8 +240,8 @@ dependencies {
implementation "androidx.core:core-ktx:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "ch.acra:acra-core:5.7.0"
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'com.github.tony19:logback-android:2.0.0'
runtimeOnly 'org.slf4j:slf4j-api:1.7.32'
runtimeOnly "com.github.tony19:logback-android:$logbackAndroidVersion"
}

configurations.all {
Expand All @@ -254,6 +256,15 @@ configurations.all {
}
}

configurations.all { config ->
// This workarounds logback's multiple bindings problem when running tests.
if (config.name.toLowerCase().contains('test')) {
config.resolutionStrategy.dependencySubstitution {
substitute module("com.github.tony19:logback-android:$logbackAndroidVersion") with module("ch.qos.logback:logback-classic:1.2.9")
}
}
}

task supportOldLangCodes

[['id', 'in'], ['yi', 'ji'], ['he', 'iw']].forEach { sourceCode, destinationCode ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ServiceTestRule
import com.amaze.filemanager.utils.ObtainableServiceBinder
import com.amaze.filemanager.utils.PasswordUtil
import org.apache.commons.net.PrintCommandListener
import org.apache.commons.net.ftp.FTP
import org.apache.commons.net.ftp.FTPClient
import org.apache.commons.net.ftp.FTPSClient
Expand Down Expand Up @@ -92,9 +93,11 @@ class FtpServiceEspressoTest {
.putExtra(FtpService.TAG_STARTED_BY_TILE, false)
)

await().atMost(10, TimeUnit.SECONDS).until { FtpService.isRunning() }
waitForServer()
await().atMost(10, TimeUnit.SECONDS).until {
FtpService.isRunning() && isServerReady()
}
FTPClient().run {
addProtocolCommandListener(PrintCommandListener(System.err))
loginAndVerifyWith(this)
testUploadWith(this)
testDownloadWith(this)
Expand All @@ -118,10 +121,12 @@ class FtpServiceEspressoTest {
.putExtra(FtpService.TAG_STARTED_BY_TILE, false)
)

await().atMost(10, TimeUnit.SECONDS).until { FtpService.isRunning() }
waitForServer()
await().atMost(10, TimeUnit.SECONDS).until {
FtpService.isRunning() && isServerReady()
}

FTPSClient(true).run {
addProtocolCommandListener(PrintCommandListener(System.err))
loginAndVerifyWith(this)
testUploadWith(this)
testDownloadWith(this)
Expand Down Expand Up @@ -150,9 +155,9 @@ class FtpServiceEspressoTest {
.putExtra(FtpService.TAG_STARTED_BY_TILE, false)
)

while (!FtpService.isRunning());
assertTrue(FtpService.isRunning())
waitForServer()
await().atMost(10, TimeUnit.SECONDS).until {
FtpService.isRunning() && isServerReady()
}

FTPClient().run {
connect("localhost", FtpService.DEFAULT_PORT)
Expand All @@ -171,7 +176,7 @@ class FtpServiceEspressoTest {
assertTrue(
"No files found on device? It is also possible that app doesn't have " +
"permission to access storage, which may occur on broken Android emulators",
files.size > 0
files.isNotEmpty()
)
var downloadFolderExists = false
for (f in files) {
Expand Down Expand Up @@ -203,12 +208,12 @@ class FtpServiceEspressoTest {
enterLocalPassiveMode()
setFileType(FTP.ASCII_FILE_TYPE)
ByteArrayInputStream(randomString.toByteArray(charset("utf-8"))).run {
storeFile("test.txt", this)
this.copyTo(storeFileStream("test.txt"))
close()
}
ByteArrayInputStream(bytes2).run {
setFileType(FTP.BINARY_FILE_TYPE)
storeFile("test.bin", this)
assertTrue(setFileType(FTP.BINARY_FILE_TYPE))
this.copyTo(storeFileStream("test.bin"))
close()
}
logout()
Expand Down Expand Up @@ -296,17 +301,15 @@ class FtpServiceEspressoTest {
}
}

private fun waitForServer() {
var available = false
while (!available) {
Socket().run {
available = try {
connect(InetSocketAddress(InetAddress.getLocalHost(), FtpService.DEFAULT_PORT))
close()
true
} catch (e: SocketException) {
false
}
private fun isServerReady(): Boolean {
return Socket().let {
try {
it.connect(InetSocketAddress(InetAddress.getLocalHost(), FtpService.DEFAULT_PORT))
true
} catch (e: SocketException) {
false
} finally {
it.close()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.junit.runner.RunWith;

import com.amaze.filemanager.database.models.OperationData;
import com.amaze.filemanager.filesystem.ssh.SshClientUtils;
import com.amaze.filemanager.filesystem.ftp.NetCopyClientUtils;

import android.content.Context;
import android.os.Environment;
Expand Down Expand Up @@ -118,7 +118,7 @@ public void testRepeatedSaveBookmarkShouldNeverThrowException() {
}

private void performEncryptUriTest(@NonNull final String origPath) {
String encryptedPath = SshClientUtils.encryptSshPathAsNecessary(origPath);
String encryptedPath = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(origPath);

utilsHandler.saveToDatabase(
new OperationData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import com.amaze.filemanager.filesystem.ssh.SshClientUtils;
import com.amaze.filemanager.filesystem.ftp.NetCopyClientUtils;

import androidx.test.ext.junit.runners.AndroidJUnit4;

Expand All @@ -36,47 +36,47 @@ public class SshClientUtilTest {
@Test
public void testEncryptDecryptUriWithNoPassword() {
String uri = "ssh://testuser@127.0.0.1:22";
assertEquals(uri, SshClientUtils.encryptSshPathAsNecessary(uri));
assertEquals(uri, SshClientUtils.decryptSshPathAsNecessary(uri));
assertEquals(uri, NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(uri));
assertEquals(uri, NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(uri));
}

@Test
public void testEncryptDecryptPasswordWithMinusSign1() {
String uri = "ssh://testuser:abcd-efgh@127.0.0.1:22";
String result = SshClientUtils.encryptSshPathAsNecessary(uri);
String result = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(uri);
assertTrue(result.contains("ssh://testuser:"));
assertTrue(result.contains("@127.0.0.1:22"));
String verify = SshClientUtils.decryptSshPathAsNecessary(result);
String verify = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(result);
assertEquals(uri, verify);
}

@Test
public void testEncryptDecryptPasswordWithMinusSign2() {
String uri = "ssh://testuser:---------------@127.0.0.1:22";
String result = SshClientUtils.encryptSshPathAsNecessary(uri);
String result = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(uri);
assertTrue(result.contains("ssh://testuser:"));
assertTrue(result.contains("@127.0.0.1:22"));
String verify = SshClientUtils.decryptSshPathAsNecessary(result);
String verify = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(result);
assertEquals(uri, verify);
}

@Test
public void testEncryptDecryptPasswordWithMinusSign3() {
String uri = "ssh://testuser:--agdiuhdpost15@127.0.0.1:22";
String result = SshClientUtils.encryptSshPathAsNecessary(uri);
String result = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(uri);
assertTrue(result.contains("ssh://testuser:"));
assertTrue(result.contains("@127.0.0.1:22"));
String verify = SshClientUtils.decryptSshPathAsNecessary(result);
String verify = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(result);
assertEquals(uri, verify);
}

@Test
public void testEncryptDecryptPasswordWithMinusSign4() {
String uri = "ssh://testuser:t-h-i-s-i-s-p-a-s-s-w-o-r-d-@127.0.0.1:22";
String result = SshClientUtils.encryptSshPathAsNecessary(uri);
String result = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(uri);
assertTrue(result.contains("ssh://testuser:"));
assertTrue(result.contains("@127.0.0.1:22"));
String verify = SshClientUtils.decryptSshPathAsNecessary(result);
String verify = NetCopyClientUtils.INSTANCE.encryptFtpPathAsNecessary(result);
assertEquals(uri, verify);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (C) 2014-2022 Arpit Khurana <arpitkh96@gmail.com>, Vishal Nehra <vishalmeham2@gmail.com>,
* Emmanuel Messulam<emmanuelbendavid@gmail.com>, Raymond Lai <airwave209gt at gmail.com> and Contributors.
*
* This file is part of Amaze File Manager.
*
* Amaze File Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.amaze.filemanager.asynchronous.asynctasks;

import java.lang.ref.WeakReference;

import com.amaze.filemanager.database.CloudHandler;
import com.amaze.filemanager.ui.activities.MainActivity;

import android.database.Cursor;
import android.os.AsyncTask;

import androidx.annotation.NonNull;

public class CloudLoaderAsyncTask extends AsyncTask<Void, Void, Boolean> {

private final WeakReference<MainActivity> mainActivity;

public CloudLoaderAsyncTask(MainActivity mainActivity, CloudHandler unused1, Cursor unused2) {
this.mainActivity = new WeakReference<>(mainActivity);
}

@Override
@NonNull
public Boolean doInBackground(Void... voids) {
return false;
}

@Override
protected void onCancelled() {
super.onCancelled();
final MainActivity mainActivity = this.mainActivity.get();
if (mainActivity != null) {
mainActivity
.getSupportLoaderManager()
.destroyLoader(MainActivity.REQUEST_CODE_CLOUD_LIST_KEY);
mainActivity
.getSupportLoaderManager()
.destroyLoader(MainActivity.REQUEST_CODE_CLOUD_LIST_KEYS);
}
}

@Override
public void onPostExecute(@NonNull Boolean result) {
if (result) {
final MainActivity mainActivity = this.mainActivity.get();
if (mainActivity != null) {
mainActivity.getDrawer().refreshDrawer();
mainActivity.invalidateFragmentAndBundle(null, true);
}
}
}
}
Loading

0 comments on commit 45e82bf

Please sign in to comment.