1.0 Release

This commit is contained in:
ZaidElkurdi 2015-04-05 00:03:50 -07:00
parent 96d55d818f
commit ae6daf45b4
165 changed files with 2960 additions and 862 deletions

View File

@ -0,0 +1 @@
2

View File

@ -14,4 +14,7 @@
<FileRef
location = "group:Makefile">
</FileRef>
<FileRef
location = "group:assistantplus_root_helper/assistantplus_root_helper.xcodeproj">
</FileRef>
</Workspace>

View File

@ -25,9 +25,11 @@ static BOOL hasLoadedSnippets = NO;
BOOL shouldHandleRequest(NSString *text, APSession *currSession) {
pluginManager = [[%c(APSpringboardUtils) sharedAPUtils] getPluginManager];
NSLog(@"Manager: %@", pluginManager);
NSSet *tokens = [NSSet setWithArray:[text componentsSeparatedByString: @" "]];
return [pluginManager handleCommand:text withTokens:tokens withSession:currSession];
NSArray *lowerCaseArr = [[text componentsSeparatedByString: @" "] valueForKey:@"lowercaseString"];
NSSet *tokens = [NSSet setWithArray:lowerCaseArr];
BOOL pluginWillHandle = [pluginManager handleCommand:text withTokens:tokens withSession:currSession];
defaultHandling = !pluginWillHandle;
return pluginWillHandle;
}
%hook BasicAceContext
@ -43,13 +45,6 @@ BOOL shouldHandleRequest(NSString *text, APSession *currSession) {
%end
%hook SiriUISnippetViewController
-(void)setSnippet:(id)arg1 {
%log;
%orig;
}
%end
%hook SiriUIPluginManager
- (id)transcriptItemForObject:(AceObject*)arg1 {
@ -60,11 +55,8 @@ BOOL shouldHandleRequest(NSString *text, APSession *currSession) {
if (properties) {
NSString *className = properties[@"snippetClass"];
if (className) {
NSLog(@"AP: Looking for custom snippet: %@", className);
NSLog(@"Attempt to get: %@", NSClassFromString(className));
id<APPluginSnippet> customClass = [[NSClassFromString(className) alloc] initWithProperties:properties[@"snippetProps"]];
if ([customClass respondsToSelector:@selector(view)]) {
NSLog(@"Custom class: %@", customClass);
UIViewController *customVC = (UIViewController*)customClass;
SiriUISnippetViewController *vc = [[%c(SiriUISnippetViewController) alloc] init];
object_setClass(vc, [%c(APPluginSnippetViewController) class]);
@ -97,20 +89,18 @@ BOOL shouldHandleRequest(NSString *text, APSession *currSession) {
options:NSDirectoryEnumerationSkipsHiddenFiles
error:nil];
NSLog(@"SiriUIPluginManager: Plugins:");
for (NSURL *fileURL in contents) {
NSString *name = [[[fileURL absoluteString] lastPathComponent] stringByDeletingPathExtension];
NSLog(@"Loading %@ at %@", name, fileURL);
NSBundle *bundle = [NSBundle bundleWithURL:fileURL];
if (!bundle) {
NSLog(@"Failed to open extension bundle %@ (%@)!", fileURL, fileURL);
NSLog(@"Failed to open plugin bundle %@ (%@)!", fileURL, fileURL);
continue;
}
if (![bundle load]) {
NSLog(@"Failed to load extension bundle %@ (wrong CFBundleExecutable? Missing? Not signed?)!", name);
NSLog(@"Failed to load plugin bundle %@!", name);
continue;
} else {
NSLog(@"Loaded bundle!");
@ -121,14 +111,6 @@ BOOL shouldHandleRequest(NSString *text, APSession *currSession) {
%end
%hook AFConnection
- (void)_doCommand:(SAUIAddViews*)arg1 reply:(id)arg2 {
NSLog(@"Doing: %@ with reply: %@", arg1, arg2);
if ([arg1 respondsToSelector:@selector(views)]) {
NSLog(@"Views: %@", arg1.views);
}
%log;
%orig;
}
- (void)startRequestWithCorrectedText:(NSString*)text forSpeechIdentifier:(id)arg2 {
NSLog(@"AP: Starting request with corrected text: %@", text);
@ -140,17 +122,6 @@ BOOL shouldHandleRequest(NSString *text, APSession *currSession) {
}
}
- (void)startAcousticIDRequestWithOptions:(id)arg1 { %log; %orig; }
- (void)startSpeechPronunciationRequestWithOptions:(id)arg1 pronunciationContext:(id)arg2 { %log; %orig; }
- (void)startSpeechRequestWithOptions:(id)arg1 {
NSLog(@"%@", arg1);
%log;
%orig;
}
- (void)startContinuationRequestWithUserInfo:(id)arg1 { %log; %orig; }
- (void)startDirectActionRequestWithString:(id)arg1 { %log; %orig; }
- (void)startRequestWithText:(NSString*)text {
NSLog(@"AP: Starting request with text: %@", text);
APSession *currSession = [APSession sessionWithConnection:self];
@ -164,28 +135,6 @@ BOOL shouldHandleRequest(NSString *text, APSession *currSession) {
%end
%hook AFUISiriSession
- (void)_requestContextWithCompletion:(id)arg1 {
NSLog(@"%@", arg1);
%log;
%orig;
}
- (void)_requestDidFinishWithError:(id)arg1 {
NSLog(@"%@", arg1);
%log;
%orig;
}
- (void)assistantConnectionRequestFinished:(id)arg1 {
NSLog(@"%@", arg1);
%log;
%orig;
}
- (void)end {
%log;
%orig;
}
%end
%hook AFConnectionClientServiceDelegate
- (void)speechRecognized:(SASSpeechRecognized*)arg1 {
@ -194,8 +143,9 @@ BOOL shouldHandleRequest(NSString *text, APSession *currSession) {
if (currPhrase.interpretations.count > 0) {
SASInterpretation *currInterpretation = currPhrase.interpretations[0];
if (currInterpretation.tokens.count > 0) {
AFSpeechToken *currToken = currInterpretation.tokens[0];
[phraseBuilder appendString:[NSString stringWithFormat:@"%@ ", currToken.text]];
for (AFSpeechToken *currToken in currInterpretation.tokens) {
[phraseBuilder appendString:[NSString stringWithFormat:@"%@ ", currToken.text]];
}
}
}
}
@ -203,23 +153,21 @@ BOOL shouldHandleRequest(NSString *text, APSession *currSession) {
NSLog(@"AP Starting Speech Query: %@", phraseBuilder);
AFConnection *connection = MSHookIvar<AFConnection*>(self, "_connection");
APSession *currSession = [APSession sessionWithConnection:connection];
if (shouldHandleRequest(phraseBuilder, currSession)) {
defaultHandling = NO;
NSLog(@"Handling with plugin!");
[connection cancelRequest];
[self requestDidFinish];
} else {
defaultHandling = YES;
NSLog(@"Going to default!");
%orig;
}
}
- (void)requestDidFinish{ %log; %orig; }
- (void)requestDidReceiveCommand:(id)arg1 reply:(CDUnknownBlockType*)arg2 {
%log;
if (defaultHandling) {
NSLog(@"Allowing default!");
%orig;
} else {
NSLog(@"Overriding!");
}
}
%end

View File

@ -2,7 +2,8 @@ include theos/makefiles/common.mk
export ARCHS = armv7s arm64
export TARGET = iphone:clang:latest:8.0
export SDKVERSION=8.2
export TARGET_IPHONEOS_DEPLOYMENT_VERSION = 8.0
export SDKVERSION=8.1
TWEAK_NAME = Assistant+
@ -15,11 +16,16 @@ Assistant+_CFLAGS = -fobjc-arc
include $(THEOS_MAKE_PATH)/tweak.mk
after-stage::
chmod u+s $(THEOS_STAGING_DIR)/Applications/AssistantPlusApp.app/assistantplus_root_helper
after-install::
install.exec "killall -9 SpringBoard"
SUBPROJECTS += assistantpluspluginmanager
SUBPROJECTS += aplocationdaemon
SUBPROJECTS += assistantplusapp
SUBPROJECTS += assistantplus_root_helper
SUBPROJECTS += customreply
include $(THEOS_MAKE_PATH)/aggregate.mk

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -4,8 +4,6 @@
<dict>
<key>CFBundleDisplayName</key>
<string>Assistant+</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleSupportedPlatforms</key>
@ -23,7 +21,7 @@
<string>1</string>
</array>
<key>LSRequiresIPhoneOS</key>
<false/>
<true/>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
@ -34,27 +32,25 @@
<string>8.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<string>false</string>
</dict>
</dict>
<key>UIStatusBarHidden</key>
<true/>
<key>UILaunchImageFile</key>
<string>Default.png</string>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>UILaunchImages</key>
<array>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default</string>
<string>Default-568h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{640, 1136}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>Default-700</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -62,19 +58,9 @@
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>Default</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{320, 480}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-568h</string>
<string>Default-700-568h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -84,17 +70,7 @@
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-568h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{320, 568}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<string>Default-800-667h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -104,17 +80,7 @@
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{375, 667}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<string>Default-800-Portrait-736h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -124,35 +90,13 @@
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<string>Default-800-Landscape-736h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{414, 736}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-Portrait</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{768, 1024}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-Landscape</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{768, 1024}</string>
</dict>
</array>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>CustomReply</string>
<key>APPluginName</key>
<string>Custom Replies</string>
<key>APPluginAuthor</key>
<string>Zaid Elkurdi</string>
<key>CFBundleIdentifier</key>
<string>com.assistantplus.customreplyidentifier</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleDisplayName</key>
<string>CustomReply</string>
<key>MinimumOSVersion</key>
<string>5.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>AppBundleID</key>
<string>com.assistantplus.customreplyidentifier</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>NSPrincipalClass</key>
<string>customreply</string>
</dict>
</plist>

View File

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>RunAtLoad</key>

View File

@ -1,10 +1,11 @@
Package: com.zaid.assistant+
Name: Assistant+
Depends: mobilesubstrate
Depends: libactivator (>= 1.8.3), mobilesubstrate
Architecture: iphoneos-arm
Description: Framework for Siri Extensions
Description: Assign commands to trigger Activator events from Siri, set up custom replies for Siri, and also use and create plugins for Siri using the Assistant+ plugin framework
Maintainer: Zaid Elkurdi
Author: Zaid Elkurdi
Section: Tweaks
Version: 0.0.1-604
Installed-Size: 792
Icon: file:///Applications/AssistantPlusApp.app/Icon.png
Version: 1.0.0-2
Installed-Size: 1120

View File

@ -1,6 +1,11 @@
#!/bin/sh
chown root:wheel /Library/LaunchDaemons/com.zaid.aplocationdaemon.plist
launchctl unload /Library/LaunchDaemons/com.zaid.aplocationdaemon.plist
launchctl unload /Library/LaunchDaemons/com.zaid.aplocationdaemon.plist 2> /dev/null
launchctl load /Library/LaunchDaemons/com.zaid.aplocationdaemon.plist
echo "Starting APLocationManger..."
exit 0
chown root:wheel /Applications/AssistantPlusApp.app/assistantplus_root_helper
chmod 6755 /Applications/AssistantPlusApp.app/assistantplus_root_helper
uicache
exit 0

View File

@ -1,5 +0,0 @@
#!/bin/sh
echo "Installing APLocationManager!"
chown root:wheel /Library/LaunchDaemons/com.zaid.aplocationdaemon.plist
launchctl unload /Library/LaunchDaemons/com.zaid.aplocationdaemon.plist
exit 0

View File

@ -19,9 +19,6 @@
<FileRef
location = "group:../layout/debian/postinst">
</FileRef>
<FileRef
location = "group:../layout/debian/preinst">
</FileRef>
<FileRef
location = "group:../layout/debian/prerm">
</FileRef>

View File

@ -9,7 +9,6 @@
#import "CPDistributedMessagingCenter.h"
@interface APLocationManager : NSObject <CLLocationManagerDelegate>
@property (nonatomic) BOOL shouldTerminate;
- (void)startMonitoringLocation;
- (void)stopMonitoringLocation;

View File

@ -22,20 +22,16 @@
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.shouldTerminate = NO;
}
return self;
}
- (void)startMonitoringLocation {
NSLog(@"Start monitoring!");
[locationManager startUpdatingLocation];
}
- (void)stopMonitoringLocation {
NSLog(@"Stop monitoring!");
[locationManager stopUpdatingLocation];
}
#pragma mark - CLLocationManagerDelegate
@ -54,7 +50,6 @@
@"timestamp" : currLocation.timestamp};
CPDistributedMessagingCenter* center = [CPDistributedMessagingCenter centerNamed:@"com.zaid.applus.springboard"];
NSLog(@"Sending %@ to APSpringboardUtils", dict);
[center sendMessageName:@"RetrievedLocation" userInfo:@{@"Location" : dict}];
}

View File

@ -14,7 +14,4 @@ APLocationDaemon_PRIVATE_FRAMEWORKS = AppSupport
APLocationDaemon_LIBRARIES = substrate
APLocationDaemon_CODESIGN_FLAGS = -Sentitlements.xml
include $(THEOS_MAKE_PATH)/tool.mk
after-APLocationDaemon-stage::
$(ECHO_NOTHING)$(FAKEROOT) chown root:wheel $(THEOS_STAGING_DIR)/Library/LaunchDaemons/com.zaid.aplocationdaemon.plist$(ECHO_END)
include $(THEOS_MAKE_PATH)/tool.mk

View File

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/dev/null</string>
<key>RunAtLoad</key>

View File

@ -13,6 +13,7 @@ int main(int argc, char *argv[]) {
NSLog(@"Starting this shit 2");
APLocationManager *manager = [[APLocationManager alloc] init];
[manager startMonitoringLocation];
CPDistributedMessagingCenter* center = [CPDistributedMessagingCenter centerNamed:@"com.zaid.applus.daemon"];
[center runServerOnCurrentThread];
[center registerForMessageName:@"RetrieveLocation" target:manager selector:@selector(startMonitoringLocation)];

View File

@ -0,0 +1,8 @@
export GO_EASY_ON_ME=1
TOOL_NAME = assistantplus_root_helper
assistantplus_root_helper_INSTALL_PATH = /Applications/AssistantPlusApp.app
assistantplus_root_helper_OBJC_FILES = assistantplus_root_helper.c
include $(THEOS)/makefiles/common.mk
include $(THEOS)/makefiles/tool.mk

View File

@ -0,0 +1,34 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <spawn.h>
#include "paths.h"
void startLocationDaemon() {
system("/bin/launchctl load /Library/LaunchDaemons/com.zaid.aplocationdaemon.plist");
}
void stopLocationDaemon() {
system("/bin/launchctl unload /Library/LaunchDaemons/com.zaid.aplocationdaemon.plist");
}
int main(int argc, const char *argv[]) {
// Run as root.
if (setuid(0) != 0) {
fprintf(stderr, "setuid failed. Error: %d.\n", errno);
return EXIT_FAILURE;
}
if (strcmp(argv[1], "start") == 0) {
startLocationDaemon();
} else if (strcmp(argv[1], "stop") == 0) {
stopLocationDaemon();
}
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,138 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXFileReference section */
B86E66E11ACE4084007C6014 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B86E66E21ACE4084007C6014 /* assistantplus_root_helper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = assistantplus_root_helper.c; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
B86E66DB1ACE4084007C6014 = {
isa = PBXGroup;
children = (
B86E66E11ACE4084007C6014 /* Makefile */,
B86E66E21ACE4084007C6014 /* assistantplus_root_helper.c */,
);
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXLegacyTarget section */
B86E66E01ACE4084007C6014 /* assistantplus_root_helper */ = {
isa = PBXLegacyTarget;
buildArgumentsString = "$(ACTION)";
buildConfigurationList = B86E66E31ACE4084007C6014 /* Build configuration list for PBXLegacyTarget "assistantplus_root_helper" */;
buildPhases = (
);
buildToolPath = /usr/bin/make;
buildWorkingDirectory = "/Users/Zaid/Programming/Assistant2/assistant+/assistantplus_root_helper";
dependencies = (
);
name = assistantplus_root_helper;
passBuildSettingsInEnvironment = 1;
productName = assistantplus_root_helper;
};
/* End PBXLegacyTarget section */
/* Begin PBXProject section */
B86E66DC1ACE4084007C6014 /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = B86E66DF1ACE4084007C6014 /* Build configuration list for PBXProject "assistantplus_root_helper" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = B86E66DB1ACE4084007C6014;
projectDirPath = "";
projectRoot = "";
targets = (
B86E66E01ACE4084007C6014 /* assistantplus_root_helper */,
);
};
/* End PBXProject section */
/* Begin XCBuildConfiguration section */
B86E66DD1ACE4084007C6014 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx10.6;
};
name = Debug;
};
B86E66DE1ACE4084007C6014 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
SDKROOT = macosx10.6;
};
name = Release;
};
B86E66E41ACE4084007C6014 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
DEBUGGING_SYMBOLS = YES;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = assistantplus_root_helper;
};
name = Debug;
};
B86E66E51ACE4084007C6014 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_ENABLE_FIX_AND_CONTINUE = NO;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = assistantplus_root_helper;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
B86E66DF1ACE4084007C6014 /* Build configuration list for PBXProject "assistantplus_root_helper" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B86E66DD1ACE4084007C6014 /* Debug */,
B86E66DE1ACE4084007C6014 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B86E66E31ACE4084007C6014 /* Build configuration list for PBXLegacyTarget "assistantplus_root_helper" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B86E66E41ACE4084007C6014 /* Debug */,
B86E66E51ACE4084007C6014 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = B86E66DC1ACE4084007C6014 /* Project object */;
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
</Workspace>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B86E66E01ACE4084007C6014"
BuildableName = "assistantplus_root_helper"
BlueprintName = "assistantplus_root_helper"
ReferencedContainer = "container:assistantplus_root_helper.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B86E66E01ACE4084007C6014"
BuildableName = "assistantplus_root_helper"
BlueprintName = "assistantplus_root_helper"
ReferencedContainer = "container:assistantplus_root_helper.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B86E66E01ACE4084007C6014"
BuildableName = "assistantplus_root_helper"
BlueprintName = "assistantplus_root_helper"
ReferencedContainer = "container:assistantplus_root_helper.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>assistantplus_root_helper.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>B86E66E01ACE4084007C6014</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@ -8,7 +8,8 @@
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "ListenerDetailViewController.h"
@interface ActivatorListenersViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@interface ActivatorListenersViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, ListenerDetailDelegate>
@property (strong, nonatomic) UITableView *listenersTable;
@end

View File

@ -8,7 +8,6 @@
#import "ActivatorListenersViewController.h"
#import "APActivatorListener.h"
#import "ListenerDetailViewController.h"
#import "CPDistributedMessagingCenter.h"
@interface ActivatorListenersViewController ()
@ -22,6 +21,8 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Listeners";
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addNewListener:)];
[self.navigationItem setRightBarButtonItem:addButton];
@ -29,21 +30,21 @@
self.listenersTable.delegate = self;
self.listenersTable.dataSource = self;
UIView *msgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 130)];
UILabel *msgLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, self.view.frame.size.width-40, 60)];
UIView *msgView = [[UIView alloc] initWithFrame:CGRectMake(0, 10, self.view.frame.size.width, 130)];
UILabel *msgLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, self.view.frame.size.width, 60)];
msgLabel.lineBreakMode = NSLineBreakByWordWrapping;
msgLabel.numberOfLines = 2;
msgLabel.text = @"You must respring your device before new listeners will appear in Activator";
msgLabel.numberOfLines = 0;
msgLabel.text = @"You must respring your device before listeners you delete here will be removed from Activator";
msgLabel.textAlignment = NSTextAlignmentCenter;
msgLabel.font = [UIFont fontWithName:@"Helvetica" size:16];
msgLabel.textColor = [UIColor darkGrayColor];
[msgView addSubview:msgLabel];
UIButton *respringButton = [UIButton buttonWithType:UIButtonTypeSystem];
respringButton.frame = CGRectMake(0, 60, self.view.frame.size.width, 40);
respringButton.frame = CGRectMake(0, 70, self.view.frame.size.width, 40);
[respringButton addTarget:self action:@selector(respringPressed:) forControlEvents:UIControlEventTouchUpInside];
[respringButton setTitle:@"Respring" forState:UIControlStateNormal];
respringButton.titleLabel.font = [UIFont systemFontOfSize:20];
respringButton.titleLabel.font = [UIFont systemFontOfSize:18];
[msgView addSubview:respringButton];
self.listenersTable.tableFooterView = msgView;
@ -62,9 +63,6 @@
if ([self.listenersTable indexPathForSelectedRow]) {
[self.listenersTable deselectRowAtIndexPath:[self.listenersTable indexPathForSelectedRow] animated:YES];
}
[self saveListenersToFile];
[self.listenersTable reloadData];
}
- (void)didReceiveMemoryWarning {
@ -76,18 +74,18 @@
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"activatorListeners"]) {
NSArray *listeners = [defaults objectForKey:@"activatorListeners"];
NSLog(@"Serialized listeners: %@", listeners);
for (NSDictionary *currListener in listeners) {
APActivatorListener *listener = [[APActivatorListener alloc] initWithDictionary:currListener];
[savedListeners addObject:listener];
}
}
}
- (void)saveListenersToFile {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableArray *toSave = [[NSMutableArray alloc] init];
if (savedListeners) {
NSMutableArray *toSave = [[NSMutableArray alloc] init];
for (APActivatorListener *currListener in savedListeners) {
[toSave addObject:[currListener dictionaryRepresentation]];
}
@ -96,7 +94,7 @@
}
CPDistributedMessagingCenter* center = [CPDistributedMessagingCenter centerNamed:@"com.zaid.applus.springboard"];
[center sendMessageName:@"UpdateActivatorListeners" userInfo:nil];
[center sendMessageName:@"UpdateActivatorListeners" userInfo:@{@"activatorListeners" : toSave}];
}
#pragma mark - Button Handlers
@ -119,7 +117,6 @@
}
- (void)respringPressed:(UIButton*)button {
NSLog(@"Will respring!");
CPDistributedMessagingCenter* center = [CPDistributedMessagingCenter centerNamed:@"com.zaid.applus.springboard"];
[center sendMessageName:@"respringForListeners" userInfo:nil];
}
@ -145,6 +142,7 @@
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
APActivatorListener *selectedListener = [savedListeners objectAtIndex:indexPath.row];
ListenerDetailViewController *detailVC = [[ListenerDetailViewController alloc] initWithListener:selectedListener];
detailVC.delegate = self;
[self.navigationController pushViewController:detailVC animated:YES];
}
@ -169,4 +167,20 @@
return 60;
}
#pragma mark - ListenerDelegate
- (void)listenerDidChange:(APActivatorListener *)listener {
for (NSInteger currIndex = 0; currIndex < savedListeners.count; currIndex++) {
APActivatorListener *currListener = [savedListeners objectAtIndex:currIndex];
if ([currListener.uniqueId isEqualToString:currListener.uniqueId]) {
[savedListeners replaceObjectAtIndex:currIndex withObject:currListener];
break;
}
}
[self saveListenersToFile];
[self.listenersTable reloadData];
}
@end

