mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-06-18 04:39:45 -04:00
post-install Intent to tell OsmAnd to import "installed" OBF
OsmAnd will import map files from a file:// URL pointing to an OBF file, but this currently only works for file:// and not the proper content://. This uses a hack to disable the warning about file:// URIs but only for the final stage of installing the .obf file. Hopefully in the future, this can be changed to use a proper content:// URL as I suggested to them in this merge request: https://github.com/osmandapp/OsmAnd/pull/10043
This commit is contained in:
@@ -2,7 +2,6 @@ package org.fdroid.fdroid.data;
|
||||
|
||||
import android.content.ContextWrapper;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@@ -58,6 +57,16 @@ public class ApkTest {
|
||||
assertEquals(new File(context.getApplicationInfo().dataDir + "/ota"), path);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMediaInstallPathWithObf() {
|
||||
Apk apk = new Apk();
|
||||
apk.apkName = "Norway_bouvet_europe_2.obf";
|
||||
apk.repoAddress = "https://example.com/fdroid/repo";
|
||||
assertFalse(apk.isApk());
|
||||
File path = apk.getMediaInstallPath(context);
|
||||
assertEquals(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), path);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMediaInstallPathWithObfZip() throws IOException {
|
||||
Apk apk = new Apk();
|
||||
|
||||
@@ -54,5 +54,9 @@ public class ApkCacheTest {
|
||||
new File(cacheDir, "example.com--1/Norway_bouvet_europe_2.obf.zip"),
|
||||
ApkCache.getApkDownloadPath(context,
|
||||
"https://example.com/fdroid/repo/Norway_bouvet_europe_2.obf.zip"));
|
||||
assertEquals("Should work for OBF files also",
|
||||
new File(cacheDir, "example.com--1/Norway_bouvet_europe_2.obf"),
|
||||
ApkCache.getApkDownloadPath(context,
|
||||
"https://example.com/fdroid/repo/Norway_bouvet_europe_2.obf"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user