react-native-okhi 1.0.20-beta → 1.0.23-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -2
- package/README.md +15 -160
- package/android/build.gradle +117 -40
- package/android/gradle.properties +5 -0
- package/android/src/main/java/com/reactnativeokhi/OkhiModule.java +12 -20
- package/ios/OkHiExtension.swift +1 -2
- package/ios/OkHiStruct.swift +2 -2
- package/ios/Okhi.xcodeproj/project.pbxproj +5 -53
- package/ios/Okhi.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -3
- package/lib/commonjs/OkCollect/Helpers.js.map +1 -1
- package/lib/commonjs/OkCollect/OkHiLocationManager.js.map +1 -1
- package/lib/commonjs/OkCollect/Spinner.js.map +1 -1
- package/lib/commonjs/OkCollect/Util.js.map +1 -1
- package/lib/commonjs/OkCollect/index.js.map +1 -1
- package/lib/commonjs/OkCollect/types.js.map +1 -1
- package/lib/commonjs/OkCore/Helpers.js.map +1 -1
- package/lib/commonjs/OkCore/OkHiAuth.js.map +1 -1
- package/lib/commonjs/OkCore/OkHiException.js.map +1 -1
- package/lib/commonjs/OkCore/OkHiMode.js.map +1 -1
- package/lib/commonjs/OkCore/_helpers.js.map +1 -1
- package/lib/commonjs/OkCore/_types.js.map +1 -1
- package/lib/commonjs/OkCore/index.js.map +1 -1
- package/lib/commonjs/OkCore/types.js.map +1 -1
- package/lib/commonjs/OkHiNativeModule/index.js +10 -1
- package/lib/commonjs/OkHiNativeModule/index.js.map +1 -1
- package/lib/commonjs/OkVerify/index.js.map +1 -1
- package/lib/commonjs/OkVerify/types.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/OkCollect/Helpers.js.map +1 -1
- package/lib/module/OkCollect/OkHiLocationManager.js.map +1 -1
- package/lib/module/OkCollect/Spinner.js.map +1 -1
- package/lib/module/OkCollect/Util.js.map +1 -1
- package/lib/module/OkCollect/index.js.map +1 -1
- package/lib/module/OkCollect/types.js.map +1 -1
- package/lib/module/OkCore/Helpers.js.map +1 -1
- package/lib/module/OkCore/OkHiAuth.js.map +1 -1
- package/lib/module/OkCore/OkHiException.js.map +1 -1
- package/lib/module/OkCore/OkHiMode.js.map +1 -1
- package/lib/module/OkCore/_helpers.js.map +1 -1
- package/lib/module/OkCore/_types.js.map +1 -1
- package/lib/module/OkCore/index.js.map +1 -1
- package/lib/module/OkCore/types.js.map +1 -1
- package/lib/module/OkHiNativeModule/index.js +11 -2
- package/lib/module/OkHiNativeModule/index.js.map +1 -1
- package/lib/module/OkVerify/index.js.map +1 -1
- package/lib/module/OkVerify/types.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/OkCollect/Helpers.d.ts +2 -2
- package/lib/typescript/OkHiNativeModule/index.d.ts +0 -1
- package/lib/typescript/OkVerify/index.d.ts +4 -4
- package/package.json +24 -27
- package/react-native-okhi.podspec +18 -2
- package/src/OkCollect/{index.tsx → index.ts} +0 -0
- package/src/OkCore/Helpers.ts +4 -4
- package/src/OkHiNativeModule/index.ts +17 -3
- package/android/.classpath +0 -6
- package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.1.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/android.iml +0 -2
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -21
- package/android/.idea/jarRepositories.xml +0 -45
- package/android/.idea/misc.xml +0 -5
- package/android/.idea/vcs.xml +0 -6
- package/android/.idea/workspace.xml +0 -56
- package/android/.project +0 -34
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -183
- package/android/gradlew.bat +0 -100
- package/android/local.properties +0 -8
- package/android/src/main/java/com/reactnativeokhi/RNOkHiCore.java +0 -18
- package/ios/Okhi.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/Okhi.xcodeproj/project.xcworkspace/xcuserdata/kiano.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Okhi.xcodeproj/xcuserdata/kiano.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
package/LICENSE
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
3
|
+
Copyright (c) 2022 OkHi
|
|
5
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
7
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -1,174 +1,29 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
The official OkHi React Native library will enable you to start collecting and verifying your user's addresses.
|
|
4
|
-
|
|
5
|
-
# Prerequisites
|
|
6
|
-
|
|
7
|
-
## OkHi Client Key and Branch Id
|
|
8
|
-
|
|
9
|
-
First you need to obtain your OkHi client key and branch ID. You can get these by signing up [here](https://docs.google.com/forms/d/e/1FAIpQLSed2rhgKQ8iv-xiJrJnDqOTaPiP6c7oE7DzrhTPF_d3VTihDQ/viewform).
|
|
10
|
-
Use your sandbox keys while you test and develop, and your production mode keys before you publish your app.
|
|
11
|
-
|
|
12
|
-
## Android
|
|
13
|
-
|
|
14
|
-
### Change your minSdkVersion target
|
|
15
|
-
|
|
16
|
-
This library targets android devices >= SDK 23. Make sure you're targeting at-least the same by modifying your `android/build.gradle` file
|
|
17
|
-
|
|
18
|
-
```gradle
|
|
19
|
-
minSdkVersion = 23
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Add necessary permissions to your `AndroidManifest.xml`
|
|
23
|
-
|
|
24
|
-
```xml
|
|
25
|
-
<manifest ...>
|
|
26
|
-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
27
|
-
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
|
28
|
-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
29
|
-
<uses-permission android:name="android.permission.INTERNET" />
|
|
30
|
-
...
|
|
31
|
-
|
|
32
|
-
<application>
|
|
33
|
-
...
|
|
34
|
-
</application>
|
|
35
|
-
|
|
36
|
-
</manifest>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
If you're targeting Android versions > 8 and you're using the OkVerify library you need to make sure your users select on "Allow always" when granting permissions otherwise the verification process won't work.
|
|
40
|
-
|
|
41
|
-
## iOS
|
|
42
|
-
|
|
43
|
-
### Enable background mode in your application
|
|
44
|
-
|
|
45
|
-
OkHi obtains verification signals in the background, to enable this make sure to add "Location updates" and "Background fetch" to your Background Modes under Signing & Capabilities of your target.
|
|
46
|
-
|
|
47
|
-

|
|
48
|
-
|
|
49
|
-
### Change your deployment target
|
|
50
|
-
|
|
51
|
-
All OkHi React Native libraries target ios devices >= 12. Make sure you're targeting at-least the same by modifying your both your Podfile and deployment target in xcode.
|
|
52
|
-
|
|
53
|
-

|
|
54
|
-
|
|
55
|
-
Podile located under: `ios/Podfile`
|
|
56
|
-
|
|
57
|
-
```xml
|
|
58
|
-
platform :ios, '12.0'
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### Add necessary permissions to your `Info.plist`
|
|
62
|
-
|
|
63
|
-
```xml
|
|
64
|
-
<key>NSLocationWhenInUseUsageDescription</key>
|
|
65
|
-
<string>String that explains why you need when in use location permission</string>
|
|
66
|
-
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
|
67
|
-
<string>String that explains why you need always location permission</string>
|
|
68
|
-
```
|
|
69
|
-
|
|
1
|
+
# react-native-okhi
|
|
2
|
+
The OkHi React Native library enables you to collect and verify addresses from your users
|
|
70
3
|
## Installation
|
|
71
4
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
```yaml
|
|
75
|
-
yarn add react-native-okhi react-native-webview
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Finally install all required pods by running the following command in the ios directory
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
cd ios/ && pod install && cd ../
|
|
5
|
+
```sh
|
|
6
|
+
npm install react-native-okhi
|
|
82
7
|
```
|
|
83
8
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
## Initialization
|
|
9
|
+
## Usage
|
|
87
10
|
|
|
88
|
-
|
|
11
|
+
```js
|
|
12
|
+
import { multiply } from "react-native-okhi";
|
|
89
13
|
|
|
90
|
-
|
|
91
|
-
import * as OkHi from 'react-native-okhi';
|
|
14
|
+
// ...
|
|
92
15
|
|
|
93
|
-
|
|
94
|
-
credentials: {
|
|
95
|
-
branchId: '<my_branch_id>',
|
|
96
|
-
clientKey: '<my_client_key>',
|
|
97
|
-
},
|
|
98
|
-
context: {
|
|
99
|
-
mode: 'sandbox',
|
|
100
|
-
},
|
|
101
|
-
notification: {
|
|
102
|
-
title: 'Address verification in progress',
|
|
103
|
-
text: 'Tap here to view your verification status.',
|
|
104
|
-
channelId: 'okhi',
|
|
105
|
-
channelName: 'OkHi Channel',
|
|
106
|
-
channelDescription: 'OkHi verification alerts',
|
|
107
|
-
},
|
|
108
|
-
})
|
|
109
|
-
.then(() => console.log('init done'))
|
|
110
|
-
.catch(console.log);
|
|
16
|
+
const result = await multiply(3, 7);
|
|
111
17
|
```
|
|
112
18
|
|
|
113
|
-
##
|
|
114
|
-
|
|
115
|
-
```javascript
|
|
116
|
-
import React, { useState, useEffect } from 'react';
|
|
117
|
-
import { View, Text } from 'react-native';
|
|
118
|
-
import { OkHiLocationManager, canStartVerification } from 'react-native-okhi';
|
|
119
|
-
|
|
120
|
-
const App = () => {
|
|
121
|
-
const [launch, setLaunch] = useState(false);
|
|
19
|
+
## Contributing
|
|
122
20
|
|
|
123
|
-
|
|
124
|
-
canStartVerification({ requestServices: true }).then((result) => {
|
|
125
|
-
setLaunch(result);
|
|
126
|
-
}); // checks & requests for required services for verification to run
|
|
127
|
-
});
|
|
21
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
128
22
|
|
|
129
|
-
|
|
130
|
-
phone: '+254712345678', // required
|
|
131
|
-
firstName: 'Julius',
|
|
132
|
-
lastName: 'Kiano',
|
|
133
|
-
};
|
|
23
|
+
## License
|
|
134
24
|
|
|
135
|
-
|
|
136
|
-
console.log(response.user); // user information
|
|
137
|
-
console.log(response.location); // address information
|
|
138
|
-
await response.startVerification();
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const handleOnError = (error) => {
|
|
142
|
-
console.log(error.code); // user information
|
|
143
|
-
console.log(error.message); // address information
|
|
144
|
-
setLaunch(false);
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
if (launch) {
|
|
148
|
-
return (
|
|
149
|
-
<View style={{ flex: 1 }}>
|
|
150
|
-
<OkHiLocationManager
|
|
151
|
-
user={user}
|
|
152
|
-
launch={launch}
|
|
153
|
-
onSuccess={handleOnSuccess}
|
|
154
|
-
onCloseRequest={() => setLaunch(false)} // called when user taps on the top right close button
|
|
155
|
-
onError={handleOnError}
|
|
156
|
-
/>
|
|
157
|
-
</View>
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return (
|
|
162
|
-
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
|
163
|
-
<Text>Loading..</Text>
|
|
164
|
-
</View>
|
|
165
|
-
);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export default App;
|
|
169
|
-
```
|
|
25
|
+
MIT
|
|
170
26
|
|
|
171
|
-
|
|
27
|
+
---
|
|
172
28
|
|
|
173
|
-
|
|
174
|
-
- [Best practices](https://docs.google.com/document/d/1kxolQJ4n6tEgReuqVLYpDVMW--xvqv5UQ7AdvrN0Uw0/edit)
|
|
29
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
package/android/build.gradle
CHANGED
|
@@ -1,62 +1,139 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
jcenter()
|
|
7
|
-
}
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
}
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
dependencies {
|
|
8
|
+
classpath 'com.android.tools.build:gradle:3.5.3'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
def isNewArchitectureEnabled() {
|
|
13
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
apply plugin: 'com.android.library'
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
if (isNewArchitectureEnabled()) {
|
|
19
|
+
apply plugin: 'com.facebook.react'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def getExtOrDefault(name) {
|
|
23
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Okhi_' + name]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
def getExtOrIntegerDefault(name) {
|
|
27
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['Okhi_' + name]).toInteger()
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
android {
|
|
22
|
-
|
|
23
|
-
defaultConfig {
|
|
24
|
-
minSdkVersion safeExtGet('Okhi_minSdkVersion', 16)
|
|
25
|
-
targetSdkVersion safeExtGet('Okhi_targetSdkVersion', 29)
|
|
26
|
-
versionCode 1
|
|
27
|
-
versionName "1.0"
|
|
31
|
+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
28
32
|
|
|
33
|
+
defaultConfig {
|
|
34
|
+
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
35
|
+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
36
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
37
|
+
}
|
|
38
|
+
buildTypes {
|
|
39
|
+
release {
|
|
40
|
+
minifyEnabled false
|
|
29
41
|
}
|
|
42
|
+
}
|
|
30
43
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
compileOptions {
|
|
40
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
41
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
42
|
-
}
|
|
44
|
+
lintOptions {
|
|
45
|
+
disable 'GradleCompatible'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
compileOptions {
|
|
49
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
50
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
51
|
+
}
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
repositories {
|
|
46
|
-
|
|
55
|
+
mavenCentral()
|
|
56
|
+
google()
|
|
57
|
+
|
|
58
|
+
def found = false
|
|
59
|
+
def defaultDir = null
|
|
60
|
+
def androidSourcesName = 'React Native sources'
|
|
61
|
+
|
|
62
|
+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
63
|
+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
64
|
+
} else {
|
|
65
|
+
defaultDir = new File(
|
|
66
|
+
projectDir,
|
|
67
|
+
'/../../../node_modules/react-native/android'
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (defaultDir.exists()) {
|
|
47
72
|
maven {
|
|
48
|
-
|
|
49
|
-
|
|
73
|
+
url defaultDir.toString()
|
|
74
|
+
name androidSourcesName
|
|
50
75
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
76
|
+
|
|
77
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
78
|
+
found = true
|
|
79
|
+
} else {
|
|
80
|
+
def parentDir = rootProject.projectDir
|
|
81
|
+
|
|
82
|
+
1.upto(5, {
|
|
83
|
+
if (found) return true
|
|
84
|
+
parentDir = parentDir.parentFile
|
|
85
|
+
|
|
86
|
+
def androidSourcesDir = new File(
|
|
87
|
+
parentDir,
|
|
88
|
+
'node_modules/react-native'
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
def androidPrebuiltBinaryDir = new File(
|
|
92
|
+
parentDir,
|
|
93
|
+
'node_modules/react-native/android'
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
if (androidPrebuiltBinaryDir.exists()) {
|
|
97
|
+
maven {
|
|
98
|
+
url androidPrebuiltBinaryDir.toString()
|
|
99
|
+
name androidSourcesName
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
103
|
+
found = true
|
|
104
|
+
} else if (androidSourcesDir.exists()) {
|
|
105
|
+
maven {
|
|
106
|
+
url androidSourcesDir.toString()
|
|
107
|
+
name androidSourcesName
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
111
|
+
found = true
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!found) {
|
|
117
|
+
throw new GradleException(
|
|
118
|
+
"${project.name}: unable to locate React Native android sources. " +
|
|
119
|
+
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
120
|
+
)
|
|
121
|
+
}
|
|
55
122
|
}
|
|
56
123
|
|
|
124
|
+
|
|
57
125
|
dependencies {
|
|
58
126
|
//noinspection GradleDynamicVersion
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
127
|
+
implementation "com.facebook.react:react-native:+"
|
|
128
|
+
implementation 'com.github.okhi:android-core:v1.4.4'
|
|
129
|
+
implementation 'com.github.okhi:android-okverify:v1.5.3'
|
|
130
|
+
// From node_modules
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (isNewArchitectureEnabled()) {
|
|
134
|
+
react {
|
|
135
|
+
jsRootDir = file("../src/")
|
|
136
|
+
libraryName = "Okhi"
|
|
137
|
+
codegenJavaPackageName = "com.reactnativeokhi"
|
|
138
|
+
}
|
|
62
139
|
}
|
|
@@ -81,22 +81,12 @@ public class OkhiModule extends ReactContextBaseJavaModule {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
85
84
|
@Override
|
|
86
85
|
@NonNull
|
|
87
86
|
public String getName() {
|
|
88
87
|
return NAME;
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
// Example method
|
|
92
|
-
// See https://reactnative.dev/docs/native-modules-android
|
|
93
|
-
@ReactMethod
|
|
94
|
-
public void multiply(int a, int b, Promise promise) {
|
|
95
|
-
promise.resolve(a * b);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public static native int nativeMultiply(int a, int b);
|
|
99
|
-
|
|
100
90
|
@ReactMethod
|
|
101
91
|
public void isLocationServicesEnabled(Promise promise) {
|
|
102
92
|
boolean result = OkHi.isLocationServicesEnabled(getReactApplicationContext());
|
|
@@ -289,16 +279,6 @@ public class OkhiModule extends ReactContextBaseJavaModule {
|
|
|
289
279
|
promise.resolve(map);
|
|
290
280
|
}
|
|
291
281
|
|
|
292
|
-
@ReactMethod
|
|
293
|
-
public void addListener(String eventName) {
|
|
294
|
-
// Keep: Required for RN built in Event Emitter Calls.
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
@ReactMethod
|
|
298
|
-
public void removeListeners(Integer count) {
|
|
299
|
-
// Keep: Required for RN built in Event Emitter Calls.
|
|
300
|
-
}
|
|
301
|
-
|
|
302
282
|
private Dynamic getConfig(ReadableMap map, String prop) {
|
|
303
283
|
if (map != null && map.hasKey("android")) {
|
|
304
284
|
ReadableMap config = map.getMap("android");
|
|
@@ -310,4 +290,16 @@ public class OkhiModule extends ReactContextBaseJavaModule {
|
|
|
310
290
|
}
|
|
311
291
|
return null;
|
|
312
292
|
}
|
|
293
|
+
|
|
294
|
+
// Required for rn built in EventEmitter Calls.
|
|
295
|
+
@ReactMethod
|
|
296
|
+
public void addListener(String eventName) {
|
|
297
|
+
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
@ReactMethod
|
|
301
|
+
public void removeListeners(Integer count) {
|
|
302
|
+
|
|
303
|
+
}
|
|
304
|
+
|
|
313
305
|
}
|
package/ios/OkHiExtension.swift
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// OkHiExtension.swift
|
|
3
3
|
// react-native-okhi
|
|
4
4
|
//
|
|
5
|
-
// Created by Julius Kiano on
|
|
5
|
+
// Created by Julius Kiano on 01/09/2022.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
@@ -25,4 +25,3 @@ extension String {
|
|
|
25
25
|
return try? JSONSerialization.jsonObject(with: data, options: .mutableContainers)
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
package/ios/OkHiStruct.swift
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
-
|
|
11
|
-
F4FF95D7245B92E800C19C63 /*
|
|
10
|
+
5E555C0D2413F4C50049A1A2 /* Okhi.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* Okhi.m */; };
|
|
11
|
+
F4FF95D7245B92E800C19C63 /* Okhi.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* Okhi.swift */; };
|
|
12
12
|
/* End PBXBuildFile section */
|
|
13
13
|
|
|
14
14
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -25,10 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
/* Begin PBXFileReference section */
|
|
27
27
|
134814201AA4EA6300B7C361 /* libOkhi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libOkhi.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
28
|
-
170C66738D71F8E47CCAE826 /* libPods-Okhi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Okhi.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
29
|
-
9AC598260B86BDE618FEDC44 /* Pods-Okhi.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Okhi.debug.xcconfig"; path = "Target Support Files/Pods-Okhi/Pods-Okhi.debug.xcconfig"; sourceTree = "<group>"; };
|
|
30
28
|
B3E7B5891CC2AC0600A0062D /* Okhi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Okhi.m; sourceTree = "<group>"; };
|
|
31
|
-
D065C9FE4594C7F1A2C82304 /* Pods-Okhi.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Okhi.release.xcconfig"; path = "Target Support Files/Pods-Okhi/Pods-Okhi.release.xcconfig"; sourceTree = "<group>"; };
|
|
32
29
|
F4FF95D5245B92E700C19C63 /* Okhi-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Okhi-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
33
30
|
F4FF95D6245B92E800C19C63 /* Okhi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Okhi.swift; sourceTree = "<group>"; };
|
|
34
31
|
/* End PBXFileReference section */
|
|
@@ -38,7 +35,6 @@
|
|
|
38
35
|
isa = PBXFrameworksBuildPhase;
|
|
39
36
|
buildActionMask = 2147483647;
|
|
40
37
|
files = (
|
|
41
|
-
65EDEB844862F66710D9416F /* libPods-Okhi.a in Frameworks */,
|
|
42
38
|
);
|
|
43
39
|
runOnlyForDeploymentPostprocessing = 0;
|
|
44
40
|
};
|
|
@@ -53,15 +49,6 @@
|
|
|
53
49
|
name = Products;
|
|
54
50
|
sourceTree = "<group>";
|
|
55
51
|
};
|
|
56
|
-
1D74A8B99575604223785C10 /* Pods */ = {
|
|
57
|
-
isa = PBXGroup;
|
|
58
|
-
children = (
|
|
59
|
-
9AC598260B86BDE618FEDC44 /* Pods-Okhi.debug.xcconfig */,
|
|
60
|
-
D065C9FE4594C7F1A2C82304 /* Pods-Okhi.release.xcconfig */,
|
|
61
|
-
);
|
|
62
|
-
path = Pods;
|
|
63
|
-
sourceTree = "<group>";
|
|
64
|
-
};
|
|
65
52
|
58B511D21A9E6C8500147676 = {
|
|
66
53
|
isa = PBXGroup;
|
|
67
54
|
children = (
|
|
@@ -69,17 +56,7 @@
|
|
|
69
56
|
B3E7B5891CC2AC0600A0062D /* Okhi.m */,
|
|
70
57
|
F4FF95D5245B92E700C19C63 /* Okhi-Bridging-Header.h */,
|
|
71
58
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
72
|
-
1D74A8B99575604223785C10 /* Pods */,
|
|
73
|
-
E82590BD637540CF278F8B63 /* Frameworks */,
|
|
74
|
-
);
|
|
75
|
-
sourceTree = "<group>";
|
|
76
|
-
};
|
|
77
|
-
E82590BD637540CF278F8B63 /* Frameworks */ = {
|
|
78
|
-
isa = PBXGroup;
|
|
79
|
-
children = (
|
|
80
|
-
170C66738D71F8E47CCAE826 /* libPods-Okhi.a */,
|
|
81
59
|
);
|
|
82
|
-
name = Frameworks;
|
|
83
60
|
sourceTree = "<group>";
|
|
84
61
|
};
|
|
85
62
|
/* End PBXGroup section */
|
|
@@ -89,7 +66,6 @@
|
|
|
89
66
|
isa = PBXNativeTarget;
|
|
90
67
|
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Okhi" */;
|
|
91
68
|
buildPhases = (
|
|
92
|
-
E83F62762DC106CBECF750EA /* [CP] Check Pods Manifest.lock */,
|
|
93
69
|
58B511D71A9E6C8500147676 /* Sources */,
|
|
94
70
|
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
95
71
|
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
@@ -135,37 +111,13 @@
|
|
|
135
111
|
};
|
|
136
112
|
/* End PBXProject section */
|
|
137
113
|
|
|
138
|
-
/* Begin PBXShellScriptBuildPhase section */
|
|
139
|
-
E83F62762DC106CBECF750EA /* [CP] Check Pods Manifest.lock */ = {
|
|
140
|
-
isa = PBXShellScriptBuildPhase;
|
|
141
|
-
buildActionMask = 2147483647;
|
|
142
|
-
files = (
|
|
143
|
-
);
|
|
144
|
-
inputFileListPaths = (
|
|
145
|
-
);
|
|
146
|
-
inputPaths = (
|
|
147
|
-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
|
148
|
-
"${PODS_ROOT}/Manifest.lock",
|
|
149
|
-
);
|
|
150
|
-
name = "[CP] Check Pods Manifest.lock";
|
|
151
|
-
outputFileListPaths = (
|
|
152
|
-
);
|
|
153
|
-
outputPaths = (
|
|
154
|
-
"$(DERIVED_FILE_DIR)/Pods-Okhi-checkManifestLockResult.txt",
|
|
155
|
-
);
|
|
156
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
157
|
-
shellPath = /bin/sh;
|
|
158
|
-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
|
159
|
-
showEnvVarsInLog = 0;
|
|
160
|
-
};
|
|
161
|
-
/* End PBXShellScriptBuildPhase section */
|
|
162
|
-
|
|
163
114
|
/* Begin PBXSourcesBuildPhase section */
|
|
164
115
|
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
165
116
|
isa = PBXSourcesBuildPhase;
|
|
166
117
|
buildActionMask = 2147483647;
|
|
167
118
|
files = (
|
|
168
119
|
F4FF95D7245B92E800C19C63 /* Okhi.swift in Sources */,
|
|
120
|
+
B3E7B58A1CC2AC0600A0062D /* Okhi.m in Sources */,
|
|
169
121
|
);
|
|
170
122
|
runOnlyForDeploymentPostprocessing = 0;
|
|
171
123
|
};
|
|
@@ -200,6 +152,7 @@
|
|
|
200
152
|
COPY_PHASE_STRIP = NO;
|
|
201
153
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
202
154
|
ENABLE_TESTABILITY = YES;
|
|
155
|
+
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
203
156
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
204
157
|
GCC_DYNAMIC_NO_PIC = NO;
|
|
205
158
|
GCC_NO_COMMON_BLOCKS = YES;
|
|
@@ -250,6 +203,7 @@
|
|
|
250
203
|
COPY_PHASE_STRIP = YES;
|
|
251
204
|
ENABLE_NS_ASSERTIONS = NO;
|
|
252
205
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
206
|
+
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
253
207
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
254
208
|
GCC_NO_COMMON_BLOCKS = YES;
|
|
255
209
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
@@ -267,7 +221,6 @@
|
|
|
267
221
|
};
|
|
268
222
|
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
269
223
|
isa = XCBuildConfiguration;
|
|
270
|
-
baseConfigurationReference = 9AC598260B86BDE618FEDC44 /* Pods-Okhi.debug.xcconfig */;
|
|
271
224
|
buildSettings = {
|
|
272
225
|
HEADER_SEARCH_PATHS = (
|
|
273
226
|
"$(inherited)",
|
|
@@ -287,7 +240,6 @@
|
|
|
287
240
|
};
|
|
288
241
|
58B511F11A9E6C8500147676 /* Release */ = {
|
|
289
242
|
isa = XCBuildConfiguration;
|
|
290
|
-
baseConfigurationReference = D065C9FE4594C7F1A2C82304 /* Pods-Okhi.release.xcconfig */;
|
|
291
243
|
buildSettings = {
|
|
292
244
|
HEADER_SEARCH_PATHS = (
|
|
293
245
|
"$(inherited)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["canStartAddressCreation","configuration","Promise","resolve","reject","requestServices","locationServicesStatus","isLocationServicesEnabled","googlePlayServices","Platform","OS","isGooglePlayServicesAvailable","locationPerm","isLocationPermissionGranted","OkHiException","code","SERVICE_UNAVAILABLE_CODE","message","locationServicesRequestStatus","requestEnableLocationServices","gPlayServices","requestEnableGooglePlayServices","locationPermStatus","requestLocationPermission"],"sources":["Helpers.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport {\n isLocationServicesEnabled,\n isLocationPermissionGranted,\n isGooglePlayServicesAvailable,\n requestEnableLocationServices,\n requestEnableGooglePlayServices,\n requestLocationPermission,\n} from '../OkCore/Helpers';\nimport { OkHiException } from '../OkCore/OkHiException';\n\n/**\n * Checks whether all necessary permissions and services are available in order to start the address creation process.\n * @param {Object} configuration Object that determines whether or not to request these permissions and services from the user.\n * @param {boolean} configuration.requestServices Flag that determines whether to request the services from the user.\n * @returns {Promise<boolean>} A promise that resolves to a boolean value indicating whether or not all conditions are met to start the address creation process.\n */\nexport const canStartAddressCreation = (configuration?: {\n requestServices?: boolean;\n}): Promise<boolean> => {\n return new Promise(async (resolve, reject) => {\n const requestServices = configuration && configuration.requestServices;\n const locationServicesStatus = await isLocationServicesEnabled();\n const googlePlayServices =\n Platform.OS === 'android' ? await isGooglePlayServicesAvailable() : true;\n const locationPerm = await isLocationPermissionGranted();\n if (!requestServices) {\n resolve(locationServicesStatus && googlePlayServices && locationPerm);\n return;\n }\n if (!locationServicesStatus && Platform.OS === 'ios') {\n reject(\n new OkHiException({\n code: OkHiException.SERVICE_UNAVAILABLE_CODE,\n message: 'Location services is unavailable',\n })\n );\n } else {\n const locationServicesRequestStatus =\n Platform.OS === 'ios'\n ? true\n : ((await requestEnableLocationServices()) as boolean);\n const gPlayServices =\n Platform.OS === 'android'\n ? await requestEnableGooglePlayServices()\n : true;\n const locationPermStatus = await requestLocationPermission();\n resolve(\n locationServicesRequestStatus && gPlayServices && locationPermStatus\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAIC,aAAD,IAEf;EACtB,OAAO,IAAIC,OAAJ,CAAY,OAAOC,OAAP,EAAgBC,MAAhB,KAA2B;IAC5C,MAAMC,eAAe,GAAGJ,aAAa,IAAIA,aAAa,CAACI,eAAvD;IACA,MAAMC,sBAAsB,GAAG,MAAM,IAAAC,kCAAA,GAArC;IACA,MAAMC,kBAAkB,GACtBC,qBAAA,CAASC,EAAT,KAAgB,SAAhB,GAA4B,MAAM,IAAAC,sCAAA,GAAlC,GAAoE,IADtE;IAEA,MAAMC,YAAY,GAAG,MAAM,IAAAC,oCAAA,GAA3B;;IACA,IAAI,CAACR,eAAL,EAAsB;MACpBF,OAAO,CAACG,sBAAsB,IAAIE,kBAA1B,IAAgDI,YAAjD,CAAP;MACA;IACD;;IACD,IAAI,CAACN,sBAAD,IAA2BG,qBAAA,CAASC,EAAT,KAAgB,KAA/C,EAAsD;MACpDN,MAAM,CACJ,IAAIU,4BAAJ,CAAkB;QAChBC,IAAI,EAAED,4BAAA,CAAcE,wBADJ;QAEhBC,OAAO,EAAE;MAFO,CAAlB,CADI,CAAN;IAMD,CAPD,MAOO;MACL,MAAMC,6BAA6B,GACjCT,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GACI,IADJ,GAEM,MAAM,IAAAS,sCAAA,GAHd;MAIA,MAAMC,aAAa,GACjBX,qBAAA,CAASC,EAAT,KAAgB,SAAhB,GACI,MAAM,IAAAW,wCAAA,GADV,GAEI,IAHN;MAIA,MAAMC,kBAAkB,GAAG,MAAM,IAAAC,kCAAA,GAAjC;MACApB,OAAO,CACLe,6BAA6B,IAAIE,aAAjC,IAAkDE,kBAD7C,CAAP;IAGD;EACF,CA/BM,CAAP;AAgCD,CAnCM"}
|