dequan1331 / hybridpagekit Goto Github PK
View Code? Open in Web Editor NEWA high-performance、high-extensibility、easy integration framework for Hybrid content page. Support most content page types of News App.
License: MIT License
A high-performance、high-extensibility、easy integration framework for Hybrid content page. Support most content page types of News App.
License: MIT License
好像没有实现对内部tableViewDelegate
我使用 wkwebview + NSURLProtocol 尝试拦截本地的html/js 文件以及相应的请求,
但是并没有触发 + (BOOL)canInitWithRequest:(NSURLRequest *)request 方法, 这个方法在UIWebView 里面是会触发的 ,这种情况该如何修改支持 本地(file:// )的这种请求拦截
I see your README has two language version: English and Chinese
But in code the comment almost Chinese, it's bad
Consider to use English to make all users around the world to read and participate the development
默认缓存策略
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL];
实际复现步骤:
1、打开一个支持协商缓存的h5
2、退出当前h5,然后重新进入,会发现有重新请求h5主html,状态码是200
期望结果
1、打开一个支持协商缓存的h5
2、退出当前h5,然后重新进入,会发现有重新请求h5主html,状态码是304
现在还是 WKWebView 计算有问题,如果我在外部想用和前端约定好的方法获取内容高度,请问需要如何处理呢? NSString *jsString = [NSString stringWithFormat:@"document.documentElement.offsetHeight * %d / document.documentElement.clientWidth",(int)_defaultWebView.bounds.size.width];
这个方法获取的高度时对时不对,原因可能是我这里css js 里的一些样式问题导致的,我们这里定义了
在ios下由于内存不足,会将webkitwebview的web process卸载或者停止渲染,导致白屏问题,这个框架支持识别到这种白屏问题并且自动恢复吗
NestingWebViewController 我在demo里这个类,用Masonry写的_containerScrollView 布局显示不出来HPKWebView,改成frame 正常?是时机不对还是不支持Masonry呢
不是很清楚,大厂都是怎么使用 LocalWebServer 来支持离线包的,下面是我想的一些思路:
1、把本地服务器的地址放在请求头里,然后服务器端渲染,如果是来自app的请求,把所有src的host改成 app 本地服务的localhost。只是这种方式也对后续异步渲染和懒加载JS就不太好支持了。
2、服务器端渲染返回 src='customScheme://',然后 urlprotocol 这拦截 customScheme 的请求,也不会引起 http ajax 丢失 body。
自己也觉得这两种方式,实际上都需要服务器端配合,另外还需要H5业务方去配合支持后续的src的改动。
成本上是有点高的,如果是不要服务器端配合,那至少也是需要 H5业务放配合把所有加载图片和脚本的地方,都要使用JS动态借助Native能力去加载,可是这样会破坏H5的原有结构。
能请教下还有什么更好的思路吗?
请教一个问题
进入界面后定位到指定的Component
看到 HPKPageHandler有如下接口
(void)scrollToComponentView:(HPKView *)elementView atOffset:(CGFloat)offsetY animated:(BOOL)animated;
那要需要如何手动构建这个HPKView呢
外部引入无法引入 WKWebView + HPKExtension.m 希望能添加支持,感谢
双击时当前cell滑动到屏幕中间,但是再滑动列表时,会出现弹跳
html计算实际站位的native view的过程在js里面是不是很消耗性能,能不能通过类似yoga之类的布局引擎去优化?
在UIView上面加载WebView时,native + webView, HPKPageHandler 需要怎么初始化, 在ViewController是```
1、目前我们是通过一个本地html和js去展示页面。在页面load本地页面时调用初始化js对象的方法,在APP启动以后第一次加载是正常的,后续加载页面就不能正常展示内容。如果调用clearCache或者[[HPKPageManager sharedInstance] clearAllReusableWebViews];方法才能正常展示出来。请问是否有比较好的解决办法。
2、在APP第一次加载webview的时候很慢,请问是否可以在展示webview之前就提前加载。
作者你好,在你的demo中 articleContent.txt,内 给标题字符串增加了很多字符,但是TitleView的TitleLabel依然是一行 设置了.numberOfLines=0; 也没有用,我也理解sizeToFit 的意思,但事实就是无法自适应高度
首屏之外的component滑动后会显示空白,需要第二次进入页面才可以
想做预览图片,点击图片如何回调到当前的ViewController中呢?
老师你好,想问一下支持标签页控件吗?例如 VTMagic。
双击时当前cell滑动到屏幕中间,但是再滑动列表时,会出现弹跳
Android端有类似的框架吗?
"ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs"
我观察到这个文件中有一个容错逻辑用到,可以删掉。
WKWebView + HPKExtension.m
版本: 1.4.0
iOS版本: 13.4
复现:为您demo中的hotCommentView添加tableHeaderView 和FooterView
在HotCommentController.m中第57行插入
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width , 5)];
headerView.backgroundColor = UIColor.redColor;
UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width , 5)];
footerView.backgroundColor = UIColor.redColor;
_hotCommentView.tableHeaderView = headerView;
_hotCommentView.tableFooterView = footerView;
请问如何注入js方法到webview,在初始化HPKWebView的时候没有添加UserContentController的地方,希望能指导一下。谢谢
通过注入JS代码 获取网页中全部图片,但是不起作用。
在webViewDidFinishNavigation代理中执行的
HPKWebView还在加载或者滚动显示中时,收到警告就直接给释放了,导致崩溃。
Cannot form weak reference to instance (0x10d013600) of class HPKWebView. It is possible that this object was over-released, or is in the process of deallocation.
虽然在swift里也能直接使用,但如果有纯swift版本就更完美了
[!] Error installing HybridPageKit
[!] /usr/bin/git clone https://github.com/dequan1331/HybridPageKit.git /var/folders/rk/fy1x7s814x501kyzygn0tplc0000gn/T/d20180627-10811-12sd0h --template= --single-branch --depth 1 --branch 0.2
Cloning into '/var/folders/rk/fy1x7s814x501kyzygn0tplc0000gn/T/d20180627-10811-12sd0h'...
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
除了NSURLProtocol拦截H5请求外,HTTP代理server也是一个方法,这个有实现吗
[self.componentHandler.webView evaluateJavaScript:@"loadImages()" completionHandler:^(id _Nullable data, NSError * _Nullable error) {
if (error) {
NSLog(@"错误:------>%@", error);
}
}];
打印:
Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={WKJavaScriptExceptionLineNumber=22, WKJavaScriptExceptionMessage=ReferenceError: Can't find variable: $, WKJavaScriptExceptionColumnNumber=16, WKJavaScriptExceptionSourceURL=about:blank, NSLocalizedDescription=A JavaScript exception occurred}
已修复 commit - 4320432
Originally posted by @dequan1331 in #20 (comment)
之前的web展示不完整已经解决,但现在是scrollview的contentSize不对,我这边有录屏,如有需要请联系我。
希望能加上注释,不然感觉看的很费劲.....
你好 有关wkwebView设置cookies问题你是怎么处理的?怎么解决的呢?谢谢
你这个
第一次启动app,进入新闻详情页。web部分未展示完,再次进来又可以展示完整。
项目的demo更换数据也重现了这个问题。
大神您好,页面无导航,页面最上面有空白。
在HPKAbstractViewController.m
_containerScrollView 的高度 把-64 去掉 并写下面代码
if (@available(iOS 11.0,*)) {
_containerScrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}else{
self.automaticallyAdjustsScrollViewInsets=NO;
}
布局就乱了 ,运营推广区和扩展阅读区跑到评论下面去了。
我简单集成,发现对swift支持并不太好,不知作者是否有swift支持计划
- (void)_clearBackForwardList {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
SEL sel = NSSelectorFromString([NSString stringWithFormat:@"%@%@%@%@", @"_re", @"moveA", @"llIte", @"ms"]);
if ([self.backForwardList respondsToSelector:sel]) {
[self.backForwardList performSelector:sel];
}
#pragma clang diagnostic pop
}
这段代码不会有审核风险么?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.