From b927d6e81ba1a1365a35d4f6fd6aefaf9ec040f2 Mon Sep 17 00:00:00 2001 From: Dusan Stevanovic Date: Thu, 4 Jul 2024 12:57:55 +0200 Subject: [PATCH] ios: use NS_CLOSED_ENUM for intensity level --- iosx/include/AVSMediaManager.h | 2 +- iosx/src/mediamgr/AVSMediaManager+Client.m | 29 +++------------------- iosx/src/mediamgr/AVSMediaManager.m | 4 +-- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/iosx/include/AVSMediaManager.h b/iosx/include/AVSMediaManager.h index c2973706e..e42d48208 100644 --- a/iosx/include/AVSMediaManager.h +++ b/iosx/include/AVSMediaManager.h @@ -61,7 +61,7 @@ typedef NS_ENUM (NSUInteger, AVSRecordingRoute) { }; -typedef NS_ENUM (NSUInteger, AVSIntensityLevel) { +typedef NS_CLOSED_ENUM (NSUInteger, AVSIntensityLevel) { AVSIntensityLevelNone = 0, AVSIntensityLevelSome = 50, AVSIntensityLevelFull = 100 diff --git a/iosx/src/mediamgr/AVSMediaManager+Client.m b/iosx/src/mediamgr/AVSMediaManager+Client.m index 1d33cc994..2a9b54ffb 100644 --- a/iosx/src/mediamgr/AVSMediaManager+Client.m +++ b/iosx/src/mediamgr/AVSMediaManager+Client.m @@ -243,34 +243,13 @@ - (BOOL)isInControlOfAudio - (AVSIntensityLevel)intensityLevel { - float intensity = [self intensity]; - - if ( intensity == 0 ) { - return AVSIntensityLevelNone; - } - - if ( intensity == 100 ) { - return AVSIntensityLevelFull; - } - - return AVSIntensityLevelSome; + return [self intensity]; } -- (void)setIntensityLevel:(AVSIntensityLevel)intensityLevel +- (void)setIntensityLevel:(AVSIntensityLevel)intensityLevel { - switch ( intensityLevel ) { - case AVSIntensityLevelNone: - [self setIntensity:0]; - break; - - case AVSIntensityLevelSome: - [self setIntensity:50]; - break; - - case AVSIntensityLevelFull: - [self setIntensity:100]; - break; - } + + [self setIntensity:intensityLevel]; } diff --git a/iosx/src/mediamgr/AVSMediaManager.m b/iosx/src/mediamgr/AVSMediaManager.m index 8279baf30..7daeafbd4 100644 --- a/iosx/src/mediamgr/AVSMediaManager.m +++ b/iosx/src/mediamgr/AVSMediaManager.m @@ -259,7 +259,7 @@ - (void)registerMedia:(id)media withOptions:(NSDictionary *)options { bool mixing = true; bool incall = false; - int intensity = 100; + int intensity = AVSIntensityLevelFull; int priority = 0; mediamgr_register_media(_mm, [media.name UTF8String], (__bridge_retained void *)(media), @@ -386,7 +386,7 @@ - (void)setPreferredRecordingRoute:(AVSRecordingRoute)route - (float)intensityForMediaName:(NSString *)name { - return 0.0f; + return AVSIntensityLevelNone; } - (void)setIntensity:(float)intensity forMediaName:(NSString *)name