react-native-lightspeedsdk
Version:
A react-native interface for using the LightspeedSDK
32 lines (25 loc) • 921 B
JavaScript
import {Platform} from 'react-native';
const NativeQuestionsCoordinator = require('react-native').NativeModules.LSQuestionsCoordinator;
module.exports = {
getQuestions(restartChallenge: bool, questionType: string) : Promise<?LSQuestionList> {
return NativeQuestionsCoordinator.getQuestions(restartChallenge, questionType);
},
submitAnswers(answers: Array<Answer>, answerType:string, lastQuestion:number = -1, redeemCredit:number = -1) : Promise<?Array<DeviceService>> {
if (Platform.OS === 'ios') {
if (lastQuestion == -1) {
lastQuestion = null;
}
if (redeemCredit == -1) {
redeemCredit = null;
}
}else {
if (lastQuestion == null) {
lastQuestion = -1;
}
if (redeemCredit == null) {
redeemCredit = -1;
}
}
return NativeQuestionsCoordinator.submitAnswers(answers, answerType, lastQuestion, redeemCredit);
}
};