https://github.com/entria/react-native-datami
https://github.com/entria/react-native-datami
datami react-native
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/entria/react-native-datami
- Owner: entria
- Created: 2017-02-23T21:41:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-20T19:39:29.000Z (about 9 years ago)
- Last Synced: 2025-04-12T09:12:29.284Z (about 1 year ago)
- Topics: datami, react-native
- Language: Objective-C++
- Size: 2.39 MB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-datami
## Getting started
`$ npm install react-native-datami --save`
### Mostly automatic installation
`$ react-native link react-native-datami`
### Manual installation
#### iOS
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-datami` and add `RNDatami.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNDatami.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<
### How I did it
Search all `NSURLSessionConfiguration` references, and add this line after it
```objective-c
[SmiSdk registerAppConfiguration: configuration];
```
#### Example
```diff
(NSURLSessionDataTask *)sendRequest:(NSURLRequest *)request
withDelegate:(id)delegate
{
// Lazy setup
if (!_session && [self isValid]) {
NSOperationQueue *callbackQueue = [NSOperationQueue new];
callbackQueue.maxConcurrentOperationCount = 1;
callbackQueue.underlyingQueue = [[_bridge networking] methodQueue];
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
+ [SmiSdk registerAppConfiguration: configuration];
_session = [NSURLSession sessionWithConfiguration:configuration
delegate:self
delegateQueue:callbackQueue];
std::lock_guard lock(_mutex);
_delegates = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory
valueOptions:NSPointerFunctionsStrongMemory
capacity:0];
}
NSURLSessionDataTask *task = [_session dataTaskWithRequest:request];
{
std::lock_guard lock(_mutex);
[_delegates setObject:delegate forKey:task];
}
[task resume];
return task;
}
```
#### Android
This is only needed on iOS