cpp_client_telemetry/wrappers/swift/Sources/OneDSSwift/PrivacyGuard.swift

56 строки
1.9 KiB
Swift
Исходник Постоянная ссылка Обычный вид История

//
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
import ObjCModule
/// Wrapper to `ODWPrivacyGuard` representing Privacy Guard Hook.
public final class PrivacyGuard {
// MARK: Behavior methods
/**
Set Privacy Guard enabled.
- Parameters:
- enable: `True` to enable Privacy Guard, `False` otherwise.
*/
public static func setEnabled(_ enable: Bool) {
ODWPrivacyGuard.setEnabled(enable)
}
/// Checks if Privacy Guard is enabled, returns `True` if it is, `False` otherwise.
public static func enabled() -> Bool {
return ODWPrivacyGuard.enabled()
}
/**
Append fresh Common Data Contexts to the existing instance of Privacy Guard.
- Parameters:
- freshCommonDataContext: Fresh Common Data Contexts instance.
*/
Hiding all ObjC types behind Swift wrappers (#1176) * adding swift wrapper * moving files to sources * moving files to proper places * adding module for header expose and importing it in swift wrapper * correcting files for build errors and other changes * adding module for objc * swift build passing' * adding readme * changing the package name to 1dsswiftwrapper * changing target name * adding pr suggestions * adding build.sh changes * cmake list file changes * creating static lib * adding swift wrappers build and linking * adding more logic for building and producing sample app * adding code for swiftc invoking * adding comments * adding change to create the sample app * linking and includding modules in swiftc to build the sample exe: being created * adding comments * compiling all files frrom sample * removing extraline * correcting the output folder of swift build * correcting build output folder paths * adding typealias file to stop importing the objcmodule in clients (#1171) * adding typealias file to stop importing the objcmodule in clients * giving better names * adding call to create logger * adding changes for framework include * adding fwks * linking libs and fwks * adding getter and setters for swift as computed properties * adding sample app changes * adding app changes * adding commondatacontext * swift build passing * correcting common context init * adding get set in event properties list * adding getter to eventprops * removing useless methods * adding getter and setter for eventprops * adding getter * fixing type bug * fixing main app issues * adding semantic context variable to the logger * modifying the access level for the objc types in swift to make sure they are not exposed to the lcient * adding default constructor * keeping main.swift clean ' * correcting comment * adding computed property for objc variable --------- Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2023-06-24 01:40:02 +03:00
public static func appendCommonDataContext(freshCommonDataContext: CommonDataContext) {
ODWPrivacyGuard.append(freshCommonDataContext.odwCommonDataContext)
}
/**
Add ignored concern to prevent generate of notification signals when this concern is found
for the given EventName and Field combination.
- Parameters:
- eventName: Event name that the ignored concern should apply to.
- Note: If the ignored concern applies to the Semantic Context Feild, set the Event name to `SemanticContext`.
- fieldName: Field that the ignored concern should apply to.
- ignoredConcern: The concern that is expected and should be ignored.
*/
Hiding all ObjC types behind Swift wrappers (#1176) * adding swift wrapper * moving files to sources * moving files to proper places * adding module for header expose and importing it in swift wrapper * correcting files for build errors and other changes * adding module for objc * swift build passing' * adding readme * changing the package name to 1dsswiftwrapper * changing target name * adding pr suggestions * adding build.sh changes * cmake list file changes * creating static lib * adding swift wrappers build and linking * adding more logic for building and producing sample app * adding code for swiftc invoking * adding comments * adding change to create the sample app * linking and includding modules in swiftc to build the sample exe: being created * adding comments * compiling all files frrom sample * removing extraline * correcting the output folder of swift build * correcting build output folder paths * adding typealias file to stop importing the objcmodule in clients (#1171) * adding typealias file to stop importing the objcmodule in clients * giving better names * adding call to create logger * adding changes for framework include * adding fwks * linking libs and fwks * adding getter and setters for swift as computed properties * adding sample app changes * adding app changes * adding commondatacontext * swift build passing * correcting common context init * adding get set in event properties list * adding getter to eventprops * removing useless methods * adding getter and setter for eventprops * adding getter * fixing type bug * fixing main app issues * adding semantic context variable to the logger * modifying the access level for the objc types in swift to make sure they are not exposed to the lcient * adding default constructor * keeping main.swift clean ' * correcting comment * adding computed property for objc variable --------- Co-authored-by: Lalit Kumar Bhasin <labhas@microsoft.com>
2023-06-24 01:40:02 +03:00
public static func addIgnoredConcern(eventName: String, fieldName: String, ignoredConcern: DataConcernType) {
ODWPrivacyGuard.addIgnoredConcern(eventName, with: fieldName, with: ignoredConcern)
}
/// Resets the Priavcy Guard instance.
public static func resetPrivacyGuardInstance() {
ODWPrivacyGuard.resetPrivacyGuardInstance()
}
}