This repository has been archived by the owner on Jul 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
AEExtension.h
133 lines (116 loc) · 5.08 KB
/
AEExtension.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//
// AEExtension.h
// AssistantExtensions
//
// Created by Kexik on 12/26/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#pragma once
#import <Foundation/Foundation.h>
#import "SiriObjects.h"
#import "SiriObjects_private.h"
#import "AEContext.h"
#import "AEX.h"
/// A class represention one AE extension with some static methods for common tasks with extension registry
@interface AEExtension : NSObject<SESystem> {
@private
BOOL _initialized;
id<SEExtension> _principal;
NSBundle* _bundle;
NSString* _name;
NSString* _displayName;
NSString* _author;
NSString* _web;
NSString* _version;
NSString* _desc;
NSString* _ident;
BOOL _hasPreferences;
NSString* _preferenceBundle;
NSMutableArray* _commands; // array of NSObject<SECommand>*
NSMutableArray* _snippets; // array of NSString class names
BOOL _respondsToServerToClient; // handles that method
BOOL _respondsToClientToServer; // handles that method
NSSet* _serverToClientFilter;
NSSet* _clientToServerFilter;
NSString* _currLang;
NSString* _currLangDir;
NSDictionary* _currLangDict;
NSObject<SECommand>* _nextCommand; // if this extension requested "listen after speaking", here is the command instance which needs to be called after the speech is recognized next time.
AEPattern* _nextPattern; // the same as _nextCommand but stores the pattern in which "listen after speaking" was requested
NSMutableArray* _patterns;
id<SECommand> _commandForCurrentPatternRegistrations; // an instance of SECommand for which user will call registerPattern* methods
NSDictionary* _patternsPlist; // dictionary holding Patterns.plist
}
+(id)findExtensionNamed:(NSString*)name;
+(BOOL)initExtensions;
+(void)reloadExtensions;
+(void)shutdownExtensions;
+(void)switchToLanguage:(NSString*)lang;
+(NSArray*)allExtensionsNames;
+(NSArray*)allExtensions;
+(id)extensionWithName:(NSString*)name;
-(id)initWithName:(NSString*)name;
-(NSString*)name;
-(NSString*)displayName;
-(NSString*)author;
-(NSString*)website;
-(NSString*)description;
-(NSString*)version;
-(BOOL)hasPreferenceBundle;
-(NSString*)preferenceBundle;
-(BOOL)enabled;
-(NSString*)iconPath;
-(NSString*)identifier;
-(NSString*)pathToInfoDictionary;
//-(id<SOExtension>)principalObject;
-(NSObject<SECommand>*)handleSpeech:(NSString*)text tokens:(NSArray*)tokens tokenSet:(NSSet*)tokenset context:(AEContext*)ctx;
-(NSObject<SESnippet>*)allocSnippet:(NSString*)snippetClass properties:(NSDictionary *)props; // can return nil
-(BOOL)handlesServerToClientClass:(NSString*)className;
-(BOOL)handlesClientToServerClass:(NSString*)className;
-(NSDictionary*)serverToClient:(NSDictionary*)input context:(AEContext*)ctx;
-(NSDictionary*)clientToServer:(NSDictionary*)input context:(AEContext*)ctx;
-(void)callAssistantDismissed;
-(void)callAssistantActivated;
-(void)languageChangedTo:(NSString*)lang;
// public methods (SESystem) --------------------------------------------------
-(BOOL)setServerToClientFilter:(NSArray*)allowedClasses;
-(BOOL)setClientToServerFilter:(NSArray*)allowedClasses;
-(BOOL)registerCommand:(Class)cls;
-(BOOL)registerSnippet:(Class)cls;
-(NSString*)systemVersion;
-(NSString*)localizedString:(NSString*)text; //SINCE 1.0.2
-(NSString*)localizedString:(NSString*)text inLanguage:(NSString*)lang; //SINCE 1.0.2
-(BOOL)registerPattern:(NSString*)pattern target:(id)target selector:(SEL)sel userInfo:(id)user; //SINCE 1.0.2
-(BOOL)registerPattern:(NSString*)pattern target:(id)target selector:(SEL)sel; //SINCE 1.0.2
-(BOOL)registerPattern:(NSString*)pattern selector:(SEL)sel userInfo:(id)user; //SINCE 1.0.2
-(BOOL)registerPattern:(NSString*)pattern selector:(SEL)sel; //SINCE 1.0.2
-(BOOL)registerPattern:(NSString*)pattern userInfo:(id)user; //SINCE 1.0.2
-(BOOL)registerPattern:(NSString*)pattern; //SINCE 1.0.2
-(BOOL)registerNamedPattern:(NSString*)name target:(id)target selector:(SEL)sel userInfo:(id)user; //SINCE 1.0.2
-(BOOL)registerNamedPattern:(NSString*)name target:(id)target selector:(SEL)sel; //SINCE 1.0.2
-(BOOL)registerNamedPattern:(NSString*)name selector:(SEL)sel userInfo:(id)user; //SINCE 1.0.2
-(BOOL)registerNamedPattern:(NSString*)name selector:(SEL)sel; //SINCE 1.0.2
-(BOOL)registerNamedPattern:(NSString*)name userInfo:(id)user; //SINCE 1.0.2
-(BOOL)registerNamedPattern:(NSString*)name; //SINCE 1.0.2
-(NSDictionary*)patternsPlist;
@end
BOOL HandleSpeechExtensions(NSString* refId, NSString* text, NSArray* tokens, NSSet* tokenset);
void AEExtensionBeginExclusive(NSObject<SECommand>* ex);
void AEExtensionEndExclusive();
void RequestCompleted();
#pragma mark - UNIVERSAL SIRI SNIPPET ---------------------------------------------------------------------------------
// Used as a proxy between user-supplied snippet from an extension and Assistant implementation
@interface SAK3AExtensionSnippet : SAUISnippet {
@private
}
- (id)encodedClassName;
- (id)groupIdentifier;
@end
@interface K3AExtensionSnippetController : AFUISnippetController {
UIView* _view;
NSObject<SESnippet>* _snip;
}
- (id)view;
- (void)dealloc;
- (id)initWithAceObject:(id)ace delegate:(id)dlg;
@end