Skip to content

Commit

Permalink
chore: add version guards
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Feb 3, 2024
1 parent a09d12f commit f642558
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions iphone/Classes/TiSymbolEffectManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

NS_ASSUME_NONNULL_BEGIN

API_AVAILABLE(ios(17))
@interface TiSymbolEffectManager : NSObject

- (instancetype)initWithConfiguration:(NSDictionary *)configuration;
Expand Down
24 changes: 14 additions & 10 deletions iphone/Classes/TiUIImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -692,16 +692,20 @@ - (void)addSymbolEffect:(NSDictionary *)args
BOOL animated = [TiUtils boolValue:@"animated" properties:args def:NO];
KrollCallback *callback = [args valueForKey:@"callback"];

TiSymbolEffectManager *symbolEffectManager = [[TiSymbolEffectManager alloc] initWithConfiguration:args];

[imageView addSymbolEffect:symbolEffectManager.symbolEffect
options:symbolEffectManager.symbolEffectOptions
animated:animated
completion:^(UISymbolEffectCompletionContext *_Nonnull context) {
if (callback != nil) {
// [callback call:@[@{ @"finished": @(context.isFinished) }] thisObject:self];
}
}];
if (@available(iOS 17.0, *)) {
TiSymbolEffectManager *symbolEffectManager = [[TiSymbolEffectManager alloc] initWithConfiguration:args];

[imageView addSymbolEffect:symbolEffectManager.symbolEffect
options:symbolEffectManager.symbolEffectOptions
animated:animated
completion:^(UISymbolEffectCompletionContext *_Nonnull context) {
if (callback != nil) {
// [callback call:@[@{ @"finished": @(context.isFinished) }] thisObject:self];
}
}];
} else {
NSLog(@"[ERROR] The \"addSymbolEffect\" API is only available on iOS 17+");
}
}

- (void)setImage_:(id)arg
Expand Down

0 comments on commit f642558

Please sign in to comment.