-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Direct app exec #38
Open
CMTaylor
wants to merge
8
commits into
TestingWithFrank:master
Choose a base branch
from
CMTaylor:Direct_App_Exec
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+101
−5
Open
Direct app exec #38
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a2971e1
Bug-fix: Fall back to orientation via status-bar when orientation via…
KotiJocki e955c48
Merge pull request #258 from HaikuJock/master
moredip ef748a1
Allowing UIAlertViews be queryable in iOS7.
seanoshea 8dc9a38
Removing debug code in favour of frankly_os_version
seanoshea 452df56
Updating the pull request for iOS and UIAlertViews
seanoshea 0bc4aab
Merge pull request #260 from seanoshea/master
moredip 138d614
Merge branch 'master' of https://github.com/CMTaylor/Frank
6696c6b
Direct App Exec Command committed to CMTaylor/Frank fork, ready to ge…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// DirectAppExecCommand.h | ||
// Frank | ||
// | ||
// Created by Martin Taylor on 4-Apr-14. | ||
// Copyright (c) 2014 Texas Instruments, Inc. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "FrankCommandRoute.h" | ||
|
||
@interface DirectAppExecCommand : NSObject<FrankCommand>{ | ||
|
||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// DirectAppExecCommand.m | ||
// Frank | ||
// | ||
// Created by Martin Taylor on 4-Apr-14. | ||
// Copyright (c) 2014 Texas Instruments, Inc. All rights reserved. | ||
// | ||
// NOTE: This code was copied directly from AppCommand.m. The only difference in this command is that the | ||
// RequestRouter.m executes it on the HTTP thread rather than on the main UI thread. | ||
// | ||
#import <Foundation/Foundation.h> | ||
#import "DirectAppExecCommand.h" | ||
|
||
#import "Operation.h" | ||
#import "ViewJSONSerializer.h" | ||
#import "FranklyProtocolHelper.h" | ||
#import "JSON.h" | ||
|
||
@implementation DirectAppExecCommand | ||
|
||
- (NSString *)handleCommandWithRequestBody:(NSString *)requestBody { | ||
|
||
NSDictionary *requestCommand = FROM_JSON(requestBody); | ||
NSDictionary *operationDict = [requestCommand objectForKey:@"operation"]; | ||
Operation *operation = [[[Operation alloc] initFromJsonRepresentation:operationDict] autorelease]; | ||
|
||
#if TARGET_OS_IPHONE | ||
id <UIApplicationDelegate> appDelegate = [[UIApplication sharedApplication] delegate]; | ||
#else | ||
id <NSApplicationDelegate> appDelegate = [[NSApplication sharedApplication] delegate]; | ||
#endif | ||
|
||
if( ![operation appliesToObject:appDelegate] ) | ||
{ | ||
return [FranklyProtocolHelper generateErrorResponseWithReason:@"operation doesn't apply" andDetails:@"operation does not appear to be implemented in app delegate"]; | ||
} | ||
|
||
id result; | ||
|
||
@try { | ||
result = [operation applyToObject:appDelegate]; | ||
} | ||
@catch (NSException *e) { | ||
NSLog( @"Exception while applying operation to app delegate:\n%@", e ); | ||
return [FranklyProtocolHelper generateErrorResponseWithReason:@"exception while executing operation" andDetails:[e reason]]; | ||
} | ||
|
||
NSMutableArray *results = [NSMutableArray new]; | ||
[results addObject:[ViewJSONSerializer jsonify:result]]; | ||
|
||
return [FranklyProtocolHelper generateSuccessResponseWithResults: results]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really happy with this approach. Feels pretty hacky to hard-code intimate knowledge about that specific command in the path routing code.
Is there a way we can instead have the DirectAppExecCommand run its command in its own thread? That seems like it'd achieve the same goals.