This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

73
node_modules/expo-file-system/android/build.gradle generated vendored Normal file
View File

@ -0,0 +1,73 @@
apply plugin: 'com.android.library'
apply plugin: 'maven'
group = 'host.exp.exponent'
version = '9.3.0'
// Simple helper that allows the root project to override versions declared by this library.
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
//Upload android library to maven with javadoc and android sources
configurations {
deployerJars
}
//Creating sources with comments
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
//Put the androidSources and javadoc to the artifacts
artifacts {
archives androidSourcesJar
}
uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: mavenLocal().url)
}
}
}
android {
compileSdkVersion safeExtGet("compileSdkVersion", 29)
defaultConfig {
minSdkVersion safeExtGet("minSdkVersion", 21)
targetSdkVersion safeExtGet("targetSdkVersion", 29)
versionCode 29
versionName "9.3.0"
}
lintOptions {
abortOnError false
}
}
repositories {
mavenCentral()
}
if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {
apply from: project(":unimodules-core").file("../unimodules-core.gradle")
} else {
throw new GradleException(
"'unimodules-core.gradle' was not found in the usual React Native dependency location. " +
"This package can only be used in such projects. Are you sure you've installed the dependencies properly?")
}
dependencies {
unimodule 'unimodules-core'
unimodule 'unimodules-file-system-interface'
api 'commons-codec:commons-codec:1.10'
api 'commons-io:commons-io:1.4'
api 'com.squareup.okhttp3:okhttp:3.10.0'
api 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
api "androidx.legacy:legacy-support-v4:1.0.0"
}

View File

@ -0,0 +1,22 @@
<manifest package="expo.modules.filesystem"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application>
<provider
tools:replace="android:authorities"
android:name=".FileSystemFileProvider"
android:authorities="${applicationId}.FileSystemFileProvider"
android:exported="false"
android:grantUriPermissions="true"
>
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_system_provider_paths"
/>
</provider>
</application>
</manifest>

View File

@ -0,0 +1,68 @@
package expo.modules.filesystem;
import android.content.Context;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import org.unimodules.core.interfaces.InternalModule;
import org.unimodules.interfaces.filesystem.FilePermissionModuleInterface;
import org.unimodules.interfaces.filesystem.Permission;
public class FilePermissionModule implements FilePermissionModuleInterface, InternalModule {
@Override
public List<Class> getExportedInterfaces() {
return Collections.<Class>singletonList(FilePermissionModuleInterface.class);
}
@Override
public EnumSet<Permission> getPathPermissions(Context context, final String path) {
EnumSet<Permission> permissions = getInternalPathPermissions(path, context);
if (permissions == null) {
permissions = getExternalPathPermissions(path);
}
// getExternalPathPermissions guarantees not to return null
return permissions;
}
protected EnumSet<Permission> getInternalPathPermissions(final String path, Context context) {
try {
String canonicalPath = new File(path).getCanonicalPath();
for (String dir : getInternalPaths(context)) {
if (canonicalPath.startsWith(dir + "/") || dir.equals(canonicalPath)) {
return EnumSet.of(Permission.READ, Permission.WRITE);
}
}
} catch (IOException e) {
return EnumSet.noneOf(Permission.class);
}
return null;
}
protected EnumSet<Permission> getExternalPathPermissions(final String path) {
File file = new File(path);
if (file.canWrite() && file.canRead()) {
return EnumSet.of(Permission.READ, Permission.WRITE);
}
if (file.canWrite()) {
return EnumSet.of(Permission.WRITE);
}
if (file.canRead()) {
return EnumSet.of(Permission.READ);
}
return EnumSet.noneOf(Permission.class);
}
protected List<String> getInternalPaths(Context context) throws IOException {
return Arrays.asList(
context.getFilesDir().getCanonicalPath(),
context.getCacheDir().getCanonicalPath()
);
}
}

View File

@ -0,0 +1,5 @@
package expo.modules.filesystem;
import androidx.core.content.FileProvider;
public class FileSystemFileProvider extends FileProvider {}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
package expo.modules.filesystem;
import android.content.Context;
import java.util.Collections;
import java.util.List;
import org.unimodules.core.ExportedModule;
import org.unimodules.core.BasePackage;
import org.unimodules.core.interfaces.InternalModule;
public class FileSystemPackage extends BasePackage {
@Override
public List<InternalModule> createInternalModules(Context context) {
return Collections.<InternalModule>singletonList(new FilePermissionModule());
}
@Override
public List<ExportedModule> createExportedModules(Context context) {
return Collections.<ExportedModule>singletonList(new FileSystemModule(context));
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<files-path name="expo_files" path="." />
<cache-path name="cached_expo_files" path="." />
</paths>