Coder Social home page Coder Social logo

Comments (8)

karosLi avatar karosLi commented on July 26, 2024

嗯,这个没有太好的方案。建议使用JSBridge提供给H5选择照片的能力

from kkjsbridge.

Huiz110 avatar Huiz110 commented on July 26, 2024

嗯,这个没有太好的方案。建议使用JSBridge提供给H5选择照片的能力

这个已经支持了,但是交互需要展示图片上传远端的进度,这个目前没有好的方案解决,因为上传请求会被 hook

from kkjsbridge.

karosLi avatar karosLi commented on July 26, 2024

是的

from kkjsbridge.

karosLi avatar karosLi commented on July 26, 2024

你可以考虑在选择照片组件里显示上传进度

from kkjsbridge.

Huiz110 avatar Huiz110 commented on July 26, 2024

你可以考虑在选择照片组件里显示上传进度

目前交互需求是在 H5 页面上展示上传进度,因为选择完照片后不一定要立即上传。
原生能否增加类似白名单配置、或者让 H5 设置某个请求不进行 hook,目前这个配置都是全局的。
类似下面代码,针对某个 request 或 path 来设置白名单

+ (BOOL)canInitWithRequest:(NSURLRequest *)request {
    // 看看是否已经处理过了,防止无限循环
    if ([NSURLProtocol propertyForKey:kKKJSBridgeNSURLProtocolKey inRequest:request]) {
        return NO;
    }
}

from kkjsbridge.

karosLi avatar karosLi commented on July 26, 2024

这里是设不了白名单的。可以通过后台下发白名单列表,然后在 WebViewVC 入口的地方来控制是否需要 ajax hook

from kkjsbridge.

Huiz110 avatar Huiz110 commented on July 26, 2024

这里是设不了白名单的。可以通过后台下发白名单列表,然后在 WebViewVC 入口的地方来控制是否需要 ajax hook

目前改为只在使用离线缓存、或需要本地资源拦截的页面,开启 hook 了,其他页面关闭 ajax hook 以及 URLProtocol 的注册,感谢~

from kkjsbridge.

karosLi avatar karosLi commented on July 26, 2024

不客气

from kkjsbridge.

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.