From 9716b26b518a2ad7b9c115d91d213d22af2b2394 Mon Sep 17 00:00:00 2001
From: roozbehzarei <5$6#y2Dm@hAA>
Date: Tue, 9 Apr 2024 15:31:54 +0330
Subject: [PATCH 1/7] Fix typo
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index fd65622..239d9fe 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
Filester
- A secure, accessible cloud sotrage app for android.
+ A secure, accessible cloud storage app for android.
From 9897ae332ce6ca4ade730c573acaed88f2a62981 Mon Sep 17 00:00:00 2001
From: roozbehzarei <5$6#y2Dm@hAA>
Date: Tue, 9 Apr 2024 17:22:44 +0330
Subject: [PATCH 2/7] Add oshi.at as default hosting service
---
.../domain/ParseOshiResponseUseCase.kt | 22 +++++++++++
.../filester/model/OshiResponse.kt | 6 +++
.../filester/network/OshiApiService.kt | 38 +++++++++++++++++++
.../filester/network/TransferApiService.kt | 4 +-
.../filester/worker/UploadWorker.kt | 14 ++++---
app/src/main/res/values/strings.xml | 4 +-
6 files changed, 79 insertions(+), 9 deletions(-)
create mode 100644 app/src/main/java/com/roozbehzarei/filester/domain/ParseOshiResponseUseCase.kt
create mode 100644 app/src/main/java/com/roozbehzarei/filester/model/OshiResponse.kt
create mode 100644 app/src/main/java/com/roozbehzarei/filester/network/OshiApiService.kt
diff --git a/app/src/main/java/com/roozbehzarei/filester/domain/ParseOshiResponseUseCase.kt b/app/src/main/java/com/roozbehzarei/filester/domain/ParseOshiResponseUseCase.kt
new file mode 100644
index 0000000..8a3f928
--- /dev/null
+++ b/app/src/main/java/com/roozbehzarei/filester/domain/ParseOshiResponseUseCase.kt
@@ -0,0 +1,22 @@
+package com.roozbehzarei.filester.domain
+
+import android.util.Log
+import com.roozbehzarei.filester.model.OshiResponse
+
+class ParseOshiResponseUseCase() {
+
+ operator fun invoke(response: String): OshiResponse {
+ val lines = response.split("\n")
+ var manageUrl = ""
+ var downloadUrl = ""
+ for (line in lines) {
+ if (line.startsWith("MANAGE: ")) {
+ manageUrl = line.substring(8) // Skip "MANAGE: "
+ } else if (line.startsWith("DL: ")) {
+ downloadUrl = line.substring(4) // Skip "DL: "
+ }
+ }
+
+ return OshiResponse(manageUrl = manageUrl, downloadUrl = downloadUrl)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/roozbehzarei/filester/model/OshiResponse.kt b/app/src/main/java/com/roozbehzarei/filester/model/OshiResponse.kt
new file mode 100644
index 0000000..c4ffcd1
--- /dev/null
+++ b/app/src/main/java/com/roozbehzarei/filester/model/OshiResponse.kt
@@ -0,0 +1,6 @@
+package com.roozbehzarei.filester.model
+
+data class OshiResponse(
+ val manageUrl: String,
+ val downloadUrl: String
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/roozbehzarei/filester/network/OshiApiService.kt b/app/src/main/java/com/roozbehzarei/filester/network/OshiApiService.kt
new file mode 100644
index 0000000..71c677d
--- /dev/null
+++ b/app/src/main/java/com/roozbehzarei/filester/network/OshiApiService.kt
@@ -0,0 +1,38 @@
+package com.roozbehzarei.filester.network
+
+import okhttp3.MultipartBody
+import retrofit2.Response
+import retrofit2.Retrofit
+import retrofit2.converter.scalars.ScalarsConverterFactory
+import retrofit2.http.Multipart
+import retrofit2.http.POST
+import retrofit2.http.Part
+
+private const val OSHI_URL = "https://oshi.at"
+
+/**
+ * The Retrofit object with the Scalars converter.
+ */
+private val retrofit: Retrofit = Retrofit.Builder()
+ .baseUrl(OSHI_URL)
+ .addConverterFactory(ScalarsConverterFactory.create())
+ .build()
+
+/**
+ * A public interface that exposes the [sendFile] method
+ */
+interface OshiApiService {
+ @Multipart
+ @POST("/?expire=1800")
+ suspend fun sendFile(
+ @Part("f") filePart: MultipartBody.Part
+ ): Response
+}
+
+/**
+ * A public Api object that exposes the lazy-initialized Retrofit service
+ */
+object OshiApi {
+ val retrofitService:
+ TransferApiService by lazy { retrofit.create(TransferApiService::class.java) }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/roozbehzarei/filester/network/TransferApiService.kt b/app/src/main/java/com/roozbehzarei/filester/network/TransferApiService.kt
index 5793b96..fa5b07d 100644
--- a/app/src/main/java/com/roozbehzarei/filester/network/TransferApiService.kt
+++ b/app/src/main/java/com/roozbehzarei/filester/network/TransferApiService.kt
@@ -8,13 +8,13 @@ import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
-private const val BASE_URL = "https://transfer.sh"
+private const val TRANSFER_URL = "https://transfer.sh"
/**
* The Retrofit object with the Scalars converter.
*/
private val retrofit: Retrofit = Retrofit.Builder()
- .baseUrl(BASE_URL)
+ .baseUrl(TRANSFER_URL)
.addConverterFactory(ScalarsConverterFactory.create())
.build()
diff --git a/app/src/main/java/com/roozbehzarei/filester/worker/UploadWorker.kt b/app/src/main/java/com/roozbehzarei/filester/worker/UploadWorker.kt
index 8169960..903ba63 100644
--- a/app/src/main/java/com/roozbehzarei/filester/worker/UploadWorker.kt
+++ b/app/src/main/java/com/roozbehzarei/filester/worker/UploadWorker.kt
@@ -8,6 +8,7 @@ import android.content.Intent
import android.content.pm.ServiceInfo
import android.net.Uri
import android.os.Build
+import android.util.Log
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import androidx.work.CoroutineWorker
@@ -17,7 +18,8 @@ import androidx.work.workDataOf
import com.roozbehzarei.filester.BaseApplication
import com.roozbehzarei.filester.FilesterBroadcastReceiver
import com.roozbehzarei.filester.R
-import com.roozbehzarei.filester.network.TransferApi
+import com.roozbehzarei.filester.domain.ParseOshiResponseUseCase
+import com.roozbehzarei.filester.network.OshiApi
import com.roozbehzarei.filester.ui.MainActivity
import com.roozbehzarei.filester.viewmodel.KEY_FILE_NAME
import com.roozbehzarei.filester.viewmodel.KEY_FILE_URI
@@ -66,13 +68,13 @@ class UploadWorker(private val context: Context, params: WorkerParameters) :
context.getString(R.string.notification_title_in_progress)
)
)
- val apiResponse = TransferApi.retrofitService.sendFile(filePart)
- val responseBody = apiResponse.body()
- if (apiResponse.isSuccessful && !responseBody.isNullOrEmpty()) {
- val outputData = workDataOf(KEY_FILE_URI to responseBody)
+ val apiResponse = OshiApi.retrofitService.sendFile(filePart)
+ if (apiResponse.isSuccessful && !apiResponse.body().isNullOrEmpty()) {
+ val oshiResponse = ParseOshiResponseUseCase().invoke(apiResponse.body()!!)
+ val outputData = workDataOf(KEY_FILE_URI to oshiResponse.downloadUrl)
val newFileEntry = com.roozbehzarei.filester.database.File(
fileName = file.name,
- fileUrl = responseBody,
+ fileUrl = oshiResponse.downloadUrl,
fileSize = file.length() / 1024 / 1024
)
fileDao.insert(newFileEntry)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5b71076..a24dd6a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -5,11 +5,12 @@
Copyleft © 2024 by Roozbeh Zarei
About
transfer.sh
+ oshi.at
Donate
Website
Privacy Policy
Upload successful
- Your uploaded file will be available for the next 14 days.
+ Your uploaded file will be available for the next 30 days.
Copy Link
Close
Upload failed
@@ -29,6 +30,7 @@
Uploading…
English
Persian
+ Turkish
Dark
Light
System default
From 5413d713254803fa9bb5670d826f580a94845f61 Mon Sep 17 00:00:00 2001
From: roozbehzarei <5$6#y2Dm@hAA>
Date: Tue, 9 Apr 2024 17:23:11 +0330
Subject: [PATCH 3/7] Update translations
---
app/src/main/res/values-fa-rIR/strings.xml | 3 ++-
app/src/main/res/values-tr/strings.xml | 6 ++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/app/src/main/res/values-fa-rIR/strings.xml b/app/src/main/res/values-fa-rIR/strings.xml
index 625c324..62ef904 100644
--- a/app/src/main/res/values-fa-rIR/strings.xml
+++ b/app/src/main/res/values-fa-rIR/strings.xml
@@ -9,7 +9,7 @@
وبسایت
سیاست حفظ حریم خصوصی
بارگذاری انجام شد
- فایل آپلود شده برای 14 روز آینده در دسترس خواهد بود.
+ فایل آپلود شده برای 30 روز آینده در دسترس خواهد بود.
کپی نشانی
بستن
بارگذاری انجام نشد
@@ -53,5 +53,6 @@
ارسال
برنامه با خطا مواجه شد
لطفا گزارش خطا را به توسعه دهنده ارسال نمایید.
+ ترکی
\ No newline at end of file
diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml
index 625847a..8536046 100644
--- a/app/src/main/res/values-tr/strings.xml
+++ b/app/src/main/res/values-tr/strings.xml
@@ -4,12 +4,11 @@
Sürüm %1$s
Copyleft © 2024, Roozbeh Zarei
Hakkında
- transfer.sh
Bağış Yapın
Web sitesi
Gizlilik Politikası
Yükleme başarılı
- Yüklediğiniz dosya önümüzdeki 14 gün boyunca kullanılabilir olacaktır.
+ Yüklediğiniz dosya önümüzdeki 30 gün boyunca kullanılabilir olacaktır.
Bağlantıyı Kopyala
Kapat
Yükleme başarısız
@@ -23,8 +22,6 @@
Yükleme devam ederken, başarılı veya başarısız olduğunda bildir.
Dosya yükle
Ayarlar
-
- filester_notification_id
Karşıya yükleme başlatılıyor...
Yükleniyor...
İngilizce
@@ -55,4 +52,5 @@
Gönder
Uygulama çöktü
Lütfen geliştiriciye bir rapor gönderin.
+ Türkçe
\ No newline at end of file
From c366b1ee2d403677c2a8d4a3cfa771097d64c7f5 Mon Sep 17 00:00:00 2001
From: roozbehzarei <5$6#y2Dm@hAA>
Date: Tue, 9 Apr 2024 17:23:42 +0330
Subject: [PATCH 4/7] Update settings entries
---
.../com/roozbehzarei/filester/ui/SettingsFragment.kt | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/src/main/java/com/roozbehzarei/filester/ui/SettingsFragment.kt b/app/src/main/java/com/roozbehzarei/filester/ui/SettingsFragment.kt
index c9705c4..fa7a01c 100644
--- a/app/src/main/java/com/roozbehzarei/filester/ui/SettingsFragment.kt
+++ b/app/src/main/java/com/roozbehzarei/filester/ui/SettingsFragment.kt
@@ -23,10 +23,10 @@ class SettingsFragment : PreferenceFragmentCompat() {
key = "file_hosting_service"
title = getString(R.string.file_hosting_service)
dialogTitle = getString(R.string.file_hosting_service)
- entries = arrayOf(getString(R.string.link_transfer))
- entryValues = arrayOf(getString(R.string.link_transfer))
- setDefaultValue(getString(R.string.link_transfer))
- summary = getString(R.string.link_transfer)
+ entries = arrayOf(getString(R.string.link_oshi))
+ entryValues = arrayOf(getString(R.string.link_oshi))
+ setDefaultValue(getString(R.string.link_oshi))
+ summary = getString(R.string.link_oshi)
}
val languagePreference = ListPreference(context)
@@ -34,8 +34,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
key = "language"
title = getString(R.string.language)
dialogTitle = getString(R.string.language)
- entries = arrayOf(getString(R.string.english), getString(R.string.persian))
- entryValues = arrayOf("en-US", "fa-IR")
+ entries = arrayOf(getString(R.string.english),getString(R.string.turkish) ,getString(R.string.persian))
+ entryValues = arrayOf("en-US","tr" ,"fa-IR")
setDefaultValue("en-US")
summaryProvider = ListPreference.SimpleSummaryProvider.getInstance()
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
From 372056f7e45305c32e0c25eea4c000b49766b1f1 Mon Sep 17 00:00:00 2001
From: roozbehzarei <5$6#y2Dm@hAA>
Date: Tue, 9 Apr 2024 17:24:19 +0330
Subject: [PATCH 5/7] Bump app version code and name
---
app/build.gradle.kts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index fa9fcbc..ddc612f 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -13,8 +13,8 @@ android {
applicationId = "com.roozbehzarei.filester"
minSdk = 21
targetSdk = 34
- versionCode = 7
- versionName = "2.3.1"
+ versionCode = 8
+ versionName = "2.3.2"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
From 53ba4392b95e3a226e60125298600735525024a3 Mon Sep 17 00:00:00 2001
From: roozbehzarei <5$6#y2Dm@hAA>
Date: Tue, 9 Apr 2024 17:24:27 +0330
Subject: [PATCH 6/7] Add changelog for version 2.3.2
---
fastlane/metadata/android/en-US/changelogs/8.txt | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 fastlane/metadata/android/en-US/changelogs/8.txt
diff --git a/fastlane/metadata/android/en-US/changelogs/8.txt b/fastlane/metadata/android/en-US/changelogs/8.txt
new file mode 100644
index 0000000..6b310f8
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/8.txt
@@ -0,0 +1,2 @@
+* Replaced transfer.sh hosting service with oshi.at due to downtime issues
+* Added Turkish translation
\ No newline at end of file
From 9670789a815e58869fb8de0331d3762714ef24ea Mon Sep 17 00:00:00 2001
From: roozbehzarei <5$6#y2Dm@hAA>
Date: Tue, 9 Apr 2024 17:30:41 +0330
Subject: [PATCH 7/7] Code refactor
---
.../java/com/roozbehzarei/filester/database/MainUiState.kt | 2 ++
.../com/roozbehzarei/filester/{database => model}/Version.kt | 2 +-
.../com/roozbehzarei/filester/network/FilesterApiService.kt | 2 +-
.../main/java/com/roozbehzarei/filester/ui/MainActivity.kt | 4 ----
4 files changed, 4 insertions(+), 6 deletions(-)
rename app/src/main/java/com/roozbehzarei/filester/{database => model}/Version.kt (75%)
diff --git a/app/src/main/java/com/roozbehzarei/filester/database/MainUiState.kt b/app/src/main/java/com/roozbehzarei/filester/database/MainUiState.kt
index d21b6bf..afa3dd9 100755
--- a/app/src/main/java/com/roozbehzarei/filester/database/MainUiState.kt
+++ b/app/src/main/java/com/roozbehzarei/filester/database/MainUiState.kt
@@ -1,5 +1,7 @@
package com.roozbehzarei.filester.database
+import com.roozbehzarei.filester.model.Version
+
data class MainUiState(
val appVersion: Version? = null,
val isFileDeleted: Boolean = false
diff --git a/app/src/main/java/com/roozbehzarei/filester/database/Version.kt b/app/src/main/java/com/roozbehzarei/filester/model/Version.kt
similarity index 75%
rename from app/src/main/java/com/roozbehzarei/filester/database/Version.kt
rename to app/src/main/java/com/roozbehzarei/filester/model/Version.kt
index 0ce5513..0b8e9f2 100644
--- a/app/src/main/java/com/roozbehzarei/filester/database/Version.kt
+++ b/app/src/main/java/com/roozbehzarei/filester/model/Version.kt
@@ -1,4 +1,4 @@
-package com.roozbehzarei.filester.database
+package com.roozbehzarei.filester.model
import com.squareup.moshi.JsonClass
diff --git a/app/src/main/java/com/roozbehzarei/filester/network/FilesterApiService.kt b/app/src/main/java/com/roozbehzarei/filester/network/FilesterApiService.kt
index c53d48e..fd9492e 100644
--- a/app/src/main/java/com/roozbehzarei/filester/network/FilesterApiService.kt
+++ b/app/src/main/java/com/roozbehzarei/filester/network/FilesterApiService.kt
@@ -1,6 +1,6 @@
package com.roozbehzarei.filester.network
-import com.roozbehzarei.filester.database.Version
+import com.roozbehzarei.filester.model.Version
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import retrofit2.Response
diff --git a/app/src/main/java/com/roozbehzarei/filester/ui/MainActivity.kt b/app/src/main/java/com/roozbehzarei/filester/ui/MainActivity.kt
index a639e60..4c87bf5 100644
--- a/app/src/main/java/com/roozbehzarei/filester/ui/MainActivity.kt
+++ b/app/src/main/java/com/roozbehzarei/filester/ui/MainActivity.kt
@@ -12,16 +12,12 @@ import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding
-import androidx.lifecycle.Lifecycle
-import androidx.lifecycle.lifecycleScope
-import androidx.lifecycle.repeatOnLifecycle
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import com.google.android.material.appbar.AppBarLayout
import com.roozbehzarei.filester.R
import com.roozbehzarei.filester.databinding.ActivityMainBinding
-import kotlinx.coroutines.launch
/**
* Main Activity and entry point for the app.