Skip to content

Commit

Permalink
Fixed clang check.
Browse files Browse the repository at this point in the history
The [[ syntax requires bash, not merely sh. This patch fixes this by simply running the script and letting it use the binary declared inside.

Diffs=
c5cde614b Fixed clang check. (#6125)

Co-authored-by: Dragoș Tiselice <[email protected]>
  • Loading branch information
dragostis and dragostis committed Oct 20, 2023
1 parent 4869bfd commit c9a6137
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3b32d24314be7d877a11b8069622d6d6115383b7
c5cde614bdb0de792c0bb074185f6ff51b1ff954
2 changes: 1 addition & 1 deletion .rive_renderer
Original file line number Diff line number Diff line change
@@ -1 +1 @@
98c616d84bf6eb6ed7a63bdcc3dcd1c869f5ebca
4922724744bcca92e465f98f80553224db7e8874
38 changes: 24 additions & 14 deletions Source/Renderer/RiveEvent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import <Rive.h>
#import <RivePrivateHeaders.h>


/*
* RiveEvent
*/
Expand All @@ -24,8 +23,7 @@ @implementation RiveEvent
return instance;
}

- (instancetype)initWithRiveEvent:(const rive::Event*)riveEvent
delay:(float)delay
- (instancetype)initWithRiveEvent:(const rive::Event*)riveEvent delay:(float)delay
{
if (self = [super init])
{
Expand Down Expand Up @@ -58,30 +56,40 @@ - (float)delay
- (NSDictionary<NSString*, id>*)properties
{
bool hasCustomProperties = false;
NSMutableDictionary<NSString *, id>* customProperties = [NSMutableDictionary dictionary];
NSMutableDictionary<NSString*, id>* customProperties = [NSMutableDictionary dictionary];
for (auto child : ((const rive::Event*)instance)->children())
{
if (child->is<rive::CustomProperty>())
{
std::string eventName = child->name();
if (!eventName.empty())
{
NSString* convertedName = [NSString stringWithCString:eventName.c_str() encoding:[NSString defaultCStringEncoding]];
NSString* convertedName =
[NSString stringWithCString:eventName.c_str()
encoding:[NSString defaultCStringEncoding]];
switch (child->coreType())
{
case rive::CustomPropertyBoolean::typeKey: {
bool customBoolValue = child->as<rive::CustomPropertyBoolean>()->propertyValue();
case rive::CustomPropertyBoolean::typeKey:
{
bool customBoolValue =
child->as<rive::CustomPropertyBoolean>()->propertyValue();
customProperties[convertedName] = @(customBoolValue);
break;
}
case rive::CustomPropertyString::typeKey: {
std::string customStringValue = child->as<rive::CustomPropertyString>()->propertyValue();
NSString* convertedStringValue = [NSString stringWithCString:customStringValue.c_str() encoding:[NSString defaultCStringEncoding]];
case rive::CustomPropertyString::typeKey:
{
std::string customStringValue =
child->as<rive::CustomPropertyString>()->propertyValue();
NSString* convertedStringValue =
[NSString stringWithCString:customStringValue.c_str()
encoding:[NSString defaultCStringEncoding]];
customProperties[convertedName] = convertedStringValue;
break;
}
case rive::CustomPropertyNumber::typeKey: {
float customNumValue = child->as<rive::CustomPropertyNumber>()->propertyValue();
case rive::CustomPropertyNumber::typeKey:
{
float customNumValue =
child->as<rive::CustomPropertyNumber>()->propertyValue();
customProperties[convertedName] = @(customNumValue);
break;
}
Expand All @@ -90,7 +98,8 @@ - (float)delay
}
}
}
if (hasCustomProperties) {
if (hasCustomProperties)
{
return customProperties;
}
return nil;
Expand Down Expand Up @@ -132,6 +141,7 @@ - (NSString*)target
targetString = "_top";
break;
}
return [NSString stringWithCString:targetString.c_str() encoding:[NSString defaultCStringEncoding]];
return [NSString stringWithCString:targetString.c_str()
encoding:[NSString defaultCStringEncoding]];
}
@end
2 changes: 1 addition & 1 deletion Source/Renderer/RiveRenderer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -461,4 +461,4 @@
namespace rive
{
RenderPath* makeRenderPath() { return new RiveRenderPath(); }
}
} // namespace rive
5 changes: 3 additions & 2 deletions Source/Renderer/RiveStateMachineInstance.mm
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ - (NSInteger)reportedEventCount
return instance->reportedEventCount();
}


- (RiveEvent*)_convertEvent:(const rive::Event*)event delay:(float)delay
{
if (event->is<rive::OpenUrlEvent>())
Expand Down Expand Up @@ -307,7 +306,9 @@ - (RiveEvent*)reportedEventAt:(NSInteger)index
if (event == nullptr)
{
return nil;
} else {
}
else
{
return [self _convertEvent:event delay:report.secondsDelay()];
}
}
Expand Down
11 changes: 6 additions & 5 deletions Source/Renderer/include/RiveEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

NS_ASSUME_NONNULL_BEGIN

@interface RiveEventReport: NSObject
- (float) secondsDelay;
@interface RiveEventReport : NSObject
- (float)secondsDelay;
@end

/*
Expand All @@ -25,8 +25,9 @@ NS_ASSUME_NONNULL_BEGIN
- (NSString*)name;
/// Type of the RiveEvent
- (NSInteger)type;
/// Delay in seconds since the Event was actually fired (applicable in cases of Events fired off from timeline animations)
- (float) delay;
/// Delay in seconds since the Event was actually fired (applicable in cases of Events fired off
/// from timeline animations)
- (float)delay;
/// Dictionary of custom properties set on any event
- (NSDictionary<NSString*, id>*)properties;
@end
Expand All @@ -40,7 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
/*
* RiveOpenUrlEvent
*/
@interface RiveOpenUrlEvent: RiveEvent
@interface RiveOpenUrlEvent : RiveEvent
/// URL of a link to open
- (NSString*)url;
/// Target value for a link to open with
Expand Down
3 changes: 1 addition & 2 deletions Source/Renderer/include/RivePrivateHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
* RiveEvent interface
*/
@interface RiveEvent ()
- (instancetype)initWithRiveEvent:(const rive::Event*)riveEvent
delay:(float)delay;
- (instancetype)initWithRiveEvent:(const rive::Event*)riveEvent delay:(float)delay;
@end

/*
Expand Down
2 changes: 1 addition & 1 deletion submodules/rive-cpp

0 comments on commit c9a6137

Please sign in to comment.