Skip to content

Commit 247d085

Browse files
committed
add debug info
Signed-off-by: alperozturk <[email protected]>
1 parent 5578f87 commit 247d085

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

app/build.gradle

Lines changed: 15 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,10 @@ android {
142153
debug {
143154
testCoverageEnabled = project.hasProperty("coverage")
144155
resConfigs "xxxhdpi"
156+
157+
buildConfigField "String", "NC_TEST_SERVER_BASEURL", "\"${configProps['NC_TEST_SERVER_BASEURL']}\""
158+
buildConfigField "String", "NC_TEST_SERVER_USERNAME", "\"${configProps['NC_TEST_SERVER_USERNAME']}\""
159+
buildConfigField "String", "NC_TEST_SERVER_PASSWORD", "\"${configProps['NC_TEST_SERVER_PASSWORD']}\""
145160
}
146161
}
147162

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import com.nextcloud.operations.PostMethod;
6767
import com.nextcloud.utils.extensions.BundleExtensionsKt;
6868
import com.nextcloud.utils.mdm.MDMConfig;
69+
import com.owncloud.android.BuildConfig;
6970
import com.owncloud.android.MainApp;
7071
import com.owncloud.android.R;
7172
import com.owncloud.android.databinding.AccountSetupBinding;
@@ -582,12 +583,26 @@ private void initOverallUi() {
582583

583584
if (deviceInfo.hasCamera(this)) {
584585
accountSetupBinding.scanQr.setOnClickListener(v -> onScan());
586+
addDebugLogin();
585587
viewThemeUtils.platform.tintDrawable(this, accountSetupBinding.scanQr.getDrawable(), ColorRole.ON_PRIMARY);
586588
} else {
587589
accountSetupBinding.scanQr.setVisibility(View.GONE);
588590
}
589591
}
590592

593+
private void addDebugLogin() {
594+
if (BuildConfig.DEBUG) {
595+
accountSetupBinding.scanQr.setOnLongClickListener(v -> {
596+
String baseUrl = BuildConfig.NC_TEST_SERVER_BASEURL;
597+
String username = BuildConfig.NC_TEST_SERVER_USERNAME;
598+
String password = BuildConfig.NC_TEST_SERVER_PASSWORD;
599+
String dataString = "nc://login/user:" + username + "&" + "password:" + password + "&" + "server:" + baseUrl;
600+
parseAndLoginFromWebView(dataString);
601+
return false;
602+
});
603+
}
604+
}
605+
591606
/**
592607
* @param savedInstanceState Saved activity state, as in {{@link #onCreate(Bundle)}
593608
*/

0 commit comments

Comments
 (0)