Skip to content

Commit

Permalink
Add check which prevents to create more than one instance of ARPlayer.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximAlien committed Mar 4, 2019
1 parent b571cdf commit ab46508
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions ARPlayer/Gestures/NodeInsertionHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,24 @@

// Utils
#import "PlaylistService.h"
#import "Constants.h"

// Categories
#import "UIViewController+Helpers.h"

@implementation NodeInsertionHandler

- (void)handleGesture:(UIGestureRecognizer *)gesture inSceneView:(ARSCNView *)sceneView {
NSAssert([gesture isKindOfClass:[UILongPressGestureRecognizer class]], @"Different class type is expected.");

if (gesture.state == UIGestureRecognizerStateBegan) {
SCNNode *node = [sceneView.scene.rootNode childNodeWithName:kMediaPlayerNode
recursively:YES];
if (node != nil) {
[[UIApplication sharedApplication].keyWindow.rootViewController showMessage:@"It's possible to create only one instance of ARPlayer."];
return;
}

CGPoint tapPoint = [gesture locationInView:sceneView];
NSArray<ARHitTestResult *> *arHitTestResults = [sceneView hitTest:tapPoint
types:ARHitTestResultTypeExistingPlaneUsingExtent];
Expand Down
1 change: 0 additions & 1 deletion ARPlayerTestHarness/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ @interface AppDelegate ()
@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

return YES;
}

Expand Down

0 comments on commit ab46508

Please sign in to comment.