diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index cd98c233935aa1..45c9fde406c529 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#import #import "MTRAttributeTLVValueDecoder_Internal.h" #import "MTRBaseDevice_Internal.h" @@ -86,6 +87,7 @@ class MTRDataValueDictionaryCallbackBridge; +MTR_HIDDEN @interface MTRReadClientContainer : NSObject @property (nonatomic, readwrite) app::ReadClient * readClientPtr; @property (nonatomic, readwrite) app::AttributePathParams * pathParams; diff --git a/src/darwin/Framework/CHIP/MTRCommissionableBrowser.h b/src/darwin/Framework/CHIP/MTRCommissionableBrowser.h index 9b6a639133fcea..4ab4b9559b1f2d 100644 --- a/src/darwin/Framework/CHIP/MTRCommissionableBrowser.h +++ b/src/darwin/Framework/CHIP/MTRCommissionableBrowser.h @@ -16,11 +16,13 @@ */ #import +#import NS_ASSUME_NONNULL_BEGIN @protocol MTRCommissionableBrowserDelegate; +MTR_HIDDEN @interface MTRCommissionableBrowser : NSObject - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; diff --git a/src/darwin/Framework/CHIP/MTRCommissionableBrowserResult_Internal.h b/src/darwin/Framework/CHIP/MTRCommissionableBrowserResult_Internal.h index f60f50f74521fd..bf312d83361117 100644 --- a/src/darwin/Framework/CHIP/MTRCommissionableBrowserResult_Internal.h +++ b/src/darwin/Framework/CHIP/MTRCommissionableBrowserResult_Internal.h @@ -16,6 +16,7 @@ */ #import +#import #import "MTRCommissionableBrowserResult.h" @@ -23,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN +MTR_HIDDEN @interface MTRCommissionableBrowserResultInterfaces : NSObject @property (nonatomic, readwrite) chip::Optional resolutionData; diff --git a/src/darwin/Framework/CHIP/MTRControllerAccessControl.h b/src/darwin/Framework/CHIP/MTRControllerAccessControl.h index 6adc5288212088..81060ddca6d0b4 100644 --- a/src/darwin/Framework/CHIP/MTRControllerAccessControl.h +++ b/src/darwin/Framework/CHIP/MTRControllerAccessControl.h @@ -16,9 +16,11 @@ #pragma once #import +#import NS_ASSUME_NONNULL_BEGIN +MTR_HIDDEN @interface MTRControllerAccessControl : NSObject - (instancetype)init NS_UNAVAILABLE; diff --git a/src/darwin/Framework/CHIP/MTRDefines.h b/src/darwin/Framework/CHIP/MTRDefines.h index 2c6a4eea7dd6ed..55a053e9639339 100644 --- a/src/darwin/Framework/CHIP/MTRDefines.h +++ b/src/darwin/Framework/CHIP/MTRDefines.h @@ -21,6 +21,8 @@ #define MTR_EXPORT __attribute__((visibility("default"))) +#define MTR_HIDDEN __attribute__((visibility("hidden"))) + #ifdef __cplusplus #define MTR_EXTERN extern "C" MTR_EXPORT #else diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index dc158c89f768ec..553f5bd24055c5 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -15,6 +15,7 @@ * limitations under the License. */ +#import #import #import "MTRAsyncCallbackWorkQueue_Internal.h" @@ -44,6 +45,7 @@ // Consider moving utility classes to their own file #pragma mark - Utility Classes // This class is for storing weak references in a container +MTR_HIDDEN @interface MTRWeakReference : NSObject + (instancetype)weakReferenceWithObject:(ObjectType)object; - (instancetype)initWithObject:(ObjectType)object; diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 5c4ae26c1f92b6..4b7f7fcc7f0f57 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -14,6 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#import + #import "MTRDeviceController_Internal.h" #import "MTRBaseDevice_Internal.h" @@ -1021,6 +1023,7 @@ - (void)operationalInstanceAdded:(chip::NodeId)nodeID * Shim to allow us to treat an MTRDevicePairingDelegate as an * MTRDeviceControllerDelegate. */ +MTR_HIDDEN @interface MTRDevicePairingDelegateShim : NSObject @property (nonatomic, readonly) id delegate; - (instancetype)initWithDelegate:(id)delegate; @@ -1078,6 +1081,7 @@ - (void)onPairingDeleted:(NSError * _Nullable)error * Shim to allow us to treat an MTRNOCChainIssuer as an * MTROperationalCertificateIssuer. */ +MTR_HIDDEN @interface MTROperationalCertificateChainIssuerShim : NSObject @property (nonatomic, readonly) id nocChainIssuer; @property (nonatomic, readonly) BOOL shouldSkipAttestationCertificateValidation; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.h b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.h index f51f8292a83d76..b4c383b6481963 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerOverXPC.h @@ -15,6 +15,7 @@ * limitations under the License. */ +#import #import NS_ASSUME_NONNULL_BEGIN @@ -23,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN typedef NSXPCConnection * _Nonnull (^MTRXPCConnectBlock)(void); +MTR_HIDDEN @interface MTRDeviceControllerOverXPC : MTRDeviceController - (instancetype)init NS_UNAVAILABLE; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h index 146a4bad978985..24acc7a2dbb3a8 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h @@ -18,6 +18,7 @@ #import "MTRDeviceControllerStartupParams.h" #import +#import #include #include @@ -42,6 +43,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithParams:(MTRDeviceControllerStartupParams *)params; @end +MTR_HIDDEN @interface MTRDeviceControllerStartupParamsInternal : MTRDeviceControllerStartupParams // Fabric table we can use to do things like allocate operational keys. diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerXPCConnection.h b/src/darwin/Framework/CHIP/MTRDeviceControllerXPCConnection.h index 8660a4fbb07a10..0dc4592f2ea981 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerXPCConnection.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerXPCConnection.h @@ -15,6 +15,8 @@ * limitations under the License. */ +#import + #import "MTRDeviceController+XPC.h" NS_ASSUME_NONNULL_BEGIN @@ -27,6 +29,7 @@ typedef void (^MTRXPCReportHandler)(id _Nullable values, NSError * _Nullable err * Releasing the handle may cause invalidating the XPC connection. Hence, in order to retain the connection, the handle must not be * released. */ +MTR_HIDDEN @interface MTRDeviceControllerXPCProxyHandle : NSObject @property (nonatomic, readonly, getter=proxy) id proxy; @@ -40,6 +43,7 @@ typedef void (^MTRGetProxyHandleHandler)(dispatch_queue_t queue, MTRDeviceContro * * This class is in charge of making a new XPC connection and disconnecting as needed by the clients and by the report handlers. */ +MTR_HIDDEN @interface MTRDeviceControllerXPCConnection : NSObject /** diff --git a/src/darwin/Framework/CHIP/MTRDeviceOverXPC.h b/src/darwin/Framework/CHIP/MTRDeviceOverXPC.h index 9718c3ee34a3f7..c7da1f211110e0 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceOverXPC.h +++ b/src/darwin/Framework/CHIP/MTRDeviceOverXPC.h @@ -15,6 +15,8 @@ * limitations under the License. */ +#import + #import "MTRBaseDevice.h" #import "MTRCluster.h" // For MTRSubscriptionEstablishedHandler #import "MTRDeviceControllerXPCConnection.h" @@ -23,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN +MTR_HIDDEN @interface MTRDeviceOverXPC : MTRBaseDevice - (instancetype)init NS_UNAVAILABLE; diff --git a/src/darwin/Framework/CHIP/MTRError.mm b/src/darwin/Framework/CHIP/MTRError.mm index f4e5afae4a6675..94cc4cabfe4975 100644 --- a/src/darwin/Framework/CHIP/MTRError.mm +++ b/src/darwin/Framework/CHIP/MTRError.mm @@ -15,6 +15,8 @@ * limitations under the License. */ +#import + #import "MTRError.h" #import "MTRError_Internal.h" @@ -32,6 +34,7 @@ // Class for holding on to a CHIP_ERROR that we can use as the value // in a dictionary. +MTR_HIDDEN @interface MTRErrorHolder : NSObject @property (nonatomic, readonly) CHIP_ERROR error; diff --git a/src/darwin/Framework/CHIP/MTRError_Internal.h b/src/darwin/Framework/CHIP/MTRError_Internal.h index d41046ecbf5bd7..696895f02e234d 100644 --- a/src/darwin/Framework/CHIP/MTRError_Internal.h +++ b/src/darwin/Framework/CHIP/MTRError_Internal.h @@ -16,6 +16,7 @@ */ #import +#import #import #include @@ -23,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN +MTR_HIDDEN @interface MTRError : NSObject + (NSError * _Nullable)errorForCHIPErrorCode:(CHIP_ERROR)errorCode; + (NSError * _Nullable)errorForIMStatus:(const chip::app::StatusIB &)status; diff --git a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm index 75ea6a45ecc205..d64522f4ceded7 100644 --- a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm @@ -492,9 +492,11 @@ CHIP_ERROR ConfigureState(chip::FabricIndex fabricIndex, chip::NodeId nodeId) uint64_t mTransferGeneration = 0; }; +namespace { BdxOTASender gOtaSender; -static NSInteger const kOtaProviderEndpoint = 0; +NSInteger const kOtaProviderEndpoint = 0; +} // anonymous namespace MTROTAProviderDelegateBridge::MTROTAProviderDelegateBridge(id delegate) : mDelegate(delegate) diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 9cbf25d443f478..d5d91a5076b5f9 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -1753,6 +1753,7 @@ CoreBluetooth, "-lnetwork", "-Wl,-unexported_symbol,\"__Z*\"", + "-Wl,-hidden-lCHIP", ); "OTHER_LDFLAGS[sdk=macosx*]" = ( "-framework", @@ -1767,11 +1768,14 @@ "-framework", CoreData, "-Wl,-unexported_symbol,\"__Z*\"", + "-Wl,-hidden-lCHIP", ); PRODUCT_BUNDLE_IDENTIFIER = com.csa.matter; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; + TAPI_VERIFY_MODE = Pedantic; TARGETED_DEVICE_FAMILY = "1,2,3,4"; + VERSION_INFO_EXPORT_DECL = "__attribute__((visibility(\"hidden\")))"; }; name = Debug; }; @@ -1905,6 +1909,7 @@ CoreBluetooth, "-lnetwork", "-Wl,-unexported_symbol,\"__Z*\"", + "-Wl,-hidden-lCHIP", ); "OTHER_LDFLAGS[sdk=macosx*]" = ( "-framework", @@ -1919,12 +1924,15 @@ "-framework", CoreData, "-Wl,-unexported_symbol,\"__Z*\"", + "-Wl,-hidden-lCHIP", ); PRODUCT_BUNDLE_IDENTIFIER = com.csa.matter; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; STRIP_STYLE = "non-global"; + TAPI_VERIFY_MODE = Pedantic; TARGETED_DEVICE_FAMILY = "1,2,3,4"; + VERSION_INFO_EXPORT_DECL = "__attribute__((visibility(\"hidden\")))"; }; name = Release; };