-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from roozbehzarei/dev
Release v2.3.2
- Loading branch information
Showing
16 changed files
with
98 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
app/src/main/java/com/roozbehzarei/filester/database/MainUiState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/src/main/java/com/roozbehzarei/filester/domain/ParseOshiResponseUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/roozbehzarei/filester/model/OshiResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.roozbehzarei.filester.model | ||
|
||
data class OshiResponse( | ||
val manageUrl: String, | ||
val downloadUrl: String | ||
) |
2 changes: 1 addition & 1 deletion
2
...roozbehzarei/filester/database/Version.kt → ...om/roozbehzarei/filester/model/Version.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/src/main/java/com/roozbehzarei/filester/network/FilesterApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/roozbehzarei/filester/network/OshiApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String> | ||
} | ||
|
||
/** | ||
* A public Api object that exposes the lazy-initialized Retrofit service | ||
*/ | ||
object OshiApi { | ||
val retrofitService: | ||
TransferApiService by lazy { retrofit.create(TransferApiService::class.java) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Replaced transfer.sh hosting service with oshi.at due to downtime issues | ||
* Added Turkish translation |