File tree Expand file tree Collapse file tree 6 files changed +9
-20
lines changed
Expand file tree Collapse file tree 6 files changed +9
-20
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,9 @@ public class Amplitude {
119119
120120 func onExitForeground( ) {
121121 inForeground = false
122- _ = self . flush ( )
122+ if configuration. flushEventsOnClose == true {
123+ _ = self . flush ( )
124+ }
123125 }
124126
125127 public func apply( closure: ( Plugin ) -> Void ) {
Original file line number Diff line number Diff line change 6464 }
6565
6666 func applicationDidBecomeActive( notification: NSNotification ) {
67- analytics ? . apply { ( ext) in
67+ amplitude ? . apply { ( ext) in
6868 if let validExt = ext as? MacOSLifecycle {
6969 validExt. applicationDidBecomeActive ( )
7070 }
7171 }
7272 }
7373
7474 func applicationWillResignActive( notification: NSNotification ) {
75- analytics ? . apply { ( ext) in
75+ amplitude ? . apply { ( ext) in
7676 if let validExt = ext as? MacOSLifecycle {
7777 validExt. applicationWillResignActive ( )
7878 }
7979 }
8080 }
8181 }
8282
83- extension AmplitudeDestinationPlugin : MacOSLifecycle {
84- public func applicationWillEnterForeground( application: UIApplication ? ) {
85- let timestamp = NSDate ( ) . timeIntervalSince1970
86- self . amplitude? . onEnterForeground ( timestamp: timestamp)
87- }
88-
89- public func applicationDidEnterBackground( application: UIApplication ? ) {
90- self . amplitude? . onExitForeground ( )
91- }
92- }
93-
9483 extension AmplitudeDestinationPlugin : MacOSLifecycle {
9584 public func applicationDidBecomeActive( ) {
9685 let timestamp = NSDate ( ) . timeIntervalSince1970
Original file line number Diff line number Diff line change 1212 }
1313#endif
1414
15- #if os(watchOS )
15+ #if os(macOS )
1616 internal class MacOSVendorSystem : VendorSystem {
1717 override var requiredPlugin : Plugin {
1818 return MacOSLifecycleMonitor ( )
Original file line number Diff line number Diff line change @@ -13,8 +13,6 @@ internal class VendorSystem {
1313 return MacOSVendorSystem ( )
1414 #elseif os(watchOS)
1515 return WatchOSVendorSystem ( )
16- #elseif os(Linux)
17- return LinuxVendorSystem ( )
1816 #else
1917 return VendorSystem ( )
2018 #endif
Original file line number Diff line number Diff line change 88#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
99
1010 import Foundation
11- import UIKit
11+ import SwiftUI
1212
1313 public protocol IOSLifecycle {
1414 func applicationDidEnterBackground( application: UIApplication ? )
Original file line number Diff line number Diff line change 6767 // from iOS, so ignore until we've been backgrounded at least once.
6868 if wasBackgrounded == false { return }
6969
70- analytics ? . apply { ( ext) in
70+ amplitude ? . apply { ( ext) in
7171 if let validExt = ext as? WatchOSLifecycle {
7272 validExt. applicationWillEnterForeground ( watchExtension: watchExtension)
7373 }
7878 // make sure to denote that we were backgrounded.
7979 wasBackgrounded = true
8080
81- analytics ? . apply { ( ext) in
81+ amplitude ? . apply { ( ext) in
8282 if let validExt = ext as? WatchOSLifecycle {
8383 validExt. applicationDidEnterBackground ( watchExtension: watchExtension)
8484 }
You can’t perform that action at this time.
0 commit comments