0

I have the following code:

import { put } from "redux-saga/effects"
import { actions, AppStrings } from "common"

const DeviceInfo = require("react-native-device-info")

interface CheckIosVersionAction {
    readonly type: "CHECK_IOS_VERSION"
    readonly buildNumber: number
    readonly systemName: string
}

export function* checkIosVersion(action: CheckIosVersionAction): {} {
    if (DeviceInfo.getSystemName() !== "iOS") {
        return
    }


    const deviceBuildNumber = parseInt(DeviceInfo.getBuildNumber(), 10)

    if (action.buildNumber > deviceBuildNumber) {
        yield put(
            actions.receiveError(AppStrings.AppStrings.landing.invalidVersion),
        )
    }
}

I'm trying to add device version to the information payload. I have the app version passing as it should but I can't get the device version to work as it should.I thought of adding DeviceInfo.getVersion() at the end but that doesn't seem to work very well either.

FileasFogg
  • 93
  • 2
  • 2
  • 13

1 Answers1

0

DeviceInfo.getSystemVersion() should give you the device's OS version. https://github.com/rebeccahughes/react-native-device-info#getsystemversion

Matt Aft
  • 8,742
  • 3
  • 24
  • 37