Giter Site home page Giter Site logo

公告:这个SDK后面有时间准备重新搞起来了,大家有issue,有PR的欢迎可以提交 about aliyun-oss-react-native HOT 17 OPEN

luozhang002 avatar luozhang002 commented on June 28, 2024 6
公告:这个SDK后面有时间准备重新搞起来了,大家有issue,有PR的欢迎可以提交

from aliyun-oss-react-native.

Comments (17)

Joyor avatar Joyor commented on June 28, 2024

希望更新一下这个

from aliyun-oss-react-native.

Shik1997 avatar Shik1997 commented on June 28, 2024

非常需要!

from aliyun-oss-react-native.

kala888 avatar kala888 commented on June 28, 2024

然后呢?没有然后了?

from aliyun-oss-react-native.

lh9403 avatar lh9403 commented on June 28, 2024

没下文了,怕是作者一直没有时间

from aliyun-oss-react-native.

suwu150 avatar suwu150 commented on June 28, 2024

?

from aliyun-oss-react-native.

emclab avatar emclab commented on June 28, 2024

RN 0.66.3版本Xcode build出很多错误。

from aliyun-oss-react-native.

emclab avatar emclab commented on June 28, 2024

如果是个人维护,时间有限,或许可以考虑募捐资助作者进行module维护和更新。

from aliyun-oss-react-native.

alantoa avatar alantoa commented on June 28, 2024

https://github.com/hufans/react-native-alioss
可以关注下这个库,支持ts

from aliyun-oss-react-native.

emclab avatar emclab commented on June 28, 2024

alantoa, 有使用经验可以分享吗?react-native-aliosssize小很多。我的使用环境是RN 0.66, both android/ios。主要是上传图像到OSS。Many thanks.

from aliyun-oss-react-native.

alantoa avatar alantoa commented on June 28, 2024

@emclab 简单测试了一下,两个库 Api 都是一样的,这里有问题的,react-native-alioss 也会又问题,但是react-native-alioss sdk 会新一点,然后增加了 ts 的类型,作者也在维护。
然后说一下这个库是在 aliyun 组织下的,阿里云咱们用都也是付费服务,相应的阿里云也应该提供维护,但是这个库已经三年多不维护了,我提的 PR 也无人问津,九成是弃坑了,建议换掉吧,react-native-alioss 后面遇到问题的话我也会提PR。

from aliyun-oss-react-native.

emclab avatar emclab commented on June 28, 2024

alantoa, 谢谢input。会考虑测试一下。我现在碰到一个棘手的问题,就是在安卓手机上传图像到OSS会出找不到文件的错误。但在安卓emulator上却没有同样的问题。不知道这个问题是否跟OSS模块有关系。

from aliyun-oss-react-native.

emclab avatar emclab commented on June 28, 2024

alantoa, 但是react-native-alioss sdk 会新一点, 你是指·react-native-alioss call 的OSS sdk 比这个模块call的版本更新?如果sdk更新,是不是模块会运行得更好?

from aliyun-oss-react-native.

alantoa avatar alantoa commented on June 28, 2024

这个是oss库,不会出现文件找不到的情况,你排除下是否是因为读写权限的问题或者是图片选择器的问题

from aliyun-oss-react-native.

emclab avatar emclab commented on June 28, 2024

问题确实很奇怪。已经试了另外一个popular的image picker,错误是一样的,这样基本可以排除image picker。我也怀疑是权限问题。在Android Manifest目前已经给了5个权限:

<uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.CAMERA" /> 
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

不知道还缺什么权限。会需要给OSS模块单独授权吗?

from aliyun-oss-react-native.

emclab avatar emclab commented on June 28, 2024

alantoa, 问题应该是android10用的是scoped storage,每个应用存储在自己的子目录下。而Android9以前,应用是共享一个存储子目录。本OSS库不知道scoped storage,而是仍然用共享存储,因此在Android10上出错。以下是关于EXTERNAL_STORAGE的文章

if (android.os.Build.VERSION.SDK_INT < 29) {

     // ==>  /storage/emulated/0    (Emulator)
     File dir = Environment.getExternalStorageDirectory();
} else if (android.os.Build.VERSION.SDK_INT >= 29) {
     // ==> /storage/emulated/0/Android/data/org.o7planning.externalstoragedemo/files
     File dir = this.getExternalFilesDir(null);
}

本库对全部Android版本都仅仅使用了Environment.getExternalStorageDirectory();。这也就是为何在错误信息中显示的是共享路径(Android9以前)的原因。本库的AliOssUploadManager.javaFileUtils.java需要update。或许还有其他的也需要update。

from aliyun-oss-react-native.

emclab avatar emclab commented on June 28, 2024

the following code change in FileUtils.java works in Android 10 emulator:

import android.os.Build;
public static String getFilePathFromURI(Context context, Uri contentUri) {
        //copy file and send new file path
        String fileName = getFileName(contentUri);
        if (!TextUtils.isEmpty(fileName)) {
            File copyFile;
            if (Build.VERSION.SDK_INT >= 29) {
            // ==> /storage/emulated/0/Android/data/org.o7planning.externalstoragedemo/files
                copyFile = new File( context.getExternalFilesDir(null).getAbsolutePath() + File.separator + fileName);
            } else {
                copyFile = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + fileName);
            }
            
            FileUtils.copy(context, contentUri, copyFile);
            return copyFile.getAbsolutePath();
        }
        return null;
    }

from aliyun-oss-react-native.

newyoung21 avatar newyoung21 commented on June 28, 2024

the following code change in FileUtils.java works in Android 10 emulator:

import android.os.Build;
public static String getFilePathFromURI(Context context, Uri contentUri) {
        //copy file and send new file path
        String fileName = getFileName(contentUri);
        if (!TextUtils.isEmpty(fileName)) {
            File copyFile;
            if (Build.VERSION.SDK_INT >= 29) {
            // ==> /storage/emulated/0/Android/data/org.o7planning.externalstoragedemo/files
                copyFile = new File( context.getExternalFilesDir(null).getAbsolutePath() + File.separator + fileName);
            } else {
                copyFile = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + fileName);
            }
            
            FileUtils.copy(context, contentUri, copyFile);
            return copyFile.getAbsolutePath();
        }
        return null;
    }

@emclab 什么时候发包更新呢?

from aliyun-oss-react-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.