View File

@ -7,10 +7,12 @@
//
#import <UIKit/UIKit.h>
#import "MainViewController.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UINavigationController *navController;
@property (strong, nonatomic) MainViewController *mainController;
@end

View File

@ -1,4 +1,3 @@
#import "MainViewController.h"
#import "AppDelegate.h"
@implementation AppDelegate
@ -7,9 +6,9 @@
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
MainViewController *mainVC = [[MainViewController alloc] init];
self.mainController = [[MainViewController alloc] init];
self.navController = [[UINavigationController alloc] initWithRootViewController:mainVC];
self.navController = [[UINavigationController alloc] initWithRootViewController:self.mainController];
self.navController.title = @"Assistant+";
self.navController.view.backgroundColor = [UIColor whiteColor];
[self.window setRootViewController:self.navController];
@ -17,14 +16,6 @@
return YES;
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[[UIApplication sharedApplication] setStatusBarHidden:NO];
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
@end
// vim:ft=objc

View File

@ -8,6 +8,18 @@
/* Begin PBXBuildFile section */
B834F0171AC5FEEF00CF009E /* AssistantPlusAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B834F0161AC5FEEF00CF009E /* AssistantPlusAppTests.m */; };
B86E66DA1ACD1991007C6014 /* PluginsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B86E66D91ACD1991007C6014 /* PluginsViewController.m */; };
B86E67101ACE7AC0007C6014 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0A7C1ABF79AA00D4D107 /* AppDelegate.m */; };
B86E67111ACE7AC0007C6014 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0A7F1ABF79AA00D4D107 /* MainViewController.m */; };
B86E67121ACE7AC0007C6014 /* PluginsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B86E66D91ACD1991007C6014 /* PluginsViewController.m */; };
B86E67131ACE7AC0007C6014 /* CustomRepliesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0ADF1AC32C2000D4D107 /* CustomRepliesViewController.m */; };
B86E67141ACE7AC0007C6014 /* CustomReplyDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0AE21AC32C2A00D4D107 /* CustomReplyDetailViewController.m */; };
B86E67151ACE7AC0007C6014 /* ActivatorListenersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0ACD1ABF8F7C00D4D107 /* ActivatorListenersViewController.m */; };
B86E67161ACE7AC0007C6014 /* ListenerDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0AD91AC0949D00D4D107 /* ListenerDetailViewController.m */; };
B86E67171ACE7AC0007C6014 /* APActivatorListener.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0AD21ABF968B00D4D107 /* APActivatorListener.m */; };
B86E67181ACE7AC0007C6014 /* APCustomReply.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0AE51AC32CEF00D4D107 /* APCustomReply.m */; };
B86E67191ACE7AC0007C6014 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0A871ABF7D6200D4D107 /* main.m */; };
B86E671B1ACE7C66007C6014 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B86E671A1ACE7C66007C6014 /* Default-568h@2x.png */; };
B8EC46D41AC6422100ED3836 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0A7C1ABF79AA00D4D107 /* AppDelegate.m */; };
B8EC46D51AC6422100ED3836 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0A7F1ABF79AA00D4D107 /* MainViewController.m */; };
B8EC46D61AC6422100ED3836 /* ActivatorListenersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B88C0ACD1ABF8F7C00D4D107 /* ActivatorListenersViewController.m */; };
@ -27,6 +39,13 @@
remoteGlobalIDString = B834EFF71AC5FEEF00CF009E;
remoteInfo = AssistantPlusApp;
};
B86E67031ACE7A77007C6014 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B88C0A561ABF794E00D4D107 /* Project object */;
proxyType = 1;
remoteGlobalIDString = B86E66E91ACE7A77007C6014;
remoteInfo = assistantapp;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@ -37,6 +56,11 @@
B834F0101AC5FEEF00CF009E /* AssistantPlusAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AssistantPlusAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
B834F0151AC5FEEF00CF009E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B834F0161AC5FEEF00CF009E /* AssistantPlusAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AssistantPlusAppTests.m; sourceTree = "<group>"; };
B86E66D81ACD1991007C6014 /* PluginsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginsViewController.h; sourceTree = SOURCE_ROOT; };
B86E66D91ACD1991007C6014 /* PluginsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginsViewController.m; sourceTree = SOURCE_ROOT; };
B86E66EA1ACE7A77007C6014 /* assistantapp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = assistantapp.app; sourceTree = BUILT_PRODUCTS_DIR; };
B86E67021ACE7A77007C6014 /* assistantappTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = assistantappTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
B86E671A1ACE7C66007C6014 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "Resources/Default-568h@2x.png"; sourceTree = "<group>"; };
B88C0A7C1ABF79AA00D4D107 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = SOURCE_ROOT; };
B88C0A7E1ABF79AA00D4D107 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = SOURCE_ROOT; };
B88C0A7F1ABF79AA00D4D107 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = SOURCE_ROOT; };
@ -75,6 +99,20 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
B86E66E71ACE7A77007C6014 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
B86E66FF1ACE7A77007C6014 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@ -107,6 +145,7 @@
B88C0A551ABF794E00D4D107 = {
isa = PBXGroup;
children = (
B86E671A1ACE7C66007C6014 /* Default-568h@2x.png */,
B88C0A601ABF794E00D4D107 /* AssistantPlusApp */,
B834F0131AC5FEEF00CF009E /* AssistantPlusAppTests */,
B834EFB81AC51E4600CF009E /* Frameworks */,
@ -120,6 +159,8 @@
children = (
B834EFF81AC5FEEF00CF009E /* AssistantPlusApp.app */,
B834F0101AC5FEEF00CF009E /* AssistantPlusAppTests.xctest */,
B86E66EA1ACE7A77007C6014 /* assistantapp.app */,
B86E67021ACE7A77007C6014 /* assistantappTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@ -133,6 +174,8 @@
B88C0A7E1ABF79AA00D4D107 /* MainViewController.h */,
B88C0A7F1ABF79AA00D4D107 /* MainViewController.m */,
B834EFF31AC5EF2C00CF009E /* LaunchScreen2.xib */,
B86E66D81ACD1991007C6014 /* PluginsViewController.h */,
B86E66D91ACD1991007C6014 /* PluginsViewController.m */,
B88C0ADE1AC32C2000D4D107 /* CustomRepliesViewController.h */,
B88C0ADF1AC32C2000D4D107 /* CustomRepliesViewController.m */,
B88C0AE11AC32C2A00D4D107 /* CustomReplyDetailViewController.h */,
@ -190,6 +233,41 @@
productReference = B834F0101AC5FEEF00CF009E /* AssistantPlusAppTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
B86E66E91ACE7A77007C6014 /* assistantapp */ = {
isa = PBXNativeTarget;
buildConfigurationList = B86E670A1ACE7A77007C6014 /* Build configuration list for PBXNativeTarget "assistantapp" */;
buildPhases = (
B86E66E61ACE7A77007C6014 /* Sources */,
B86E66E71ACE7A77007C6014 /* Frameworks */,
B86E66E81ACE7A77007C6014 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = assistantapp;
productName = assistantapp;
productReference = B86E66EA1ACE7A77007C6014 /* assistantapp.app */;
productType = "com.apple.product-type.application";
};
B86E67011ACE7A77007C6014 /* assistantappTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = B86E670D1ACE7A77007C6014 /* Build configuration list for PBXNativeTarget "assistantappTests" */;
buildPhases = (
B86E66FE1ACE7A77007C6014 /* Sources */,
B86E66FF1ACE7A77007C6014 /* Frameworks */,
B86E67001ACE7A77007C6014 /* Resources */,
);
buildRules = (
);
dependencies = (
B86E67041ACE7A77007C6014 /* PBXTargetDependency */,
);
name = assistantappTests;
productName = assistantappTests;
productReference = B86E67021ACE7A77007C6014 /* assistantappTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@ -206,6 +284,14 @@
CreatedOnToolsVersion = 6.2;
TestTargetID = B834EFF71AC5FEEF00CF009E;
};
B86E66E91ACE7A77007C6014 = {
CreatedOnToolsVersion = 6.1;
DevelopmentTeam = 7AMDTT3YCW;
};
B86E67011ACE7A77007C6014 = {
CreatedOnToolsVersion = 6.1;
TestTargetID = B86E66E91ACE7A77007C6014;
};
};
};
buildConfigurationList = B88C0A591ABF794E00D4D107 /* Build configuration list for PBXProject "AssistantPlusApp" */;
@ -223,6 +309,8 @@
targets = (
B834EFF71AC5FEEF00CF009E /* AssistantPlusApp */,
B834F00F1AC5FEEF00CF009E /* AssistantPlusAppTests */,
B86E66E91ACE7A77007C6014 /* assistantapp */,
B86E67011ACE7A77007C6014 /* assistantappTests */,
);
};
/* End PBXProject section */
@ -242,6 +330,21 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
B86E66E81ACE7A77007C6014 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B86E671B1ACE7C66007C6014 /* Default-568h@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B86E67001ACE7A77007C6014 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@ -254,6 +357,7 @@
B8EC46D61AC6422100ED3836 /* ActivatorListenersViewController.m in Sources */,
B8EC46D71AC6422100ED3836 /* CustomRepliesViewController.m in Sources */,
B8EC46D81AC6422100ED3836 /* CustomReplyDetailViewController.m in Sources */,
B86E66DA1ACD1991007C6014 /* PluginsViewController.m in Sources */,
B8EC46D91AC6422100ED3836 /* ListenerDetailViewController.m in Sources */,
B8EC46DA1AC6422100ED3836 /* APActivatorListener.m in Sources */,
B8EC46DB1AC6422100ED3836 /* APCustomReply.m in Sources */,
@ -269,6 +373,30 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
B86E66E61ACE7A77007C6014 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B86E67101ACE7AC0007C6014 /* AppDelegate.m in Sources */,
B86E67111ACE7AC0007C6014 /* MainViewController.m in Sources */,
B86E67121ACE7AC0007C6014 /* PluginsViewController.m in Sources */,
B86E67131ACE7AC0007C6014 /* CustomRepliesViewController.m in Sources */,
B86E67141ACE7AC0007C6014 /* CustomReplyDetailViewController.m in Sources */,
B86E67151ACE7AC0007C6014 /* ActivatorListenersViewController.m in Sources */,
B86E67161ACE7AC0007C6014 /* ListenerDetailViewController.m in Sources */,
B86E67171ACE7AC0007C6014 /* APActivatorListener.m in Sources */,
B86E67181ACE7AC0007C6014 /* APCustomReply.m in Sources */,
B86E67191ACE7AC0007C6014 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B86E66FE1ACE7A77007C6014 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
@ -277,6 +405,11 @@
target = B834EFF71AC5FEEF00CF009E /* AssistantPlusApp */;
targetProxy = B834F0111AC5FEEF00CF009E /* PBXContainerItemProxy */;
};
B86E67041ACE7A77007C6014 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B86E66E91ACE7A77007C6014 /* assistantapp */;
targetProxy = B86E67031ACE7A77007C6014 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@ -352,6 +485,82 @@
};
name = Release;
};
B86E670B1ACE7A77007C6014 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "$(SRCROOT)/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
B86E670C1ACE7A77007C6014 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
INFOPLIST_FILE = "$(SRCROOT)/Resources/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
B86E670E1ACE7A77007C6014 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = assistantappTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/assistantapp.app/assistantapp";
};
name = Debug;
};
B86E670F1ACE7A77007C6014 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = assistantappTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/assistantapp.app/assistantapp";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
B88C0A701ABF794E00D4D107 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -447,6 +656,22 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B86E670A1ACE7A77007C6014 /* Build configuration list for PBXNativeTarget "assistantapp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B86E670B1ACE7A77007C6014 /* Debug */,
B86E670C1ACE7A77007C6014 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
B86E670D1ACE7A77007C6014 /* Build configuration list for PBXNativeTarget "assistantappTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B86E670E1ACE7A77007C6014 /* Debug */,
B86E670F1ACE7A77007C6014 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
B88C0A591ABF794E00D4D107 /* Build configuration list for PBXProject "AssistantPlusApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B86E66E91ACE7A77007C6014"
BuildableName = "assistantapp.app"
BlueprintName = "assistantapp"
ReferencedContainer = "container:AssistantPlusApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B86E66E91ACE7A77007C6014"
BuildableName = "assistantapp.app"
BlueprintName = "assistantapp"
ReferencedContainer = "container:AssistantPlusApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B86E66E91ACE7A77007C6014"
BuildableName = "assistantapp.app"
BlueprintName = "assistantapp"
ReferencedContainer = "container:AssistantPlusApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B86E66E91ACE7A77007C6014"
BuildableName = "assistantapp.app"
BlueprintName = "assistantapp"
ReferencedContainer = "container:AssistantPlusApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -9,6 +9,11 @@
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>assistantapp.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
@ -47,6 +52,16 @@
<key>primary</key>
<true/>
</dict>
<key>B86E66E91ACE7A77007C6014</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>B86E67011ACE7A77007C6014</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>B88C0A5D1ABF794E00D4D107</key>
<dict>
<key>primary</key>

View File

@ -20,6 +20,8 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Custom Replies";
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addNewReply:)];
@ -34,7 +36,7 @@
self.repliesTableView.backgroundColor = backgroundColor;
[self.view addSubview:self.repliesTableView];
[self loadRepliesFromFile];
}
@ -55,7 +57,6 @@
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"customReplies"]) {
NSArray *replies = [defaults objectForKey:@"customReplies"];
NSLog(@"Serialized replies: %@", replies);
for (NSDictionary *currReply in replies) {
APCustomReply *reply = [[APCustomReply alloc] initWithDictionary:currReply];
[savedReplies addObject:reply];
@ -68,7 +69,6 @@
if (savedReplies) {
NSMutableArray *toSave = [[NSMutableArray alloc] init];
for (APCustomReply *currReply in savedReplies) {
NSLog(@"Saving: %@ %@", currReply.trigger, currReply.response);
[toSave addObject:[currReply dictionaryRepresentation]];
}
@ -78,8 +78,6 @@
CPDistributedMessagingCenter* center = [CPDistributedMessagingCenter centerNamed:@"com.zaid.applus.springboard"];
[center sendMessageName:@"UpdateCustomReplies" userInfo:@{@"customReplies" : toSave}];
}
NSLog(@"Saved replies is: %@", savedReplies);
}
#pragma mark - Reply Creation

View File

@ -13,7 +13,7 @@
- (void)customReplyDidChange:(APCustomReply*)reply;
@end
@interface CustomReplyDetailViewController : UIViewController <UITextFieldDelegate>
@interface CustomReplyDetailViewController : UIViewController <UITextFieldDelegate, UITextViewDelegate>
- (id)initWithCustomReply:(APCustomReply*)reply;
@property (weak) id<CustomRepliesDelegate> delegate;
@end

View File

@ -11,7 +11,7 @@
@interface CustomReplyDetailViewController ()
@property (strong, nonatomic) APCustomReply *currReply;
@property (strong, nonatomic) UITextField *triggerField;
@property (strong, nonatomic) UITextField *responseField;
@property (strong, nonatomic) UITextView *responseField;
@property (nonatomic) BOOL didChange;
@end
@ -46,12 +46,13 @@
[triggerBackground addSubview:self.triggerField];
[self.view addSubview:triggerBackground];
UIView *responseBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 190, self.view.frame.size.width, 50)];
UIView *responseBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 190, self.view.frame.size.width, 100)];
responseBackground.backgroundColor = [UIColor whiteColor];
UILabel *responseLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 100, 50)];
responseLabel.text = @"Response:";
self.responseField = [[UITextField alloc] initWithFrame:CGRectMake(120, 2, self.view.frame.size.width-60, 50)];
self.responseField = [[UITextView alloc] initWithFrame:CGRectMake(110, 8, self.view.frame.size.width-110, 90)];
self.responseField.text = self.currReply.response;
self.responseField.font = [UIFont systemFontOfSize:16];
self.responseField.delegate = self;
[responseBackground addSubview:responseLabel];
[responseBackground addSubview:self.responseField];
@ -62,12 +63,9 @@
[super viewWillDisappear:animated];
if (self.didChange) {
NSLog(@"Did change!");
self.currReply.trigger = self.triggerField.text;
self.currReply.response = self.responseField.text;
[self.delegate customReplyDidChange:self.currReply];
} else {
NSLog(@"Didn't change!");
}
}
@ -75,7 +73,11 @@
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
self.didChange = YES;
return YES;
return YES;
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
self.didChange = YES;
return YES;
}
@end

View File

@ -9,6 +9,11 @@
#import <UIKit/UIKit.h>
#import "APActivatorListener.h"
@interface ListenerDetailViewController : UIViewController <UITextFieldDelegate>
@protocol ListenerDetailDelegate <NSObject>
- (void)listenerDidChange:(APActivatorListener*)listener;
@end
@interface ListenerDetailViewController : UIViewController <UITextViewDelegate, UITextFieldDelegate>
@property (assign) id<ListenerDetailDelegate> delegate;
- (id)initWithListener:(APActivatorListener*)listener;
@end

View File

@ -12,7 +12,8 @@
@property (strong, nonatomic) APActivatorListener *currListener;
@property (strong, nonatomic) UISwitch *enabledSwitch;
@property (strong, nonatomic) UITextField *nameField;
@property (strong, nonatomic) UITextField *triggerField;
@property (strong, nonatomic) UITextView *triggerField;
@property (nonatomic) BOOL didChange;
@end
@implementation ListenerDetailViewController
@ -20,6 +21,7 @@
- (id)initWithListener:(APActivatorListener*)listener {
if (self = [super init]) {
self.currListener = listener;
self.didChange = NO;
}
return self;
}
@ -29,7 +31,7 @@
UIColor *backgroundColor = [UIColor colorWithWhite:.9f alpha:1.0];
self.view.backgroundColor = backgroundColor;
UIView *switchBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 50)];
UIView *switchBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 90, self.view.frame.size.width, 50)];
switchBackground.backgroundColor = [UIColor whiteColor];
UILabel *switchLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 80, 50)];
switchLabel.text = @"Enabled:";
@ -40,7 +42,7 @@
[switchBackground addSubview:self.enabledSwitch];
[self.view addSubview:switchBackground];
UIView *nameBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 190, self.view.frame.size.width, 50)];
UIView *nameBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 170, self.view.frame.size.width, 50)];
nameBackground.backgroundColor = [UIColor whiteColor];
UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 60, 50)];
nameLabel.text = @"Name:";
@ -52,11 +54,12 @@
[self.view addSubview:nameBackground];
UIView *triggerBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 280, self.view.frame.size.width, 50)];
UIView *triggerBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 230, self.view.frame.size.width, 100)];
triggerBackground.backgroundColor = [UIColor whiteColor];
UILabel *triggerLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 70, 50)];
triggerLabel.text = @"Trigger:";
self.triggerField = [[UITextField alloc] initWithFrame:CGRectMake(90, 2, self.view.frame.size.width-60, 50)];
self.triggerField = [[UITextView alloc] initWithFrame:CGRectMake(80, 8, self.view.frame.size.width-80, 90)];
self.triggerField.font = [UIFont systemFontOfSize:16];
self.triggerField.text = self.currListener.trigger;
self.triggerField.delegate = self;
[triggerBackground addSubview:triggerLabel];
@ -64,18 +67,31 @@
[self.view addSubview:triggerBackground];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if (self.didChange) {
self.currListener.trigger = self.triggerField.text;
self.currListener.name = self.nameField.text;
[self.delegate listenerDidChange:self.currListener];
}
}
#pragma mark - UI Delegates
- (void)didToggleSwitch:(UISwitch*)theSwitch {
self.didChange = YES;
self.currListener.enabled = theSwitch.on;
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
if (textField == self.triggerField) {
self.currListener.trigger = textField.text;
} else if (textField == self.nameField) {
self.currListener.name = textField.text;
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
self.didChange = YES;
return YES;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
self.didChange = YES;
return YES;
}
- (void)didReceiveMemoryWarning {

View File

@ -1,6 +1,8 @@
#import "MainViewController.h"
#import "ActivatorListenersViewController.h"
#import "CustomRepliesViewController.h"
#import "CPDistributedMessagingCenter.h"
#import "PluginsViewController.h"
@implementation MainViewController
@ -23,17 +25,6 @@
self.optionsTable.backgroundColor = backgroundColor;
[self.view addSubview:self.optionsTable];
NSBundle *bundle = [NSBundle mainBundle];
NSLog(@"%@", bundle);
NSLog(@"%@", bundle.resourcePath);
NSURL *bundleURL = [[NSBundle mainBundle] bundleURL];
NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:bundleURL
includingPropertiesForKeys:@[]
options:NSDirectoryEnumerationSkipsHiddenFiles
error:nil];
NSLog(@"contents: %@", contents);
}
- (void)viewWillAppear:(BOOL)animated {
@ -106,9 +97,11 @@
case 1:
[self goToNewVC:[[CustomRepliesViewController alloc] init]];
break;
case 2:
[self goToNewVC:[[ActivatorListenersViewController alloc] init]];
break;
case 2: {
CPDistributedMessagingCenter *center = [CPDistributedMessagingCenter centerNamed:@"com.zaid.applus.springboard"];
NSDictionary *installed = [center sendMessageAndReceiveReplyName:@"getInstalledPlugins" userInfo:nil];
[self goToNewVC:[[PluginsViewController alloc] initWithInstalledPlugins:installed[@"plugins"]]];
break; }
default:
break;
}

View File

@ -1,13 +1,11 @@
include theos/makefiles/common.mk
export THEOS_DEVICE_IP=192.168.1.17
export ARCHS = armv7 arm64
export TARGET = iphone:clang:latest:8.0
export SDKVERSION=8.2
export SDKVERSION=8.1
APPLICATION_NAME = AssistantPlusApp
AssistantPlusApp_FILES = main.m AppDelegate.m MainViewController.m APActivatorListener.m ActivatorListenersViewController.m ListenerDetailViewController.m CustomReplyDetailViewController.m CustomRepliesViewController.m APCustomReply.m
AssistantPlusApp_FILES = main.m AppDelegate.m MainViewController.m APActivatorListener.m ActivatorListenersViewController.m ListenerDetailViewController.m CustomReplyDetailViewController.m CustomRepliesViewController.m APCustomReply.m PluginsViewController.m
AssistantPlusApp_FRAMEWORKS = UIKit CoreGraphics QuartzCore
AssistantPlusApp_PRIVATE_FRAMEWORKS = AppSupport
AssistantPlusApp_CFLAGS = -fobjc-arc
@ -15,4 +13,4 @@ AssistantPlusApp_CFLAGS = -fobjc-arc
include $(THEOS_MAKE_PATH)/application.mk
after-install::
install.exec “uicache”
install.exec "killall -9 SpringBoard"

View File

@ -0,0 +1,14 @@
//
// PluginsViewController.h
// AssistantPlusApp
//
// Created by Zaid Elkurdi on 4/1/15.
// Copyright (c) 2015 Zaid Elkurdi. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PluginsViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@property (strong, nonatomic) UITableView *pluginsTable;
- (id)initWithInstalledPlugins:(NSArray*)plugins;
@end

View File

@ -0,0 +1,65 @@
//
// PluginsViewController.m
// AssistantPlusApp
//
// Created by Zaid Elkurdi on 4/1/15.
// Copyright (c) 2015 Zaid Elkurdi. All rights reserved.
//
#import "PluginsViewController.h"
@implementation PluginsViewController {
NSArray *installedPlugins;
}
- (id)initWithInstalledPlugins:(NSArray *)plugins {
if (self = [super init]) {
installedPlugins = plugins;
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.pluginsTable = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
self.pluginsTable.delegate = self;
self.pluginsTable.dataSource = self;
self.pluginsTable.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
[self.view addSubview:self.pluginsTable];
UIColor *backgroundColor = [UIColor colorWithWhite:.9f alpha:1.0];
self.pluginsTable.backgroundColor = backgroundColor;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - UITableViewDelegate
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"pluginCell"];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"pluginCell"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
NSDictionary *currPlugin = [installedPlugins objectAtIndex:indexPath.row];
cell.textLabel.text = currPlugin[@"name"];
cell.detailTextLabel.text = currPlugin[@"author"];
return cell;
}
#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return installedPlugins.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 60.0f;
}
@end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -4,8 +4,6 @@
<dict>
<key>CFBundleDisplayName</key>
<string>Assistant+</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleSupportedPlatforms</key>
@ -23,7 +21,7 @@
<string>1</string>
</array>
<key>LSRequiresIPhoneOS</key>
<false/>
<true/>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
@ -34,27 +32,25 @@
<string>8.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<string>false</string>
</dict>
</dict>
<key>UIStatusBarHidden</key>
<true/>
<key>UILaunchImageFile</key>
<string>Default.png</string>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>UILaunchImages</key>
<array>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default</string>
<string>Default-568h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{640, 1136}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>Default-700</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -62,19 +58,9 @@
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>Default</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{320, 480}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-568h</string>
<string>Default-700-568h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -84,17 +70,7 @@
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-568h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{320, 568}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<string>Default-800-667h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -104,17 +80,7 @@
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{375, 667}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<string>Default-800-Portrait-736h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -124,35 +90,13 @@
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<string>Default-800-Landscape-736h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{414, 736}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-Portrait</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{768, 1024}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-Landscape</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{768, 1024}</string>
</dict>
</array>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -4,8 +4,6 @@
<dict>
<key>CFBundleDisplayName</key>
<string>Assistant+</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleSupportedPlatforms</key>
@ -23,7 +21,7 @@
<string>1</string>
</array>
<key>LSRequiresIPhoneOS</key>
<false/>
<true/>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
@ -34,27 +32,25 @@
<string>8.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<string>false</string>
</dict>
</dict>
<key>UIStatusBarHidden</key>
<true/>
<key>UILaunchImageFile</key>
<string>Default.png</string>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>UILaunchImages</key>
<array>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default</string>
<string>Default-568h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{640, 1136}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>Default-700</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -62,19 +58,9 @@
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>Default</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{320, 480}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-568h</string>
<string>Default-700-568h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -84,17 +70,7 @@
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-568h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{320, 568}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<string>Default-800-667h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -104,17 +80,7 @@
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{375, 667}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<string>Default-800-Portrait-736h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@ -124,35 +90,13 @@
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<string>Default-800-Landscape-736h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{414, 736}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-Portrait</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{768, 1024}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-Landscape</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{768, 1024}</string>
</dict>
</array>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>

View File

@ -0,0 +1,17 @@
//
// APActivatorListener.h
//
//
// Created by Zaid Elkurdi on 4/2/15.
//
//
#import <Foundation/Foundation.h>
@interface APActivatorListener : NSObject
@property (strong, nonatomic) NSString *name;
@property (strong, nonatomic) NSString *triggerString;
@property (strong, nonatomic) NSRegularExpression *trigger;
@property (strong, nonatomic) NSString *identifier;
- (id)initWithDictionary:(NSDictionary*)dict;
@end

View File

@ -0,0 +1,22 @@
//
// APActivatorListener.m
//
//
// Created by Zaid Elkurdi on 4/2/15.
//
//
#import "APActivatorListener.h"
@implementation APActivatorListener
- (id)initWithDictionary:(NSDictionary*)dict {
if (self = [super init]) {
self.name = dict[@"name"];
self.triggerString = dict[@"trigger"];
self.trigger = [NSRegularExpression regularExpressionWithPattern:self.triggerString options:NSRegularExpressionCaseInsensitive error:nil];
self.identifier = dict[@"identifier"];
}
return self;
}
@end

View File

@ -10,8 +10,6 @@
@interface APPlugin : NSObject <APPluginManager> {
NSBundle *bundle;
BOOL isInitialized;
NSString *name;
NSString *displayName;
NSString *bundleName;
@ -25,6 +23,7 @@
id<APPlugin> pluginClass;
}
-(NSString*)displayName;
-(NSString*)author;
-(NSString*)identifier;
- (id)initWithFilePath:(NSURL*)filePath andName:(NSString*)name;

View File

@ -16,55 +16,45 @@
commands = [[NSMutableArray alloc] init];
snippets = [[NSMutableSet alloc] init];
NSLog(@"Commnds just created: %@", commands);
bundle = [NSBundle bundleWithURL:filePath];
if (!bundle) {
NSLog(@"Failed to open extension bundle %@ (%@)!", fileName, filePath);
NSLog(@"Failed to open plugin bundle %@!", filePath);
return nil;
}
if (![bundle load]) {
NSLog(@"Failed to load extension bundle %@ (wrong CFBundleExecutable? Missing? Not signed?)!", name);
NSLog(@"Failed to load plugin bundle %@!", name);
return nil;
} else {
NSLog(@"Loaded bundle!");
}
//load principal class
Class principal = [bundle principalClass];
if (!principal) {
NSLog(@"Plugin %@ doesn't provide a NSPrincipalClass!", fileName);
NSLog(@"AP: Plugin %@ doesn't provide a NSPrincipalClass!", fileName);
return nil;
}
NSLog(@"AP: Principal Class is %@", principal);
pluginClass = [[principal alloc] initWithSystem:self];
pluginClass = [[principal alloc] initWithPluginManager:self];
if (!pluginClass) {
NSLog(@"Failed to initialize NSPrincipalClass from plugin %@!", fileName);
NSLog(@"AP: Failed to initialize NSPrincipalClass from plugin %@!", fileName);
return nil;
} else {
NSLog(@"has pluginClass!");
}
// get extension info
displayName = @"FuckerShit";
// displayName = [[[_bundle infoDictionary] objectForKey:@"APPluginName"] copy];
// if (!displayName) {
// displayName = name;
// }
//Get the plugin's display name
displayName = [[bundle infoDictionary] objectForKey:@"APPluginName"];
if (!displayName) {
displayName = name;
}
author = [[bundle objectForInfoDictionaryKey:@"PluginAuthor"] copy];
pluginDescription = [[bundle objectForInfoDictionaryKey:@"PluginDescription"] copy];
identifier = [[bundle objectForInfoDictionaryKey:@"CFBundleIdentifier"] copy];
author = [bundle objectForInfoDictionaryKey:@"APPluginAuthor"];
identifier = [bundle objectForInfoDictionaryKey:@"CFBundleIdentifier"];
pluginName = fileName;
bundleName = [name copy];
isInitialized = YES;
bundleName = fileName;
}
NSLog(@"Loaded Plugin: %@", self);
return self;
}
@ -72,17 +62,19 @@
return displayName;
}
-(NSString*)author {
return author;
}
- (NSString*)identifier {
return identifier;
}
- (NSArray*)getRegisteredCommands {
NSLog(@"Registered Commands: %@", commands);
return commands;
}
- (NSSet*)getRegisteredSnippets {
NSLog(@"Registered Snippets: %@", snippets);
return snippets;
}
@ -107,17 +99,16 @@
NSObject<APPluginSnippet>* snip = [NSClassFromString(snippetClass) alloc];
id initRes = nil;
if ([snip respondsToSelector:@selector(initWithProperties:system:)])
initRes = [snip initWithProperties:props system:self];
if (!initRes && [snip respondsToSelector:@selector(initWithProperties:)])
if (!initRes && [snip respondsToSelector:@selector(initWithProperties:)]) {
initRes = [snip initWithProperties:props];
}
if (!initRes)
if (!initRes) {
initRes = [snip init];
}
if (!initRes)
{
if (!initRes) {
NSLog(@"APPluginSnippet class %@ failed to initialize!", snippetClass);
return nil;
}
@ -136,23 +127,14 @@
return NO;
}
// alloc
id inst = [cls alloc];
// init 1.0.2
if ([inst respondsToSelector:@selector(initWithSystem:)]) {
inst = [inst initWithSystem:self];
} else {
NSLog(@"%@ did not respond to initWithSystem:. Using default init.", className);
inst = [inst init];
}
inst = [inst init];
if (!inst) {
NSLog(@"Command %@ failed to initialize!", className);
return NO;
}
[commands addObject:inst];
NSLog(@"Registered Command %@, commands is now: %@", className, commands);
@ -168,21 +150,9 @@
return NO;
}
id helloClass = [[NSClassFromString(className) alloc] init];
NSLog(@"Snippet Initalized: %@", helloClass);
[snippets addObject:className];
NSLog(@"Registered snippet %@, snippets is now %@", className, snippets);
return YES;
}
-(NSString*)systemVersion {
return @"1.0";
}
-(NSString*)localizedString:(NSString*)text {
return text;
}
@end

View File

@ -7,7 +7,6 @@ static UIViewController *_view;
%new
-(void)setCustomView:(UIViewController*)newVC {
NSLog(@"Setting custom view to: %@", newVC);
_view = newVC;
[self addChildViewController:newVC];
[newVC didMoveToParentViewController:self];
@ -17,13 +16,11 @@ static UIViewController *_view;
%new
-(id)viewControllerForSnippet:(id)arg1 error:(id)arg2 {
NSLog(@"VC FOR Snippet: %@" ,arg1);
return _view;
}
%new
-(id)viewControllerForAceObject:(id)arg1 {
NSLog(@"VC FOR ACE: %@" ,arg1);
return _view;
}
@ -42,17 +39,13 @@ static UIViewController *_view;
}
-(id)navigationTitle {
return @"yoyoyo";
return @"APPluginSnippet";
}
%new
-(void)transcriptViewControllerTappedOutsideEditingView {
NSLog(@"tapped outside editing view!");
NSLog(@"Tapped outside editing view!");
}
- (void)didMoveToParentViewController:(UIViewController *)parent {
NSLog(@"Hello moved to %@", parent);
}
%end

View File

@ -12,13 +12,12 @@
@interface APPluginSystem : NSObject<APPluginSystem, LAEventDataSource> {
NSMutableArray *plugins;
NSMutableDictionary *activatorListenersDict;
NSMutableArray *activatorListenersArray;
}
+ (id)sharedManager;
- (BOOL)loadPlugins;
- (BOOL)handleCommand:(NSString*)command withTokens:(NSSet*)tokens withSession:(APSession*)currSession;
- (id<APPluginSnippet>)viewControllerForClass:(NSString*)snippetClass;
- (void)reloadCustomRepliesPlugin:(NSDictionary*)replies;
- (void)reloadActivatorListeners;
- (void)reloadActivatorListeners:(NSDictionary*)listeners;
- (NSDictionary*)getInstalledPlugins;
@end

View File

@ -7,7 +7,8 @@
//
#import "APPluginSystem.h"
#include "APPlugin.h"
#import "APPlugin.h"
#import "APActivatorListener.h"
static NSString *PREFERENCE_PATH = @"/var/mobile/Library/Preferences/com.assistantplus.app.plist";
static NSString *EVENT_PREFIX = @"APListener";
@ -19,14 +20,14 @@ static NSString *EVENT_PREFIX = @"APListener";
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedManager = [[self alloc] init];
NSLog(@"Creating plugin manager again!");
if ([sharedManager loadPlugins]) {
NSLog(@"Successfully loaded plugins!");
} else {
NSLog(@"Failed to load plugins!");
}
[sharedManager reloadActivatorListeners];
NSDictionary *pref = [NSDictionary dictionaryWithContentsOfFile:PREFERENCE_PATH];
[sharedManager reloadActivatorListeners:pref];
});
return sharedManager;
}
@ -42,13 +43,9 @@ static NSString *EVENT_PREFIX = @"APListener";
options:NSDirectoryEnumerationSkipsHiddenFiles
error:nil];
// NSPredicate *predicate = [NSPredicate predicateWithFormat:@"pathExtension == 'assistantPlugin'"];
NSLog(@"Loading Plugins:");
for (NSURL *fileURL in contents) {//[contents filteredArrayUsingPredicate:predicate]) {
for (NSURL *fileURL in contents) {
NSString *name = [[[fileURL absoluteString] lastPathComponent] stringByDeletingPathExtension];
NSLog(@"Loading %@ at %@", name, fileURL);
APPlugin *currPlugin = [[APPlugin alloc] initWithFilePath:fileURL andName:name];
if (currPlugin != nil) {
@ -60,66 +57,43 @@ static NSString *EVENT_PREFIX = @"APListener";
}
- (BOOL)handleCommand:(NSString*)command withTokens:(NSSet*)tokens withSession:(APSession*)currSession {
NSLog(@"Looking for command to handle: %@", command);
NSLog(@"There are currently %lu plugins registered: %@", (unsigned long)plugins.count, plugins);
//First check activator listeners
NSString *lowercase = [command lowercaseString];
lowercase = [lowercase stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSLog(@"Listeners: %@ Query: %@", activatorListenersDict, lowercase);
if ([activatorListenersDict objectForKey:lowercase]) {
NSLog(@"Handling with activator!");
[LASharedActivator sendEventToListener:[LAEvent eventWithName:[activatorListenersDict objectForKey:lowercase] mode:LASharedActivator.currentEventMode]];
return YES;
NSString *userCommand = [command lowercaseString];
userCommand = [userCommand stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
for (APActivatorListener *currListener in activatorListenersArray) {
NSArray *arrayOfAllMatches = [currListener.trigger matchesInString:userCommand options:0 range:NSMakeRange(0, [userCommand length])];
for (NSTextCheckingResult *match in arrayOfAllMatches) {
if (match.numberOfRanges > 0) {
NSString *eventName = [NSString stringWithFormat:@"%@%@", EVENT_PREFIX, currListener.identifier];
[LASharedActivator sendEventToListener:[LAEvent eventWithName:eventName mode:LASharedActivator.currentEventMode]];
[currSession sendRequestCompleted];
return YES;
}
}
}
NSLog(@"AP: Got Command \"%@\"", userCommand);
for (APPlugin *currPlugin in plugins) {
NSLog(@"Currently on: %@:%@", currPlugin, [currPlugin displayName]);
if ([currPlugin handleSpeech:command withTokens:tokens withSession:currSession]) {
NSLog(@"%@ is handling command: %@", [currPlugin displayName], command);
if ([currPlugin handleSpeech:userCommand withTokens:tokens withSession:currSession]) {
return YES;
}
}
return NO;
}
- (id<APPluginSnippet>)viewControllerForClass:(NSString*)snippetClass {
NSLog(@"Begin search for: %@ with %d plugins", snippetClass, (int)plugins.count);
#pragma mark - Message Handlers
- (NSDictionary*)getInstalledPlugins {
NSMutableArray *pluginArray = [[NSMutableArray alloc] init];
for (APPlugin *currPlugin in plugins) {
NSLog(@"Current (%@) contains: %@", [currPlugin displayName], [currPlugin getRegisteredSnippets]);
if ([[currPlugin getRegisteredSnippets] containsObject:snippetClass]) {
NSObject<APPluginSnippet>* snip = [NSClassFromString(snippetClass) alloc];
id initRes = nil;
if ([snip respondsToSelector:@selector(initWithProperties:)])
initRes = [snip initWithProperties:@{@"labelText" : @"fuck you"}];
if (!initRes)
initRes = [snip init];
if (!initRes) {
NSLog(@"ERROR: Snippet class %@ failed to initialize!", snippetClass);
return nil;
}
return snip;
}
NSDictionary *currDict = @{@"name" : [currPlugin displayName],
@"author" :[currPlugin author]};
[pluginArray addObject:currDict];
}
NSLog(@"APPluginManager: Found no VC for %@", snippetClass);
return nil;
return @{@"plugins" : pluginArray};
}
-(NSString*)localizedString:(NSString*)text {
return text;
}
-(NSString*)systemVersion {
return @"1.0";
}
#pragma mark - Custom replies
- (void)reloadCustomRepliesPlugin:(NSDictionary*)replies {
NSLog(@"Updating replies with %@", replies);
for (APPlugin *currPlugin in plugins) {
if ([[currPlugin identifier] isEqualToString:@"com.assistantplus.customreplyidentifier"]) {
id customCmd = [[currPlugin getRegisteredCommands] lastObject];
@ -131,37 +105,27 @@ static NSString *EVENT_PREFIX = @"APListener";
#pragma mark - Activator Methods
- (void)reloadActivatorListeners {
NSLog(@"Reloading listeners!");
if (!activatorListenersDict) {
activatorListenersDict = [[NSMutableDictionary alloc] init];
}
- (void)reloadActivatorListeners:(NSDictionary*)listeners {
if (!activatorListenersArray) {
activatorListenersArray = [[NSMutableArray alloc] init];
}
for (NSString *currKey in activatorListenersDict.allKeys) {
NSString *identifier = activatorListenersDict[currKey];
for (APActivatorListener *currListener in activatorListenersArray) {
NSString *identifier = currListener.identifier;
NSString *eventName = [NSString stringWithFormat:@"%@%@", EVENT_PREFIX, identifier];
NSLog(@"removed eventName = %@", eventName);
[LASharedActivator unregisterEventDataSourceWithEventName:eventName];
}
[activatorListenersDict removeAllObjects];
[activatorListenersArray removeAllObjects];
NSDictionary *pref = [NSDictionary dictionaryWithContentsOfFile:PREFERENCE_PATH];
if ([pref objectForKey:@"activatorListeners"]) {
for (NSDictionary *currListener in [pref objectForKey:@"activatorListeners"]) {
if ([listeners objectForKey:@"activatorListeners"]) {
for (NSDictionary *currListener in [listeners objectForKey:@"activatorListeners"]) {
NSString *trigger = currListener[@"trigger"];
BOOL isEnabled = [currListener[@"enabled"] boolValue];
if (trigger.length > 0 && isEnabled) {
NSString *eventName = [NSString stringWithFormat:@"%@%@", EVENT_PREFIX, currListener[@"identifier"]];
NSLog(@"Registered %@ for %@", eventName, trigger);
[activatorListenersDict setObject:eventName forKey:[trigger lowercaseString]];
[activatorListenersArray addObject:currListener];
APActivatorListener *newListener = [[APActivatorListener alloc] initWithDictionary:currListener];
NSString *eventName = [NSString stringWithFormat:@"%@%@", EVENT_PREFIX, newListener.identifier];
[activatorListenersArray addObject:newListener];
[LASharedActivator registerEventDataSource:self forEventName:eventName];
}
}
@ -169,10 +133,10 @@ static NSString *EVENT_PREFIX = @"APListener";
}
- (NSString *)localizedTitleForEventName:(NSString *)eventName {
for (NSDictionary *currListener in activatorListenersArray) {
NSString *comp = [NSString stringWithFormat:@"%@%@", EVENT_PREFIX, currListener[@"identifier"]];
for (APActivatorListener *currListener in activatorListenersArray) {
NSString *comp = [NSString stringWithFormat:@"%@%@", EVENT_PREFIX, currListener.identifier];
if ([comp isEqualToString:eventName]) {
return currListener[@"name"];
return currListener.name;
}
}
@ -184,10 +148,10 @@ static NSString *EVENT_PREFIX = @"APListener";
}
- (NSString *)localizedDescriptionForEventName:(NSString *)eventName {
for (NSDictionary *currListener in activatorListenersArray) {
NSString *comp = [NSString stringWithFormat:@"%@%@", EVENT_PREFIX, currListener[@"identifier"]];
for (APActivatorListener *currListener in activatorListenersArray) {
NSString *comp = [NSString stringWithFormat:@"%@%@", EVENT_PREFIX, currListener.identifier];
if ([comp isEqualToString:eventName]) {
return [NSString stringWithFormat:@"Siri Query - \"%@\"", currListener[@"trigger"]];
return [NSString stringWithFormat:@"Siri Query - \"%@\"", currListener.triggerString];
}
}

View File

@ -21,7 +21,6 @@ static NSMutableDictionary *sessionDict;
self.refId = [referenceId copy];
if (!self.refId) self.refId = [@"00000000-0000-0000-0000-000000000000" copy];
self.connection = connection;
NSLog(@"Created a new session for request %@.", self.refId);
}
return self;
}
@ -54,7 +53,6 @@ static NSMutableDictionary *sessionDict;
}
- (void)sendCustomSnippet:(NSString*)snippetClass withProperties:(NSDictionary*)props {
NSLog(@"Sending snippet: %@", snippetClass);
[self sendAddViewsSnippet:snippetClass properties:props dialogPhase:@"Completion" scrollToTop:NO temporary:NO];
}
@ -93,7 +91,6 @@ static NSMutableDictionary *sessionDict;
- (void)handleMessage:(NSString*)name withInfo:(NSDictionary*)locationData {
if (self.completionHandler) {
NSLog(@"Sending %@" ,locationData);
self.completionHandler(locationData);
}
}
@ -101,23 +98,26 @@ static NSMutableDictionary *sessionDict;
#pragma mark - AFConnection Communication
- (void)sendCommandToConnection:(NSDictionary*) dict {
NSLog(@"Sending %@ to client", dict);
id ctx = nil;
id AceObject = objc_getClass("AceObject");
id BasicAceContext = objc_getClass("BasicAceContext");
if (!AceObject) NSLog(@"No AceObject class");
if (!BasicAceContext) NSLog(@"AE ERROR: No BasicAceContext class");
if (!BasicAceContext) NSLog(@"No BasicAceContext class");
if (!dict) {
NSLog(@"AE ERROR: SessionSendToClient: nil dict as an argument!");
return;
}
// create context
if (ctx == nil) ctx = [[BasicAceContext alloc] init]; // ... is not needed normally, but just in case...
if (!ctx) NSLog(@"AE ERROR: No context");
if (ctx == nil) {
ctx = [[BasicAceContext alloc] init]; // ... is not needed normally, but just in case...
}
if (!ctx) {
NSLog(@"Error getting BasicAceContext!");
}
if ([dict objectForKey:@"v"] && !s_ver) {
@ -127,19 +127,15 @@ static NSMutableDictionary *sessionDict;
[(NSMutableDictionary*)dict setObject:s_ver forKey:@"v"];
}
NSLog(@"AE: ###### ===> Sending Ace Object to Client: %@", dict);
// create real AceObject
id obj = [AceObject aceObjectWithDictionary:dict context:ctx];
if (obj == nil) {
NSLog(@"AE ERROR: SessionSendToClient: NIL ACE OBJECT RETURNED FOR DICT: %@", dict);
return;
}
// call the original method to handle our new object
if (self.connection == nil) { NSLog(@"AE: AFConnection is nil"); return; }
if (self.connection == nil) { NSLog(@"AP: AFConnection is nil"); return; }
NSLog(@"Sending this: %@", obj);
if ([dict[@"$class"] isEqualToString:@"CommandSucceeded"]) {
[self.connection sendReplyCommand:obj];
} else {
@ -149,7 +145,6 @@ static NSMutableDictionary *sessionDict;
-(void)sendAddViewsSnippet:(NSString*)snippetClass properties:(NSDictionary*)props dialogPhase:(NSString*)dialogPhase scrollToTop:(BOOL)scrollToTop temporary:(BOOL)temporary {
NSArray* views = [NSArray arrayWithObject:[self createSnippet:snippetClass properties:props]];
// NSLog(@"About to send: %@", views);
[self sendAddViews:views];
}
@ -160,7 +155,6 @@ static NSMutableDictionary *sessionDict;
NSMutableDictionary* lowLevelProps = [NSMutableDictionary dictionaryWithObjectsAndKeys:
props,@"snippetProps", snippetClass,@"snippetClass", nil];
NSLog(@"Creating snippet: %@ with properties: %@", snippetClass, lowLevelProps);
return [self createObjectDictForGroup:@"zaid.assistantplus.plugin" class:@"SnippetObject" properties:lowLevelProps];
}
@ -183,7 +177,6 @@ static NSMutableDictionary *sessionDict;
[objDict setObject:properties[currKey] forKey:currKey];
}
}
NSLog(@"Returning: %@", objDict);
return objDict;
}

View File

@ -22,19 +22,21 @@
NSDictionary *currLocation;
}
static const char *root_helper_path = "/Applications/AssistantPlusApp.app/assistantplus_root_helper";
+ (id)sharedAPUtils {
static APSpringboardUtils *sharedObj = nil;
@synchronized(self) {
if (sharedObj == nil) {
NSLog(@"CREATED SHARED UTILS!");
sharedObj = [[self alloc] init];
[sharedObj loadPlugins];
CPDistributedMessagingCenter* center = [CPDistributedMessagingCenter centerNamed:@"com.zaid.applus.springboard"];
[center runServerOnCurrentThread];
[center registerForMessageName:@"RetrievedLocation" target:sharedObj selector:@selector(gotCurrentLocation:withInfo:)];
[center registerForMessageName:@"UpdateActivatorListeners" target:sharedObj selector:@selector(updateActivatorListeners)];
[center registerForMessageName:@"UpdateActivatorListeners" target:sharedObj selector:@selector(updateActivatorListeners:withListeners:)];
[center registerForMessageName:@"UpdateCustomReplies" target:sharedObj selector:@selector(updateCustomReplies:withReplies:)];
[center registerForMessageName:@"respringForListeners" target:sharedObj selector:@selector(respring)];
[center registerForMessageName:@"getInstalledPlugins" target:sharedObj selector:@selector(getInstalledPlugins:withInfo:)];
}
}
return sharedObj;
@ -49,18 +51,15 @@
NSLog(@"APSpringboardUtils: Loaded Plugin Manager: %@", pluginManager);
}
- (void)updateActivatorListeners {
NSLog(@"Calling1 on %@", pluginManager);
[pluginManager reloadActivatorListeners];
- (void)updateActivatorListeners:(NSString*)msg withListeners:(NSDictionary*)listeners {
[pluginManager reloadActivatorListeners:listeners];
}
- (void)updateCustomReplies:(NSString*)msg withReplies:(NSDictionary*)dict {
NSLog(@"AP SB: Updating custom replies with %@", dict);
[pluginManager reloadCustomRepliesPlugin:dict];
}
- (void)respring {
NSLog(@"Respringing here!");
pid_t pid;
int status;
const char *argv[] = {"killall", "backboardd", NULL};
@ -68,22 +67,33 @@
waitpid(pid, &status, WEXITED);
}
- (NSDictionary*)getInstalledPlugins:(NSString*)msg withInfo:(NSDictionary*)info {
return [pluginManager getInstalledPlugins];
}
- (void)getCurrentLocationWithCompletion:(void (^)(NSDictionary *info))completion {
[self startLocationDaemon];
self.completionHandler = completion;
CPDistributedMessagingCenter* center = [CPDistributedMessagingCenter centerNamed:@"com.zaid.applus.daemon"];
[center sendMessageName:@"RetrieveLocation" userInfo:nil];
}
- (void)gotCurrentLocation:(NSString*)msg withInfo:(NSDictionary*)info {
NSLog(@"APSU got: %@", info);
if (info) {
NSDictionary *locInfo = info[@"Location"];
if (locInfo && self.completionHandler) {
NSLog(@"Sending: %@ to block!", locInfo);
self.completionHandler(locInfo);
self.completionHandler = nil;
}
}
[self stopLocationDaemon];
}
- (void)startLocationDaemon {
system("/Applications/AssistantPlusApp.app/assistantplus_root_helper start");
}
- (void)stopLocationDaemon {
system("/Applications/AssistantPlusApp.app/assistantplus_root_helper stop");
}
@end

View File

@ -108,6 +108,11 @@ typedef SOObject SOAceObject;
- (void)sendReplyCommand:(id)arg1;
- (void)_willCompleteRequest;
- (void)_tellDelegateRequestFinished;
- (void)cancelRequest;
- (void)_requestDidEnd;
- (void)endSession;
- (void)clearContext;
-(void)_cancelRequestTimeout;
@end
@interface SABaseCommand : AceObject
@ -115,11 +120,10 @@ typedef SOObject SOAceObject;
@property(copy, nonatomic) NSString *aceId;
@end
@interface AFConnectionClientServiceDelegate : NSObject
{
@interface AFConnectionClientServiceDelegate : NSObject {
AFConnection *_connection;
}
- (void)requestDidFinish;
@end
@interface SABaseClientBoundCommand : SABaseCommand
@ -162,8 +166,33 @@ typedef SOObject SOAceObject;
@property(copy, nonatomic) NSArray *phrases;
@end
@interface AFUserUtterance : NSObject {
NSMutableArray* _phrases;
NSMutableArray* _tokens;
NSString* _text;
NSDictionary* _correctionIdentifier;
}
@property (nonatomic,readonly) NSDictionary * correctionIdentifier; //@synthesize correctionIdentifier=_correctionIdentifier - In the implementation block
@property (nonatomic,readonly) NSArray * dictationResult;
-(id)description;
-(id)bestTextInterpretation;
-(id)initWithPhrases:(id)arg1 correctionIdentifier:(id)arg2 ;
-(id)initWithTokens:(id)arg1 correctionIdentifier:(id)arg2 ;
-(id)initWithString:(id)arg1 correctionIdentifier:(id)arg2 ;
-(NSArray *)dictationResult;
-(id)streamingTokens;
-(NSDictionary *)correctionIdentifier;
@end
@interface SASSpeechRecognized : SABaseClientBoundCommand
@property(retain, nonatomic) SASRecognition *recognition;
- (id)af_bestTextInterpretation;
- (id)af_correctionContext;
- (AFUserUtterance*)af_userUtteranceValue;
@end
@interface AFSpeechToken : NSObject

View File

@ -18,7 +18,6 @@
-(NSMutableDictionary*)createTextSnippet:(NSString*)text;
- (void)sendCustomSnippet:(NSString*)snippetClass withProperties:(NSDictionary*)props;
- (void)sendRequestCompleted;
-(NSMutableDictionary*)createAssistantUtteranceView:(NSString*)text;
- (void)getCurrentLocationWithCompletion:(void (^)(NSDictionary *info))completion;
@end
@ -31,7 +30,7 @@
@required
+(id)sharedManager;
- (void)reloadCustomRepliesPlugin:(NSDictionary*)replies;
- (void)reloadActivatorListeners;
- (void)reloadActivatorListeners:(NSDictionary*)listeners;
@end
@protocol APPluginManager <NSObject>
@ -44,12 +43,7 @@
@protocol APPluginSnippet <NSObject>
@optional
/// Initializes a snippet by properties
-(id)initWithProperties:(NSDictionary*)props;
/// Initializes a snippet by properties and system
-(id)initWithProperties:(NSDictionary*)props system:(id<APPluginManager>)system;
/// Returns a view representing snippet, can be self if the conforming class is already UIView
@end
@interface APPluginSnippetViewController : UIViewController <APPluginSnippet>
@ -57,30 +51,12 @@
@end
/** Protocol specifying methods of an extension class handling commands.
Classes conforming to this protocol are initialized just after loading bundle and will remain in memory.
Don't forget you really should prefix your class with some shortcut, e.g. K3AAwesomeCommand!
*/
@protocol APPluginCommand <NSObject>
@optional
-(BOOL)handleSpeech:(NSString*)text withTokens:(NSSet*)tokens withSession:(id<APSiriSession>)session;
-(id)initWithSystem:(id<APPluginManager>)manager;
-(void)assistantDismissed;
@end
/// Protocol specifying methods of the extension's principal class
@protocol APPlugin <NSObject>
@required
/// The first method which is called on your class, system is where you register commands and snippets
-(id)initWithSystem:(id<APPluginManager>)system;
@optional
-(void)assistantDismissed; //clean up
-(id)initWithPluginManager:(id<APPluginManager>)system;
@end

