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@
24 #import <Foundation/Foundation.h>
27 #import "Analytics/SFAnalytics.h"
29 extern NSString
* const CKKSAnalyticsInCircle
;
30 extern NSString
* const CKKSAnalyticsHasTLKs
;
31 extern NSString
* const CKKSAnalyticsSyncedClassARecently
;
32 extern NSString
* const CKKSAnalyticsSyncedClassCRecently
;
33 extern NSString
* const CKKSAnalyticsIncomingQueueIsErrorFree
;
34 extern NSString
* const CKKSAnalyticsOutgoingQueueIsErrorFree
;
35 extern NSString
* const CKKSAnalyticsInSync
;
36 extern NSString
* const CKKSAnalyticsValidCredentials
;
37 extern NSString
* const CKKSAnalyticsLastUnlock
;
38 extern NSString
* const CKKSAnalyticsLastKeystateReady
;
39 extern NSString
* const CKKSAnalyticsLastInCircle
;
41 @
class CKKSKeychainView
;
43 @protocol CKKSAnalyticsFailableEvent
<NSObject
>
45 typedef NSString
<CKKSAnalyticsFailableEvent
> CKKSAnalyticsFailableEvent
;
46 extern CKKSAnalyticsFailableEvent
* const CKKSEventProcessIncomingQueueClassA
;
47 extern CKKSAnalyticsFailableEvent
* const CKKSEventProcessIncomingQueueClassC
;
48 extern CKKSAnalyticsFailableEvent
* const CKKSEventProcessOutgoingQueue
;
49 extern CKKSAnalyticsFailableEvent
* const CKKSEventUploadChanges
;
50 extern CKKSAnalyticsFailableEvent
* const CKKSEventStateError
;
51 extern CKKSAnalyticsFailableEvent
* const CKKSEventProcessHealKeyHierarchy
;
53 extern CKKSAnalyticsFailableEvent
* const OctagonEventPreflightBottle
;
54 extern CKKSAnalyticsFailableEvent
* const OctagonEventLaunchBottle
;
55 extern CKKSAnalyticsFailableEvent
* const OctagonEventScrubBottle
;
56 extern CKKSAnalyticsFailableEvent
* const OctagonEventSignIn
;
57 extern CKKSAnalyticsFailableEvent
* const OctagonEventSignOut
;
58 extern CKKSAnalyticsFailableEvent
* const OctagonEventRestoreBottle
;
59 extern CKKSAnalyticsFailableEvent
* const OctagonEventRamp
;
60 extern CKKSAnalyticsFailableEvent
* const OctagonEventBottleCheck
;
61 extern CKKSAnalyticsFailableEvent
* const OctagonEventCoreFollowUp
;
63 extern CKKSAnalyticsFailableEvent
* const OctagonEventRestoredSignedBottlePeer
;
64 extern CKKSAnalyticsFailableEvent
* const OctagonEventRestoredOctagonPeerEncryptionKey
;
65 extern CKKSAnalyticsFailableEvent
* const OctagonEventRestoredOctagonPeerSigningKey
;
66 extern CKKSAnalyticsFailableEvent
* const OctagonEventRestoreComplete
;
69 @protocol CKKSAnalyticsSignpostEvent
<NSObject
>
71 typedef NSString
<CKKSAnalyticsSignpostEvent
> CKKSAnalyticsSignpostEvent
;
72 extern CKKSAnalyticsSignpostEvent
* const CKKSEventPushNotificationReceived
;
73 extern CKKSAnalyticsSignpostEvent
* const CKKSEventItemAddedToOutgoingQueue
;
74 extern CKKSAnalyticsSignpostEvent
* const CKKSEventReachabilityTimerExpired
;
75 extern CKKSAnalyticsSignpostEvent
* const CKKSEventMissingLocalItemsFound
;
77 @protocol CKKSAnalyticsActivity
<NSObject
>
79 typedef NSString
<CKKSAnalyticsActivity
> CKKSAnalyticsActivity
;
80 extern CKKSAnalyticsActivity
* const CKKSActivityOTFetchRampState
;
81 extern CKKSAnalyticsActivity
* const CKKSActivityOctagonSignIn
;
82 extern CKKSAnalyticsActivity
* const CKKSActivityOctagonPreflightBottle
;
83 extern CKKSAnalyticsActivity
* const CKKSActivityOctagonLaunchBottle
;
84 extern CKKSAnalyticsActivity
* const CKKSActivityOctagonRestore
;
85 extern CKKSAnalyticsActivity
* const CKKSActivityScrubBottle
;
86 extern CKKSAnalyticsActivity
* const CKKSActivityBottleCheck
;
88 @interface CKKSAnalytics
: SFAnalytics
90 + (instancetype
)logger
;
92 - (void)logSuccessForEvent
:(CKKSAnalyticsFailableEvent
*)event inView
:(CKKSKeychainView
*)view
;
93 - (void)logRecoverableError
:(NSError
*)error
94 forEvent
:(CKKSAnalyticsFailableEvent
*)event
95 inView
:(CKKSKeychainView
*)view
96 withAttributes
:(NSDictionary
*)attributes
;
98 - (void)logRecoverableError
:(NSError
*)error
99 forEvent
:(CKKSAnalyticsFailableEvent
*)event
100 zoneName
:(NSString
*)zoneName
101 withAttributes
:(NSDictionary
*)attributes
;
104 - (void)logUnrecoverableError
:(NSError
*)error
105 forEvent
:(CKKSAnalyticsFailableEvent
*)event
106 withAttributes
:(NSDictionary
*)attributes
;
108 - (void)logUnrecoverableError
:(NSError
*)error
109 forEvent
:(CKKSAnalyticsFailableEvent
*)event
110 inView
:(CKKSKeychainView
*)view
111 withAttributes
:(NSDictionary
*)attributes
;
113 - (void)noteEvent
:(CKKSAnalyticsSignpostEvent
*)event
;
114 - (void)noteEvent
:(CKKSAnalyticsSignpostEvent
*)event inView
:(CKKSKeychainView
*)view
;
116 - (void)setDateProperty
:(NSDate
*)date forKey
:(NSString
*)key inView
:(CKKSKeychainView
*)view
;
117 - (NSDate
*)datePropertyForKey
:(NSString
*)key inView
:(CKKSKeychainView
*)view
;
121 @interface
CKKSAnalytics (UnitTesting
)
123 - (NSDate
*)dateOfLastSuccessForEvent
:(CKKSAnalyticsFailableEvent
*)event inView
:(CKKSKeychainView
*)view
;
124 - (NSDictionary
*)errorChain
:(NSError
*)error depth
:(NSUInteger
)depth
;