File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import Foundation
3030import Segment
3131import UIKit
3232
33+
3334@objc ( SEGAmplitudeSession)
3435public class ObjCAmplitudeSession : NSObject , ObjCPlugin , ObjCPluginShim {
3536 public func instance( ) -> EventPlugin { return AmplitudeSession ( ) }
@@ -161,7 +162,21 @@ extension AmplitudeSession: VersionedPlugin {
161162 public static func version( ) -> String {
162163 return __destination_version
163164 }
165+
164166}
167+ #if os(watchOS)
168+ extension AmplitudeSession : watchOSLifecycle {
169+ public func applicationWillEnterForeground( watchExtension: WKExtension ) {
170+ startNewSessionIfNecessary ( )
171+ debugLog ( " Foreground: \( eventSessionID) " )
172+ }
173+
174+ public func applicationWillResignActive( watchExtension: WKExtension ) {
175+ debugLog ( " Background: \( eventSessionID) " )
176+ _lastEventTime. set ( newTimestamp ( ) )
177+ }
178+ }
179+ #endif
165180
166181
167182// MARK: - AmplitudeSession Helper Methods
You can’t perform that action at this time.
0 commit comments