1
+ //
2
+ // Copyright (c) Microsoft Corporation. All rights reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ //
5
+
6
+ /// Wrapper class over `ODWDiagnosticDataViewer` representing Diagnostic Data Viewer Hook.
7
+ public final class DiagnosticDataViewer {
8
+
9
+ /// MARK: Initialization Methods
10
+
11
+ /**
12
+ Initializes Data Viewer with a specified machine identifier.
13
+
14
+ - Parameters:
15
+ - machineIdentifier: `String` that contains the machine identifier.
16
+ */
17
+ public static func initViewerWithMachineIdentifier( machineIdentifier: String ) {
18
+ ODWDiagnosticDataViewer . initializeViewer ( withMachineIdentifier: machineIdentifier)
19
+ }
20
+
21
+ /// MARK: Behavior Methods
22
+
23
+ /**
24
+ Enables Data Viewer.
25
+
26
+ - Parameters:
27
+ - endpoint: A `String` that contains endpoint to route events.
28
+ - completionWithResult: Code to execute when enable is completed.
29
+ - Note: This value can be null.
30
+
31
+ Execution is dispatched to queue with default priority.
32
+ */
33
+ public static func enableRemoteViewer( endpoint: String , completionWithResult completion: @escaping ( Bool ) -> Void ) {
34
+ ODWDiagnosticDataViewer . enableRemoteViewer ( endpoint, completionWithResult: completion)
35
+ }
36
+
37
+ /**
38
+ Enables Data Viewer.
39
+
40
+ - Parameters:
41
+ - endpoint: A `String` that contains endpoint to route events.
42
+ */
43
+ public static func enableRemoteViewer( endpoint: String ) -> Bool {
44
+ return ODWDiagnosticDataViewer . enableRemoteViewer ( endpoint)
45
+ }
46
+
47
+ /**
48
+ Disables Data Viewer.
49
+
50
+ - Parameters:
51
+ - completionWithResult: Code to execute when disable is completed.
52
+ - Note: This value can be null.
53
+
54
+ Execution is dispatched to queue with default priority.
55
+ */
56
+ public static func disableViewer( completionWithResult completion: @escaping ( Bool ) -> Void ) {
57
+ ODWDiagnosticDataViewer . disableViewer ( completion)
58
+ }
59
+
60
+ /// Disables Data Viewer.
61
+ public static func disableViewer( ) -> Bool {
62
+ return ODWDiagnosticDataViewer . disableViewer ( )
63
+ }
64
+
65
+ /// `True` if Data Viewer is enabled, `False` otherwise.
66
+ public static var viewerEnabled : Bool {
67
+ return ODWDiagnosticDataViewer . viewerEnabled ( )
68
+ }
69
+
70
+ /// current endpoint if it is set, empty `String` otherwise.
71
+ public static var currentEndpoint : String ? {
72
+ return ODWDiagnosticDataViewer . currentEndpoint ( )
73
+ }
74
+
75
+ /**
76
+ Sets callback for OnDisableNotification event.
77
+
78
+ - Parameters:
79
+ - run: Code to execute when OnDisableNotification event occurs.
80
+ */
81
+ public static func onDisableNotification( run callback: @escaping ( ) -> Void ) {
82
+ ODWDiagnosticDataViewer . register ( onDisableNotification: callback)
83
+ }
84
+ }
0 commit comments