Skip to content

Commit

Permalink
feat: add android c++ and bridge files
Browse files Browse the repository at this point in the history
  • Loading branch information
numandev1 committed Dec 23, 2020
1 parent 8b4865b commit 112975a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
26 changes: 13 additions & 13 deletions src/util/common.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
const fs=require('fs-extra');
const path=require('path');
const PROJECT_ROOT_DIR_PATH=path.join(__dirname,"../../../../");
const fs = require('fs-extra');
const path = require('path');
const PROJECT_ROOT_DIR_PATH = path.join(__dirname, '../../../../');

module.exports.getJniKeys=()=>{
const jniJsonFilePath=`${PROJECT_ROOT_DIR_PATH}jnikeys.json`;
const jnikeysJson=fs.readJSONSync(jniJsonFilePath)
const secureKeys=jnikeysJson.secure;
module.exports.getJniKeys = () => {
const jniJsonFilePath = `${PROJECT_ROOT_DIR_PATH}jnikeys.json`;
const jnikeysJson = fs.readJSONSync(jniJsonFilePath);
const secureKeys = jnikeysJson.secure;
return secureKeys;
}
};

module.exports.makeFileInIosDir=(fileContent,fileName)=>{
module.exports.makeFileInIosDir = (fileContent, fileName) => {
try {
const iosDirPath=path.join(PROJECT_ROOT_DIR_PATH,"ios");
const iosCppFilePath=path.join(iosDirPath,fileName);
fs.outputFileSync(iosCppFilePath,fileContent);
const iosDirPath = path.join(PROJECT_ROOT_DIR_PATH, 'ios');
const iosCppFilePath = path.join(iosDirPath, fileName);
fs.outputFileSync(iosCppFilePath, fileContent);
return true;
} catch (error) {
return false;
}
}
};
25 changes: 12 additions & 13 deletions src/util/jniFilesTemplateIos.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports.makeCppFileTemplate=(data)=>{

module.exports.makeCppFileTemplate = (data) => {
return `
#include "crypto.hpp"
Crypto::Crypto() {
Expand All @@ -12,10 +11,10 @@ module.exports.makeCppFileTemplate=(data)=>{
return jsonStringyfyData;
}
`
}
`;
};

module.exports.makeHppFileTemplate=()=>{
module.exports.makeHppFileTemplate = () => {
return `
#ifndef crypto_hpp
#define crypto_hpp
Expand All @@ -28,10 +27,10 @@ module.exports.makeHppFileTemplate=()=>{
std::string getJniJsonStringyfyData(std::string);
};
#endif
`
}
`;
};

module.exports.makeCryptographicPackageHTemplate=()=>{
module.exports.makeCryptographicPackageHTemplate = () => {
return `
#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
Expand All @@ -43,10 +42,10 @@ module.exports.makeCryptographicPackageHTemplate=()=>{
@end
NS_ASSUME_NONNULL_END
`
}
`;
};

module.exports.makeCryptographicPackageMMTemplate=()=>{
module.exports.makeCryptographicPackageMMTemplate = () => {
return `
#import "CryptographicPackage.h"
#import "crypto.hpp"
Expand Down Expand Up @@ -90,5 +89,5 @@ module.exports.makeCryptographicPackageMMTemplate=()=>{
@end
`
}
`;
};

0 comments on commit 112975a

Please sign in to comment.