This repository was archived by the owner on Feb 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,6 +166,8 @@ public struct PixelParameters {
166166
167167 public static let appState = " state "
168168 public static let appEvent = " event "
169+
170+ public static let didCallWillEnterForeground = " didCallWillEnterForeground "
169171}
170172
171173public struct PixelValues {
Original file line number Diff line number Diff line change @@ -974,6 +974,8 @@ extension Pixel {
974974
975975 // MARK: Lifecycle
976976 case appDidTransitionToUnexpectedState
977+ case appDidConsecutivelyBackground
978+
977979 }
978980
979981}
@@ -1945,6 +1947,7 @@ extension Pixel.Event {
19451947
19461948 // MARK: Lifecycle
19471949 case . appDidTransitionToUnexpectedState: return " m_debug_app-did-transition-to-unexpected-state-2 "
1950+ case . appDidConsecutivelyBackground: return " m_debug_app-did-consecutively-background-2 "
19481951
19491952 }
19501953 }
Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ protocol DDGApp {
6767 }
6868 } ( )
6969
70+ var didCallWillEnterForeground : Bool = false
71+
7072 override init ( ) {
7173 super. init ( )
7274 realDelegate. initialize ( )
@@ -77,6 +79,7 @@ protocol DDGApp {
7779 }
7880
7981 func applicationDidBecomeActive( _ application: UIApplication ) {
82+ didCallWillEnterForeground = false
8083 realDelegate. applicationDidBecomeActive ? ( application)
8184 }
8285
@@ -85,6 +88,7 @@ protocol DDGApp {
8588 }
8689
8790 func applicationWillEnterForeground( _ application: UIApplication ) {
91+ didCallWillEnterForeground = true
8892 realDelegate. applicationWillEnterForeground ? ( application)
8993 }
9094
Original file line number Diff line number Diff line change @@ -104,6 +104,12 @@ extension Background {
104104 urlToOpen = url
105105 return self
106106 case . backgrounding:
107+ if let appDelegate = UIApplication . shared. delegate as? AppDelegate {
108+ Pixel . fire ( pixel: . appDidConsecutivelyBackground, withAdditionalParameters: [
109+ PixelParameters . didCallWillEnterForeground: appDelegate. didCallWillEnterForeground. description
110+ ] )
111+ appDelegate. didCallWillEnterForeground = false
112+ }
107113 run ( )
108114 return self
109115 case . handleShortcutItem( let shortcutItem) :
You can’t perform that action at this time.
0 commit comments