2 * Copyright (c) 2017 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
25 #ifndef SignInAnalytics_h
26 #define SignInAnalytics_h
28 #import <Foundation/Foundation.h>
29 #import <Security/SFAnalytics.h>
31 NS_ASSUME_NONNULL_BEGIN
33 @interface SFSignInAnalytics
: NSObject
<NSSecureCoding
>
35 @
property (readonly
) NSString
* eventName
;
36 @
property (readonly
) NSString
* category
;
37 @
property (readonly
) BOOL stopped
;
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
45 - (instancetype _Nullable
)initWithSignInUUID
:(NSString
*)uuid category
:(NSString
*)category eventName
:(NSString
*)eventName
;
46 - (instancetype
)init NS_UNAVAILABLE
;
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
53 - (SFSignInAnalytics
* _Nullable
)newSubTaskForEvent
:(NSString
*)eventName
;
56 abstract: call to log when a recoverable error occurs during sign in
57 error: error that occured during iCloud Sign in
59 - (void)logRecoverableError
:(NSError
*)error
;
62 abstract: call to log when a unrecoverable error occurs during sign in
63 error: error that occured during iCloud Sign in
65 - (void)logUnrecoverableError
:(NSError
*)error
;
68 abstract: call to cancel the timer object.
73 abstract: call to stop a timer and log the time spent.
74 eventName: subsystem name
75 attributes: a dictionary containing event attributes
77 - (void)stopWithAttributes
:(NSDictionary
<NSString
*, id
>* _Nullable
)attributes
;
80 abstract: call to signal iCloud sign in has finished.
82 - (void)signInCompleted
;
86 #endif /* SignInAnalytics_h */