0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-30 06:53:01 +00:00

attempt to fix uri

This commit is contained in:
X1nto 2020-07-11 18:12:03 +04:00
parent 89d8be8cdc
commit 1224e01823
3 changed files with 6 additions and 5 deletions

View file

@ -23,6 +23,7 @@ import com.vanced.manager.utils.InternetTools.getObjectFromJson
import com.vanced.manager.utils.NotificationHelper
import com.vanced.manager.utils.NotificationHelper.cancelNotif
import com.vanced.manager.utils.NotificationHelper.createBasicNotif
import java.io.File
class MicrogDownloadService: Service() {
@ -43,7 +44,7 @@ class MicrogDownloadService: Service() {
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
request.setTitle(getString(R.string.downloading_file, "MicroG"))
request.setDestinationUri(Uri.parse("${filesDir.path}/microg.apk"))
request.setDestinationUri(Uri.fromFile(File("${filesDir.path}/microg.apk")))
val downloadManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
downloadId = downloadManager.enqueue(request)

View file

@ -25,6 +25,7 @@ import com.vanced.manager.utils.InternetTools.getObjectFromJson
import com.vanced.manager.utils.NotificationHelper.cancelNotif
import com.vanced.manager.utils.NotificationHelper.createBasicNotif
import com.vanced.manager.utils.NotificationHelper.displayDownloadNotif
import java.io.File
class VancedDownloadService: Service() {
@ -69,7 +70,7 @@ class VancedDownloadService: Service() {
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
request.setTitle(getString(R.string.downloading_file, "MicroG"))
request.setDestinationUri(Uri.parse("${filesDir.path}/${getFileNameFromUrl(url)}"))
request.setDestinationUri(Uri.fromFile(File("${filesDir.path}/${getFileNameFromUrl(url)}")))
val downloadManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
downloadId = downloadManager.enqueue(request)

View file

@ -77,15 +77,14 @@ class UpdateCheckFragment : DialogFragment() {
}
private fun upgradeManager() {
val dwnldUrl = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/manager.json")
.get("url").asString
val dwnldUrl = GetJson().AsJSONObject("https://x1nto.github.io/VancedFiles/manager.json").get("url").asString
//val loadBar = view?.findViewById<ProgressBar>(R.id.update_center_progressbar)
val request = DownloadManager.Request(Uri.parse(dwnldUrl))
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI)
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE)
request.setTitle(activity?.getString(R.string.downloading_file, "Manager"))
request.setDestinationUri(Uri.parse("${activity?.filesDir?.path}/manager.apk"))
request.setDestinationUri(Uri.fromFile(File("${activity?.filesDir?.path}/manager.apk")))
val downloadManager = activity?.getSystemService(DOWNLOAD_SERVICE) as DownloadManager
downloadId = downloadManager.enqueue(request)