Skip to content
This repository was archived by the owner on Mar 28, 2025. It is now read-only.

Commit 4b00277

Browse files
committed
Fix OAuth, Update Strings, Update Release
1 parent bb19a36 commit 4b00277

File tree

5 files changed

+59
-8
lines changed

5 files changed

+59
-8
lines changed

.github/workflows/release.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,24 @@ jobs:
5050
- name: "Debug Build"
5151
continue-on-error: true
5252
run: |
53+
echo "ref: ${{ github.ref }}"
54+
echo "name: ${{ github.repository_owner }}-debug"
55+
echo "dir: ${{ env.debug }}"
56+
echo "glob: ${{ env.debug }}/*.apk"
5357
ls -lAh ${{ env.debug }}
5458
5559
- name: "Upload Artifacts"
5660
if: ${{ !github.event.act }}
5761
uses: actions/upload-artifact@v4
5862
with:
59-
name: ${{ env.GITHUB_REPOSITORY_OWNER }}-debug
63+
name: ${{ github.repository_owner }}-debug
6064
path: ${{ env.debug }}
6165

6266
- name: "Upload to Release"
6367
if: ${{ github.event_name == 'release' }}
6468
uses: svenstaro/upload-release-action@v2
6569
with:
66-
file: ${{ env.debug }}
70+
file: ${{ env.debug }}/*.apk
6771
tag: ${{ github.ref }}
6872
overwrite: true
6973
file_glob: true

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,30 @@ The URL to the file is automatically copied to the clipboard and the preview is
3030

3131
## Install
3232

33-
Until the app is published it must be loaded with [ADB](https://developer.android.com/tools/adb).
33+
Until the app is published it must be loaded with [ADB](https://developer.android.com/tools/adb) or [Android Studio](https://developer.android.com/studio).
3434
This requires using Android Studio or the command line interface.
3535

36+
<details><summary>▶️ Click Here to View Quick CLI Steps</summary>
37+
38+
```shell
39+
$ which adb
40+
C:\Users\Shane\Android\sdk\platform-tools\adb.EXE
41+
42+
$ wget https://github.com/django-files/android-app/releases/latest/download/app-debug.apk
43+
44+
$ adb devices
45+
List of devices attached
46+
RF9M33Z1Q0M device
47+
48+
$ adb -s RF9M33Z1Q0M install .\app-debug.apk
49+
Performing Streamed Install
50+
Success
51+
```
52+
53+
See below for more details...
54+
55+
</details>
56+
3657
1. Download and Install Android Studio or the Android SDK Platform Tools.
3758

3859
https://developer.android.com/studio
@@ -57,6 +78,13 @@ RF9M33Z1Q0M device
5778

5879
https://github.com/django-files/android-app/releases
5980

81+
```shell
82+
./gradlew build
83+
./gradlew assemble
84+
```
85+
86+
Note: Use `gradlew.bat` for Windows.
87+
6088
4. Unzip the release and change into the directory.
6189

6290
The built apk should be here: `app/build/outputs/apk/debug`

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
minSdk 29
1212
targetSdk 35
1313
versionCode 1
14-
versionName "1.0"
14+
versionName "0.0.1"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
}

app/src/main/java/com/djangofiles/djangofiles/MainActivity.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,28 +172,34 @@ public void showSettingsDialog() {
172172
Log.d("showSettingsDialog", "savedUrl: " + savedUrl);
173173

174174
EditText input = new EditText(this);
175-
input.setHint("Example: df.cssnr.com");
175+
input.setHint(this.getString(R.string.settings_input_place));
176176
if (savedUrl != null) {
177177
input.setText(savedUrl);
178178
}
179+
input.requestFocus();
179180

180181
runOnUiThread(() -> {
181182
new AlertDialog.Builder(this)
182-
.setTitle("App Settings")
183+
.setCancelable(false)
184+
.setTitle(this.getString(R.string.settings_title))
185+
.setMessage(this.getString(R.string.settings_message))
183186
.setView(input)
184187
.setNegativeButton("Exit", (dialog, which) -> finish())
185188
.setPositiveButton("OK", (dialog, which) -> {
186189
String url = input.getText().toString().trim();
187190
Log.d("showSettingsDialog", "setPositiveButton: url:" + url);
188191
if (url.isEmpty()) {
189192
// TODO: Need to add verification here and keep dialog open...
190-
Toast.makeText(this, "Please enter a valid URL", Toast.LENGTH_SHORT).show();
193+
Toast.makeText(this, this.getString(R.string.settings_tst_invalid), Toast.LENGTH_SHORT).show();
191194
finish();
192195
return;
193196
}
194197
if (!url.startsWith("http://") && !url.startsWith("https://")) {
195198
url = "https://" + url;
196199
}
200+
if (url.endsWith("/")) {
201+
url = url.substring(0, url.length() - 1);
202+
}
197203
if (!Objects.equals(savedUrl, url)) {
198204
Log.d("showSettingsDialog", "Saving New URL.");
199205
preferences.edit().putString(URL_KEY, url).apply();
@@ -235,6 +241,7 @@ private void processSharedFile(Uri fileUri) {
235241
String authToken = preferences.getString(TOKEN_KEY, null);
236242
Log.d("processSharedFile", "authToken: " + authToken);
237243
if (savedUrl == null) {
244+
// TODO: Show settings dialog here...
238245
Toast.makeText(this, "Saved URL is not found", Toast.LENGTH_SHORT).show();
239246
return;
240247
}
@@ -396,14 +403,21 @@ public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request
396403
SharedPreferences preferences = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
397404
String savedUrl = preferences.getString(URL_KEY, null);
398405
String requestUrl = request.getUrl().toString();
406+
Log.d("shouldOverrideUrlLoading", "requestUrl: " + requestUrl);
399407

400408
if ((savedUrl != null && requestUrl.startsWith(savedUrl)) ||
401-
requestUrl.startsWith("https://discord.com/oauth2")) {
409+
requestUrl.startsWith("https://discord.com/oauth2") ||
410+
requestUrl.startsWith("https://github.com/sessions/two-factor/app") ||
411+
requestUrl.startsWith("https://github.com/login") ||
412+
requestUrl.startsWith("https://accounts.google.com/v3/signin") ||
413+
requestUrl.startsWith("https://accounts.google.com/o/oauth2/v2/auth")) {
414+
Log.d("shouldOverrideUrlLoading", "FALSE");
402415
return false;
403416
}
404417

405418
Intent intent = new Intent(Intent.ACTION_VIEW, request.getUrl());
406419
startActivity(intent);
420+
Log.d("shouldOverrideUrlLoading", "TRUE");
407421
return true;
408422
}
409423
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
<resources>
22
<string name="app_name">Django Files</string>
3+
4+
<string name="settings_title">App Settings</string>
5+
<string name="settings_message">Set or Change the Django Files URL</string>
6+
<string name="settings_input_place">your.django-files.com</string>
7+
<string name="settings_tst_invalid">Please enter a valid URL</string>
38
</resources>

0 commit comments

Comments
 (0)