New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

countly-sdk-react-native-bridge

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

countly-sdk-react-native-bridge - npm Package Compare versions

Comparing version 19.8.5 to 19.8.6

79

Countly.js

@@ -51,7 +51,11 @@ /**

}
Countly.isInitialized = function(){
return CountlyReactNative.isInitialized([]);
// returns a promise
return CountlyReactNative.isInitialized();
}
Countly.hasBeenCalledOnStart = function(){
return CountlyReactNative.hasBeenCalledOnStart([]);
// returns a promise
return CountlyReactNative.hasBeenCalledOnStart();
}

@@ -104,26 +108,7 @@

}
Countly.recordView = function(recordView){
CountlyReactNative.recordView([recordView || ""]);
};
// As per the above documentation apply auto tracking method.
// https://reactnavigation.org/docs/screen-tracking
Countly.previousRouteName = "";
Countly.autoTrackingView = function(state){
const currentRouteName = getActiveRouteName(state);
if(currentRouteName != Countly.previousRouteName){
Countly.recordView(currentRouteName);
}
Countly.previousRouteName = currentRouteName;
};
const getActiveRouteName = function(state){
const route = state.routes[state.index];
if (route.state) {
// Dive into nested navigators
return getActiveRouteName(route.state);
}
return route.name;
};
Countly.setViewTracking = function(boolean){

@@ -136,3 +121,7 @@ CountlyReactNative.setViewTracking([boolean || "false"]);

args.push(tokenType || "");
CountlyReactNative.pushTokenType(args);
if(CountlyReactNative.pushTokenType){
CountlyReactNative.pushTokenType(args);
}else{
console.log("CountlyReactNative.pushTokenType is only supported in iOS");
}
}

@@ -150,3 +139,7 @@ Countly.sendPushToken = function(options){

var event = eventEmitter.addListener('onCountlyPushNotification', theListener);
CountlyReactNative.registerForNotification([]);
if(CountlyReactNative.registerForNotification){
CountlyReactNative.registerForNotification([]);
}else{
console.log("Countly.registerForNotification is only available for iOS");
}
return event;

@@ -470,17 +463,31 @@ };

Countly.getRemoteConfigValueForKey = function(keyName, callback){
CountlyReactNative.getRemoteConfigValueForKey([keyName.toString() || ""], (stringItem) => {
callback(stringItem);
CountlyReactNative.getRemoteConfigValueForKey([keyName.toString() || ""], (value) => {
if (Platform.OS == "android" ) {
try {
value = JSON.parse(value);
}
catch (e) {
// console.log(e.message);
// noop. value will remain string if not JSON parsable and returned as string
}
}
callback(value);
});
}
Countly.getRemoteConfigValueForKeyP = async function(keyName){
try {
const value = await CountlyReactNative.getRemoteConfigValueForKeyP(keyName);
console.log("value for key", keyName, value);
return value;
}
catch (e) {
console.log("value not found for key", keyName);
return `Value not found for key: ${keyName}`;
}
Countly.getRemoteConfigValueForKeyP = function(keyName){
if (Platform.OS != "android" ) return "To be implemented";
const promise = CountlyReactNative.getRemoteConfigValueForKeyP(keyName);
return promise.then(value => {
if (Platform.OS == "android" ) {
try {
value = JSON.parse(value);
}
catch (e) {
// console.log(e.message);
// noop. value will remain string if not JSON parsable and returned as string
}
}
return value;
})
}

@@ -487,0 +494,0 @@

@@ -5,17 +5,20 @@ import React, { Component } from 'react';

// import { PushNotificationIOS } from 'react-native';
// import { NavigationContainer } from '@react-navigation/native';
// import { createStackNavigator } from '@react-navigation/stack';
// import StackTrace from '/Countly.StackTrace.js';
// import stacktrace from 'react-native-stacktrace';
// var PushNotification = require('react-native-push-notification');
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
Countly.autoTrackingView = function(state){
function autoTrackingView(state){
var viewName = state.routes[state.routes.length -1].name;
console.log("autoTrackingView");
console.log(viewName);
Countly.recordView(viewName);
}
// // Auto Navigation Example.
// const Stack = createStackNavigator();
// export const navigationRef = React.createRef();
// export function navigate(name){
// navigationRef.current?.navigate(name);
// }
// Auto Navigation Example.
const Stack = createStackNavigator();
export const navigationRef = React.createRef();
export function navigate(name){
navigationRef.current?.navigate(name);
}

@@ -66,11 +69,10 @@ class PageOne extends Component {

return (
<Example />
// <NavigationContainer onStateChange={Countly.autoTrackingView}>
// <Stack.Navigator initialRouteName="Example">
// <Stack.Screen name="Example" component = {Example} />
// <Stack.Screen name="PageOne" component={PageOne} />
// <Stack.Screen name="PageTwo" component={PageTwo} />
// <Stack.Screen name="PageThree" component={PageThree} />
// </Stack.Navigator>
// </NavigationContainer>
<NavigationContainer ref={navigationRef} onStateChange={autoTrackingView}>
<Stack.Navigator initialRouteName="Example">
<Stack.Screen name="Example" component = {Example} />
<Stack.Screen name="PageOne" component={PageOne} />
<Stack.Screen name="PageTwo" component={PageTwo} />
<Stack.Screen name="PageThree" component={PageThree} />
</Stack.Navigator>
</NavigationContainer>
)

@@ -77,0 +79,0 @@ }

{
"name": "countly-sdk-react-native-bridge",
"version": "19.8.5",
"version": "19.8.6",
"author": {

@@ -5,0 +5,0 @@ "name": "Trinisoft Technologies",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc