-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from WalletConnect/develop
Develop
- Loading branch information
Showing
97 changed files
with
1,236 additions
and
837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
import Foundation | ||
#if os(iOS) | ||
import UIKit | ||
#endif | ||
|
||
protocol AppStateObserving { | ||
var onWillEnterForeground: (()->())? {get set} | ||
var onWillEnterBackground: (()->())? {get set} | ||
} | ||
|
||
class AppStateObserver: AppStateObserving { | ||
@objc var onWillEnterForeground: (() -> ())? | ||
|
||
@objc var onWillEnterBackground: (() -> ())? | ||
|
||
init() { | ||
subscribeNotificationCenter() | ||
} | ||
|
||
private func subscribeNotificationCenter() { | ||
#if os(iOS) | ||
NotificationCenter.default.addObserver( | ||
self, | ||
selector: #selector(appWillEnterForeground), | ||
name: UIApplication.willEnterForegroundNotification, | ||
object: nil) | ||
NotificationCenter.default.addObserver( | ||
self, | ||
selector: #selector(appWillEnterBackground), | ||
name: UIApplication.willResignActiveNotification, | ||
object: nil) | ||
#endif | ||
} | ||
|
||
@objc | ||
private func appWillEnterBackground() { | ||
onWillEnterBackground?() | ||
} | ||
|
||
@objc | ||
private func appWillEnterForeground() { | ||
onWillEnterForeground?() | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ class NetworkMonitor: NetworkMonitoring { | |
monitor.start(queue: monitorQueue) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.