diff --git a/.jazzy.yaml b/.jazzy.yaml index 75627e93..0dc524e7 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -2,11 +2,11 @@ author_url: "https://www.bugsnag.com" author: "Bugsnag Inc" clean: false # avoid deleting docs/.git framework_root: "BugsnagPerformance" -github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa-performance/tree/v2.0.0/Bugsnag" +github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa-performance/tree/v2.0.1/Bugsnag" github_url: "https://github.com/bugsnag/bugsnag-cocoa-performance" hide_documentation_coverage: true module: "BugsnagPerformance" -module_version: "2.0.0" +module_version: "2.0.1" objc: true output: "docs" readme: "README.md" diff --git a/BugsnagPerformance.podspec.json b/BugsnagPerformance.podspec.json index 1e2a1f50..7479a261 100644 --- a/BugsnagPerformance.podspec.json +++ b/BugsnagPerformance.podspec.json @@ -1,6 +1,6 @@ { "name": "BugsnagPerformance", - "version": "2.0.0", + "version": "2.0.1", "summary": "The Bugsnag performance monitoring framework for iOS.", "homepage": "https://github.com/bugsnag/bugsnag-cocoa-performance", "license": { @@ -12,7 +12,7 @@ }, "source": { "git": "https://github.com/bugsnag/bugsnag-cocoa-performance.git", - "tag": "v2.0.0" + "tag": "v2.0.1" }, "platforms": { "ios": "13.0" diff --git a/BugsnagPerformance.xcodeproj/project.pbxproj b/BugsnagPerformance.xcodeproj/project.pbxproj index 544a6e16..ddad6c0d 100644 --- a/BugsnagPerformance.xcodeproj/project.pbxproj +++ b/BugsnagPerformance.xcodeproj/project.pbxproj @@ -306,6 +306,7 @@ DA8E5EF42E2FC45B0049F7AB /* BugsnagPerformance.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 72E4BB63359EA30E80116E2A /* BugsnagPerformance.framework */; }; DA8E5EFF2E2FCA020049F7AB /* BugsnagPerformanceNamedSpansPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8E5EFD2E2FCA020049F7AB /* BugsnagPerformanceNamedSpansPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA9BB1CB2E40CC19009A7D25 /* BugsnagPerformanceNamedSpansPlugin+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9BB1CA2E40CC19009A7D25 /* BugsnagPerformanceNamedSpansPlugin+Private.h */; }; + E1AE2B5C2F76F9FA00019D5A /* EarlyConfigurationInfoPlistTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1AE2B5B2F76F9FA00019D5A /* EarlyConfigurationInfoPlistTests.mm */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -737,6 +738,7 @@ DA8E5EFD2E2FCA020049F7AB /* BugsnagPerformanceNamedSpansPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BugsnagPerformanceNamedSpansPlugin.h; sourceTree = ""; }; DA8E5F0F2E2FCDED0049F7AB /* BugsnagPerformanceNamedSpansTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = BugsnagPerformanceNamedSpansTests.mm; sourceTree = ""; }; DA9BB1CA2E40CC19009A7D25 /* BugsnagPerformanceNamedSpansPlugin+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BugsnagPerformanceNamedSpansPlugin+Private.h"; sourceTree = ""; }; + E1AE2B5B2F76F9FA00019D5A /* EarlyConfigurationInfoPlistTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = EarlyConfigurationInfoPlistTests.mm; sourceTree = ""; }; EDE8339F2AF550E20042A78F /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = Sources/BugsnagPerformance/resources/PrivacyInfo.xcprivacy; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1052,6 +1054,7 @@ 964B785A2D4C20C000FF077D /* BugsnagPerformanceSpanConditionTests.mm */, 96F129302DCD325E00A6FB2B /* BugsnagPerformanceSpanTests.mm */, 09E313032BF363020081F219 /* CrossTalkTests.mm */, + E1AE2B5B2F76F9FA00019D5A /* EarlyConfigurationInfoPlistTests.mm */, CBEC51C8296ED98F009C0CE3 /* FileBasedTest.h */, CBEC51C9296ED98F009C0CE3 /* FileBasedTest.m */, CBEC51D82976D54B009C0CE3 /* FilesystemTests.m */, @@ -2030,6 +2033,7 @@ 96F129312DCD325E00A6FB2B /* BugsnagPerformanceSpanTests.mm in Sources */, CBEC51E129793B1E009C0CE3 /* RetryQueueTests.mm in Sources */, 01A58C11290931A5006E4DF7 /* SamplerTests.mm in Sources */, + E1AE2B5C2F76F9FA00019D5A /* EarlyConfigurationInfoPlistTests.mm in Sources */, CBEC51C5296ED8BA009C0CE3 /* PersistentStateTests.mm in Sources */, CBEC51CC296EDA2D009C0CE3 /* FileBasedTest.m in Sources */, 963726DA2DEFBA5A00C739E6 /* BSGCompositeSpanControlProviderTests.m in Sources */, @@ -2329,7 +2333,7 @@ GCC_WARN_PEDANTIC = NO; GENERATE_INFOPLIST_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = "com.bugsnag.BugsnagPerformance-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2351,7 +2355,7 @@ GCC_WARN_PEDANTIC = NO; GENERATE_INFOPLIST_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = "com.bugsnag.BugsnagPerformance-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2385,7 +2389,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceSwiftUI; @@ -2421,7 +2425,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceSwiftUI; @@ -2449,7 +2453,7 @@ GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 17.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceSwiftUITests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; @@ -2473,7 +2477,7 @@ GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 17.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceSwiftUITests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; @@ -2505,7 +2509,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 17.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceSwiftUI; @@ -2541,7 +2545,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 17.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceSwiftUI; @@ -2573,7 +2577,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformance; PRODUCT_NAME = BugsnagPerformance; SDKROOT = iphoneos; @@ -2603,7 +2607,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformance; PRODUCT_NAME = BugsnagPerformance; SDKROOT = iphoneos; @@ -2812,7 +2816,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 7W9PZ27Y5F; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceTestsSwift; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2832,7 +2836,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 7W9PZ27Y5F; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceTestsSwift; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2854,7 +2858,7 @@ GCC_WARN_PEDANTIC = NO; GENERATE_INFOPLIST_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = "com.bugsnag.BugsnagPerformance-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2876,7 +2880,7 @@ GCC_WARN_PEDANTIC = NO; GENERATE_INFOPLIST_FILE = YES; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = "com.bugsnag.BugsnagPerformance-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2908,7 +2912,7 @@ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceTestsApp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2939,7 +2943,7 @@ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceTestsApp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2980,7 +2984,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = NO; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceNamedSpans; @@ -3043,7 +3047,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = NO; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = ""; PRODUCT_BUNDLE_IDENTIFIER = com.bugsnag.BugsnagPerformanceNamedSpans; diff --git a/BugsnagPerformanceNamedSpans.podspec.json b/BugsnagPerformanceNamedSpans.podspec.json index 87f9b6e3..59f33c86 100644 --- a/BugsnagPerformanceNamedSpans.podspec.json +++ b/BugsnagPerformanceNamedSpans.podspec.json @@ -1,6 +1,6 @@ { "name": "BugsnagPerformanceNamedSpans", - "version": "2.0.0", + "version": "2.0.1", "summary": "The Bugsnag performance monitoring framework for iOS.", "homepage": "https://github.com/bugsnag/bugsnag-cocoa-performance", "license": { @@ -12,7 +12,7 @@ }, "source": { "git": "https://github.com/bugsnag/bugsnag-cocoa-performance.git", - "tag": "v2.0.0" + "tag": "v2.0.1" }, "platforms": { "ios": "13.0" @@ -22,7 +22,7 @@ "public_header_files": "Sources/BugsnagPerformanceNamedSpans/include/BugsnagPerformanceNamedSpans/*.h", "prefix_header_file": false, "dependencies": { - "BugsnagPerformance": "2.0.0" + "BugsnagPerformance": "2.0.1" }, "libraries": "c++", "pod_target_xcconfig": { diff --git a/BugsnagPerformanceSwift.podspec.json b/BugsnagPerformanceSwift.podspec.json index a4046610..214d5656 100644 --- a/BugsnagPerformanceSwift.podspec.json +++ b/BugsnagPerformanceSwift.podspec.json @@ -1,6 +1,6 @@ { "name": "BugsnagPerformanceSwift", - "version": "2.0.0", + "version": "2.0.1", "summary": "The Bugsnag performance monitoring framework for Swift-only functionality in iOS.", "homepage": "https://github.com/bugsnag/bugsnag-cocoa-performance", "license": { @@ -13,7 +13,7 @@ "swift_version": "4.2", "source": { "git": "https://github.com/bugsnag/bugsnag-cocoa-performance.git", - "tag": "v2.0.0" + "tag": "v2.0.1" }, "platforms": { "ios": "13.0" @@ -24,6 +24,6 @@ "SwiftUI" ], "dependencies": { - "BugsnagPerformance": "2.0.0" + "BugsnagPerformance": "2.0.1" } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 15510a13..db44c8e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +## 2.0.1 (2026-04-28) + +### Bug fixes + +* Support Pascal case plist configuration values. + [#571](https://github.com/bugsnag/bugsnag-cocoa-performance/pull/571) + ## 2.0.0 (2026-01-20) ### Enhancements diff --git a/Gemfile b/Gemfile index 62ca8063..ac3cbddf 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,8 @@ source 'https://rubygems.org' -gem 'bugsnag-maze-runner', '~>10.0' +gem 'bugsnag-maze-runner', '~>11.0' gem 'cocoapods' gem 'xcpretty', '~>0.4.0' -gem 'openssl' #gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner', branch: 'integration/v8' diff --git a/Sources/BugsnagPerformance/Private/EarlyConfiguration.h b/Sources/BugsnagPerformance/Private/EarlyConfiguration.h index f5a0b4a2..ef5a7351 100644 --- a/Sources/BugsnagPerformance/Private/EarlyConfiguration.h +++ b/Sources/BugsnagPerformance/Private/EarlyConfiguration.h @@ -28,6 +28,9 @@ NS_ASSUME_NONNULL_BEGIN */ - (instancetype) initWithBundleDictionary:(NSDictionary *)dict earlyPhaseStartTime:(CFAbsoluteTime)startTime; ++ (NSDictionary * _Nullable)bsg_loadConfigWithBundle:(NSBundle *)bundle; ++ (NSDictionary * _Nullable)bsg_loadConfigFromInfoDictionary:(NSDictionary * _Nullable)infoDictionary; + @property(nonatomic, readonly) BOOL enableSwizzling; @property(nonatomic, readonly) BOOL swizzleViewLoadPreMain; @property(nonatomic, readwrite) BOOL appWasLaunchedPreWarmed; diff --git a/Sources/BugsnagPerformance/Private/EarlyConfiguration.mm b/Sources/BugsnagPerformance/Private/EarlyConfiguration.mm index 680671f4..ac0d6805 100644 --- a/Sources/BugsnagPerformance/Private/EarlyConfiguration.mm +++ b/Sources/BugsnagPerformance/Private/EarlyConfiguration.mm @@ -9,15 +9,34 @@ #import "EarlyConfiguration.h" #import "Utils.h" +using namespace bugsnag; + @implementation BSGEarlyConfiguration ++ (NSDictionary * _Nullable)bsg_loadConfigFromInfoDictionary:(NSDictionary *)infoDictionary { + if (infoDictionary == nil) { + return nil; + } + return BSGSelectedBugsnagDict(infoDictionary); +} + ++ (NSDictionary * _Nullable)bsg_loadConfigWithBundle:(NSBundle *)bundle { + if (bundle == nil) { + return nil; + } + return [self bsg_loadConfigFromInfoDictionary:[bundle infoDictionary]]; +} + - (instancetype) initWithBundleDictionary:(NSDictionary *)dict earlyPhaseStartTime:(CFAbsoluteTime)startTime { if ((self = [super init])) { _earlyPhaseStartTime = startTime; - if (![[dict valueForKeyPath:@"bugsnag.performance.disableSwizzling"] boolValue]) { + // Use centralized helper to pick a Bugsnag dict and then read the 'performance' settings. + NSDictionary *selected = BSGSelectedBugsnagDict(dict); + id disableSwizzling = BSGDynamicCast(selected)[@"performance"][@"disableSwizzling"]; + if (![disableSwizzling boolValue]) { _enableSwizzling = YES; } - id swizzleViewLoadPreMain = [dict valueForKeyPath:@"bugsnag.performance.swizzleViewLoadPreMain"]; + id swizzleViewLoadPreMain = BSGDynamicCast(selected)[@"performance"][@"swizzleViewLoadPreMain"]; _swizzleViewLoadPreMain = swizzleViewLoadPreMain != nil && [swizzleViewLoadPreMain boolValue]; #if defined(DEBUG) && DEBUG diff --git a/Sources/BugsnagPerformance/Private/Utils.h b/Sources/BugsnagPerformance/Private/Utils.h index 663ca92f..9e9f2bac 100644 --- a/Sources/BugsnagPerformance/Private/Utils.h +++ b/Sources/BugsnagPerformance/Private/Utils.h @@ -136,5 +136,26 @@ static inline NSURLRequest *getTaskRequest(NSURLSessionTask *task, NSError **err return getTaskCurrentRequest(task, error); } +/** + * Returns the Bugsnag dictionary from the given info dictionary, or nil if there is none. + * + * This will look for both "Bugsnag" and "bugsnag" keys, preferring "Bugsnag" if both are present. + */ +static inline NSDictionary *BSGSelectedBugsnagDict(NSDictionary *info) { + if (info == nil) { + return nil; + } + // Prefer capitalized key (some Info.plist tools rename the key to 'Bugsnag'). + id capitalized = info[@"Bugsnag"]; + if ([capitalized isKindOfClass:[NSDictionary class]]) { + return (NSDictionary *)capitalized; + } + id lowercase = info[@"bugsnag"]; + if ([lowercase isKindOfClass:[NSDictionary class]]) { + return (NSDictionary *)lowercase; + } + return nil; +} + } diff --git a/Sources/BugsnagPerformance/Private/Version.h b/Sources/BugsnagPerformance/Private/Version.h index 395452a7..0e9754c7 100644 --- a/Sources/BugsnagPerformance/Private/Version.h +++ b/Sources/BugsnagPerformance/Private/Version.h @@ -9,4 +9,4 @@ #pragma once #define TELEMETRY_SDK_NAME "bugsnag.performance.cocoa" -#define TELEMETRY_SDK_VERSION "2.0.0" +#define TELEMETRY_SDK_VERSION "2.0.1" diff --git a/Sources/BugsnagPerformance/Public/BugsnagPerformanceConfiguration.mm b/Sources/BugsnagPerformance/Public/BugsnagPerformanceConfiguration.mm index 92efb43d..662c19ea 100644 --- a/Sources/BugsnagPerformance/Public/BugsnagPerformanceConfiguration.mm +++ b/Sources/BugsnagPerformance/Public/BugsnagPerformanceConfiguration.mm @@ -156,7 +156,8 @@ + (instancetype)loadConfig { } + (instancetype)loadConfigWithInfoDictionary:(NSDictionary * _Nullable)infoDictionary { - __block auto bugsnagConfiguration = BSGDynamicCast(infoDictionary[@"bugsnag"]); + // Use centralized helper to pick the bugsnag dict (prefers 'bugsnag', falls back to 'Bugsnag') + __block auto bugsnagConfiguration = BSGDynamicCast(BSGSelectedBugsnagDict(infoDictionary)); __block auto bugsnagPerformanceConfiguration = BSGDynamicCast(bugsnagConfiguration[@"performance"]); NSString *(^getSharedConfigValue)(NSString *) = ^NSString *(NSString *property) { return BSGDynamicCast(bugsnagPerformanceConfiguration[property] ?: bugsnagConfiguration[property]); diff --git a/Tests/BugsnagPerformanceTests/EarlyConfigurationInfoPlistTests.mm b/Tests/BugsnagPerformanceTests/EarlyConfigurationInfoPlistTests.mm new file mode 100644 index 00000000..6dc1acf0 --- /dev/null +++ b/Tests/BugsnagPerformanceTests/EarlyConfigurationInfoPlistTests.mm @@ -0,0 +1,65 @@ +#import +#import "EarlyConfiguration.h" + +@interface EarlyConfigurationInfoPlistTests : XCTestCase + +@end + +@implementation EarlyConfigurationInfoPlistTests + +- (void)testPrefersCapitalizedBugsnagKey { + NSDictionary *infoDict = @{ + @"Bugsnag": @{ + @"performance": @{ @"disableSwizzling": @YES } + }, + @"bugsnag": @{ + @"performance": @{ @"disableSwizzling": @NO } + } + }; + + NSDictionary *result = [BSGEarlyConfiguration bsg_loadConfigFromInfoDictionary:infoDict]; + XCTAssertNotNil(result); + NSDictionary *perf = result[@"performance"]; + XCTAssertEqualObjects(perf[@"disableSwizzling"], @YES); +} + +- (void)testFallsBackToLowercaseBugsnagKey { + NSDictionary *infoDict = @{ + @"bugsnag": @{ + @"performance": @{ @"disableSwizzling": @NO } + } + }; + + NSDictionary *result = [BSGEarlyConfiguration bsg_loadConfigFromInfoDictionary:infoDict]; + XCTAssertNotNil(result); + NSDictionary *perf = result[@"performance"]; + XCTAssertEqualObjects(perf[@"disableSwizzling"], @NO); +} + +- (void)testNonDictionaryIsTreatedAsNil { + NSDictionary *infoDict = @{ + @"Bugsnag": @123, + @"bugsnag": @{ + @"performance": @{ @"disableSwizzling": @NO } + } + }; + + NSDictionary *result = [BSGEarlyConfiguration bsg_loadConfigFromInfoDictionary:infoDict]; + // Capitalized key is not a dictionary, so it should fallback to lowercase + XCTAssertNotNil(result); + NSDictionary *perf = result[@"performance"]; + XCTAssertEqualObjects(perf[@"disableSwizzling"], @NO); +} + +- (void)testMissingKeyReturnsNilOptions { + NSDictionary *infoDict = @{ + @"SomeOtherKey": @{ + @"foo": @"bar" + } + }; + + NSDictionary *result = [BSGEarlyConfiguration bsg_loadConfigFromInfoDictionary:infoDict]; + XCTAssertNil(result); +} + +@end diff --git a/VERSION b/VERSION index 227cea21..38f77a65 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.0 +2.0.1 diff --git a/docker-compose.yml b/docker-compose.yml index e6d94e20..ccbd41b8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ x-common-environment: &common-environment services: maze-runner-bb: - image: 855461928731.dkr.ecr.us-west-1.amazonaws.com/maze-runner-releases:latest-v10-cli + image: 855461928731.dkr.ecr.us-west-1.amazonaws.com/maze-runner-releases:latest-v11-cli environment: <<: *common-environment BITBAR_USERNAME: @@ -41,7 +41,7 @@ services: - ./reports/:/app/reports/ maze-runner-bs: - image: 855461928731.dkr.ecr.us-west-1.amazonaws.com/maze-runner-releases:latest-v10-cli + image: 855461928731.dkr.ecr.us-west-1.amazonaws.com/maze-runner-releases:latest-v11-cli environment: <<: *common-environment BROWSER_STACK_USERNAME: diff --git a/features/default/configuration.feature b/features/default/configuration.feature index af469bd1..14e064e2 100644 --- a/features/default/configuration.feature +++ b/features/default/configuration.feature @@ -43,4 +43,4 @@ Feature: Configuration overrides Given I set the sampling probability for the next traces to "0" And I enter unmanaged traces mode And I run "FixedSamplingProbabilityZeroScenario" - And I should receive no traces \ No newline at end of file + And I should receive no traces