| | |
| | | B9D2528C2744ECAA0053C15F /* HDLSceneSiri.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = B9D252892744ECAA0053C15F /* HDLSceneSiri.h */; }; |
| | | B9D2529C2744ECCB0053C15F /* TopBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = B9D252942744ECCB0053C15F /* TopBarView.m */; }; |
| | | B9D2529D2744ECCB0053C15F /* HDLSiriSceneListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B9D252952744ECCB0053C15F /* HDLSiriSceneListCell.m */; }; |
| | | B9D2529E2744ECCB0053C15F /* HDLSiriSceneModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B9D252962744ECCB0053C15F /* HDLSiriSceneModel.m */; }; |
| | | B9D2529F2744ECCB0053C15F /* HDLSiriSceneListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9D252972744ECCB0053C15F /* HDLSiriSceneListViewController.m */; }; |
| | | B9D252A02744ECCB0053C15F /* HDLRunSceneIntent.m in Sources */ = {isa = PBXBuildFile; fileRef = B9D2529B2744ECCB0053C15F /* HDLRunSceneIntent.m */; }; |
| | | B9D252A22744ED2E0053C15F /* HDLRunSceneIntent.h in Headers */ = {isa = PBXBuildFile; fileRef = B9D252922744ECCB0053C15F /* HDLRunSceneIntent.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| | | B9D252A32744ED350053C15F /* HDLSiriSceneListViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B9D252992744ECCB0053C15F /* HDLSiriSceneListViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| | | B9D252A42744ED380053C15F /* HDLSiriSceneModel.h in Headers */ = {isa = PBXBuildFile; fileRef = B9D252982744ECCB0053C15F /* HDLSiriSceneModel.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| | | B9D252A82744ED860053C15F /* IntentsUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9D252A62744ED860053C15F /* IntentsUI.framework */; }; |
| | | B9D252A92744ED860053C15F /* Intents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9D252A72744ED860053C15F /* Intents.framework */; }; |
| | | B9F52EA72754792F0049014D /* HDLSiriShortcutModel.h in Headers */ = {isa = PBXBuildFile; fileRef = B9F52EA32754792F0049014D /* HDLSiriShortcutModel.h */; }; |
| | | B9F52EA82754792F0049014D /* HDLSiriShortcutModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B9F52EA42754792F0049014D /* HDLSiriShortcutModel.m */; }; |
| | | B9F52EA92754792F0049014D /* HDLSectionHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = B9F52EA52754792F0049014D /* HDLSectionHeaderView.m */; }; |
| | | B9F52EAA2754792F0049014D /* HDLSectionHeaderView.h in Headers */ = {isa = PBXBuildFile; fileRef = B9F52EA62754792F0049014D /* HDLSectionHeaderView.h */; }; |
| | | /* End PBXBuildFile section */ |
| | | |
| | | /* Begin PBXCopyFilesBuildPhase section */ |
| | |
| | | B9D252932744ECCB0053C15F /* HDLSiriSceneListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDLSiriSceneListCell.h; sourceTree = "<group>"; }; |
| | | B9D252942744ECCB0053C15F /* TopBarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopBarView.m; sourceTree = "<group>"; }; |
| | | B9D252952744ECCB0053C15F /* HDLSiriSceneListCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDLSiriSceneListCell.m; sourceTree = "<group>"; }; |
| | | B9D252962744ECCB0053C15F /* HDLSiriSceneModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDLSiriSceneModel.m; sourceTree = "<group>"; }; |
| | | B9D252972744ECCB0053C15F /* HDLSiriSceneListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDLSiriSceneListViewController.m; sourceTree = "<group>"; }; |
| | | B9D252982744ECCB0053C15F /* HDLSiriSceneModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDLSiriSceneModel.h; sourceTree = "<group>"; }; |
| | | B9D252992744ECCB0053C15F /* HDLSiriSceneListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDLSiriSceneListViewController.h; sourceTree = "<group>"; }; |
| | | B9D2529A2744ECCB0053C15F /* TopBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopBarView.h; sourceTree = "<group>"; }; |
| | | B9D2529B2744ECCB0053C15F /* HDLRunSceneIntent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDLRunSceneIntent.m; sourceTree = "<group>"; }; |
| | | B9D252A62744ED860053C15F /* IntentsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IntentsUI.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/iOSSupport/System/Library/Frameworks/IntentsUI.framework; sourceTree = DEVELOPER_DIR; }; |
| | | B9D252A72744ED860053C15F /* Intents.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Intents.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Intents.framework; sourceTree = DEVELOPER_DIR; }; |
| | | B9F52EA32754792F0049014D /* HDLSiriShortcutModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDLSiriShortcutModel.h; sourceTree = "<group>"; }; |
| | | B9F52EA42754792F0049014D /* HDLSiriShortcutModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDLSiriShortcutModel.m; sourceTree = "<group>"; }; |
| | | B9F52EA52754792F0049014D /* HDLSectionHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDLSectionHeaderView.m; sourceTree = "<group>"; }; |
| | | B9F52EA62754792F0049014D /* HDLSectionHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDLSectionHeaderView.h; sourceTree = "<group>"; }; |
| | | /* End PBXFileReference section */ |
| | | |
| | | /* Begin PBXFrameworksBuildPhase section */ |
| | |
| | | B9D252882744ECAA0053C15F /* HDLSceneSiri */ = { |
| | | isa = PBXGroup; |
| | | children = ( |
| | | B9D252892744ECAA0053C15F /* HDLSceneSiri.h */, |
| | | B9D2528A2744ECAA0053C15F /* HDLSceneSiri.m */, |
| | | B9F52EA32754792F0049014D /* HDLSiriShortcutModel.h */, |
| | | B9F52EA42754792F0049014D /* HDLSiriShortcutModel.m */, |
| | | B9D252992744ECCB0053C15F /* HDLSiriSceneListViewController.h */, |
| | | B9D252972744ECCB0053C15F /* HDLSiriSceneListViewController.m */, |
| | | B9F52EA62754792F0049014D /* HDLSectionHeaderView.h */, |
| | | B9F52EA52754792F0049014D /* HDLSectionHeaderView.m */, |
| | | B9D252922744ECCB0053C15F /* HDLRunSceneIntent.h */, |
| | | B9D2529B2744ECCB0053C15F /* HDLRunSceneIntent.m */, |
| | | B9D252932744ECCB0053C15F /* HDLSiriSceneListCell.h */, |
| | | B9D252952744ECCB0053C15F /* HDLSiriSceneListCell.m */, |
| | | B9D252992744ECCB0053C15F /* HDLSiriSceneListViewController.h */, |
| | | B9D252972744ECCB0053C15F /* HDLSiriSceneListViewController.m */, |
| | | B9D252982744ECCB0053C15F /* HDLSiriSceneModel.h */, |
| | | B9D252962744ECCB0053C15F /* HDLSiriSceneModel.m */, |
| | | B9D2529A2744ECCB0053C15F /* TopBarView.h */, |
| | | B9D252942744ECCB0053C15F /* TopBarView.m */, |
| | | B9D252892744ECAA0053C15F /* HDLSceneSiri.h */, |
| | | B9D2528A2744ECAA0053C15F /* HDLSceneSiri.m */, |
| | | ); |
| | | path = HDLSceneSiri; |
| | | sourceTree = "<group>"; |
| | |
| | | buildActionMask = 2147483647; |
| | | files = ( |
| | | B9D252A22744ED2E0053C15F /* HDLRunSceneIntent.h in Headers */, |
| | | B9D252A42744ED380053C15F /* HDLSiriSceneModel.h in Headers */, |
| | | B9F52EAA2754792F0049014D /* HDLSectionHeaderView.h in Headers */, |
| | | B9D252A32744ED350053C15F /* HDLSiriSceneListViewController.h in Headers */, |
| | | B9F52EA72754792F0049014D /* HDLSiriShortcutModel.h in Headers */, |
| | | ); |
| | | runOnlyForDeploymentPostprocessing = 0; |
| | | }; |
| | |
| | | isa = PBXSourcesBuildPhase; |
| | | buildActionMask = 2147483647; |
| | | files = ( |
| | | B9D2529E2744ECCB0053C15F /* HDLSiriSceneModel.m in Sources */, |
| | | B9D252A02744ECCB0053C15F /* HDLRunSceneIntent.m in Sources */, |
| | | B9D2529D2744ECCB0053C15F /* HDLSiriSceneListCell.m in Sources */, |
| | | B9D2529F2744ECCB0053C15F /* HDLSiriSceneListViewController.m in Sources */, |
| | | B9F52EA92754792F0049014D /* HDLSectionHeaderView.m in Sources */, |
| | | B9F52EA82754792F0049014D /* HDLSiriShortcutModel.m in Sources */, |
| | | B9D2529C2744ECCB0053C15F /* TopBarView.m in Sources */, |
| | | B9D2528B2744ECAA0053C15F /* HDLSceneSiri.m in Sources */, |
| | | ); |
| | |
| | | API_AVAILABLE(ios(12.0), macos(10.16), watchos(5.0)) API_UNAVAILABLE(tvos) |
| | | @interface HDLRunSceneIntent : INIntent |
| | | |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *sceneName; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *sceneId; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *controlName; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *controlId; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *homeId; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *controlType; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *controlJSONStr; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *actionName; |
| | | |
| | | @end |
| | | |
| | |
| | | /*! |
| | | @abstract Initializes and returns the response object with the success code. |
| | | */ |
| | | + (instancetype)successIntentResponseWithSceneName:(NSString *)sceneName NS_SWIFT_NAME(success(sceneName:)); |
| | | + (instancetype)successIntentResponseWithControlName:(NSString *)controlName NS_SWIFT_NAME(success(controlName:)); |
| | | /*! |
| | | @abstract Initializes and returns the response object with the failure code. |
| | | */ |
| | |
| | | |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *errorMessage; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *successMessage; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *sceneName; |
| | | @property (readwrite, copy, nullable, nonatomic) NSString *controlName; |
| | | |
| | | /*! |
| | | @abstract The response code indicating your success or failure in confirming or handling the intent. |
| | |
| | | |
| | | @implementation HDLRunSceneIntent |
| | | |
| | | @dynamic sceneName, sceneId; |
| | | @dynamic controlName, controlId, homeId, controlType, controlJSONStr, actionName; |
| | | |
| | | @end |
| | | |
| | |
| | | |
| | | @synthesize code = _code; |
| | | |
| | | @dynamic errorMessage, successMessage, sceneName; |
| | | @dynamic errorMessage, successMessage, controlName; |
| | | |
| | | - (instancetype)initWithCode:(HDLRunSceneIntentResponseCode)code userActivity:(nullable NSUserActivity *)userActivity { |
| | | self = [super init]; |
| | |
| | | return self; |
| | | } |
| | | |
| | | + (instancetype)successIntentResponseWithSceneName:(NSString *)sceneName { |
| | | + (instancetype)successIntentResponseWithControlName:(NSString *)controlName { |
| | | HDLRunSceneIntentResponse *intentResponse = [[HDLRunSceneIntentResponse alloc] initWithCode:HDLRunSceneIntentResponseCodeSuccess userActivity:nil]; |
| | | intentResponse.sceneName = sceneName; |
| | | intentResponse.controlName = controlName; |
| | | return intentResponse; |
| | | } |
| | | |
| | |
| | | #define WEAKSELF_AT __weak __typeof(&*self)weakSelf_AT = self; |
| | | #define HEXCOLORA(rgbValue, a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:a] |
| | | // 字体颜色 |
| | | #define COLOR_TEXT HEXCOLORA(0x222222,1.0) |
| | | #define COLOR_TEXT HEXCOLORA(0x1B2D4D,1.0) |
| | | |
| | | // APP_UIFont |
| | | #define APP_UIFont @"PingFangSC-Regular"//苹方-简 常规体 |
| | |
| | | #define Get_FontBoldWithSize(s) [UIFont fontWithName:APP_UIFont_BOLD size:s] |
| | | #define Get_FontMediumWithSize(s) [UIFont fontWithName:APP_UIFont_Medium size:s] |
| | | |
| | | |
| | | |
| | | @interface HDLSceneSiri : NSObject |
| | | |
| | | @end |
New file |
| | |
| | | // |
| | | // HDLSectionHeaderView.h |
| | | // HDLSceneSiriDemo |
| | | // |
| | | // Created by 陈嘉乐 on 2021/11/26. |
| | | // |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | @interface HDLSectionHeaderView : UIView |
| | | |
| | | @property (nonatomic, strong) UILabel *titleLabel;//标题 |
| | | @property (nonatomic, strong) UILabel *messageLabel;//内容 |
| | | @property (nonatomic, strong) UIView *lineView;//分割线View |
| | | |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
New file |
| | |
| | | // |
| | | // HDLSectionHeaderView.m |
| | | // HDLSceneSiriDemo |
| | | // |
| | | // Created by 陈嘉乐 on 2021/11/26. |
| | | // |
| | | |
| | | #import "HDLSectionHeaderView.h" |
| | | #import "HDLSceneSiri.h" |
| | | |
| | | @implementation HDLSectionHeaderView |
| | | |
| | | - (id)initWithFrame:(CGRect)frame |
| | | { |
| | | self = [super initWithFrame:frame]; |
| | | if (self) { |
| | | self.frame = CGRectMake(0, 0, APP_SCREEN_WIDTH, 65); |
| | | self.backgroundColor = UIColor.whiteColor; |
| | | [self addSubview:self.titleLabel]; |
| | | [self addSubview:self.messageLabel]; |
| | | [self addSubview:self.lineView]; |
| | | } |
| | | return self; |
| | | } |
| | | |
| | | |
| | | - (UILabel *)titleLabel{ |
| | | if (!_titleLabel) { |
| | | _titleLabel = [self NewLabel:CGRectMake(16, 11, APP_SCREEN_WIDTH - 32, 22) font:Get_FontBoldWithSize(16) textColor:HEXCOLORA(0x4484F4, 1.0) text:@""]; |
| | | _titleLabel.textAlignment = NSTextAlignmentLeft; |
| | | } |
| | | return _titleLabel; |
| | | } |
| | | |
| | | - (UILabel *)messageLabel{ |
| | | if (!_messageLabel) { |
| | | _messageLabel = [self NewLabel:CGRectMake(16, 37, APP_SCREEN_WIDTH - 32, 17) font:Get_FontWithSize(12) textColor:HEXCOLORA(0xC0C7D4, 1.0) text:@""]; |
| | | _messageLabel.textAlignment = NSTextAlignmentLeft; |
| | | } |
| | | return _messageLabel; |
| | | } |
| | | |
| | | -(UIView*)lineView{ |
| | | if(!_lineView){ |
| | | _lineView = [[UIView alloc]initWithFrame:CGRectMake(16, 64, APP_SCREEN_WIDTH - 16, 1)]; |
| | | _lineView.backgroundColor = HEXCOLORA(0xECEDEE , 1.0); |
| | | } |
| | | return _lineView; |
| | | } |
| | | |
| | | - (UILabel *)NewLabel:(CGRect)frame font:(UIFont *)font textColor:(UIColor *)color text:(NSString *)text{ |
| | | UILabel *label = [[UILabel alloc] initWithFrame:frame]; |
| | | label.backgroundColor = [UIColor clearColor]; |
| | | label.font = font; |
| | | if (color != nil) { |
| | | label.textColor = color; |
| | | } |
| | | label.text = text; |
| | | |
| | | return label; |
| | | } |
| | | |
| | | // |
| | | -(void)backButtonClick{ |
| | | |
| | | } |
| | | |
| | | -(void)setTitle:(NSString *)title{ |
| | | self.titleLabel.text = title; |
| | | } |
| | | @end |
| | |
| | | #import <UIKit/UIKit.h> |
| | | #import <Intents/Intents.h> |
| | | #import <IntentsUI/IntentsUI.h> |
| | | #import "HDLSiriShortcutModel.h" |
| | | #import "HDLRunSceneIntent.h" |
| | | #import "HDLSiriSceneModel.h" |
| | | |
| | | //#import <HDLSmartKit/HDLSceneModel.h> |
| | | |
| | |
| | | |
| | | @interface HDLSiriSceneListCell : UITableViewCell |
| | | |
| | | @property (nonatomic, strong) UIView *bgView;//背景View |
| | | //@property (nonatomic, strong) UIView *bgView;//背景View |
| | | @property (nonatomic, strong) UILabel *titleLabel;//场景标题 |
| | | @property (nonatomic, strong) UIView *lineView;//分割线View |
| | | @property (nonatomic, strong) INUIAddVoiceShortcutButton API_AVAILABLE(ios(12.0)) *shortcutButton;//快捷指令按钮 |
| | | |
| | | @property (nonatomic, strong) HDLSiriSceneModel *model;//场景model |
| | | @property (nonatomic, strong) HDLSiriControlModel *model;//场景model |
| | | @property (nonatomic, strong) NSString *homeId; |
| | | |
| | | -(void)initModel:(HDLSiriSceneModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)); |
| | | -(void)initModel:(HDLSiriControlModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)); |
| | | |
| | | @end |
| | | |
| | |
| | | |
| | | /// |
| | | - (void)addAllChildView{ |
| | | self.backgroundColor = [UIColor clearColor]; |
| | | self.contentView.backgroundColor = [UIColor clearColor]; |
| | | [self.contentView addSubview:self.bgView]; |
| | | [self.bgView addSubview:self.titleLabel]; |
| | | self.backgroundColor = [UIColor whiteColor]; |
| | | self.contentView.backgroundColor = [UIColor whiteColor]; |
| | | // [self.contentView addSubview:self.bgView]; |
| | | [self.contentView addSubview:self.titleLabel]; |
| | | if (@available(iOS 12.0, *)) { |
| | | [self.bgView addSubview:self.shortcutButton]; |
| | | [self.contentView addSubview:self.shortcutButton]; |
| | | } |
| | | [self.contentView addSubview:self.lineView]; |
| | | } |
| | | |
| | | -(UIView*)bgView{ |
| | | if(!_bgView){ |
| | | _bgView = [[UIView alloc]initWithFrame:CGRectMake(20, 6, APP_SCREEN_WIDTH - 40, 60)]; |
| | | _bgView.backgroundColor = UIColor.whiteColor; |
| | | _bgView.layer.cornerRadius = 12; |
| | | _bgView.layer.masksToBounds = YES;// 隐藏边界 |
| | | //-(UIView*)bgView{ |
| | | // if(!_bgView){ |
| | | // _bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, APP_SCREEN_WIDTH, 50)]; |
| | | // _bgView.backgroundColor = UIColor.whiteColor; |
| | | //// _bgView.layer.cornerRadius = 12; |
| | | //// _bgView.layer.masksToBounds = YES;// 隐藏边界 |
| | | // } |
| | | // return _bgView; |
| | | //} |
| | | -(UIView*)lineView{ |
| | | if(!_lineView){ |
| | | _lineView = [[UIView alloc]initWithFrame:CGRectMake(16, 49, APP_SCREEN_WIDTH - 32, 1)]; |
| | | _lineView.backgroundColor = HEXCOLORA(0xECEDEE , 1.0); |
| | | } |
| | | return _bgView; |
| | | return _lineView; |
| | | } |
| | | |
| | | |
| | | -(UILabel*)titleLabel{ |
| | | if(!_titleLabel){ |
| | | _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(6, 10, APP_SCREEN_WIDTH - 40 - 206, 40)]; |
| | | _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(16, 0, APP_SCREEN_WIDTH - 32 - 180, 50)]; |
| | | _titleLabel.textColor = COLOR_TEXT; |
| | | _titleLabel.font = Get_FontMediumWithSize(16); |
| | | _titleLabel.font = Get_FontMediumWithSize(14); |
| | | _titleLabel.textAlignment = NSTextAlignmentLeft; |
| | | _titleLabel.numberOfLines = 2; |
| | | } |
| | |
| | | - (INUIAddVoiceShortcutButton*)shortcutButton{ |
| | | if(!_shortcutButton){ |
| | | _shortcutButton = [[INUIAddVoiceShortcutButton alloc] initWithStyle:INUIAddVoiceShortcutButtonStyleWhite]; |
| | | // _shortcutButton.backgroundColor = UIColor.redColor; |
| | | // _shortcutButton.shortcut = [[INShortcut alloc] initWithIntent:self.intent]; |
| | | _shortcutButton.translatesAutoresizingMaskIntoConstraints = YES; |
| | | _shortcutButton.frame = CGRectMake(APP_SCREEN_WIDTH - 40 - 150, 6, 150, 48); |
| | | _shortcutButton.frame = CGRectMake(APP_SCREEN_WIDTH - 160, 2, 160, 46); |
| | | [_shortcutButton setEnabled:NO]; |
| | | // _shortcutButton.delegate = self; |
| | | } |
| | |
| | | // self.titleLabel.text = model.name; |
| | | //} |
| | | |
| | | -(void)initModel:(HDLSiriSceneModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)){ |
| | | -(void)initModel:(HDLSiriControlModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)){ |
| | | _model = model; |
| | | //判空 |
| | | if (_model == nil) return; |
| | | //处理model数据 |
| | | self.titleLabel.text = model.name; |
| | | self.titleLabel.text = model.controlName; |
| | | if(intent == nil){ |
| | | _shortcutButton.shortcut = [self getINShortcut]; |
| | | _shortcutButton.shortcut = [self getINShortcut:_model]; |
| | | }else{ |
| | | _shortcutButton.shortcut = [[INShortcut alloc] initWithIntent:intent]; |
| | | } |
| | | } |
| | | |
| | | - (INShortcut *) getINShortcut API_AVAILABLE(ios(12.0)){ |
| | | NSString *title = _model.name; |
| | | - (INShortcut *) getINShortcut:(HDLSiriControlModel*)sceneModel API_AVAILABLE(ios(12.0)){ |
| | | NSString *title = sceneModel.controlName; |
| | | HDLRunSceneIntent *intent = [[HDLRunSceneIntent alloc] init]; |
| | | intent.sceneId = _model.userSceneId; |
| | | intent.suggestedInvocationPhrase = title; //在Siri语音设置时显示的建议设置唤起文字 |
| | | intent.sceneName = title; |
| | | intent.controlId = sceneModel.controlId; |
| | | intent.controlName = title; |
| | | intent.homeId = self.homeId; |
| | | intent.actionName = |
| | | intent.controlType = sceneModel.controlType; |
| | | intent.controlJSONStr = sceneModel.controlJSONStr; |
| | | INShortcut *shortCut = [[INShortcut alloc] initWithIntent:intent]; |
| | | return shortCut; |
| | | } |
| | |
| | | |
| | | @property (nonatomic, assign) UITableViewStyle tableViewStyle; |
| | | @property (nonatomic, strong) UITableView *tableView; |
| | | @property (nonatomic, strong) NSMutableArray *dataSource; |
| | | @property (nonatomic, strong) NSMutableArray *dataSource;//NSArray<HDLSiriShortcutModel *> |
| | | @property (nonatomic, strong) NSString *titleName; |
| | | @property (nonatomic, strong) NSString *homeId;//住宅ID |
| | | |
| | | |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
| | |
| | | #import <IntentsUI/IntentsUI.h> |
| | | #import "HDLRunSceneIntent.h" //上方“设置Custom Intents”图中右边箭头指的“Class Name” |
| | | #import "HDLSiriSceneListCell.h" |
| | | #import "HDLSiriSceneModel.h" |
| | | #import "HDLSectionHeaderView.h" |
| | | #import "HDLSceneSiri.h" |
| | | #import "TopBarView.h" |
| | | #import "HDLSiriShortcutModel.h" |
| | | |
| | | |
| | | NSString * const HDLSiriSceneListCellIdentifier = @"HDLSiriSceneListCellIdentifier"; |
| | | |
| | |
| | | - (void)viewDidLoad { |
| | | [super viewDidLoad]; |
| | | [self.navigationController setNavigationBarHidden:YES animated:YES]; |
| | | self.view.backgroundColor = HEXCOLORA(0xF7F7FC,1.0); |
| | | self.view.backgroundColor = HEXCOLORA(0xF2F3F7,1.0); |
| | | [self initView]; |
| | | // Do any additional setup after loading the view. |
| | | } |
| | | |
| | | -(void)initLlanguage{ |
| | | NSString *languageName = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0]; |
| | | |
| | | // 简体中文 |
| | | if ([languageName rangeOfString:@"zh-Hans"].location != NSNotFound) { |
| | | //标题 |
| | | if(self.titleName == nil || [self.titleName isEqual:@""]){ |
| | | self.titleName = @"Siri快捷指令"; |
| | | } |
| | | |
| | | }else{ |
| | | //标题 |
| | | if(self.titleName == nil || [self.titleName isEqual:@""]){ |
| | | self.titleName = @"Siri Shortcuts"; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | /// initView |
| | | - (void)initView{ |
| | | //标题 |
| | | if(self.titleName == nil || [self.titleName isEqual:@""]){ |
| | | self.titleName = @"Siri快捷指令"; |
| | | } |
| | | [self initLlanguage]; |
| | | [self setTopBarViewWithTitle:self.titleName]; |
| | | [self initTableView]; |
| | | [self refreshSiri]; |
| | |
| | | //设置标题和返回按钮 |
| | | - (void)setTopBarViewWithTitle:(NSString *)title{ |
| | | [self.view addSubview:self.topBarView]; |
| | | self.topBarView.backgroundColor = UIColor.whiteColor; |
| | | self.topBarView.backgroundColor = HEXCOLORA(0xF7F7F7, 1.0); |
| | | self.topBarView.titleLabel.text = title; |
| | | } |
| | | //返回 |
| | |
| | | } |
| | | else { |
| | | [self.navigationController popViewControllerAnimated:YES]; |
| | | // [self.navigationController popToRootViewControllerAnimated:YES]; |
| | | } |
| | | } |
| | | |
| | | #pragma NSMutableArray |
| | | - (NSMutableArray *)dataSource { |
| | | if (!_dataSource) { |
| | | _dataSource = [NSMutableArray new]; |
| | | } |
| | | return _dataSource; |
| | | } |
| | | |
| | | #pragma mark - UITableView |
| | |
| | | return _tableView; |
| | | } |
| | | - (void)initTableView{ |
| | | self.tableView.frame = CGRectMake(0, APP_TOP_BAR_HEIGHT + 12, APP_SCREEN_WIDTH, APP_VISIBLE_HEIGHT - APP_TAB_BOTTOM_HEIGHT-12); |
| | | self.tableView.frame = CGRectMake(0, APP_TOP_BAR_HEIGHT , APP_SCREEN_WIDTH, APP_VISIBLE_HEIGHT - APP_TAB_BOTTOM_HEIGHT); |
| | | // self.tableView.backgroundColor = HEXCOLORA(0xF7F7FC,1.0); |
| | | [self.view addSubview:self.tableView]; |
| | | // [self.tableView reloadData]; |
| | | |
| | | } |
| | | #pragma mark - 让tableView的每个section的headerview随tableview一起滚动 |
| | | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { |
| | | if (scrollView == self.tableView) |
| | | { |
| | | CGFloat sectionHeaderHeight = 65.0f; |
| | | if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) { |
| | | scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); |
| | | } else if (scrollView.contentOffset.y>=sectionHeaderHeight) { |
| | | scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #pragma mark - UITableViewDataSourceXW |
| | | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
| | | |
| | | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { |
| | | return self.dataSource.count; |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ |
| | | return 65.0f; |
| | | } |
| | | |
| | | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ |
| | | HDLSectionHeaderView *view = [[HDLSectionHeaderView alloc]init]; |
| | | HDLSiriShortcutModel *model = self.dataSource[section]; |
| | | if(model){ |
| | | view.titleLabel.text = model.title; |
| | | view.messageLabel.text = model.content; |
| | | } |
| | | return view; |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ |
| | | return 8.0f; |
| | | } |
| | | |
| | | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ |
| | | return [[UIView alloc]init]; |
| | | } |
| | | |
| | | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
| | | HDLSiriShortcutModel *model = self.dataSource[section]; |
| | | if(model && model.list){ |
| | | return model.list.count; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
| | |
| | | if (cell == nil) { |
| | | cell = [[HDLSiriSceneListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:HDLSiriSceneListCellIdentifier]; |
| | | } |
| | | |
| | | HDLSiriSceneModel *model = self.dataSource[indexPath.row]; |
| | | cell.homeId = self.homeId; |
| | | HDLSiriControlModel *model = [self getModelWithNSIndexPath:indexPath]; |
| | | if(model){ |
| | | if (@available(iOS 12.0, *)) { |
| | | HDLRunSceneIntent *intent = [self getSceneIntent: model.userSceneId]; |
| | | HDLRunSceneIntent *intent = [self getSceneIntent: model.controlId]; |
| | | [cell initModel:model intent:intent]; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | #pragma mark - UITableViewDelegate |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { |
| | | return 72; |
| | | return 50; |
| | | } |
| | | |
| | | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
| | | [tableView deselectRowAtIndexPath:indexPath animated:YES]; |
| | | |
| | | if (@available(iOS 12.0, *)) { |
| | | HDLSiriSceneModel *model = self.dataSource[indexPath.row]; |
| | | HDLSiriControlModel *model = [self getModelWithNSIndexPath:indexPath]; |
| | | if(model){ |
| | | INVoiceShortcut *voiceShortcut = [self getSceneINVoiceShortcut:model.userSceneId]; |
| | | INVoiceShortcut *voiceShortcut = [self getSceneINVoiceShortcut:model.controlId]; |
| | | [self addOrEditVoiceShortcut:voiceShortcut model:model]; |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /// 根据NSIndexPath 获取model |
| | | /// @param indexPath indexPath |
| | | -(HDLSiriControlModel *)getModelWithNSIndexPath:(NSIndexPath *)indexPath { |
| | | HDLSiriControlModel *model = nil; |
| | | HDLSiriShortcutModel *ssModel = self.dataSource[indexPath.section]; |
| | | if(ssModel && ssModel.list && (ssModel.list.count > indexPath.row)){ |
| | | model = ssModel.list[indexPath.row]; |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | /// 添加或者编辑快捷指令 |
| | | /// @param voiceShortcut 快捷指令 |
| | | /// @param model 场景 |
| | | -(void)addOrEditVoiceShortcut:(INVoiceShortcut *)voiceShortcut model:(HDLSiriSceneModel*)model API_AVAILABLE(ios(12.0)){ |
| | | -(void)addOrEditVoiceShortcut:(INVoiceShortcut *)voiceShortcut model:(HDLSiriControlModel*)model API_AVAILABLE(ios(12.0)){ |
| | | |
| | | if(voiceShortcut==nil){ |
| | | //1.如果不存在则添加 |
| | |
| | | } |
| | | |
| | | |
| | | - (INShortcut *) getINShortcut:(HDLSiriSceneModel*)model API_AVAILABLE(ios(12.0)){ |
| | | NSString *title = model.name; |
| | | - (INShortcut *) getINShortcut:(HDLSiriControlModel*)sceneModel API_AVAILABLE(ios(12.0)){ |
| | | NSString *title = sceneModel.controlName; |
| | | HDLRunSceneIntent *intent = [[HDLRunSceneIntent alloc] init]; |
| | | intent.sceneId = model.userSceneId; |
| | | intent.suggestedInvocationPhrase = title; //在Siri语音设置时显示的建议设置唤起文字 |
| | | intent.sceneName = title; |
| | | intent.controlId = sceneModel.controlId; |
| | | intent.controlName = title; |
| | | intent.homeId = self.homeId; |
| | | intent.controlType = sceneModel.controlType; |
| | | intent.controlJSONStr = sceneModel.controlJSONStr; |
| | | intent.actionName = sceneModel.actionName; |
| | | INShortcut *shortCut = [[INShortcut alloc] initWithIntent:intent]; |
| | | return shortCut; |
| | | } |
| | | |
| | | |
| | | /// 根据场景ID或者之前配置过低快捷指令 |
| | | /// @param sceneId 场景ID |
| | | - (HDLRunSceneIntent*)getSceneIntent:(NSString *)sceneId API_AVAILABLE(ios(12.0)){ |
| | | /// @param controlId 唯一标识ID |
| | | - (HDLRunSceneIntent*)getSceneIntent:(NSString *)controlId API_AVAILABLE(ios(12.0)){ |
| | | HDLRunSceneIntent *intentFind = nil; |
| | | for (INVoiceShortcut *voiceShortcut in self.siriShortcutList) { |
| | | HDLRunSceneIntent *intent = (HDLRunSceneIntent *)voiceShortcut.shortcut.intent; |
| | | if(intent){ |
| | | if([intent.sceneId isEqualToString:sceneId]){ |
| | | if([intent.controlId isEqualToString:controlId]){ |
| | | intentFind = intent; |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | /// 根据场景ID或者之前配置过低快捷指令 |
| | | /// @param sceneId 场景ID |
| | | - (INVoiceShortcut*)getSceneINVoiceShortcut:(NSString *)sceneId API_AVAILABLE(ios(12.0)){ |
| | | /// @param controlId 唯一标识ID |
| | | - (INVoiceShortcut*)getSceneINVoiceShortcut:(NSString *)controlId API_AVAILABLE(ios(12.0)){ |
| | | INVoiceShortcut *voiceShortcutFind = nil; |
| | | for (INVoiceShortcut *voiceShortcut in self.siriShortcutList) { |
| | | HDLRunSceneIntent *intent = (HDLRunSceneIntent *)voiceShortcut.shortcut.intent; |
| | | if(intent){ |
| | | if([intent.sceneId isEqualToString:sceneId]){ |
| | | if([intent.controlId isEqualToString:controlId]){ |
| | | voiceShortcutFind = voiceShortcut; |
| | | break; |
| | | } |
New file |
| | |
| | | // |
| | | // HDLSiriShortcutModel.h |
| | | // HDLSceneSiriDemo |
| | | // |
| | | // Created by 陈嘉乐 on 2021/11/29. |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | @class HDLSiriControlModel; |
| | | @class HDLSiriShortcutModel; |
| | | typedef NSArray<HDLSiriShortcutModel *> HDLSiriShortcutModelList; |
| | | |
| | | @interface HDLSiriShortcutModel : NSObject |
| | | @property (nonatomic, copy) NSString *title;//section Head 的标题 |
| | | @property (nonatomic, copy) NSString *content;//section 内容说明 |
| | | @property (nonatomic, copy) NSArray<HDLSiriControlModel *> *list;//row数据 |
| | | @end |
| | | |
| | | @interface HDLSiriControlModel : NSObject |
| | | @property (nonatomic, copy) NSString *controlName;//场景名、安防名等 |
| | | @property (nonatomic, copy) NSString *controlId;//场景ID,安防ID等唯一ID |
| | | @property (nonatomic, copy) NSString *controlType;//场景1,安防2 |
| | | @property (nonatomic, copy) NSString *controlJSONStr;//自定义对象JSONStr |
| | | @property (nonatomic, copy) NSString *actionName;//动作名称,"执行" |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
New file |
| | |
| | | // |
| | | // HDLSiriShortcutModel.m |
| | | // HDLSceneSiriDemo |
| | | // |
| | | // Created by 陈嘉乐 on 2021/11/29. |
| | | // |
| | | |
| | | #import "HDLSiriShortcutModel.h" |
| | | |
| | | @implementation HDLSiriShortcutModel |
| | | |
| | | @end |
| | | |
| | | @implementation HDLSiriControlModel |
| | | |
| | | @end |
| | |
| | | |
| | | - (UILabel *)titleLabel{ |
| | | if (!_titleLabel) { |
| | | _titleLabel = [self NewLabel:CGRectMake(40, APP_STATUS_BAR_HEIGHT, APP_SCREEN_WIDTH - 80, 44) font:Get_FontMediumWithSize(16) textColor:COLOR_TEXT text:@""]; |
| | | _titleLabel = [self NewLabel:CGRectMake(40, APP_STATUS_BAR_HEIGHT, APP_SCREEN_WIDTH - 80, 44) font:Get_FontWithSize(18) textColor:COLOR_TEXT text:@""]; |
| | | _titleLabel.textAlignment = NSTextAlignmentCenter; |
| | | } |
| | | return _titleLabel; |
| | |
| | | // 建议:只用reday和success 这两个code |
| | | - (void)confirmRunScene:(HDLRunSceneIntent *)intent completion:(void (^)(HDLRunSceneIntentResponse *response))completion NS_SWIFT_NAME(confirm(intent:completion:)){ |
| | | |
| | | |
| | | |
| | | HDLRunSceneIntentResponse *rsp = [[HDLRunSceneIntentResponse alloc] initWithCode:HDLRunSceneIntentResponseCodeInProgress userActivity:nil]; |
| | | rsp.successMessage =@"请等待..."; |
| | | completion(rsp); |
| | |
| | | |
| | | - (void)handleHDLRunScene:(nonnull HDLRunSceneIntent *)intent completion:(nonnull void (^)(HDLRunSceneIntentResponse * _Nonnull))completion { |
| | | NSLog(@"HDL handleRunScene"); |
| | | NSString *text = @"执行成功"; |
| | | |
| | | |
| | | NSData *jsonData = [intent.controlJSONStr dataUsingEncoding:NSUTF8StringEncoding]; |
| | | NSError *error; |
| | | NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; |
| | | if (error) { |
| | | //解析出错 |
| | | } |
| | | NSLog(@"dic :%@",dic); |
| | | text = [NSString stringWithFormat:@"%@ %@",text,intent.controlJSONStr]; |
| | | |
| | | |
| | | //执行成功 |
| | | HDLRunSceneIntentResponse *rsp = [[HDLRunSceneIntentResponse alloc] initWithCode:HDLRunSceneIntentResponseCodeSuccess userActivity:nil]; |
| | | rsp.sceneName = intent.sceneName; |
| | | rsp.successMessage = @"执行成功"; |
| | | rsp.controlName = intent.controlName; |
| | | rsp.successMessage = text; |
| | | completion(rsp); |
| | | |
| | | } |
| | |
| | | <key>NSExtensionAttributes</key> |
| | | <dict> |
| | | <key>IntentsRestrictedWhileLocked</key> |
| | | <array> |
| | | <string>HDLRunSceneIntent</string> |
| | | </array> |
| | | <key>IntentsRestrictedWhileProtectedDataUnavailable</key> |
| | | <array/> |
| | | <key>IntentsSupported</key> |
| | | <array> |
| | |
| | | B9595E602744D77D00948DB9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B9595E5F2744D77D00948DB9 /* main.m */; }; |
| | | B9595E6B2744D80400948DB9 /* HDLSiriSceneListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B9595E682744D80400948DB9 /* HDLSiriSceneListCell.m */; }; |
| | | B9595E6C2744D80400948DB9 /* HDLSiriSceneListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9595E6A2744D80400948DB9 /* HDLSiriSceneListViewController.m */; }; |
| | | B9595E7E2744DA3B00948DB9 /* HDLSiriSceneModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B9595E7D2744DA3B00948DB9 /* HDLSiriSceneModel.m */; }; |
| | | B9595E812744DA7000948DB9 /* Intents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9595E802744DA7000948DB9 /* Intents.framework */; }; |
| | | B9595E842744DC9000948DB9 /* HDLSceneSiri.m in Sources */ = {isa = PBXBuildFile; fileRef = B9595E832744DC8F00948DB9 /* HDLSceneSiri.m */; }; |
| | | B9595E9A2744E00100948DB9 /* TopBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = B9595E992744E00100948DB9 /* TopBarView.m */; }; |
| | |
| | | B9DD8812274F7CE000E37C32 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = B9DD87EA274F7B8200E37C32 /* Intents.intentdefinition */; }; |
| | | B9DD8813274F7CEC00E37C32 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = B9DD87EA274F7B8200E37C32 /* Intents.intentdefinition */; }; |
| | | B9DD8816274F7D0C00E37C32 /* HDLSceneHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = B9DD8815274F7D0C00E37C32 /* HDLSceneHandler.m */; }; |
| | | B9F52E9F2750DFE60049014D /* HDLSectionHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = B9F52E9E2750DFE60049014D /* HDLSectionHeaderView.m */; }; |
| | | B9F52EA2275468950049014D /* HDLSiriShortcutModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B9F52EA1275468950049014D /* HDLSiriShortcutModel.m */; }; |
| | | /* End PBXBuildFile section */ |
| | | |
| | | /* Begin PBXContainerItemProxy section */ |
| | |
| | | B9595E682744D80400948DB9 /* HDLSiriSceneListCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDLSiriSceneListCell.m; sourceTree = "<group>"; }; |
| | | B9595E692744D80400948DB9 /* HDLSiriSceneListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDLSiriSceneListViewController.h; sourceTree = "<group>"; }; |
| | | B9595E6A2744D80400948DB9 /* HDLSiriSceneListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDLSiriSceneListViewController.m; sourceTree = "<group>"; }; |
| | | B9595E7C2744DA3B00948DB9 /* HDLSiriSceneModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLSiriSceneModel.h; sourceTree = "<group>"; }; |
| | | B9595E7D2744DA3B00948DB9 /* HDLSiriSceneModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLSiriSceneModel.m; sourceTree = "<group>"; }; |
| | | B9595E802744DA7000948DB9 /* Intents.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Intents.framework; path = System/Library/Frameworks/Intents.framework; sourceTree = SDKROOT; }; |
| | | B9595E822744DC8F00948DB9 /* HDLSceneSiri.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLSceneSiri.h; sourceTree = "<group>"; }; |
| | | B9595E832744DC8F00948DB9 /* HDLSceneSiri.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLSceneSiri.m; sourceTree = "<group>"; }; |
| | |
| | | B9DD8804274F7CBC00E37C32 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; |
| | | B9DD8814274F7D0B00E37C32 /* HDLSceneHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLSceneHandler.h; sourceTree = "<group>"; }; |
| | | B9DD8815274F7D0C00E37C32 /* HDLSceneHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLSceneHandler.m; sourceTree = "<group>"; }; |
| | | B9F52E9D2750DFE60049014D /* HDLSectionHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLSectionHeaderView.h; sourceTree = "<group>"; }; |
| | | B9F52E9E2750DFE60049014D /* HDLSectionHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLSectionHeaderView.m; sourceTree = "<group>"; }; |
| | | B9F52EA0275468950049014D /* HDLSiriShortcutModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HDLSiriShortcutModel.h; sourceTree = "<group>"; }; |
| | | B9F52EA1275468950049014D /* HDLSiriShortcutModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HDLSiriShortcutModel.m; sourceTree = "<group>"; }; |
| | | /* End PBXFileReference section */ |
| | | |
| | | /* Begin PBXFrameworksBuildPhase section */ |
| | |
| | | B9595E682744D80400948DB9 /* HDLSiriSceneListCell.m */, |
| | | B9595E692744D80400948DB9 /* HDLSiriSceneListViewController.h */, |
| | | B9595E6A2744D80400948DB9 /* HDLSiriSceneListViewController.m */, |
| | | B9595E7C2744DA3B00948DB9 /* HDLSiriSceneModel.h */, |
| | | B9595E7D2744DA3B00948DB9 /* HDLSiriSceneModel.m */, |
| | | B9595E822744DC8F00948DB9 /* HDLSceneSiri.h */, |
| | | B9595E832744DC8F00948DB9 /* HDLSceneSiri.m */, |
| | | B9F52E9D2750DFE60049014D /* HDLSectionHeaderView.h */, |
| | | B9F52E9E2750DFE60049014D /* HDLSectionHeaderView.m */, |
| | | B9F52EA0275468950049014D /* HDLSiriShortcutModel.h */, |
| | | B9F52EA1275468950049014D /* HDLSiriShortcutModel.m */, |
| | | ); |
| | | path = HDLSceneSiri; |
| | | sourceTree = "<group>"; |
| | |
| | | isa = PBXSourcesBuildPhase; |
| | | buildActionMask = 2147483647; |
| | | files = ( |
| | | B9F52E9F2750DFE60049014D /* HDLSectionHeaderView.m in Sources */, |
| | | B9595E842744DC9000948DB9 /* HDLSceneSiri.m in Sources */, |
| | | B9595E552744D77800948DB9 /* ViewController.m in Sources */, |
| | | B9595E7E2744DA3B00948DB9 /* HDLSiriSceneModel.m in Sources */, |
| | | B9595E4F2744D77800948DB9 /* AppDelegate.m in Sources */, |
| | | B9595E602744D77D00948DB9 /* main.m in Sources */, |
| | | B9595E522744D77800948DB9 /* SceneDelegate.m in Sources */, |
| | | B9595E6C2744D80400948DB9 /* HDLSiriSceneListViewController.m in Sources */, |
| | | B9595E9A2744E00100948DB9 /* TopBarView.m in Sources */, |
| | | B9F52EA2275468950049014D /* HDLSiriShortcutModel.m in Sources */, |
| | | B9DD87EB274F7B8200E37C32 /* Intents.intentdefinition in Sources */, |
| | | B9595E6B2744D80400948DB9 /* HDLSiriSceneListCell.m in Sources */, |
| | | ); |
| | |
| | | #define WEAKSELF_AT __weak __typeof(&*self)weakSelf_AT = self; |
| | | #define HEXCOLORA(rgbValue, a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:a] |
| | | // 字体颜色 |
| | | #define COLOR_TEXT HEXCOLORA(0x222222,1.0) |
| | | #define COLOR_TEXT HEXCOLORA(0x1B2D4D,1.0) |
| | | |
| | | // APP_UIFont |
| | | #define APP_UIFont @"PingFangSC-Regular"//苹方-简 常规体 |
New file |
| | |
| | | // |
| | | // HDLSectionHeaderView.h |
| | | // HDLSceneSiriDemo |
| | | // |
| | | // Created by 陈嘉乐 on 2021/11/26. |
| | | // |
| | | |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | @interface HDLSectionHeaderView : UIView |
| | | |
| | | @property (nonatomic, strong) UILabel *titleLabel;//标题 |
| | | @property (nonatomic, strong) UILabel *messageLabel;//内容 |
| | | @property (nonatomic, strong) UIView *lineView;//分割线View |
| | | |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
New file |
| | |
| | | // |
| | | // HDLSectionHeaderView.m |
| | | // HDLSceneSiriDemo |
| | | // |
| | | // Created by 陈嘉乐 on 2021/11/26. |
| | | // |
| | | |
| | | #import "HDLSectionHeaderView.h" |
| | | #import "HDLSceneSiri.h" |
| | | |
| | | @implementation HDLSectionHeaderView |
| | | |
| | | - (id)initWithFrame:(CGRect)frame |
| | | { |
| | | self = [super initWithFrame:frame]; |
| | | if (self) { |
| | | self.frame = CGRectMake(0, 0, APP_SCREEN_WIDTH, 65); |
| | | self.backgroundColor = UIColor.whiteColor; |
| | | [self addSubview:self.titleLabel]; |
| | | [self addSubview:self.messageLabel]; |
| | | [self addSubview:self.lineView]; |
| | | } |
| | | return self; |
| | | } |
| | | |
| | | |
| | | - (UILabel *)titleLabel{ |
| | | if (!_titleLabel) { |
| | | _titleLabel = [self NewLabel:CGRectMake(16, 11, APP_SCREEN_WIDTH - 32, 22) font:Get_FontBoldWithSize(16) textColor:HEXCOLORA(0x4484F4, 1.0) text:@""]; |
| | | _titleLabel.textAlignment = NSTextAlignmentLeft; |
| | | } |
| | | return _titleLabel; |
| | | } |
| | | |
| | | - (UILabel *)messageLabel{ |
| | | if (!_messageLabel) { |
| | | _messageLabel = [self NewLabel:CGRectMake(16, 37, APP_SCREEN_WIDTH - 32, 17) font:Get_FontWithSize(12) textColor:HEXCOLORA(0xC0C7D4, 1.0) text:@""]; |
| | | _messageLabel.textAlignment = NSTextAlignmentLeft; |
| | | } |
| | | return _messageLabel; |
| | | } |
| | | |
| | | -(UIView*)lineView{ |
| | | if(!_lineView){ |
| | | _lineView = [[UIView alloc]initWithFrame:CGRectMake(16, 64, APP_SCREEN_WIDTH - 16, 1)]; |
| | | _lineView.backgroundColor = HEXCOLORA(0xECEDEE , 1.0); |
| | | } |
| | | return _lineView; |
| | | } |
| | | |
| | | - (UILabel *)NewLabel:(CGRect)frame font:(UIFont *)font textColor:(UIColor *)color text:(NSString *)text{ |
| | | UILabel *label = [[UILabel alloc] initWithFrame:frame]; |
| | | label.backgroundColor = [UIColor clearColor]; |
| | | label.font = font; |
| | | if (color != nil) { |
| | | label.textColor = color; |
| | | } |
| | | label.text = text; |
| | | |
| | | return label; |
| | | } |
| | | |
| | | // |
| | | -(void)backButtonClick{ |
| | | |
| | | } |
| | | |
| | | -(void)setTitle:(NSString *)title{ |
| | | self.titleLabel.text = title; |
| | | } |
| | | @end |
| | |
| | | #import <UIKit/UIKit.h> |
| | | #import <Intents/Intents.h> |
| | | #import <IntentsUI/IntentsUI.h> |
| | | #import "HDLSiriShortcutModel.h" |
| | | #import "HDLRunSceneIntent.h" |
| | | #import "HDLSiriSceneModel.h" |
| | | |
| | | //#import <HDLSmartKit/HDLSceneModel.h> |
| | | |
| | |
| | | |
| | | @interface HDLSiriSceneListCell : UITableViewCell |
| | | |
| | | @property (nonatomic, strong) UIView *bgView;//背景View |
| | | //@property (nonatomic, strong) UIView *bgView;//背景View |
| | | @property (nonatomic, strong) UILabel *titleLabel;//场景标题 |
| | | @property (nonatomic, strong) UIView *lineView;//分割线View |
| | | @property (nonatomic, strong) INUIAddVoiceShortcutButton API_AVAILABLE(ios(12.0)) *shortcutButton;//快捷指令按钮 |
| | | |
| | | @property (nonatomic, strong) HDLSiriSceneModel *model;//场景model |
| | | @property (nonatomic, strong) HDLSiriControlModel *model;//场景model |
| | | @property (nonatomic, strong) NSString *homeId; |
| | | |
| | | -(void)initModel:(HDLSiriSceneModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)); |
| | | -(void)initModel:(HDLSiriControlModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)); |
| | | |
| | | @end |
| | | |
| | |
| | | |
| | | /// |
| | | - (void)addAllChildView{ |
| | | self.backgroundColor = [UIColor clearColor]; |
| | | self.contentView.backgroundColor = [UIColor clearColor]; |
| | | [self.contentView addSubview:self.bgView]; |
| | | [self.bgView addSubview:self.titleLabel]; |
| | | self.backgroundColor = [UIColor whiteColor]; |
| | | self.contentView.backgroundColor = [UIColor whiteColor]; |
| | | // [self.contentView addSubview:self.bgView]; |
| | | [self.contentView addSubview:self.titleLabel]; |
| | | if (@available(iOS 12.0, *)) { |
| | | [self.bgView addSubview:self.shortcutButton]; |
| | | [self.contentView addSubview:self.shortcutButton]; |
| | | } |
| | | [self.contentView addSubview:self.lineView]; |
| | | } |
| | | |
| | | -(UIView*)bgView{ |
| | | if(!_bgView){ |
| | | _bgView = [[UIView alloc]initWithFrame:CGRectMake(20, 6, APP_SCREEN_WIDTH - 40, 60)]; |
| | | _bgView.backgroundColor = UIColor.whiteColor; |
| | | _bgView.layer.cornerRadius = 12; |
| | | _bgView.layer.masksToBounds = YES;// 隐藏边界 |
| | | //-(UIView*)bgView{ |
| | | // if(!_bgView){ |
| | | // _bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, APP_SCREEN_WIDTH, 50)]; |
| | | // _bgView.backgroundColor = UIColor.whiteColor; |
| | | //// _bgView.layer.cornerRadius = 12; |
| | | //// _bgView.layer.masksToBounds = YES;// 隐藏边界 |
| | | // } |
| | | // return _bgView; |
| | | //} |
| | | -(UIView*)lineView{ |
| | | if(!_lineView){ |
| | | _lineView = [[UIView alloc]initWithFrame:CGRectMake(16, 49, APP_SCREEN_WIDTH - 32, 1)]; |
| | | _lineView.backgroundColor = HEXCOLORA(0xECEDEE , 1.0); |
| | | } |
| | | return _bgView; |
| | | return _lineView; |
| | | } |
| | | |
| | | |
| | | -(UILabel*)titleLabel{ |
| | | if(!_titleLabel){ |
| | | _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(6, 10, APP_SCREEN_WIDTH - 40 - 206, 40)]; |
| | | _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(16, 0, APP_SCREEN_WIDTH - 32 - 180, 50)]; |
| | | _titleLabel.textColor = COLOR_TEXT; |
| | | _titleLabel.font = Get_FontMediumWithSize(16); |
| | | _titleLabel.font = Get_FontMediumWithSize(14); |
| | | _titleLabel.textAlignment = NSTextAlignmentLeft; |
| | | _titleLabel.numberOfLines = 2; |
| | | } |
| | |
| | | - (INUIAddVoiceShortcutButton*)shortcutButton{ |
| | | if(!_shortcutButton){ |
| | | _shortcutButton = [[INUIAddVoiceShortcutButton alloc] initWithStyle:INUIAddVoiceShortcutButtonStyleWhite]; |
| | | // _shortcutButton.backgroundColor = UIColor.redColor; |
| | | // _shortcutButton.shortcut = [[INShortcut alloc] initWithIntent:self.intent]; |
| | | _shortcutButton.translatesAutoresizingMaskIntoConstraints = YES; |
| | | _shortcutButton.frame = CGRectMake(APP_SCREEN_WIDTH - 40 - 150, 6, 150, 48); |
| | | _shortcutButton.frame = CGRectMake(APP_SCREEN_WIDTH - 160, 2, 160, 46); |
| | | [_shortcutButton setEnabled:NO]; |
| | | // _shortcutButton.delegate = self; |
| | | } |
| | |
| | | // self.titleLabel.text = model.name; |
| | | //} |
| | | |
| | | -(void)initModel:(HDLSiriSceneModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)){ |
| | | -(void)initModel:(HDLSiriControlModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)){ |
| | | _model = model; |
| | | //判空 |
| | | if (_model == nil) return; |
| | | //处理model数据 |
| | | self.titleLabel.text = model.name; |
| | | self.titleLabel.text = model.controlName; |
| | | if(intent == nil){ |
| | | _shortcutButton.shortcut = [self getINShortcut]; |
| | | _shortcutButton.shortcut = [self getINShortcut:_model]; |
| | | }else{ |
| | | _shortcutButton.shortcut = [[INShortcut alloc] initWithIntent:intent]; |
| | | } |
| | | } |
| | | |
| | | - (INShortcut *) getINShortcut API_AVAILABLE(ios(12.0)){ |
| | | NSString *title = _model.name; |
| | | - (INShortcut *) getINShortcut:(HDLSiriControlModel*)sceneModel API_AVAILABLE(ios(12.0)){ |
| | | NSString *title = sceneModel.controlName; |
| | | HDLRunSceneIntent *intent = [[HDLRunSceneIntent alloc] init]; |
| | | intent.sceneId = _model.userSceneId; |
| | | intent.suggestedInvocationPhrase = title; //在Siri语音设置时显示的建议设置唤起文字 |
| | | intent.sceneName = title; |
| | | intent.controlId = sceneModel.controlId; |
| | | intent.controlName = title; |
| | | intent.homeId = self.homeId; |
| | | intent.actionName = |
| | | intent.controlType = sceneModel.controlType; |
| | | intent.controlJSONStr = sceneModel.controlJSONStr; |
| | | INShortcut *shortCut = [[INShortcut alloc] initWithIntent:intent]; |
| | | return shortCut; |
| | | } |
| | |
| | | |
| | | @property (nonatomic, assign) UITableViewStyle tableViewStyle; |
| | | @property (nonatomic, strong) UITableView *tableView; |
| | | @property (nonatomic, strong) NSMutableArray *dataSource; |
| | | @property (nonatomic, strong) NSMutableArray *dataSource;//NSArray<HDLSiriShortcutModel *> |
| | | @property (nonatomic, strong) NSString *titleName; |
| | | @property (nonatomic, strong) NSString *homeId;//住宅ID |
| | | |
| | | |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
| | |
| | | #import <IntentsUI/IntentsUI.h> |
| | | #import "HDLRunSceneIntent.h" //上方“设置Custom Intents”图中右边箭头指的“Class Name” |
| | | #import "HDLSiriSceneListCell.h" |
| | | #import "HDLSiriSceneModel.h" |
| | | #import "HDLSectionHeaderView.h" |
| | | #import "HDLSceneSiri.h" |
| | | #import "TopBarView.h" |
| | | #import "HDLSiriShortcutModel.h" |
| | | |
| | | |
| | | NSString * const HDLSiriSceneListCellIdentifier = @"HDLSiriSceneListCellIdentifier"; |
| | | |
| | |
| | | - (void)viewDidLoad { |
| | | [super viewDidLoad]; |
| | | [self.navigationController setNavigationBarHidden:YES animated:YES]; |
| | | self.view.backgroundColor = HEXCOLORA(0xF7F7FC,1.0); |
| | | self.view.backgroundColor = HEXCOLORA(0xF2F3F7,1.0); |
| | | [self initView]; |
| | | // Do any additional setup after loading the view. |
| | | } |
| | | |
| | | -(void)initLlanguage{ |
| | | NSString *languageName = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"] objectAtIndex:0]; |
| | | |
| | | // 简体中文 |
| | | if ([languageName rangeOfString:@"zh-Hans"].location != NSNotFound) { |
| | | //标题 |
| | | if(self.titleName == nil || [self.titleName isEqual:@""]){ |
| | | self.titleName = @"Siri快捷指令"; |
| | | } |
| | | |
| | | }else{ |
| | | //标题 |
| | | if(self.titleName == nil || [self.titleName isEqual:@""]){ |
| | | self.titleName = @"Siri Shortcuts"; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | /// initView |
| | | - (void)initView{ |
| | | //标题 |
| | | if(self.titleName == nil || [self.titleName isEqual:@""]){ |
| | | self.titleName = @"Siri快捷指令"; |
| | | } |
| | | [self initLlanguage]; |
| | | [self setTopBarViewWithTitle:self.titleName]; |
| | | [self initTableView]; |
| | | [self refreshSiri]; |
| | |
| | | //设置标题和返回按钮 |
| | | - (void)setTopBarViewWithTitle:(NSString *)title{ |
| | | [self.view addSubview:self.topBarView]; |
| | | self.topBarView.backgroundColor = UIColor.whiteColor; |
| | | self.topBarView.backgroundColor = HEXCOLORA(0xF7F7F7, 1.0); |
| | | self.topBarView.titleLabel.text = title; |
| | | } |
| | | //返回 |
| | |
| | | } |
| | | else { |
| | | [self.navigationController popViewControllerAnimated:YES]; |
| | | // [self.navigationController popToRootViewControllerAnimated:YES]; |
| | | } |
| | | } |
| | | |
| | | #pragma NSMutableArray |
| | | - (NSMutableArray *)dataSource { |
| | | if (!_dataSource) { |
| | | _dataSource = [NSMutableArray new]; |
| | | } |
| | | return _dataSource; |
| | | } |
| | | |
| | | #pragma mark - UITableView |
| | |
| | | return _tableView; |
| | | } |
| | | - (void)initTableView{ |
| | | self.tableView.frame = CGRectMake(0, APP_TOP_BAR_HEIGHT + 12, APP_SCREEN_WIDTH, APP_VISIBLE_HEIGHT - APP_TAB_BOTTOM_HEIGHT-12); |
| | | self.tableView.frame = CGRectMake(0, APP_TOP_BAR_HEIGHT , APP_SCREEN_WIDTH, APP_VISIBLE_HEIGHT - APP_TAB_BOTTOM_HEIGHT); |
| | | // self.tableView.backgroundColor = HEXCOLORA(0xF7F7FC,1.0); |
| | | [self.view addSubview:self.tableView]; |
| | | // [self.tableView reloadData]; |
| | | |
| | | } |
| | | #pragma mark - 让tableView的每个section的headerview随tableview一起滚动 |
| | | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { |
| | | if (scrollView == self.tableView) |
| | | { |
| | | CGFloat sectionHeaderHeight = 65.0f; |
| | | if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) { |
| | | scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); |
| | | } else if (scrollView.contentOffset.y>=sectionHeaderHeight) { |
| | | scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #pragma mark - UITableViewDataSourceXW |
| | | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
| | | |
| | | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { |
| | | return self.dataSource.count; |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ |
| | | return 65.0f; |
| | | } |
| | | |
| | | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ |
| | | HDLSectionHeaderView *view = [[HDLSectionHeaderView alloc]init]; |
| | | HDLSiriShortcutModel *model = self.dataSource[section]; |
| | | if(model){ |
| | | view.titleLabel.text = model.title; |
| | | view.messageLabel.text = model.content; |
| | | } |
| | | return view; |
| | | } |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ |
| | | return 8.0f; |
| | | } |
| | | |
| | | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ |
| | | return [[UIView alloc]init]; |
| | | } |
| | | |
| | | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { |
| | | HDLSiriShortcutModel *model = self.dataSource[section]; |
| | | if(model && model.list){ |
| | | return model.list.count; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
| | |
| | | if (cell == nil) { |
| | | cell = [[HDLSiriSceneListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:HDLSiriSceneListCellIdentifier]; |
| | | } |
| | | |
| | | HDLSiriSceneModel *model = self.dataSource[indexPath.row]; |
| | | cell.homeId = self.homeId; |
| | | HDLSiriControlModel *model = [self getModelWithNSIndexPath:indexPath]; |
| | | if(model){ |
| | | if (@available(iOS 12.0, *)) { |
| | | HDLRunSceneIntent *intent = [self getSceneIntent: model.userSceneId]; |
| | | HDLRunSceneIntent *intent = [self getSceneIntent: model.controlId]; |
| | | [cell initModel:model intent:intent]; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | #pragma mark - UITableViewDelegate |
| | | |
| | | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { |
| | | return 72; |
| | | return 50; |
| | | } |
| | | |
| | | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
| | | [tableView deselectRowAtIndexPath:indexPath animated:YES]; |
| | | |
| | | if (@available(iOS 12.0, *)) { |
| | | HDLSiriSceneModel *model = self.dataSource[indexPath.row]; |
| | | HDLSiriControlModel *model = [self getModelWithNSIndexPath:indexPath]; |
| | | if(model){ |
| | | INVoiceShortcut *voiceShortcut = [self getSceneINVoiceShortcut:model.userSceneId]; |
| | | INVoiceShortcut *voiceShortcut = [self getSceneINVoiceShortcut:model.controlId]; |
| | | [self addOrEditVoiceShortcut:voiceShortcut model:model]; |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /// 根据NSIndexPath 获取model |
| | | /// @param indexPath indexPath |
| | | -(HDLSiriControlModel *)getModelWithNSIndexPath:(NSIndexPath *)indexPath { |
| | | HDLSiriControlModel *model = nil; |
| | | HDLSiriShortcutModel *ssModel = self.dataSource[indexPath.section]; |
| | | if(ssModel && ssModel.list && (ssModel.list.count > indexPath.row)){ |
| | | model = ssModel.list[indexPath.row]; |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | /// 添加或者编辑快捷指令 |
| | | /// @param voiceShortcut 快捷指令 |
| | | /// @param model 场景 |
| | | -(void)addOrEditVoiceShortcut:(INVoiceShortcut *)voiceShortcut model:(HDLSiriSceneModel*)model API_AVAILABLE(ios(12.0)){ |
| | | -(void)addOrEditVoiceShortcut:(INVoiceShortcut *)voiceShortcut model:(HDLSiriControlModel*)model API_AVAILABLE(ios(12.0)){ |
| | | |
| | | if(voiceShortcut==nil){ |
| | | //1.如果不存在则添加 |
| | |
| | | } |
| | | |
| | | |
| | | - (INShortcut *) getINShortcut:(HDLSiriSceneModel*)model API_AVAILABLE(ios(12.0)){ |
| | | NSString *title = model.name; |
| | | - (INShortcut *) getINShortcut:(HDLSiriControlModel*)sceneModel API_AVAILABLE(ios(12.0)){ |
| | | NSString *title = sceneModel.controlName; |
| | | HDLRunSceneIntent *intent = [[HDLRunSceneIntent alloc] init]; |
| | | intent.sceneId = model.userSceneId; |
| | | intent.suggestedInvocationPhrase = title; //在Siri语音设置时显示的建议设置唤起文字 |
| | | intent.sceneName = title; |
| | | intent.controlId = sceneModel.controlId; |
| | | intent.controlName = title; |
| | | intent.homeId = self.homeId; |
| | | intent.controlType = sceneModel.controlType; |
| | | intent.controlJSONStr = sceneModel.controlJSONStr; |
| | | intent.actionName = sceneModel.actionName; |
| | | INShortcut *shortCut = [[INShortcut alloc] initWithIntent:intent]; |
| | | return shortCut; |
| | | } |
| | | |
| | | |
| | | /// 根据场景ID或者之前配置过低快捷指令 |
| | | /// @param sceneId 场景ID |
| | | - (HDLRunSceneIntent*)getSceneIntent:(NSString *)sceneId API_AVAILABLE(ios(12.0)){ |
| | | /// @param controlId 唯一标识ID |
| | | - (HDLRunSceneIntent*)getSceneIntent:(NSString *)controlId API_AVAILABLE(ios(12.0)){ |
| | | HDLRunSceneIntent *intentFind = nil; |
| | | for (INVoiceShortcut *voiceShortcut in self.siriShortcutList) { |
| | | HDLRunSceneIntent *intent = (HDLRunSceneIntent *)voiceShortcut.shortcut.intent; |
| | | if(intent){ |
| | | if([intent.sceneId isEqualToString:sceneId]){ |
| | | if([intent.controlId isEqualToString:controlId]){ |
| | | intentFind = intent; |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | /// 根据场景ID或者之前配置过低快捷指令 |
| | | /// @param sceneId 场景ID |
| | | - (INVoiceShortcut*)getSceneINVoiceShortcut:(NSString *)sceneId API_AVAILABLE(ios(12.0)){ |
| | | /// @param controlId 唯一标识ID |
| | | - (INVoiceShortcut*)getSceneINVoiceShortcut:(NSString *)controlId API_AVAILABLE(ios(12.0)){ |
| | | INVoiceShortcut *voiceShortcutFind = nil; |
| | | for (INVoiceShortcut *voiceShortcut in self.siriShortcutList) { |
| | | HDLRunSceneIntent *intent = (HDLRunSceneIntent *)voiceShortcut.shortcut.intent; |
| | | if(intent){ |
| | | if([intent.sceneId isEqualToString:sceneId]){ |
| | | if([intent.controlId isEqualToString:controlId]){ |
| | | voiceShortcutFind = voiceShortcut; |
| | | break; |
| | | } |
New file |
| | |
| | | // |
| | | // HDLSiriShortcutModel.h |
| | | // HDLSceneSiriDemo |
| | | // |
| | | // Created by 陈嘉乐 on 2021/11/29. |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | @class HDLSiriControlModel; |
| | | @class HDLSiriShortcutModel; |
| | | typedef NSArray<HDLSiriShortcutModel *> HDLSiriShortcutModelList; |
| | | |
| | | @interface HDLSiriShortcutModel : NSObject |
| | | @property (nonatomic, copy) NSString *title;//section Head 的标题 |
| | | @property (nonatomic, copy) NSString *content;//section 内容说明 |
| | | @property (nonatomic, copy) NSArray<HDLSiriControlModel *> *list;//row数据 |
| | | @end |
| | | |
| | | @interface HDLSiriControlModel : NSObject |
| | | @property (nonatomic, copy) NSString *controlName;//场景名、安防名等 |
| | | @property (nonatomic, copy) NSString *controlId;//场景ID,安防ID等唯一ID |
| | | @property (nonatomic, copy) NSString *controlType;//场景1,安防2 |
| | | @property (nonatomic, copy) NSString *controlJSONStr;//自定义对象JSONStr |
| | | @property (nonatomic, copy) NSString *actionName;//动作名称,"执行" |
| | | @end |
| | | |
| | | NS_ASSUME_NONNULL_END |
New file |
| | |
| | | // |
| | | // HDLSiriShortcutModel.m |
| | | // HDLSceneSiriDemo |
| | | // |
| | | // Created by 陈嘉乐 on 2021/11/29. |
| | | // |
| | | |
| | | #import "HDLSiriShortcutModel.h" |
| | | |
| | | @implementation HDLSiriShortcutModel |
| | | |
| | | @end |
| | | |
| | | @implementation HDLSiriControlModel |
| | | |
| | | @end |
| | |
| | | |
| | | - (UILabel *)titleLabel{ |
| | | if (!_titleLabel) { |
| | | _titleLabel = [self NewLabel:CGRectMake(40, APP_STATUS_BAR_HEIGHT, APP_SCREEN_WIDTH - 80, 44) font:Get_FontMediumWithSize(16) textColor:COLOR_TEXT text:@""]; |
| | | _titleLabel = [self NewLabel:CGRectMake(40, APP_STATUS_BAR_HEIGHT, APP_SCREEN_WIDTH - 80, 44) font:Get_FontWithSize(18) textColor:COLOR_TEXT text:@""]; |
| | | _titleLabel.textAlignment = NSTextAlignmentCenter; |
| | | } |
| | | return _titleLabel; |
| | |
| | | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| | | <plist version="1.0"> |
| | | <dict> |
| | | <key>NSUserActivityTypes</key> |
| | | <array> |
| | | <string>HDLRunSceneIntent</string> |
| | | </array> |
| | | <key>UIApplicationSceneManifest</key> |
| | | <dict> |
| | | <key>UIApplicationSupportsMultipleScenes</key> |
| | |
| | | </array> |
| | | </dict> |
| | | </dict> |
| | | <key>NSUserActivityTypes</key> |
| | | <array> |
| | | <string>HDLRunSceneIntent</string> |
| | | </array> |
| | | </dict> |
| | | </plist> |
| | |
| | | <key>INIntentDescriptionID</key> |
| | | <string>Pe02nj</string> |
| | | <key>INIntentLastParameterTag</key> |
| | | <integer>2</integer> |
| | | <integer>22</integer> |
| | | <key>INIntentName</key> |
| | | <string>HDLRunScene</string> |
| | | <key>INIntentParameterCombinations</key> |
| | | <dict> |
| | | <key>sceneName,sceneId</key> |
| | | <key>controlName,controlId,controlType,controlJSONStr,actionName,homeId</key> |
| | | <dict> |
| | | <key>INIntentParameterCombinationIsPrimary</key> |
| | | <true/> |
| | | <key>INIntentParameterCombinationSupportsBackgroundExecution</key> |
| | | <true/> |
| | | <key>INIntentParameterCombinationTitle</key> |
| | | <string>执行场景“${sceneName}”</string> |
| | | <string>${actionName}“${controlName}”</string> |
| | | <key>INIntentParameterCombinationTitleID</key> |
| | | <string>oCGdw4</string> |
| | | <string>3GPMaH</string> |
| | | </dict> |
| | | </dict> |
| | | <key>INIntentParameters</key> |
| | | <array> |
| | | <dict> |
| | | <key>INIntentParameterDisplayName</key> |
| | | <string>Scene Name</string> |
| | | <string>Control Name</string> |
| | | <key>INIntentParameterDisplayNameID</key> |
| | | <string>wC0SgK</string> |
| | | <key>INIntentParameterDisplayPriority</key> |
| | |
| | | <string>xz2KkJ</string> |
| | | </dict> |
| | | <key>INIntentParameterName</key> |
| | | <string>sceneName</string> |
| | | <string>controlName</string> |
| | | <key>INIntentParameterTag</key> |
| | | <integer>1</integer> |
| | | <key>INIntentParameterType</key> |
| | |
| | | </dict> |
| | | <dict> |
| | | <key>INIntentParameterDisplayName</key> |
| | | <string>Scene Id</string> |
| | | <string>Control Id</string> |
| | | <key>INIntentParameterDisplayNameID</key> |
| | | <string>MtgGtd</string> |
| | | <key>INIntentParameterDisplayPriority</key> |
| | |
| | | <string>hQHCm1</string> |
| | | </dict> |
| | | <key>INIntentParameterName</key> |
| | | <string>sceneId</string> |
| | | <string>controlId</string> |
| | | <key>INIntentParameterTag</key> |
| | | <integer>2</integer> |
| | | <key>INIntentParameterType</key> |
| | | <string>String</string> |
| | | </dict> |
| | | <dict> |
| | | <key>INIntentParameterDisplayName</key> |
| | | <string>Home Id</string> |
| | | <key>INIntentParameterDisplayNameID</key> |
| | | <string>Re9KKp</string> |
| | | <key>INIntentParameterDisplayPriority</key> |
| | | <integer>3</integer> |
| | | <key>INIntentParameterMetadata</key> |
| | | <dict> |
| | | <key>INIntentParameterMetadataCapitalization</key> |
| | | <string>Sentences</string> |
| | | <key>INIntentParameterMetadataDefaultValueID</key> |
| | | <string>mQMSns</string> |
| | | </dict> |
| | | <key>INIntentParameterName</key> |
| | | <string>homeId</string> |
| | | <key>INIntentParameterTag</key> |
| | | <integer>12</integer> |
| | | <key>INIntentParameterType</key> |
| | | <string>String</string> |
| | | </dict> |
| | | <dict> |
| | | <key>INIntentParameterDisplayName</key> |
| | | <string>Control Type</string> |
| | | <key>INIntentParameterDisplayNameID</key> |
| | | <string>TBoK4E</string> |
| | | <key>INIntentParameterDisplayPriority</key> |
| | | <integer>4</integer> |
| | | <key>INIntentParameterMetadata</key> |
| | | <dict> |
| | | <key>INIntentParameterMetadataCapitalization</key> |
| | | <string>Sentences</string> |
| | | <key>INIntentParameterMetadataDefaultValueID</key> |
| | | <string>Yg2EJK</string> |
| | | </dict> |
| | | <key>INIntentParameterName</key> |
| | | <string>controlType</string> |
| | | <key>INIntentParameterTag</key> |
| | | <integer>14</integer> |
| | | <key>INIntentParameterType</key> |
| | | <string>String</string> |
| | | </dict> |
| | | <dict> |
| | | <key>INIntentParameterDisplayName</key> |
| | | <string>Control JSON Str</string> |
| | | <key>INIntentParameterDisplayNameID</key> |
| | | <string>WYEDs9</string> |
| | | <key>INIntentParameterDisplayPriority</key> |
| | | <integer>5</integer> |
| | | <key>INIntentParameterMetadata</key> |
| | | <dict> |
| | | <key>INIntentParameterMetadataCapitalization</key> |
| | | <string>Sentences</string> |
| | | <key>INIntentParameterMetadataDefaultValueID</key> |
| | | <string>WXdhpn</string> |
| | | </dict> |
| | | <key>INIntentParameterName</key> |
| | | <string>controlJSONStr</string> |
| | | <key>INIntentParameterTag</key> |
| | | <integer>21</integer> |
| | | <key>INIntentParameterType</key> |
| | | <string>String</string> |
| | | </dict> |
| | | <dict> |
| | | <key>INIntentParameterDisplayName</key> |
| | | <string>Action Name</string> |
| | | <key>INIntentParameterDisplayNameID</key> |
| | | <string>sB0JdL</string> |
| | | <key>INIntentParameterDisplayPriority</key> |
| | | <integer>6</integer> |
| | | <key>INIntentParameterMetadata</key> |
| | | <dict> |
| | | <key>INIntentParameterMetadataCapitalization</key> |
| | | <string>Sentences</string> |
| | | <key>INIntentParameterMetadataDefaultValueID</key> |
| | | <string>nGpmbm</string> |
| | | </dict> |
| | | <key>INIntentParameterName</key> |
| | | <string>actionName</string> |
| | | <key>INIntentParameterTag</key> |
| | | <integer>22</integer> |
| | | <key>INIntentParameterType</key> |
| | | <string>String</string> |
| | | </dict> |
| | |
| | | <array> |
| | | <dict> |
| | | <key>INIntentResponseCodeFormatString</key> |
| | | <string>${sceneName}</string> |
| | | <string>${controlName}</string> |
| | | <key>INIntentResponseCodeFormatStringID</key> |
| | | <string>Pq8YBC</string> |
| | | <key>INIntentResponseCodeName</key> |
| | |
| | | </dict> |
| | | <dict> |
| | | <key>INIntentResponseParameterDisplayName</key> |
| | | <string>Scene Name</string> |
| | | <string>Control Name</string> |
| | | <key>INIntentResponseParameterDisplayNameID</key> |
| | | <string>pqg7cb</string> |
| | | <key>INIntentResponseParameterDisplayPriority</key> |
| | | <integer>3</integer> |
| | | <key>INIntentResponseParameterName</key> |
| | | <string>sceneName</string> |
| | | <string>controlName</string> |
| | | <key>INIntentResponseParameterTag</key> |
| | | <integer>3</integer> |
| | | <key>INIntentResponseParameterType</key> |
| | |
| | | |
| | | #import "ViewController.h" |
| | | #import "HDLSiriSceneListViewController.h" |
| | | #import "HDLSiriSceneModel.h" |
| | | #import "HDLSiriShortcutModel.h" |
| | | |
| | | @interface ViewController () |
| | | |
| | |
| | | } |
| | | |
| | | -(void)gotoSiriSceneListViewController{ |
| | | |
| | | |
| | | NSMutableArray *dataList = [NSMutableArray new]; |
| | | //1.场景 |
| | | HDLSiriShortcutModel *sceneModel = [[HDLSiriShortcutModel alloc] init]; |
| | | sceneModel.title = @"场景"; |
| | | sceneModel.content = @"将场景添加到Siri捷径,即可通过Siri语音执行"; |
| | | NSMutableArray *list = [NSMutableArray new]; |
| | | for(int i = 0; i<10; i++){ |
| | | HDLSiriSceneModel *model = [[HDLSiriSceneModel alloc] init]; |
| | | model.name = [NSString stringWithFormat:@"回家模式%d",i]; |
| | | model.userSceneId = [NSString stringWithFormat:@"userSceneId%d",i]; |
| | | HDLSiriControlModel *model = [[HDLSiriControlModel alloc] init]; |
| | | model.controlType = @"1"; |
| | | model.controlName = [NSString stringWithFormat:@"回家模式%d",i]; |
| | | model.controlId = [NSString stringWithFormat:@"userSceneId%d",i]; |
| | | model.actionName = @"执行场景"; |
| | | model.controlJSONStr = @"2"; |
| | | [list addObject:model]; |
| | | } |
| | | sceneModel.list = [NSArray arrayWithArray:list]; |
| | | [dataList addObject:sceneModel]; |
| | | |
| | | //2.安防 |
| | | HDLSiriShortcutModel *securityModel = [[HDLSiriShortcutModel alloc] init]; |
| | | securityModel.title = @"安防"; |
| | | securityModel.content =@"将安防添加到Siri捷径,即可通过Siri语音执行"; |
| | | NSMutableArray *list2 = [NSMutableArray new]; |
| | | for(int i = 0; i<10; i++){ |
| | | HDLSiriControlModel *model = [[HDLSiriControlModel alloc] init]; |
| | | model.controlType = @"2"; |
| | | model.controlName = [NSString stringWithFormat:@"外出布防%d",i]; |
| | | model.controlId = [NSString stringWithFormat:@"usecurityId%d",i]; |
| | | model.actionName = @"执行安防"; |
| | | model.controlJSONStr = @"{\"userSecurityId\":\"111111111\",\"gatewayId\":\"2222222\",\"sid\":\"333333\",\"status\":\"enable\"}"; |
| | | // model.sid = [NSString stringWithFormat:@"securityId%d",i]; |
| | | [list2 addObject:model]; |
| | | } |
| | | securityModel.list = [NSArray arrayWithArray:list2]; |
| | | [dataList addObject:securityModel]; |
| | | |
| | | |
| | | |
| | | HDLSiriSceneListViewController *vc = [[HDLSiriSceneListViewController alloc] init]; |
| | | vc.dataSource = list; |
| | | vc.dataSource = dataList; |
| | | vc.homeId = @"000000"; |
| | | [self.navigationController pushViewController:vc animated:YES]; |
| | | |
| | | } |
| | |
| | | |
| | | namespace HDLSceneSiri |
| | | { |
| | | |
| | | // @interface HDLSiriSceneListViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> |
| | | [BaseType(typeof(UIViewController))] |
| | | interface HDLSiriSceneListViewController : IUITableViewDataSource, IUITableViewDelegate |
| | | { |
| | | // @property (assign, nonatomic) UITableViewStyle tableViewStyle; |
| | | [Export("tableViewStyle", ArgumentSemantic.Assign)] |
| | | UITableViewStyle TableViewStyle { get; set; } |
| | | |
| | | // @property (nonatomic, strong) UITableView * _Nonnull tableView; |
| | | [Export("tableView", ArgumentSemantic.Strong)] |
| | | UITableView TableView { get; set; } |
| | | |
| | | [Wrap("WeakDataSource")] |
| | | NSMutableArray DataSource { get; set; } |
| | | |
| | | // @property (nonatomic, strong) NSMutableArray * _Nonnull dataSource; |
| | | [NullAllowed, Export("dataSource", ArgumentSemantic.Strong)] |
| | | NSObject WeakDataSource { get; set; } |
| | | |
| | | // @property (nonatomic, strong) NSString * _Nonnull titleName; |
| | | [Export("titleName", ArgumentSemantic.Strong)] |
| | | string TitleName { get; set; } |
| | | } |
| | | |
| | | // @interface HDLSiriSceneModel : NSObject |
| | | [BaseType(typeof(NSObject))] |
| | | interface HDLSiriSceneModel |
| | | { |
| | | // @property (copy, nonatomic) NSString * _Nonnull userSceneId; |
| | | [Export("userSceneId")] |
| | | string UserSceneId { get; set; } |
| | | |
| | | // @property (copy, nonatomic) NSString * _Nonnull name; |
| | | [Export("name")] |
| | | string Name { get; set; } |
| | | } |
| | | |
| | | // @interface HDLRunSceneIntent : INIntent |
| | | //[Watch(5, 0), NoTV, Mac(11, 0), iOS(12, 0)] |
| | | [BaseType(typeof(INIntent))] |
| | | interface HDLRunSceneIntent |
| | | { |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable sceneName; |
| | | [NullAllowed, Export("sceneName")] |
| | | string SceneName { get; set; } |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable controlName; |
| | | [NullAllowed, Export("controlName")] |
| | | string ControlName { get; set; } |
| | | |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable sceneId; |
| | | [NullAllowed, Export("sceneId")] |
| | | string SceneId { get; set; } |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable controlId; |
| | | [NullAllowed, Export("controlId")] |
| | | string ControlId { get; set; } |
| | | |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable homeId; |
| | | [NullAllowed, Export("homeId")] |
| | | string HomeId { get; set; } |
| | | |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable controlType; |
| | | [NullAllowed, Export("controlType")] |
| | | string ControlType { get; set; } |
| | | |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable controlJSONStr; |
| | | [NullAllowed, Export("controlJSONStr")] |
| | | string ControlJSONStr { get; set; } |
| | | |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable actionName; |
| | | [NullAllowed, Export("actionName")] |
| | | string ActionName { get; set; } |
| | | } |
| | | |
| | | // @protocol HDLRunSceneIntentHandling <NSObject> |
| | |
| | | protocol, then [Model] is redundant and will generate code that will never |
| | | be used. |
| | | */ |
| | | |
| | | //[Watch(5, 0), NoTV, Mac(11, 0), iOS(12, 0)] |
| | | //[Protocol] |
| | | [Protocol, Model] |
| | | [BaseType(typeof(NSObject))] |
| | | [Protocol, Model] |
| | | [BaseType(typeof(NSObject))] |
| | | interface HDLRunSceneIntentHandling |
| | | { |
| | | // @required -(void)handleHDLRunScene:(HDLRunSceneIntent * _Nonnull)intent completion:(void (^ _Nonnull)(HDLRunSceneIntentResponse * _Nonnull))completion __attribute__((swift_name("handle(intent:completion:)"))); |
| | |
| | | [DesignatedInitializer] |
| | | IntPtr Constructor(HDLRunSceneIntentResponseCode code, [NullAllowed] NSUserActivity userActivity); |
| | | |
| | | // +(instancetype _Nonnull)successIntentResponseWithSceneName:(NSString * _Nonnull)sceneName __attribute__((swift_name("success(sceneName:)"))); |
| | | // +(instancetype _Nonnull)successIntentResponseWithControlName:(NSString * _Nonnull)controlName __attribute__((swift_name("success(controlName:)"))); |
| | | [Static] |
| | | [Export("successIntentResponseWithSceneName:")] |
| | | HDLRunSceneIntentResponse SuccessIntentResponseWithSceneName(string sceneName); |
| | | [Export("successIntentResponseWithControlName:")] |
| | | HDLRunSceneIntentResponse SuccessIntentResponseWithControlName(string controlName); |
| | | |
| | | // +(instancetype _Nonnull)failureIntentResponseWithErrorMessage:(NSString * _Nonnull)errorMessage __attribute__((swift_name("failure(errorMessage:)"))); |
| | | [Static] |
| | |
| | | [NullAllowed, Export("successMessage")] |
| | | string SuccessMessage { get; set; } |
| | | |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable sceneName; |
| | | [NullAllowed, Export("sceneName")] |
| | | string SceneName { get; set; } |
| | | // @property (readwrite, copy, nonatomic) NSString * _Nullable controlName; |
| | | [NullAllowed, Export("controlName")] |
| | | string ControlName { get; set; } |
| | | |
| | | // @property (readonly, nonatomic) HDLRunSceneIntentResponseCode code; |
| | | [Export("code")] |
| | | HDLRunSceneIntentResponseCode Code { get; } |
| | | } |
| | | |
| | | // @interface HDLSiriShortcutModel : NSObject |
| | | [BaseType(typeof(NSObject))] |
| | | interface HDLSiriShortcutModel |
| | | { |
| | | // @property (copy, nonatomic) NSString * _Nonnull title; |
| | | [Export("title")] |
| | | string Title { get; set; } |
| | | |
| | | // @property (copy, nonatomic) NSString * _Nonnull content; |
| | | [Export("content")] |
| | | string Content { get; set; } |
| | | |
| | | // @property (copy, nonatomic) NSArray<HDLSiriControlModel *> * _Nonnull list; |
| | | [Export("list", ArgumentSemantic.Copy)] |
| | | HDLSiriControlModel[] List { get; set; } |
| | | } |
| | | |
| | | // @interface HDLSiriControlModel : NSObject |
| | | [BaseType(typeof(NSObject))] |
| | | interface HDLSiriControlModel |
| | | { |
| | | // @property (copy, nonatomic) NSString * _Nonnull controlName; |
| | | [Export("controlName")] |
| | | string ControlName { get; set; } |
| | | |
| | | // @property (copy, nonatomic) NSString * _Nonnull controlId; |
| | | [Export("controlId")] |
| | | string ControlId { get; set; } |
| | | |
| | | // @property (copy, nonatomic) NSString * _Nonnull controlType; |
| | | [Export("controlType")] |
| | | string ControlType { get; set; } |
| | | |
| | | // @property (copy, nonatomic) NSString * _Nonnull controlJSONStr; |
| | | [Export("controlJSONStr")] |
| | | string ControlJSONStr { get; set; } |
| | | |
| | | // @property (copy, nonatomic) NSString * _Nonnull actionName; |
| | | [Export("actionName")] |
| | | string ActionName { get; set; } |
| | | } |
| | | |
| | | // @interface HDLSiriSceneListViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> |
| | | [BaseType(typeof(UIViewController))] |
| | | interface HDLSiriSceneListViewController : IUITableViewDataSource, IUITableViewDelegate |
| | | { |
| | | // @property (assign, nonatomic) UITableViewStyle tableViewStyle; |
| | | [Export("tableViewStyle", ArgumentSemantic.Assign)] |
| | | UITableViewStyle TableViewStyle { get; set; } |
| | | |
| | | // @property (nonatomic, strong) UITableView * _Nonnull tableView; |
| | | [Export("tableView", ArgumentSemantic.Strong)] |
| | | UITableView TableView { get; set; } |
| | | |
| | | [Wrap("WeakDataSource")] |
| | | NSMutableArray DataSource { get; set; } |
| | | |
| | | // @property (nonatomic, strong) NSMutableArray * _Nonnull dataSource; |
| | | [NullAllowed, Export("dataSource", ArgumentSemantic.Strong)] |
| | | NSObject WeakDataSource { get; set; } |
| | | |
| | | // @property (nonatomic, strong) NSString * _Nonnull titleName; |
| | | [Export("titleName", ArgumentSemantic.Strong)] |
| | | string TitleName { get; set; } |
| | | |
| | | // @property (nonatomic, strong) NSString * _Nonnull homeId; |
| | | [Export("homeId", ArgumentSemantic.Strong)] |
| | | string HomeId { get; set; } |
| | | } |
| | | } |
| | |
| | | // The form "{Major}.{Minor}.*" will automatically update the build and revision, |
| | | // and "{Major}.{Minor}.{Build}.*" will update just the revision. |
| | | |
| | | [assembly: AssemblyVersion("1.0.2")] |
| | | [assembly: AssemblyVersion("1.1.0")] |
| | | |
| | | // The following attributes are used to specify the signing key for the assembly, |
| | | // if desired. See the Mono documentation for more information about signing. |