]> git.saurik.com Git - apple/security.git/blob - keychain/SigninMetrics/SFSignInAnalytics.h
Security-59306.140.5.tar.gz
[apple/security.git] / keychain / SigninMetrics / SFSignInAnalytics.h
1 /*
2 * Copyright (c) 2017 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #if __OBJC2__
25 #ifndef SignInAnalytics_h
26 #define SignInAnalytics_h
27
28 #import <Foundation/Foundation.h>
29 #import <Security/SFAnalytics.h>
30
31 NS_ASSUME_NONNULL_BEGIN
32
33 @interface SFSignInAnalytics : NSObject <NSSecureCoding>
34
35 @property (readonly) NSString* eventName;
36 @property (readonly) NSString* category;
37 @property (readonly) BOOL stopped;
38
39 /*
40 abstract: creates a new SignInAnalytics object, automatically starts a timer for this task.
41 uuid: iCloud sign in transaction UUID
42 category: name of client subsystem. This will be used as the category name when logging
43 eventName: name of the event we are measuring
44 */
45 - (instancetype _Nullable)initWithSignInUUID:(NSString *)uuid category:(NSString *)category eventName:(NSString*)eventName;
46 - (instancetype)init NS_UNAVAILABLE;
47
48 /*
49 abstract: creates a new SignInAnalytics that starts a timer for the subtask.
50 ideal for fine grained timing of sub events and automatically creates a dependency chain.
51 eventNmae: name of the event being timed
52 */
53 - (SFSignInAnalytics* _Nullable)newSubTaskForEvent:(NSString*)eventName;
54
55 /*
56 abstract: call to log when a recoverable error occurs during sign in
57 error: error that occured during iCloud Sign in
58 */
59 - (void)logRecoverableError:(NSError*)error;
60
61 /*
62 abstract: call to log when a unrecoverable error occurs during sign in
63 error: error that occured during iCloud Sign in
64 */
65 - (void)logUnrecoverableError:(NSError*)error;
66
67 /*
68 abstract: call to cancel the timer object.
69 */
70 - (void)cancel;
71
72 /*
73 abstract: call to stop a timer and log the time spent.
74 eventName: subsystem name
75 attributes: a dictionary containing event attributes
76 */
77 - (void)stopWithAttributes:(NSDictionary<NSString*, id>* _Nullable)attributes;
78
79 /*
80 abstract: call to signal iCloud sign in has finished.
81 */
82 - (void)signInCompleted;
83
84 @end
85 NS_ASSUME_NONNULL_END
86 #endif /* SignInAnalytics_h */
87 #endif