customerio / customerio-android

This is the official Customer.io SDK for Android.
MIT License
13 stars 9 forks source link

feat: Pass options using postMessage: DO NOT MERGE #440

Closed stephen-pope-customer-io closed 1 week ago

stephen-pope-customer-io commented 2 months ago

The idea here is to support passing the options data to the gist-web-renderer using postMessage instead of passing it as a url parameter.

Required: gist-web-renderer PR here: https://github.com/customerio/gist-web-renderer/pull/17

This is currently working in a similar gist-web PR here: https://github.com/customerio/gist-web/pull/66

Linear issue: https://linear.app/customerio/issue/INAPP-12777/request-header-too-large-preventing-in-app-messages-from-rendering

This is work in progress. Currently on my machine with the gist-web-renderer PR I get this in my logs, which I believe is a CORS issue.

JavaScript injected for postMessage Flutter Web Bootstrap: Auto. -- From line 7380 of http://192.168.2.86:8080/web/main.dart.js Message received base -- From line 1 of http://192.168.2.86:8080/web/main.min.js Message received json: {"isTrusted":true} -- From line 1 of http://192.168.2.86:8080/web/main.min.js Message received orig: [object Object] -- From line 1 of http://192.168.2.86:8080/web/main.min.js Options received: {"dataCenter":"us","endpoint":"https://engine.api.dev.gist.build","instanceId":"77140a57-2e78-446a-a504-b89fefa10e80","livePreview":false,"messageId":"gist-html-01J87SG3MHFFVP758GX91CFJBR","properties":{"gist":{"encodedMessageHtml":"H4sIAAAAAAAA/7x625LjyHHo+35FLjeknVEMk3W/sJujWFFHp+0YyQrL2w/7okCTRRJqEKABsC/bMV/gJ3+Bf9Gf4MgCCiDZM5IVIXfPRDezMivvmZVF4BuA62/X1ap9PgTYtfviI63QByiycruYHMv1BNZ5vZhkx7aaEJoIQrbuPgJc70ObwWqX1U1oF5Nju5m6CcwG9LfTKfxrWFX7fSjXYQ0PeXg8VHULbQWhbI51gLycZodDA80qKwIc6uoQ6uIZslVdNQ2sw0O+Cg1Mp2ci+88AZbYPi0liOxnWV1XZhrJdTB7zdbtbdGymEfgAeZm3eVZMo8gFR/YB9tlTvj/uT5eOTagjnN0VYcES79m57Z0Cq6qoiHgX9mEyCi+rep8Vpw5p87YIH69n3d+02rTPIwQwr6uq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WBiDubo1Dra1Z9jAojsyRSjStsrGtXrjsp98TQyaohJBrbpckT5qYkkILDcZbdNRPOTopZWTAhEjw0lLuGTvihUEtFO23jGkgJyjuE/+bXt5bnHlMIBMGlEHDWSxqrbRZOsbQODrcUSgjwHqHV Loading message -- From line 1 of http://192.168.2.86:8080/web/main.min.js organizationId: undefined -- From line 1 of http://192.168.2.86:8080/web/main.min.js Message global timeout, cancelling display. GistView Error loading engine Store: action: MessageLoadingFailed(message=Message(messageId=gist-html-01J87SG3MHFFVP758GX91CFJBR, instanceId=77140a57-2e78-446a-a504-b89fefa10e80, priority=10, queueId=01e0fb5e-7117-481d-a204-d786d0669348, properties=GistProperties(routeRule=null, elementId=null, campaignId=null, position=CENTER, persistent=false)) Store: state before reducer: InAppMessagingState(siteId='0f4234d28520fd1619d0', dataCenter='us', environment=DEV, pollInterval=10000, userId=stephen.pope+gist@customer.io, currentRoute=Dashboard, currentMessageState=Loading(message=Message(messageId=gist-html-01J87SG3MHFFVP758GX91CFJBR, instanceId=77140a57-2e78-446a-a504-b89fefa10e80, priority=10, queueId=01e0fb5e-7117-481d-a204-d786d0669348, properties=GistProperties(routeRule=null, elementId=null, campaignId=null, position=CENTER, persistent=false)), messagesInQueue=[01e0fb5e-7117-481d-a204-d786d0669348], shownMessageQueueIds=[]) Error occurred on message: Message(messageId=gist-html-01J87SG3MHFFVP758GX91CFJBR, instanceId=77140a57-2e78-446a-a504-b89fefa10e80, priority=10, queueId=01e0fb5e-7117-481d-a204-d786d0669348, properties=GistProperties(routeRule=null, elementId=null, campaignId=null, position=CENTER, persistent=false) in-app message: errorWithMessage. message: InAppMessage(messageId=gist-html-01J87SG3MHFFVP758GX91CFJBR, queueId=01e0fb5e-7117-481d-a204-d786d0669348, deliveryId=null) track an event with name in-app message action and attributes {delivery-id=NULL, event-name=errorWithMessage, message-id=gist-html-01J87SG3MHFFVP758GX91CFJBR} JavaScript injected for postMessage Access to XMLHttpRequest at 'https://engine-consumer-api.cloud.dev.gist.build/api/v2/configuration?cioSiteId=0f4234d28520fd1619d0&cioDatacenter=us&random=0' from origin 'http://192.168.2.86:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. -- From line 0 of http://192.168.2.86:8080/web/index.html#/ Uncaught -- From line 6090 of http://192.168.2.86:8080/web/main.dart.js

Complete each step to get your pull request merged in. Learn more about the workflow this project uses.

github-actions[bot] commented 2 months ago
# Sample app builds 📱 Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request. --- * java_layout: `feature/support-larger-messages (1727097208)` * kotlin_compose: `feature/support-larger-messages (1727097201)`
codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 7.69231% with 24 lines in your changes missing coverage. Please review.

Project coverage is 51.00%. Comparing base (8b30804) to head (ba07d07). Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
...inginapp/gist/presentation/engine/EngineWebView.kt 0.00% 22 Missing :warning:
...io/customer/messaginginapp/gist/GistEnvironment.kt 0.00% 1 Missing :warning:
...tomer/messaginginapp/gist/presentation/GistView.kt 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #440 +/- ## ============================================ + Coverage 41.98% 51.00% +9.02% - Complexity 259 287 +28 ============================================ Files 99 95 -4 Lines 2320 2278 -42 Branches 344 358 +14 ============================================ + Hits 974 1162 +188 + Misses 1247 1016 -231 - Partials 99 100 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

github-actions[bot] commented 2 months ago

📏 SDK Binary Size Comparison Report

No changes detected in SDK binary size ✅

github-actions[bot] commented 2 months ago

Build available to test Version: feature-support-larger-messages-SNAPSHOT Repository: https://s01.oss.sonatype.org/content/repositories/snapshots/

Shahroz16 commented 1 week ago

the work has been merged.