Skip to content

Commit

Permalink
Merge pull request #120 from OneSignal/added_dist_trusty_travis
Browse files Browse the repository at this point in the history
'dist:trusty' added to '.travis.yml' file
  • Loading branch information
jkasten2 authored Aug 9, 2019
2 parents f154482 + 1b1ef04 commit 880c7e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
os:
- linux
sudo: false
dist: trusty
addons:
apt:
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
Expand All @@ -16,4 +17,4 @@ script:
- ./flutter/bin/flutter test
cache:
directories:
- $HOME/.pub-cache
- $HOME/.pub-cache
14 changes: 14 additions & 0 deletions android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.view.FlutterNativeView;

/** OnesignalPlugin */
public class OneSignalPlugin
Expand Down Expand Up @@ -61,6 +63,18 @@ public static void registerWith(Registrar registrar) {
plugin.channel.setMethodCallHandler(plugin);
plugin.flutterRegistrar = registrar;

// Create a callback for the flutterRegistrar to connect the applications onDestroy
plugin.flutterRegistrar.addViewDestroyListener(new PluginRegistry.ViewDestroyListener() {
@Override
public boolean onViewDestroy(FlutterNativeView flutterNativeView) {
// Remove all handlers so they aren't triggered with wrong context
OneSignal.removeNotificationReceivedHandler();
OneSignal.removeNotificationOpenedHandler();
OneSignal.removeInAppMessageClickHandler();
return false;
}
});

OneSignalTagsController.registerWith(registrar);
}

Expand Down

0 comments on commit 880c7e2

Please sign in to comment.