Skip to content

Commit

Permalink
Refactor to use instance variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdmunro committed May 7, 2018
1 parent 819129b commit 399b175
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ @interface RCTSpotlightSearch ()

@property (nonatomic, strong) id<NSObject> continueUserActivityObserver;
@property (nonatomic, strong) id<NSObject> bundleDidLoadObserver;
@property (nonatomic, copy) NSString *initialIdentifier;

@end

@implementation RCTSpotlightSearch

RCT_EXPORT_MODULE();

static NSString* initialIdentifier;

@synthesize bridge = _bridge;

- (instancetype)init {
Expand Down Expand Up @@ -104,13 +103,13 @@ - (void)handleContinueUserActivity:(NSUserActivity *)userActivity {
return;
}

initialIdentifier = uniqueItemIdentifier;
self.initialIdentifier = uniqueItemIdentifier;

[self sendEventWithName:kSpotlightSearchItemTapped body:uniqueItemIdentifier];
}

RCT_EXPORT_METHOD(getInitialSearchItem:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
resolve(initialIdentifier);
resolve(self.initialIdentifier);
}

RCT_EXPORT_METHOD(indexItem:(NSDictionary *)item resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
Expand Down

0 comments on commit 399b175

Please sign in to comment.