-
Notifications
You must be signed in to change notification settings - Fork 260
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 #67 from the-reach-trust/master
🚀 Android 15 (API 35) Upgrade & Firebase Storage Refactor
- Loading branch information
Showing
9 changed files
with
156 additions
and
145 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
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
30 changes: 30 additions & 0 deletions
30
app/src/main/java/org/bookdash/android/presentation/utils/StringUtils.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.bookdash.android.presentation.utils; | ||
|
||
import java.io.UnsupportedEncodingException; | ||
import java.net.URLEncoder; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
import timber.log.Timber; | ||
|
||
public class StringUtils { | ||
public static String convertGsUrlToHttp(String gsUrl) { | ||
if (gsUrl == null || !gsUrl.startsWith("gs://book-dash.appspot.com/")) { | ||
return null; | ||
} | ||
|
||
// Extract path from gs:// URL | ||
String path = gsUrl.substring("gs://book-dash.appspot.com/".length()); | ||
|
||
try { | ||
// URL-encode the path, but leave '/' and ':' as is | ||
String encodedPath = URLEncoder.encode(path, StandardCharsets.UTF_8.toString()); | ||
|
||
// Construct the Firebase URL | ||
return String.format("https://firebasestorage.googleapis.com/v0/b/book-dash.appspot.com/o/%s?alt=media", | ||
encodedPath); | ||
} catch (UnsupportedEncodingException e) { | ||
Timber.tag("URLConversion").e(e, "Failed to encode URL"); | ||
return null; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.