UNPKG

@sumsub/cordova-idensic-mobile-sdk-plugin

Version:

Cordova plugin exposing Sumsub SDK

44 lines (35 loc) 1.61 kB
'use strict'; var fs = require('fs'); module.exports = function (context) { var withFisherman = process.argv.includes('--with-Fisherman') var withEID = process.argv.includes('--with-EID') var withVideoIdent = process.argv.includes('--with-VideoIdent') || process.argv.includes('--with-VideoIdent-compat') var withMRTDReader = process.argv.includes('--with-MRTDReader') || process.argv.includes('--with-MRTDReader-compat') if (!withFisherman && !withEID && !withVideoIdent && !withMRTDReader) { return } var gradleExtrasFilePath = './platforms/android/cordova-idensic-mobile-sdk-plugin/SumSubCordova-build-extras.gradle' try { if (!fs.existsSync(gradleExtrasFilePath)) { console.log('Warning: Gradle extras file not found at ' + gradleExtrasFilePath) return } var data = fs.readFileSync(gradleExtrasFilePath, 'utf8') var formatted = data if (!withFisherman) { formatted = formatted.replace(/^(\s+implementation\s.+fisherman.+)$/m, "//$1"); } if (!withMRTDReader) { formatted = formatted.replace(/^(\s+implementation\s.+nfc.+)$/m, "//$1"); } if (!withEID) { formatted = formatted.replace(/^(\s+implementation\s.+eid.+)$/m, "//$1"); } if (!withVideoIdent) { formatted = formatted.replace(/^(\s+implementation\s.+videoident.+)$/m, "//$1"); } fs.writeFileSync(gradleExtrasFilePath, formatted, 'utf8') } catch (err) { console.log('Error processing Gradle extras file: ' + err) } }