Last Updated on : 2023-07-13 07:14:41download
Message Center UI BizBundle provides the service logic of the message center. The message center keeps the history of push notifications that are classified into alerts, home messages, and notifications. Alerts include device alerts and smart scene history.
On the message center settings page, users can enable or disable one or more push notifications. DND periods can be added for device alerts.
Add the components of the Message Center UI BizBundle to the Podfile
and run the command pod update
.
source "https://github.com/tuya/tuya-private-specs"
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
target 'your_target_name' do
# Adds the UI BizBundle.
pod 'ThingSmartMessageBizBundle'
end
The UI BizBundle relies on the implementation of the protocol ThingMessageCenterProtocol
to provide services. You can view the file ThingMessageCenterProtocol.h
in the component ThingModuleServices
.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol ThingMessageCenterProtocol <NSObject>
/// The page of push notifications.
/// @param The animation effect.
- (void)gotoMessageCenterViewControllerWithAnimated:(BOOL)animated;
@end
NS_ASSUME_NONNULL_END
The UI BizBundle depends on the method provided by the protocol ThingSmartHomeDataProtocol
to get the current home details required for pairing.
/**
Returns the current home. If the current user does not have a home, `nil` is returned.
@return ThingSmartHome
*/
- (ThingSmartHome *)getCurrentHome;
getCurrentHome
method provided by the protocol ThingSmartHomeDataProtocol
must be implemented first.ObjC:
#import <ThingSmartBizCore/ThingSmartBizCore.h>
#import <ThingModuleServices/ThingSmartHomeDataProtocol.h>
- (void)initCurrentHome {
// Registers the protocol to be implemented.
[[ThingSmartBizCore sharedInstance] registerService:@protocol(ThingSmartHomeDataProtocol) withInstance:self];
}
// Implements the protocol method.
- (ThingSmartHome *)getCurrentHome {
ThingSmartHome *home = [ThingSmartHome homeWithHomeId:@"Current home ID"];
return home;
}
Swift:
import ThingSmartDeviceKit
class ThingMessageCenterTest: NSObject,ThingSmartHomeDataProtocol{
func test() {
ThingSmartBizCore.sharedInstance().registerService(ThingSmartHomeDataProtocol.self, withInstance: self)
}
func getCurrentHome() -> ThingSmartHome! {
let home = ThingSmartHome.init(homeId: 111)
return home
}
}
ObjC:
#import <ThingSmartBizCore/ThingSmartBizCore.h>
#import <ThingModuleServices/ThingMessageCenterProtocol.h>
- (void)gotoDeviceConfig {
id<ThingMessageCenterProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingMessageCenterProtocol)];
[impl gotoMessageCenterViewControllerWithAnimated:YES];
}
Swift:
let impl = ThingSmartBizCore.sharedInstance().service(of: ThingMessageCenterProtocol.self) as? ThingMessageCenterProtocol
impl?.gotoMessageCenterViewController(animated: true)
Due to the open capabilities and component dependencies of the UI BizBundle, the message center might not respond when users tap certain types of alerts.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback