Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const PreferredAndroidMarket = {
OTHER: 'Other',
}

function appUpgradeVersionCheck(appInfo, xApiKey, alertInfo) {
versionCheck(appInfo, xApiKey, alertInfo);
function appUpgradeVersionCheck(appInfo, xApiKey, alertInfo, baseUrl) {
versionCheck(appInfo, xApiKey, alertInfo, baseUrl);
}

export { appUpgradeVersionCheck, PreferredAndroidMarket };
6 changes: 3 additions & 3 deletions src/api.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios from "axios";
import axiosRetry from "axios-retry";

async function checkVersionWithAppUpgrade(appInfo, xApiKey) {
async function checkVersionWithAppUpgrade(appInfo, xApiKey, baseUrl = '') {
try {
const appUpgradeBaseUrl = "https://appupgrade.dev";
const appUpgradeBaseUrl = baseUrl ? baseUrl : "https://appupgrade.dev/api/v1/versions/check";
const { appName, appVersion, platform, environment, appLanguage } = appInfo;

const { customAttributes } = appInfo;
Expand All @@ -27,7 +27,7 @@ async function checkVersionWithAppUpgrade(appInfo, xApiKey) {
}

const response = await axios.get(
`${appUpgradeBaseUrl}/api/v1/versions/check`,
appUpgradeBaseUrl,
{
headers: {
"x-api-key": xApiKey,
Expand Down
4 changes: 2 additions & 2 deletions src/version-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { checkVersionWithAppUpgrade } from "./api";
import { Platform, Alert, Linking } from "react-native";
import { PreferredAndroidMarket } from "app-upgrade-react-native-sdk";

async function versionCheck(appInfo, xApiKey, alertInfo) {
async function versionCheck(appInfo, xApiKey, alertInfo, baseUrl) {
const isValid = validate(appInfo, xApiKey);

if (isValid) {
const version = await checkVersionWithAppUpgrade(appInfo, xApiKey);
const version = await checkVersionWithAppUpgrade(appInfo, xApiKey, baseUrl);
if (!version) {
console.error("App Upgrade Error: Version is null.");
} else if (version && version.found === true) {
Expand Down