File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
src/main/java/com/owncloud/android/authentication Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,17 @@ file("$project.rootDir/ndk.env").readLines().each() {
8585
8686def 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+
8899android {
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
Original file line number Diff line number Diff line change 6666import com .nextcloud .operations .PostMethod ;
6767import com .nextcloud .utils .extensions .BundleExtensionsKt ;
6868import com .nextcloud .utils .mdm .MDMConfig ;
69+ import com .owncloud .android .BuildConfig ;
6970import com .owncloud .android .MainApp ;
7071import com .owncloud .android .R ;
7172import 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 */
You can’t perform that action at this time.
0 commit comments