View File

@ -1,11 +1,15 @@
include theos/makefiles/common.mk
export GO_EASY_ON_ME=1
export TARGET_IPHONEOS_DEPLOYMENT_VERSION = 8.0
TWEAK_NAME = AssistantPlusPluginManager
AssistantPlusPluginManager_CFLAGS = -fobjc-arc
AssistantPlusPluginManager_FILES = Tweak.xm APPluginSystem.m APPlugin.m APSpringboardUtils.m
AssistantPlusPluginManager_FILES = Tweak.xm APPluginSystem.m APPlugin.m APSpringboardUtils.m APActivatorListener.m
AssistantPlusPluginManager_PRIVATE_FRAMEWORKS = AssistantServices SAObjects AppSupport
AssistantPlusPluginManager_FRAMEWORKS = Foundation UIKit CoreLocation
AssistantPlusPluginManager_LIBRARIES = substrate activator
AssistantPlusPluginManager_FLAGS = -Sentitlements.xml
include $(THEOS_MAKE_PATH)/tweak.mk

View File

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:APActivatorListener.h">
</FileRef>
<FileRef
location = "group:APActivatorListener.m">
</FileRef>
<FileRef
location = "container:APPlugin.h">
</FileRef>

Some files were not shown because too many files have changed in this diff Show More