Commit fa8127dd authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk

connectivity: reconnect accounts when app returns from background

Change-Id: I44cbf4fce0bb84c76e3922b684c8cf804992f301
Reviewed-by: Kateryna Kostiuk's avatarKateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
parent 7d5b406c
......@@ -125,6 +125,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}
func applicationDidEnterBackground(_ application: UIApplication) {
self.log.warning("entering background")
}
func applicationWillEnterForeground(_ application: UIApplication) {
self.log.warning("entering foreground")
self.daemonService.connectivityChanged()
}
func applicationWillTerminate(_ application: UIApplication) {
self.stopDaemon()
}
......
......@@ -26,5 +26,6 @@
- (BOOL)startDaemon;
- (void)fini;
- (void)pollEvents;
- (void)connectivityChanged;
- (nonnull NSString*)getVersion;
@end
......@@ -23,6 +23,7 @@
#import "DRingAdapter.h"
#import "dring/dring.h"
#import "dring/configurationmanager_interface.h"
@implementation DRingAdapter
......@@ -83,6 +84,17 @@
}
}
- (void)connectivityChanged {
if (![[NSThread currentThread] isMainThread]) {
dispatch_sync(dispatch_get_main_queue(), ^{
DRing::connectivityChanged();
});
}
else {
DRing::connectivityChanged();
}
}
- (NSString*)getVersion {
if (![[NSThread currentThread] isMainThread]) {
__block NSString *version;
......
......@@ -120,6 +120,11 @@ class DaemonService {
log.debug("Daemon stopped.")
}
func connectivityChanged() {
log.debug("connectivity changed")
self.dRingAdaptor.connectivityChanged()
}
// MARK: Private Core
/**
Initiates the timer scheduling the calls to the daemon poll event method. It then starts it.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment