feat(ios): 添加用药计划Widget小组件支持
- 创建medicineExtension小组件,支持iOS桌面显示用药计划 - 实现App Group数据共享机制,支持主应用与小组件数据同步 - 添加AppGroupUserDefaultsManager原生模块,提供跨应用数据访问能力 - 添加WidgetManager和WidgetCenterHelper,实现小组件刷新控制 - 在medications页面和Redux store中集成小组件数据同步逻辑 - 支持实时同步今日用药状态(待服用/已服用/已错过)到小组件 - 配置App Group entitlements (group.com.anonymous.digitalpilates) - 更新Xcode项目配置,添加WidgetKit和SwiftUI框架支持
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.25</string>
|
||||
<string>1.0.24</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
||||
@@ -3,3 +3,5 @@
|
||||
//
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import <React/RCTViewManager.h>
|
||||
#import "../AppGroupUserDefaultsManager.h"
|
||||
#import "../WidgetManager.h"
|
||||
|
||||
@@ -16,5 +16,9 @@
|
||||
</array>
|
||||
<key>com.apple.developer.healthkit.background-delivery</key>
|
||||
<true/>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.com.anonymous.digitalpilates</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
17
ios/OutLive/WidgetCenterHelper.swift
Normal file
17
ios/OutLive/WidgetCenterHelper.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
import Foundation
|
||||
import WidgetKit
|
||||
|
||||
@objc class WidgetCenterHelper: NSObject {
|
||||
@objc static func reloadAllTimelinesIfAvailable() {
|
||||
if #available(iOS 14.0, *) {
|
||||
WidgetCenter.shared.reloadAllTimelines()
|
||||
}
|
||||
}
|
||||
|
||||
@objc(reloadTimelinesIfAvailableOfKind:)
|
||||
static func reloadTimelinesIfAvailable(ofKind kind: String) {
|
||||
if #available(iOS 14.0, *) {
|
||||
WidgetCenter.shared.reloadTimelines(ofKind: kind)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user