Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加 iPad 支持 #246

Merged
merged 7 commits into from
Sep 2, 2024
Merged

添加 iPad 支持 #246

merged 7 commits into from
Sep 2, 2024

Conversation

iGuan7u
Copy link

@iGuan7u iGuan7u commented Aug 17, 2024

看到 这个 issue有感,这么实用的应用如果能支持 iPad 就更好了,Swift/RX 苦手,略尽绵力。

代码改动似乎不小,以下希望能帮助 Review:

  • Bark/AppDelegate 增加判断版本跟设备型号,如果是 iPad 设备改用系统的 UISplitViewController 承载
  • iPad 布局代码:BarkSplitViewController, SectionViewController-iPad, SectionViewModel-iPad
  • 其他的改动都是为了适配 iPad actionSheet 的展示,由 rx.modelSelected 改为 rx.itemSelected,改由增加传递 indexPath,方便 actionSheet popover 能正确定位 sourceView,否则 iPad 下单纯展示 actionSheet 会直接出现崩溃

已自测已知路径,能正常支持 iPad 分屏模式:
Simulator Screenshot - iPad Air (5th generation) - 2024-08-17 at 17 15 18
Simulator Screenshot - iPad Air (5th generation) - 2024-08-17 at 17 17 24
Simulator Screenshot - iPad Air (5th generation) - 2024-08-17 at 17 17 45

@Finb
Copy link
Owner

Finb commented Aug 19, 2024

非常感谢!!我会找时间测试一下(需要点时间,最近比较忙),没有问题后会合并,再次感谢!

@Finb
Copy link
Owner

Finb commented Aug 19, 2024

我大致review了一下代码,基本没啥大问题,非常感谢你的pr!

已知的问题:
因为现在还支持着iOS13,我调整了一下 UISplitViewController的写法
但没怎么用过 UISplitViewController 可能不太对。之后我会再测试一下

修复了操作提示不显示问题,将BarkSnackbarController 挪到了 UISplitViewController 的上一级。

还有就是我发现 UISplitViewController 并没有保存上一次打开的页面,但希望能和 StateStorageTabBarController 一样,保存上一次打开的页面,并且希望他们之间是能联动的,一个改变另外一个同时改变。

还有就是优化了一下切换页面频繁创建实例的问题,这一块我没仔细看,之后我可能会继续改一下,希望页面都能够复用。

@iGuan7u
Copy link
Author

iGuan7u commented Aug 19, 2024

好的呢,没想到这么快就有回应

  • UISplitViewController 在 iOS14 上面新增了特性,像是 iPad 分屏模式的效果都是 iOS14 能自动兼容,我当初想着 iOS13 的存量用户应该不多,能提供最基础的用户体验估计就好(UITabBarController 效果也是可以接受的)
  • 确实保存上一次打开的页面还没完善,似乎在切换分屏的场景下需要额外兼容,所以没继续优化

要是能 Merge 进入 main 还是会感到很荣幸的

@Finb
Copy link
Owner

Finb commented Aug 20, 2024

有道理,我已经将 UISplitViewController 改回iOS14的新版本了

同时初步添加了一下默认打开页面,不过还需要同步 BarkSplitViewController 中的 sectionViewController 和 snackBarController 的页面,现在切换时打开的页面不一致是各自独立的。

@Finb Finb merged commit 648ff72 into Finb:master Sep 2, 2024
1 check passed
@Finb
Copy link
Owner

Finb commented Sep 2, 2024

测试了一下好像没啥问题了,已经合并了。非常感谢!!。
另外commit的邮箱好像并没有绑定到github,所以现在是匿名显示

@iGuan7u
Copy link
Author

iGuan7u commented Sep 2, 2024

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants