Skip to content

Commit b9a29b4

Browse files
Add custom attribute support
1 parent 3f4ccbf commit b9a29b4

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes will be documented in this file.
44

5+
## [1.0.16] - 2023-08-20
6+
7+
* Add custom attributes support
8+
59
## [1.0.15] - 2023-04-06
610

711
* Update README docs examples

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022 App Upgrade
1+
Copyright (c) 2022-23 App Upgrade
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "app-upgrade-react-native-sdk",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "Official App Upgrade react-native sdk",
55
"main": "index.js",
66
"scripts": {

src/api.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
import axios from "axios";
2-
import axiosRetry from 'axios-retry';
2+
import axiosRetry from "axios-retry";
33

44
async function checkVersionWithAppUpgrade(appInfo, xApiKey) {
55
try {
66
const appUpgradeBaseUrl = "https://appupgrade.dev";
77
const { appName, appVersion, platform, environment, appLanguage } = appInfo;
88

9-
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay, retryCondition: () => true });
9+
const { customAttributes } = appInfo;
10+
11+
axiosRetry(axios, {
12+
retries: 3,
13+
retryDelay: axiosRetry.exponentialDelay,
14+
retryCondition: () => true,
15+
});
16+
17+
const params = {
18+
app_name: appName,
19+
app_version: appVersion,
20+
platform: platform,
21+
environment: environment,
22+
app_language: appLanguage,
23+
};
24+
25+
for (const key in customAttributes) {
26+
params[key] = customAttributes[key];
27+
}
1028

1129
const response = await axios.get(
1230
`${appUpgradeBaseUrl}/api/v1/versions/check`,
1331
{
1432
headers: {
1533
"x-api-key": xApiKey,
16-
"sdk": "react-native" //Telemetry purposes
17-
},
18-
params: {
19-
app_name: appName,
20-
app_version: appVersion,
21-
platform: platform,
22-
environment: environment,
23-
app_language: appLanguage,
34+
sdk: "react-native", //Telemetry purposes
2435
},
36+
params,
2537
validateStatus: function (status) {
2638
return status >= 200 && status < 500; // default
2739
},

0 commit comments

Comments
 (0)