Skip to content

Commit 50d8c92

Browse files
Merge pull request #15188 from nextcloud/add-debug-login
Add Debug Login
2 parents 6985ce0 + 1093fd7 commit 50d8c92

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

app/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ file("$project.rootDir/ndk.env").readLines().each() {
8585

8686
def perfAnalysis = project.hasProperty("perfAnalysis")
8787

88+
def getConfigProperties() {
89+
def props = new Properties()
90+
def file = rootProject.file(".gradle/config.properties")
91+
if (file.exists()) {
92+
props.load(new FileInputStream(file))
93+
}
94+
return props
95+
}
96+
97+
def configProps = getConfigProperties()
98+
8899
android {
89100
// install this NDK version and Cmake to produce smaller APKs. Build will still work if not installed
90101
ndkVersion = "${ndkEnv.get("NDK_VERSION")}"
@@ -142,6 +153,8 @@ android {
142153
debug {
143154
testCoverageEnabled = project.hasProperty("coverage")
144155
resConfigs "xxxhdpi"
156+
157+
buildConfigField "String", "NC_TEST_SERVER_DATA_STRING", "\"nc://login/user:${configProps['NC_TEST_SERVER_USERNAME']}&password:${configProps['NC_TEST_SERVER_PASSWORD']}&server:${configProps['NC_TEST_SERVER_BASEURL']}\""
145158
}
146159
}
147160

app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import com.nextcloud.operations.PostMethod;
6565
import com.nextcloud.utils.extensions.BundleExtensionsKt;
6666
import com.nextcloud.utils.mdm.MDMConfig;
67+
import com.owncloud.android.BuildConfig;
6768
import com.owncloud.android.MainApp;
6869
import com.owncloud.android.R;
6970
import com.owncloud.android.databinding.AccountSetupBinding;
@@ -648,6 +649,18 @@ private void initOverallUi() {
648649
} else {
649650
accountSetupBinding.scanQr.setVisibility(View.GONE);
650651
}
652+
653+
addDebugLogin();
654+
}
655+
656+
private void addDebugLogin() {
657+
if (BuildConfig.DEBUG) {
658+
accountSetupBinding.thumbnail.setOnLongClickListener(v -> {
659+
final String dataString = BuildConfig.NC_TEST_SERVER_DATA_STRING;
660+
parseAndLoginFromWebView(dataString);
661+
return false;
662+
});
663+
}
651664
}
652665

653666
/**

0 commit comments

Comments
 (0)