1.1.1 • Published 1 year ago

whalecloud-dxp-nudges-react-native v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

whalecloud-dxp-nudges-react-native

whalecloud-Nudges

Installation

npm install whalecloud-dxp-nudges-react-native

目前还没发布npm所以 yarn add file:../whalecloud-dxp-ads-react-native

Usage

1 Android项目里面需要再 app 文件夹下面的build.gradle 加入implementation project(':whalecloud-dxp-nudges-react-native')

2 先在Android 工程的 Application 里调用 init如下 并且配置url以及config如下
//Nudges
 WhalecloudDxpAdsReactNativeModule.initAds(this,"http://172.16.22.5:9110");
//        DXP  NUDGES 后端服务地址

String DXP_NUDGES_BASE_URL = "http://172.16.22.5:9110/portal-web/dmc/mccm-outer/";
DxpNudgesUtil.setNudgesBaseUrl(DXP_NUDGES_BASE_URL);

//DXP  NUDGES CEG 后web Socket地址
String DXP_NUDGES_CEG_BASE_URL = "http://10.10.177.38/ceg/ceg/";
String DXP_NUDGES_CEG_WS_URL = "ws://10.10.177.38/ceg/ceg/nudges/socket";

DxpNudgesUtil.setCegNudgesBaseUrl(DXP_NUDGES_CEG_BASE_URL);
DxpNudgesUtil.setCegNudgesWsBaseUrl(DXP_NUDGES_CEG_WS_URL);
//Nudges
WhalecloudDxpNudgesReactNativeModule.init(this);//        默认设置
WhalecloudDxpNudgesReactNativeModule.initNudgesConfig("ditoapp","MzUzOWQ2YzY4NjJmYWMzOWQ5ZGIxMjFm");

3 在MainActivity 上 实现 IRouteName
重写
 @Override
  public String getRouterName() {
    return WhalecloudDxpNudgesReactNativeModule.currentPage;
  }
import { DXPNudges } from './whalecloud-dxp-nudges-react-native';

DXPNudges.setOnNudgesShowListener();
DXPNudges.setOnNudgesButtonClickListener();

调用好后在NavigationContainer 里面加入 onStateChange 监听页面变化调用DXPNudges.startNudges(url)
例子:
    <NavigationContainer
        onStateChange={state => {
        const currentRoute = state.routes[state.index];
        console.log('Current route:', currentRoute.name);
        DXPNudges.startNudges(currentRoute.name)
        }}>
1.1.1

1 year ago

1.0.19

1 year ago

1.1.0

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.7

1 year ago

1.0.12

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago