diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/App.kt b/app/src/main/java/pl/szczodrzynski/edziennik/App.kt
index cf688b03..74e23d88 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/App.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/App.kt
@@ -235,6 +235,7 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
}
Signing.getCert(this)
+ Utils.initializeStorageDir(this)
launch {
withContext(Dispatchers.Default) {
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/GenerateBlockTimetableDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/GenerateBlockTimetableDialog.kt
index 701ed9ed..66401d31 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/GenerateBlockTimetableDialog.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/timetable/GenerateBlockTimetableDialog.kt
@@ -109,12 +109,10 @@ class GenerateBlockTimetableDialog(
.show()
dialog.getButton(AlertDialog.BUTTON_POSITIVE)?.onClick {
- app.permissionManager.requestStoragePermission(activity, permissionMessage = R.string.permissions_generate_timetable) {
- when (b.weekSelectionRadioGroup.checkedRadioButtonId) {
- R.id.withChangesCurrentWeekRadio -> generateBlockTimetable(weekCurrentStart, weekCurrentEnd)
- R.id.withChangesNextWeekRadio -> generateBlockTimetable(weekNextStart, weekNextEnd)
- R.id.forSelectedWeekRadio -> selectDate()
- }
+ when (b.weekSelectionRadioGroup.checkedRadioButtonId) {
+ R.id.withChangesCurrentWeekRadio -> generateBlockTimetable(weekCurrentStart, weekCurrentEnd)
+ R.id.withChangesNextWeekRadio -> generateBlockTimetable(weekNextStart, weekNextEnd)
+ R.id.forSelectedWeekRadio -> selectDate()
}
}
}}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentsView.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentsView.kt
index 7e2bc5af..81240d62 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentsView.kt
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/views/AttachmentsView.kt
@@ -5,6 +5,7 @@
package pl.szczodrzynski.edziennik.ui.views
import android.content.Context
+import android.os.Build
import android.os.Bundle
import android.util.AttributeSet
import androidx.appcompat.app.AppCompatActivity
@@ -50,6 +51,10 @@ class AttachmentsView @JvmOverloads constructor(
val attachmentSizes = arguments.getLongArray("attachmentSizes")
val adapter = AttachmentAdapter(context, onAttachmentClick = { item ->
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ downloadAttachment(item)
+ return@AttachmentAdapter
+ }
app.permissionManager.requestStoragePermission(activity, R.string.permissions_attachment) {
downloadAttachment(item)
}
@@ -57,6 +62,10 @@ class AttachmentsView @JvmOverloads constructor(
val popupMenu = PopupMenu(chip.context, chip)
popupMenu.menu.add(0, 1, 0, R.string.messages_attachment_download_again)
popupMenu.setOnMenuItemClickListener {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ downloadAttachment(item)
+ return@setOnMenuItemClickListener true
+ }
app.permissionManager.requestStoragePermission(activity, R.string.permissions_attachment) {
downloadAttachment(item, forceDownload = true)
}
diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/utils/Utils.java b/app/src/main/java/pl/szczodrzynski/edziennik/utils/Utils.java
index d4ffae05..f039952d 100644
--- a/app/src/main/java/pl/szczodrzynski/edziennik/utils/Utils.java
+++ b/app/src/main/java/pl/szczodrzynski/edziennik/utils/Utils.java
@@ -774,14 +774,21 @@ public class Utils {
private static File storageDir = null;
public static File getStorageDir() {
- if (storageDir != null)
- return storageDir;
- storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
- storageDir = new File(storageDir, "Szkolny.eu");
- storageDir.mkdirs();
return storageDir;
}
+ public static void initializeStorageDir(Context context) {
+ if (storageDir != null)
+ return;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ storageDir = context.getExternalFilesDir(null);
+ } else {
+ storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
+ storageDir = new File(storageDir, "Szkolny.eu");
+ }
+ storageDir.mkdirs();
+ }
+
public static void writeStringToFile(File file, String data) throws IOException {
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(file));
outputStreamWriter.write(data);
diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml
index 50043dac..0be15ebe 100644
--- a/app/src/main/res/values-en/strings.xml
+++ b/app/src/main/res/values-en/strings.xml
@@ -1353,7 +1353,6 @@
Child %s does not have a profile on this account in the current school year. Probably this profile has been deleted or the student no longer attends this class.\n\nTo go to the current profile, select a student from the list or log in to their account with the Add student button.
A reference to a remote repository was not found. Make sure you are using the official repository fork and verify your Gradle configuration.
"Enter the data you use to log in to the MobiDziennik website. As the server address, you can enter the address of the website where you have MobiDziennik. "
- In order to be able to save the generated timetable, you must grant access rights to the device\'s memory.\n\nClick OK to grant permissions.
(Child)
(Parent)
Teachers
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e75273d8..d8b80368 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1416,7 +1416,6 @@
Sprawdź kod
Brak dostępu do API
Data kompilacji
- Aby móc zapisać wygenerowany plan lekcji musisz przyznać uprawnienia dostępu do pamięci urządzenia.\n\nKliknij OK, aby przyznać uprawnienia.
przeczytanie Polityki prywatności i akceptujesz jej postanowienia.
Autorzy aplikacji nie biorą odpowiedzialności za korzystanie z aplikacji Szkolny.eu.]]>
Szkolny.eu v%s\n%s
Ustawienia terminarza