Open yogeshwar-matchps opened 1 year ago
Any alternative code reference or full source code of Android app @freeboub
Unfortunately it was not successful, but I can share the code 'as is' (if I still have it). We found issue with this repo depending of the android tv device used, that's another reason why we stopped working on it...
@louis49 Can you provide Android & iOS Code in Java and Swift for TV Remote
Same problem here when I add androidtv-remote to a react native/typescript project I get an error about the crypto depdencies:
error: Error: Unable to resolve module crypto from /home/vricosti/Dev/lota-remotectl/lota-remotectl-app/node_modules/androidtv-remote/dist/certificate/CertificateGenerator.js: crypto could not be found within the project or in these directories:
node_modules
../../node_modules
10 | var _nodeForge = _interopRequireDefault(require("node-forge"));
11 |
> 12 | var _crypto = _interopRequireDefault(require("crypto"));
| ^
13 |
14 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15 |
at ModuleResolver.resolveDependency (/home/vricosti/Dev/lota-remotectl/lota-remotectl-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:138:15)
at DependencyGraph.resolveDependency (/home/vricosti/Dev/lota-remotectl/lota-remotectl-app/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
at /home/vricosti/Dev/lota-remotectl/lota-remotectl-app/node_modules/metro/src/lib/transformHelpers.js:156:21
at resolveDependencies (/home/vricosti/Dev/lota-remotectl/lota-remotectl-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:42:25)
at visit (/home/vricosti/Dev/lota-remotectl/lota-remotectl-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:83:30)
at async Promise.all (index 1)
at async visit (/home/vricosti/Dev/lota-remotectl/lota-remotectl-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:92:5)
at async Promise.all (index 0)
at async visit (/home/vricosti/Dev/lota-remotectl/lota-remotectl-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:92:5)
at async Promise.all (index 0)
ERROR [Error: undefined Unable to resolve module crypto from /home/vricosti/Dev/lota-remotectl/lota-remotectl-app/node_modules/androidtv-remote/dist/certificate/CertificateGenerator.js: crypto could not be found within the project or in these directories:
node_modules
../../node_modules
10 | var _nodeForge = _interopRequireDefault(require("node-forge"));
11 |
> 12 | var _crypto = _interopRequireDefault(require("crypto"));
| ^
13 |
14 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15 |]
It would be great to fix it inside this project because other solutions implies to play with react-native-quick-crypto or crypto-browserify or rn-nodeify and it's a bit clumsy.
Update: I followed the crypto-browserify path since I don't need crypto performance:
yarn add crypto-browserify
yarn add react-native-tcp-socket
yarn add react-native-url-polyfill
yarn add path-browserify
yarn --dev add babel-plugin-rewrite-require
Inside babel.config.js:
module.exports = {
presets: [
'module:@react-native/babel-preset'
],
plugins: [
['babel-plugin-rewrite-require', {
"aliases": {
"crypto": "crypto-browserify",
"tls": "react-native-tcp-socket",
"url": "react-native-url-polyfill",
"path": "path-browserify"
}
}],
// from doc: react-native-reanimated/plugin has to be listed last.
'react-native-reanimated/plugin',
],
};
The last error is about missing systeminformation on react ,native and for this one, I think it would be better to fix directly the source code instead of provinding a ugly hack. Don't even know if this project is still maintained...
Here is my progress: https://github.com/digitalbazaar/forge/issues/1079
Actually I have removed dependecies on specific node modules (crypto, fs path, systeminfomation) https://github.com/vricosti/androidtv-remote/tree/dev/simplify-deps at the end I have a freeze as soon as I instantiate AndroidRemote...
I have progressed and finally I think the last part is to manage to replace tls module: https://github.com/vricosti/TestAndroidTVRemoteApp
I tried to port it to react native, but it is not so easy ...