![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
react-native-ua
Advanced tools
This plugin provides client-side integration for the Urban Airship Engage Platform in iOS and Android app environment.
In your React Native project, install the following module:
npm install react-native-ua --save
android/settings.gradle
in your React Native project:include ':react-native-ua'
project(':react-native-ua').projectDir = file('../node_modules/react-native-ua/android')
react-native-ua
module in your app compile dependencies, inside the android/app/build.gradle
file:// ...
dependencies {
// ...
compile project(':react-native-ua') // add react-native-ua module
}
android/app/src/main/assets/airshipconfig.properties
file and update it with your Urban Airship App's data:gcmSender = Your GCM sender ID (Your Google API project number)
developmentAppKey = Your Development App Key
developmentAppSecret = Your Development App Secret
# If inProduction is true set production key and secret
inProduction = false
productionAppKey = Your Production App Key
productionAppSecret = Your Production Secret
MainApplication.java
, located at android/app/src/main/java/your/app/domain
, add the ReactNativeUAPackage
to your app package list:// ...
import com.globo.reactnativeua.ReactNativeUAPackage; // import react-native-ua package
public class MainApplication extends Application implements ReactApplication {
// ...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
// ...
new ReactNativeUAPackage() // set react-native-ua package using application
);
}
}
Find the ReactNativeUAIOS.xcodeproj
file within node_modules/react-native-ua/ios
and drag it into the Libraries
node in Xcode.
Add AirshipConfig.plist
from folder ios/
in the project node
Edit the file and add your App Key, App Secret and App Master Secret, the same used within Urban Airship setup (⚙ > APIs & Integrations > Urban Airship API
).
Back to the project node, select the Targets section:
In the Build Settings tab, go to Linking > Other Linker Flags and include the following tags:
-ObjC
-lz
-lsqlite3
Then go to Search Paths > Header Search Paths, add the following path and select the recursive option:
$(SRCROOT)/../node_modules/react-native-ua/ios
Open the Link Binary With Libraries section, click on the plus sign (➕) and select libReactNativeUAIOS.a
from Workspace.
Now expand the Copy Bundle Resources, click on the plus sign (➕) and add the following file:
node_modules/react-native-ua/ios/Libraries/Airship/AirshipResources.bundle
AppDelegate.m
, import ReactNativeUAIOS.h
and setup the module. Follow the example below:#import "ReactNativeUAIOS.h"
// ...
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// setup react native urban airship using AirshipConfig.plist (the default way)
[ReactNativeUAIOS setupUrbanAirship:launchOptions];
// OR setup react native urban airship programmatically. The following example use the content of AirshipConfig-dev.plist instead of the default AirshipConfig.plist
NSString *configPath = [[NSBundle mainBundle] pathForResource:@"AirshipConfig-dev" ofType:@"plist"];
UAConfig *config = [UAConfig configWithContentsOfFile:configPath];
[ReactNativeUAIOS setupUrbanAirship:launchOptions withConfig:config];
// ...
}
// ...
@end
url
property;componentWillMount()
of the component lifecycle.import React, { Component } from 'react';
import {
AppRegistry,
Text,
View
} from 'react-native';
import ReactNativeUA from 'react-native-ua'; // import module
class SampleApp extends Component {
constructor(props) {
super(props);
ReactNativeUA.enable_notification(); // prompt user to enable notification
ReactNativeUA.enable_geolocation(); // prompt user to enable geolocation
ReactNativeUA.enable_action_url(); // enable url action
ReactNativeUA.handle_background_notification(); // handle notifications when app is in background
ReactNativeUA.add_tag('tag'); // set tag to the user
ReactNativeUA.set_named_user_id('user_id'); // set named user id
ReactNativeUA.set_quiet_time_enabled(true); // activate a quiet period
ReactNativeUA.set_quiet_time({
startHour: 22,
startMinute: 0,
endHour: 7,
endMinute: 0
}); // set the period to 22:00-07:00
}
componentWillMount() {
// add handler to handle all incoming notifications
ReactNativeUA.on_notification((notification) => {
console.log('notification:',
notification.url, // if action url is disabled
notification.platform,
notification.event,
notification.alert,
notification.data);
alert(notification.alert);
});
// Check if user enabled notifications
ReactNativeUA.are_notifications_enabled().then(enabled => {
console.log('notifications enabled:', enabled);
})
// Get channel id for device
ReactNativeUA.get_channel_id().then(channelId => {
console.log('channel id:', channelId);
})
}
render () {
return (
<View>
<Text>ReactNativeUA</Text>
</View>
);
}
}
AppRegistry.registerComponent('SampleApp', () => SampleApp);
FAQs
React Native module for Urban Airship platforms: iOS and Android
The npm package react-native-ua receives a total of 1 weekly downloads. As such, react-native-ua popularity was classified as not popular.
We found that react-native-ua demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.