Skip to content

Commit

Permalink
Update intercom_flutter_web to automatically inject the Intercom scri…
Browse files Browse the repository at this point in the history
…pt (#402)
  • Loading branch information
deepak786 authored Feb 7, 2024
1 parent f425307 commit fb6f84a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions intercom_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 8.0.11

* Automatically Injected Intercom Script, if it is not added.

## 8.0.10

* Bump Intercom iOS SDK version to 16.5.5
Expand Down
6 changes: 3 additions & 3 deletions intercom_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ Intercom.instance.sendTokenToIntercom(intercomToken);
Now, if either Firebase direct (e.g. by your own backend server) or Intercom sends you a message, it will be delivered to your app.
### Web
Add the below script inside body tag in the index.html file located under web folder
You don't need to do any extra steps for the web. Intercom script will be automatically injected.
But you can pre-define some Intercom settings, if you want (optional).
```html
<script>
window.intercomSettings = {
hide_default_launcher: true, // set this to false, if you want to show the default launcher
hide_default_launcher: true, // hide the default launcher
};
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
</script>
```
#### Following functions are not yet supported on Web:
Expand Down
3 changes: 0 additions & 3 deletions intercom_flutter/example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
window.intercomSettings = {
hide_default_launcher: true, // set this to false, if you want to show the default launcher
};

(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();

</script>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
Expand Down
4 changes: 2 additions & 2 deletions intercom_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: intercom_flutter
description: Flutter plugin for Intercom integration. Provides in-app messaging
and help-center Intercom services
version: 8.0.10
version: 8.0.11
homepage: https://github.com/v3rm0n/intercom_flutter

dependencies:
Expand All @@ -10,7 +10,7 @@ dependencies:
flutter_web_plugins:
sdk: flutter
intercom_flutter_platform_interface: ^2.0.0
intercom_flutter_web: ^1.0.1
intercom_flutter_web: ^1.0.2

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit fb6f84a

Please sign in to comment.