-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove necessity of declaring PIN_APP_EXTENSIONS macro #72
Conversation
|
||
+ (BOOL)isAppExtension | ||
{ | ||
return [[[NSBundle mainBundle] executablePath] containsString:@".appex/"]; |
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.
should this be dispatch_once'd?
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.
Can you write a unit test for this? I think this is doable if you separated this into 2 methods, once of which just took a string and return a BOOL, and isAppExtension
could call that one with [[NSBundle mainBundle] executablePath]
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.
Yep this will be dispatched_once. I will look into how we could integrate a unit test for it.
Here's the smoke test I thought of to help ensure this can't break again:
|
Does this sound realistic/doable? |
Also, @martin-gearzero's final comment in #68 seems preferable to inspecting any of the main bundle's paths. |
@benasher44 @garrettmoon Added the dispatch_once for the is app extension check and added a basic share extension target that just initializes PINCache and calls a method that would create a PINBackgroundTask. I couldn't really figure out how we can test PINCache usage within the share extension via a test target. Happy for any help! |
@@ -1120,11 +1134,17 @@ - (instancetype)init | |||
+ (instancetype)start | |||
{ | |||
PINBackgroundTask *task = [[self alloc] init]; |
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.
@garrettmoon You think we should just return nil here and not allocate any PINBackgroundTask if isAppExtension == YES?
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.
Seems like a good call to me.
@maicki It might be possible to do with a UI automation test? Force the extension to run in Safari via a share extension? I think this is a good start though and worth merging. |
Remove necessity of declaring PIN_APP_EXTENSIONS macro
No description provided.