Wire up memory warning notifications on iOS. (flutter/engine#3477)

This commit is contained in:
Chinmay Garde 2017-03-14 17:12:29 -07:00 committed by GitHub
parent 9c4495c2c8
commit 02e781f347

View File

@ -174,6 +174,11 @@ void FlutterInit(int argc, const char* argv[]) {
selector:@selector(onVoiceOverChanged:)
name:UIAccessibilityVoiceOverStatusChanged
object:nil];
[center addObserver:self
selector:@selector(onMemoryWarning:)
name:UIApplicationDidReceiveMemoryWarningNotification
object:nil];
}
#pragma mark - Initializing the engine
@ -438,6 +443,13 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(
_platformView->ToggleAccessibility(self.view, enabled);
}
#pragma mark - Memory Notifications
- (void)onMemoryWarning:(NSNotification*)notification {
NSDictionary* message = @{ @"type" : @"memoryPressure" };
[self sendJSON:message withMessageName:@"flutter/system"];
}
#pragma mark - Locale updates
- (void)onLocaleUpdated:(NSNotification*)notification {