From c5e1e02eb2b91677d5214fae113e386c3fe414f0 Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Wed, 27 Jul 2022 12:48:39 -0400 Subject: [PATCH 01/16] added the new flutter streams method for iOS --- .../flutter/inapp_messages.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index f594a2f875d..21014cc9c30 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -56,7 +56,7 @@ For an example, see [AppDelegate.swift](https://github.com/braze-inc/braze-flutt {% endtab %} {% endtabs %} -## In-app message data callback +## Method 1: In-app message data callback You can set a callback in Dart to receive Braze in-app message data in the Flutter host app. @@ -87,6 +87,23 @@ To store any in-app messages triggered before the callback is available and repl ```dart BrazePlugin braze = new BrazePlugin(customConfigs: {replayCallbacksConfigKey: true}); ``` +## Method 2: In-app message data streams (Preferred) + +You can set a data stream listener in Dart to receive in-app message data in the Flutter host app. + +To begin listening to the stream, use the code below to create a `StreamSubscription` in your Flutter app and call the `listen()` method with a function that takes a `BrazeInAppMessage` instance. Remember to `cancel()` the stream subscription when no longer needed. +```dart +// Create stream subscription +StreamSubscription inAppMessageStreamSubscription; + +inAppMessageStreamSubscription = _braze.streamInAppMessagesController.stream.listen((inAppMessage) { + // Function to handle in-app messages +} + +// Cancel stream subscription +inAppMessageStreamSubscription.cancel(); +``` +For an example, see [main.dart](https://github.com/Appboy/flutter-sdk/blob/develop/braze_plugin/example/lib/main.dart) in our sample app. ## Test displaying a sample in-app message From 7f0ba3327104057f974e874a5fd92f067d2c5245 Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Wed, 27 Jul 2022 12:55:03 -0400 Subject: [PATCH 02/16] factored out similar content between 2 methods --- .../flutter/inapp_messages.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 21014cc9c30..b967c6624c0 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -56,14 +56,18 @@ For an example, see [AppDelegate.swift](https://github.com/braze-inc/braze-flutt {% endtab %} {% endtabs %} -## Method 1: In-app message data callback +## Receiving in-app message data + +To receive in-app message data in your Flutter app, `BrazePlugin` supports 2 methods for receiving in-app message data. The first method uses a data callback and the second method uses [Streams](https://dart.dev/tutorials/language/streams) (Preferred). + +The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. + +### Method 1: In-app message data callback You can set a callback in Dart to receive Braze in-app message data in the Flutter host app. To set the callback, call `BrazePlugin.setBrazeInAppMessageCallback()` from your Flutter app with a function that takes a `BrazeInAppMessage` instance. -The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. - {% tabs %} {% tab Android %} @@ -81,13 +85,13 @@ For an example, see [AppDelegate.swift](https://github.com/braze-inc/braze-flutt {% endtab %} {% endtabs %} -### Replaying the callback for in-app messages +#### Replaying the callback for in-app messages To store any in-app messages triggered before the callback is available and replay them once it is set, add the following entry to the `customConfigs` map when intializing the `BrazePlugin`: ```dart BrazePlugin braze = new BrazePlugin(customConfigs: {replayCallbacksConfigKey: true}); ``` -## Method 2: In-app message data streams (Preferred) +### Method 2: In-app message data streams (Preferred) You can set a data stream listener in Dart to receive in-app message data in the Flutter host app. From 254480c70b295d8ac0636d0db4a46e12d84509d4 Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Tue, 2 Aug 2022 14:10:32 -0400 Subject: [PATCH 03/16] Update _docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md Co-authored-by: Daniel Hok <4797040+hokstuff@users.noreply.github.com> --- .../platform_integration_guides/flutter/inapp_messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index b967c6624c0..8a7bd9d5c2f 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -95,7 +95,7 @@ BrazePlugin braze = new BrazePlugin(customConfigs: {replayCallbacksConfigKey: tr You can set a data stream listener in Dart to receive in-app message data in the Flutter host app. -To begin listening to the stream, use the code below to create a `StreamSubscription` in your Flutter app and call the `listen()` method with a function that takes a `BrazeInAppMessage` instance. Remember to `cancel()` the stream subscription when no longer needed. +To begin listening to the stream, use the code below to create a `StreamSubscription` in your Flutter app and call the `listen()` method with a function that takes a `BrazeInAppMessage` instance. Remember to `cancel()` the stream subscription when it is no longer needed. ```dart // Create stream subscription StreamSubscription inAppMessageStreamSubscription; From 4cb4cd026c55726e564029dfe9168d3aab6fd686 Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Tue, 2 Aug 2022 14:26:34 -0400 Subject: [PATCH 04/16] updated spelling of "two" instead of 2 --- .../platform_integration_guides/flutter/inapp_messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 8a7bd9d5c2f..30d6d550ec2 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -58,7 +58,7 @@ For an example, see [AppDelegate.swift](https://github.com/braze-inc/braze-flutt ## Receiving in-app message data -To receive in-app message data in your Flutter app, `BrazePlugin` supports 2 methods for receiving in-app message data. The first method uses a data callback and the second method uses [Streams](https://dart.dev/tutorials/language/streams) (Preferred). +To receive in-app message data in your Flutter app, `BrazePlugin` supports two methods for receiving in-app message data. The first method uses a data callback and the second method uses [Streams](https://dart.dev/tutorials/language/streams) (Preferred). The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. From c0dc9eacfb2e9fbb565f148af124773df5f8921b Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Tue, 2 Aug 2022 15:12:59 -0400 Subject: [PATCH 05/16] updated order of 2 methods + added "legacy" and "recommended" --- .../flutter/inapp_messages.md | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 30d6d550ec2..30f8cc03ec3 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -58,11 +58,29 @@ For an example, see [AppDelegate.swift](https://github.com/braze-inc/braze-flutt ## Receiving in-app message data -To receive in-app message data in your Flutter app, `BrazePlugin` supports two methods for receiving in-app message data. The first method uses a data callback and the second method uses [Streams](https://dart.dev/tutorials/language/streams) (Preferred). +To receive in-app message data in your Flutter app, `BrazePlugin` supports two methods for receiving in-app message data. The first method uses Dart [Streams](https://dart.dev/tutorials/language/streams) (Recommended) and the second method uses a data callback (Legacy). The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. -### Method 1: In-app message data callback +### Method 1: In-app message data streams (Recommended) + +You can set a data stream listener in Dart to receive in-app message data in the Flutter host app. + +To begin listening to the stream, use the code below to create a `StreamSubscription` in your Flutter app and call the `listen()` method with a function that takes a `BrazeInAppMessage` instance. Remember to `cancel()` the stream subscription when it is no longer needed. +```dart +// Create stream subscription +StreamSubscription inAppMessageStreamSubscription; + +inAppMessageStreamSubscription = _braze.streamInAppMessagesController.stream.listen((inAppMessage) { + // Function to handle in-app messages +} + +// Cancel stream subscription +inAppMessageStreamSubscription.cancel(); +``` +For an example, see [main.dart](https://github.com/Appboy/flutter-sdk/blob/develop/braze_plugin/example/lib/main.dart) in our sample app. + +### Method 2: In-app message data callback (Legacy) You can set a callback in Dart to receive Braze in-app message data in the Flutter host app. @@ -91,23 +109,6 @@ To store any in-app messages triggered before the callback is available and repl ```dart BrazePlugin braze = new BrazePlugin(customConfigs: {replayCallbacksConfigKey: true}); ``` -### Method 2: In-app message data streams (Preferred) - -You can set a data stream listener in Dart to receive in-app message data in the Flutter host app. - -To begin listening to the stream, use the code below to create a `StreamSubscription` in your Flutter app and call the `listen()` method with a function that takes a `BrazeInAppMessage` instance. Remember to `cancel()` the stream subscription when it is no longer needed. -```dart -// Create stream subscription -StreamSubscription inAppMessageStreamSubscription; - -inAppMessageStreamSubscription = _braze.streamInAppMessagesController.stream.listen((inAppMessage) { - // Function to handle in-app messages -} - -// Cancel stream subscription -inAppMessageStreamSubscription.cancel(); -``` -For an example, see [main.dart](https://github.com/Appboy/flutter-sdk/blob/develop/braze_plugin/example/lib/main.dart) in our sample app. ## Test displaying a sample in-app message From a3774b7b8b170b0efbe94eee99eb6334178df5a4 Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Tue, 2 Aug 2022 15:35:03 -0400 Subject: [PATCH 06/16] added a note for legacy and recommended --- .../platform_integration_guides/flutter/inapp_messages.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 30f8cc03ec3..70c1cc0beeb 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -58,10 +58,12 @@ For an example, see [AppDelegate.swift](https://github.com/braze-inc/braze-flutt ## Receiving in-app message data -To receive in-app message data in your Flutter app, `BrazePlugin` supports two methods for receiving in-app message data. The first method uses Dart [Streams](https://dart.dev/tutorials/language/streams) (Recommended) and the second method uses a data callback (Legacy). +To receive in-app message data in your Flutter app, `BrazePlugin` supports two methods for receiving in-app message data. The first method uses Dart [Streams](https://dart.dev/tutorials/language/streams) **(Recommended)** and the second method uses a data callback **(Legacy)**. The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. +{% alert note %} The legacy data callback method is soon to be deprecated. Note that in-app messages can be accessed by both data streams and data callbacks. If you have already integrated data callbacks and wish to receive only data streams, remove any callback logic to ensure that in-app messages are processed exactly once. {% endalert %} + ### Method 1: In-app message data streams (Recommended) You can set a data stream listener in Dart to receive in-app message data in the Flutter host app. From fb2f22e66f248035d85602f1a38f0b548b71e3c8 Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Tue, 2 Aug 2022 15:38:05 -0400 Subject: [PATCH 07/16] updated wording --- .../platform_integration_guides/flutter/inapp_messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 70c1cc0beeb..30713360f7b 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -62,7 +62,7 @@ To receive in-app message data in your Flutter app, `BrazePlugin` supports two m The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. -{% alert note %} The legacy data callback method is soon to be deprecated. Note that in-app messages can be accessed by both data streams and data callbacks. If you have already integrated data callbacks and wish to receive only data streams, remove any callback logic to ensure that in-app messages are processed exactly once. {% endalert %} +{% alert note %} The legacy data callback method is soon to be deprecated. Note that in-app messages can be added to both data streams and data callbacks. If you have already integrated data callbacks and wish to receive only data streams, remove any callback logic to ensure that in-app messages are processed exactly once. {% endalert %} ### Method 1: In-app message data streams (Recommended) From 322e2fb2c2a163481b3c560bd8b46f70199fe65b Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Wed, 3 Aug 2022 17:12:04 -0400 Subject: [PATCH 08/16] Update _docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md Co-authored-by: Daniel Hok <4797040+hokstuff@users.noreply.github.com> --- .../platform_integration_guides/flutter/inapp_messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 30713360f7b..49155d95c86 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -58,7 +58,7 @@ For an example, see [AppDelegate.swift](https://github.com/braze-inc/braze-flutt ## Receiving in-app message data -To receive in-app message data in your Flutter app, `BrazePlugin` supports two methods for receiving in-app message data. The first method uses Dart [Streams](https://dart.dev/tutorials/language/streams) **(Recommended)** and the second method uses a data callback **(Legacy)**. +To receive in-app message data in your Flutter app, the `BrazePlugin` supports receiving in-app message data using Dart [Streams](https://dart.dev/tutorials/language/streams) **(Recommended)** or by using a data callback **(Legacy)**. The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. From 4ec903d1fc4590924115e5a09f0104ce08e7df0c Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Wed, 3 Aug 2022 17:13:15 -0400 Subject: [PATCH 09/16] Update _docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md Co-authored-by: Daniel Hok <4797040+hokstuff@users.noreply.github.com> --- .../platform_integration_guides/flutter/inapp_messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 49155d95c86..655bf7dc84d 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -62,7 +62,7 @@ To receive in-app message data in your Flutter app, the `BrazePlugin` supports r The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. -{% alert note %} The legacy data callback method is soon to be deprecated. Note that in-app messages can be added to both data streams and data callbacks. If you have already integrated data callbacks and wish to receive only data streams, remove any callback logic to ensure that in-app messages are processed exactly once. {% endalert %} +{% alert note %} The legacy data callback method will soon be deprecated. Note that in-app messages can be added to both data streams and data callbacks. If you have already integrated data callbacks and wish to use data streams, remove any callback logic to ensure that in-app messages are processed exactly once. {% endalert %} ### Method 1: In-app message data streams (Recommended) From afee9afbd40d0e856a5ecd9ecee6e61ca0eacb59 Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Thu, 4 Aug 2022 15:34:21 -0400 Subject: [PATCH 10/16] Updated sample code variable Changed `streamInAppMessageController` to `inAppMessageStreamController` --- .../platform_integration_guides/flutter/inapp_messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 655bf7dc84d..df7e7593328 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -73,7 +73,7 @@ To begin listening to the stream, use the code below to create a `StreamSubscrip // Create stream subscription StreamSubscription inAppMessageStreamSubscription; -inAppMessageStreamSubscription = _braze.streamInAppMessagesController.stream.listen((inAppMessage) { +inAppMessageStreamSubscription = _braze.inAppMessageStreamController.stream.listen((inAppMessage) { // Function to handle in-app messages } From ce217493d4fcd84be8cfdbce3af75f329e5faa78 Mon Sep 17 00:00:00 2001 From: Vanessa Landayan Date: Fri, 5 Aug 2022 15:39:56 -0400 Subject: [PATCH 11/16] replaced `listen` with `subscribeToInAppMessages` --- .../platform_integration_guides/flutter/inapp_messages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index df7e7593328..4017111ccd5 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -68,12 +68,12 @@ The `BrazeInAppMessage` object supports a subset of fields available in the nati You can set a data stream listener in Dart to receive in-app message data in the Flutter host app. -To begin listening to the stream, use the code below to create a `StreamSubscription` in your Flutter app and call the `listen()` method with a function that takes a `BrazeInAppMessage` instance. Remember to `cancel()` the stream subscription when it is no longer needed. +To begin listening to the stream, use the code below to create a `StreamSubscription` in your Flutter app and call the `subscribeToInAppMessages()` method with a function that takes a `BrazeInAppMessage` instance. Remember to `cancel()` the stream subscription when it is no longer needed. ```dart // Create stream subscription StreamSubscription inAppMessageStreamSubscription; -inAppMessageStreamSubscription = _braze.inAppMessageStreamController.stream.listen((inAppMessage) { +inAppMessageStreamSubscription = _braze.subscribeToInAppMessages((inAppMessage) { // Function to handle in-app messages } From 4cff64421965162c58464fe956b5715eee4bafba Mon Sep 17 00:00:00 2001 From: Daniel Hok <4797040+hokstuff@users.noreply.github.com> Date: Tue, 27 Sep 2022 14:50:12 -0400 Subject: [PATCH 12/16] Add type to IAM closure in sample code --- .../platform_integration_guides/flutter/inapp_messages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 4017111ccd5..c43da653b05 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -73,7 +73,7 @@ To begin listening to the stream, use the code below to create a `StreamSubscrip // Create stream subscription StreamSubscription inAppMessageStreamSubscription; -inAppMessageStreamSubscription = _braze.subscribeToInAppMessages((inAppMessage) { +inAppMessageStreamSubscription = _braze.subscribeToInAppMessages((BrazeInAppMessage inAppMessage) { // Function to handle in-app messages } From b437294010cdd33b3cefc3ae36c6fbb6e7470ed0 Mon Sep 17 00:00:00 2001 From: Daniel Hok <4797040+hokstuff@users.noreply.github.com> Date: Tue, 27 Sep 2022 18:27:37 -0400 Subject: [PATCH 13/16] Apply suggestions from code review Co-authored-by: Jared Poelman --- .../platform_integration_guides/flutter/inapp_messages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index c43da653b05..94609b813b5 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -58,7 +58,7 @@ For an example, see [AppDelegate.swift](https://github.com/braze-inc/braze-flutt ## Receiving in-app message data -To receive in-app message data in your Flutter app, the `BrazePlugin` supports receiving in-app message data using Dart [Streams](https://dart.dev/tutorials/language/streams) **(Recommended)** or by using a data callback **(Legacy)**. +To receive in-app message data in your Flutter app, the `BrazePlugin` supports sending in-app message data using Dart [Streams](https://dart.dev/tutorials/language/streams) **(Recommended)** or by using a data callback **(Legacy)**. The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. @@ -66,7 +66,7 @@ The `BrazeInAppMessage` object supports a subset of fields available in the nati ### Method 1: In-app message data streams (Recommended) -You can set a data stream listener in Dart to receive in-app message data in the Flutter host app. +You can set a data stream listener in Dart to receive in-app message data in your Flutter app. To begin listening to the stream, use the code below to create a `StreamSubscription` in your Flutter app and call the `subscribeToInAppMessages()` method with a function that takes a `BrazeInAppMessage` instance. Remember to `cancel()` the stream subscription when it is no longer needed. ```dart From ca4bc72ea488f03383901c48521c5712d78915a2 Mon Sep 17 00:00:00 2001 From: Daniel Hok <4797040+hokstuff@users.noreply.github.com> Date: Tue, 27 Sep 2022 18:28:35 -0400 Subject: [PATCH 14/16] Update inapp_messages.md --- .../platform_integration_guides/flutter/inapp_messages.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 94609b813b5..367529e49a4 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -69,6 +69,7 @@ The `BrazeInAppMessage` object supports a subset of fields available in the nati You can set a data stream listener in Dart to receive in-app message data in your Flutter app. To begin listening to the stream, use the code below to create a `StreamSubscription` in your Flutter app and call the `subscribeToInAppMessages()` method with a function that takes a `BrazeInAppMessage` instance. Remember to `cancel()` the stream subscription when it is no longer needed. + ```dart // Create stream subscription StreamSubscription inAppMessageStreamSubscription; From 31935a40a05ab9033de1071271380df480316327 Mon Sep 17 00:00:00 2001 From: Daniel Hok <4797040+hokstuff@users.noreply.github.com> Date: Tue, 27 Sep 2022 18:32:42 -0400 Subject: [PATCH 15/16] Update inapp_messages.md --- .../platform_integration_guides/flutter/inapp_messages.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index 367529e49a4..cf8b1e2fb11 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -81,6 +81,7 @@ inAppMessageStreamSubscription = _braze.subscribeToInAppMessages((BrazeInAppMess // Cancel stream subscription inAppMessageStreamSubscription.cancel(); ``` + For an example, see [main.dart](https://github.com/Appboy/flutter-sdk/blob/develop/braze_plugin/example/lib/main.dart) in our sample app. ### Method 2: In-app message data callback (Legacy) From fa6d71e30bbe508df0b0f91221204a2c0861230a Mon Sep 17 00:00:00 2001 From: Bre Fitzgerald Date: Wed, 28 Sep 2022 08:20:23 -0700 Subject: [PATCH 16/16] Minor style edits --- .../platform_integration_guides/flutter/inapp_messages.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md index cf8b1e2fb11..a002ca6b9e8 100644 --- a/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md +++ b/_docs/_developer_guide/platform_integration_guides/flutter/inapp_messages.md @@ -58,13 +58,13 @@ For an example, see [AppDelegate.swift](https://github.com/braze-inc/braze-flutt ## Receiving in-app message data -To receive in-app message data in your Flutter app, the `BrazePlugin` supports sending in-app message data using Dart [Streams](https://dart.dev/tutorials/language/streams) **(Recommended)** or by using a data callback **(Legacy)**. +To receive in-app message data in your Flutter app, the `BrazePlugin` supports sending in-app message data using [Dart Streams](https://dart.dev/tutorials/language/streams) (recommended) or by using a data callback (legacy). The `BrazeInAppMessage` object supports a subset of fields available in the native model objects, including `uri`, `message`, `header`, `buttons`, `extras`, and more. -{% alert note %} The legacy data callback method will soon be deprecated. Note that in-app messages can be added to both data streams and data callbacks. If you have already integrated data callbacks and wish to use data streams, remove any callback logic to ensure that in-app messages are processed exactly once. {% endalert %} +{% alert note %} The legacy data callback method will soon be deprecated. In-app messages can be added to both data streams and data callbacks. If you have already integrated data callbacks and wish to use data streams, remove any callback logic to ensure that in-app messages are processed exactly once. {% endalert %} -### Method 1: In-app message data streams (Recommended) +### Method 1: In-app message data streams (recommended) You can set a data stream listener in Dart to receive in-app message data in your Flutter app.