Skip to content

Commit c046bdf

Browse files
committed
ANDROID: Fix download error when duplicate scratch.bas files
1 parent 7745694 commit c046bdf

File tree

9 files changed

+38
-12
lines changed

9 files changed

+38
-12
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2023-05-12 (12.27)
2+
CONSOLE: Fix image save
3+
ANDROID: Fix download error when there are duplicate scratch.bas files
4+
15
2023-03-26 (12.26)
26
ANDROID: Fix setenv error #187
37
ANDROID: update web UI dependencies

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dnl This program is distributed under the terms of the GPL v2.0
77
dnl Download the GNU Public License (GPL) from www.gnu.org
88
dnl
99

10-
AC_INIT([smallbasic], [12.26])
10+
AC_INIT([smallbasic], [12.27])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET

src/platform/android/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ ndk-build-release:
3131
(cd jni && ${NDK}/ndk-build NDK_DEBUG=0)
3232

3333
release:
34-
(./gradlew clean assemble)
34+
(./gradlew clean :app:bundle)
3535

3636
library:
3737
(./gradlew clean assemble)
3838
(mkdir -p dist)
3939
(cp -R app/build/intermediates/stripped_native_libs/release/out/lib/ dist)
4040
(cp app/build/intermediates/dex/release/minifyReleaseWithR8/classes.dex dist)
41+

src/platform/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
targetSdkVersion 33
1212
versionCode 59
1313
versionName '12.26'
14-
resConfigs 'en'
14+
resConfigs 'en'
1515
}
1616

1717
signingConfigs {
@@ -59,6 +59,6 @@ android {
5959
}
6060

6161
dependencies {
62-
implementation 'androidx.core:core:1.9.0'
62+
implementation 'androidx.core:core:1.10.0'
6363
testImplementation 'junit:junit:4.13.2'
6464
}

src/platform/android/app/src/main/assets/main.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ sub do_about()
120120
color colText
121121
print "Version "; sbver
122122
print
123-
print "Copyright (c) 2002-2022 Chris Warren-Smith"
123+
print "Copyright (c) 2002-2023 Chris Warren-Smith"
124124
print "Copyright (c) 1999-2006 Nicholas Christopoulos" + chr(10)
125125

126126
local bn_home

src/platform/android/app/src/main/java/net/sourceforge/smallbasic/WebServer.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
import java.util.ArrayList;
1818
import java.util.Collection;
1919
import java.util.HashMap;
20+
import java.util.HashSet;
2021
import java.util.List;
2122
import java.util.Locale;
2223
import java.util.Map;
24+
import java.util.Set;
2325
import java.util.TimeZone;
2426
import java.util.concurrent.ExecutorService;
2527
import java.util.concurrent.Executors;
@@ -424,8 +426,24 @@ private Response handleDownload(Map<String, Collection<String>> data) throws IOE
424426
// download multiple as zip
425427
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
426428
ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
429+
Set<String> fileNameSet = new HashSet<>();
427430
for (String fileName : fileNames) {
428431
Response response = getFile(remoteHost, fileName, false);
432+
// de-duplicate the fileName entry to avoid a duplicate entry/zip exception
433+
int index = 1;
434+
String originalName = fileName;
435+
while (fileNameSet.contains(fileName)) {
436+
int dot = originalName.lastIndexOf('.');
437+
if (dot != -1) {
438+
String extension = originalName.substring(dot + 1);
439+
String name = originalName.substring(0, dot);
440+
fileName = String.format(Locale.ENGLISH, "%s (%d).%s", name, index, extension);
441+
} else {
442+
fileName = String.format(Locale.ENGLISH, "%s (%d)", originalName, index);
443+
}
444+
index++;
445+
}
446+
fileNameSet.add(fileName);
429447
ZipEntry entry = new ZipEntry(fileName);
430448
zipOutputStream.putNextEntry(entry);
431449
response.toStream(zipOutputStream);

src/platform/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
mavenCentral()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:7.4.2'
8+
classpath 'com.android.tools.build:gradle:8.0.1'
99
}
1010
}
1111

src/platform/android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
12+
android.defaults.buildfeatures.buildconfig=true
1213
android.enableJetifier=true
14+
android.nonFinalResIds=false
15+
android.nonTransitiveRClass=false
1316
android.useAndroidX=true
1417
org.gradle.jvmargs=-Xmx1536m
1518

src/platform/android/webui/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"private": true,
55
"proxy": "http://localhost:8080",
66
"dependencies": {
7-
"@emotion/react": "^11.10.6",
8-
"@emotion/styled": "^11.10.6",
9-
"@mui/icons-material": "^5.11.11",
10-
"@mui/material": "^5.11.14",
11-
"@mui/x-data-grid": "^6.0.2",
12-
"npm-check-updates": "^16.8.0",
7+
"@emotion/react": "^11.11.0",
8+
"@emotion/styled": "^11.11.0",
9+
"@mui/icons-material": "^5.11.16",
10+
"@mui/material": "^5.13.0",
11+
"@mui/x-data-grid": "^6.3.1",
12+
"npm-check-updates": "^16.10.12",
1313
"react": "^18.2.0",
1414
"react-dom": "^18.2.0",
1515
"react-scripts": "5.0.1"

0 commit comments

Comments
 (0)