branch.io custom event in react native is not triggering reward rule - react-native

I have a react native project that is dedicated towards building iOS application. I set identity branch.setIdentity('yashKalwani'); this way then i create a branch universal object as shown in documentation.
let branchUniversalObject = await branch.createBranchUniversalObject('canonicalIdentifier', {
title: 'Cool Content!',
contentDescription: 'Cool Content Description',
contentMetadata: {
customMetadata: {
customMetadata1: 'abcd',
customMetadata2: 'efgh'
}
}
});
I now trigger a custom event new BranchEvent('threepoints', branchUniversalObject).logEvent() but this custom event does not trigger the rule that I have inside my rewards in branch.io dashboard.
Rule: all acting users get 3 default credits every time they trigger the event threepoints.
Am i missing out on something? Why is the rule not triggering even though the event is being logged in my Dashboard. I am able to view that the custom event has been fired via my liveview event tracking feature.

Currently for the referrals feature, v2 events are not supported:
https://docs.branch.io/pages/viral/referrals/#guide
This means that you cannot use logEvent. You must use userCompletedAction instead e.g. branch.userCompletedAction('threepoints'):
Example

Related

In Nuxt/VueJs, how can I get SendInBlue Chat Widget to see route changes?

I'm using SendInBlue chat widget on a Nuxt/VueJs website. Through the
SendInBlue Conversations UI,
the widget reports the visitor's page current location (url and title).
However, the location does not change when the internal route changes (no hard browser location change).
I want to see the location changes.
How can I notify the SendInBlue Chat Widget that the route is changing?
The
SendInBlue Chat Widget API
includes a pageView method that can be called to alert the widget to a route change.
SibConversations('pageView')
This Answer about watching a route
provides the basic framework. Note that in my case I added the code to the /layouts/default.vue since it renders most of my pages. (Add to all necessary layouts.)
<script>
export default {
watch: {
$route() {
// on route change, notify SendInBlue Chat Widget so it updates visitor location
if (process.client) {
// delay 0.5 seconds to be sure route has actually changed ($nexttick does show correct page title)
window.setTimeout(() => {
window.SibConversations('pageView')
}, 500)
}
},
},
// ... and data, methods, etc., as needed
}
</script>
So now when the route changes, we notify the widget.
Note: If we trigger window.SibConversations('pageView') without a delay, I found that the title is not correct. I'm assuming the page is not yet rendered. I tried using this.$nexttick, but the title is still not present. So, I use window.setTimeout() to provide a short delay. I found that 100ms works for me, but I used a longer time in case a slower computer took longer. (And we aren't worried about half-second accuracy.)
I also wrapped the call to ensure it's only called on client side. No nasty "windows undefined" errors.

React Native + Firebase Google Login - onAuthStateChange vs Context

I'm not sure how to use onAuthStateChange and Context
I am populating user in context and then I check for user with:
import {useAuth} from '../contexts/auth';
const { usuario } = useAuth();
if(!user)....
I don't really understand how and why I should use onAuthStateChange.
The onAuthStateChanged allows you receive an even when the authentication state changes, for example the user logs in or out. You can subscribe to the event and handle rendering based on the authentication state. Essentially you use it to populate or depopulate the user in your context.
For an example from the documentation see here.

How to get the object from API and update it in flutter

I am developing a registration screen in flutter when user signup with their detail the id will autogenerated from API i want to use the id for next page for updating the rest of user details,
I got the response from API in signup but I don't know how to take the specific object from response and used into another page then update the user details. please help me for this.
Well, if i got it right without an example, you can store that value that you retrieve from APi and store in a variable and after simply pass that variable to another page with Navigator.push method.
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SecondScreen(text: 'Json API',),
),
);
},
A more complex way store that value in system Preference and simply get access to those value from all the app. You can use this package

Target specific Element UI notification

I'm starting to use Element UI on a Vue app and can't see any obvious way to target a specific Notification instance.
As an example. I have a Vuex action that is triggering an info notification like so
Notification.info({
duration: 0,
title: 'Generating PDF',
message: 'Please standby...',
position: 'bottom-left'
})
Once I get a response from the rest of the action, I then want to dismiss that particular notification and replace it with another, but the options for a notification doesn't have even as much as an id option to tap into.
I can't be alone in having the need to target a specific notification instance?
According to the documentation of element ui:
Notification and this.$notify returns the current Notification
instance. To manually close the instance, you can call close on it.
Or Notification.closeAll to close all notifications at once

MobileFirst Analytics Creating a Custom Chart

I wanted to see how many times users visited that certain screen/page of my application using MFP Analytics. I'm wondering if I can use the analytics logs and make a log per screen and create a custom chart for the logs?
I based my assumptions on this mobilefirst tutorial:
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.0/moving-production/operational-analytics/
Yes, you can use the following to log the page.
WL.Analytics.log({page: 'pageA'}, 'Custom event for visiting page A');
WL.Analytics.send()
Then you can send it to the analytics console with WL.Analytics.send().
You can use a setTimeout function if you want to send it immediately after logging, so that you can ensure that there is time for the log to write to the disk before it is sent.
setTimeout(function () {
WL.Analytics.send();
}, 300);
Then you can create a custom chart in the analytics console with custom activities, property "page."
Yes, you can do this. It is as simple as creating a custom event such as "page X was visited" and on every load of a page, log the action (of loading it) and then send it back to the Analytics server. You can then splice your analytics data per page (event).
You can see this explained and demoed in the following:
https://mobilefirstplatform.ibmcloud.com/blog/2016/01/22/howto-custom-in-app-behavior-analytics/ (blog + video)
collecting custom data: https://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.monitor.doc/monitor/t_collecting_custom_data.html (documentation)
creating a custom chart based on it: https://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.monitor.doc/monitor/t_creating_a_custom_chart.html (documentation)