@@ -4,25 +4,28 @@ export * from './networks'
44export * from './transactions'
55export * from './skipDataAndType'
66
7+ const REMOTE_MODULE_NOT_FOUND =
8+ 'The remote module is not found, please make sure the UI is running inside the Electron App'
9+
710export const getLocale = ( ) => {
811 if ( ! window . remote ) {
9- console . warn ( 'remote is not supported' )
12+ console . warn ( REMOTE_MODULE_NOT_FOUND )
1013 return window . navigator . language
1114 }
1215 return window . remote . require ( 'electron' ) . app . getLocale ( )
1316}
1417
1518export const getWinID = ( ) => {
1619 if ( ! window . remote ) {
17- console . warn ( 'remote is not supported' )
20+ console . warn ( REMOTE_MODULE_NOT_FOUND )
1821 return - 1
1922 }
2023 return window . remote . getCurrentWindow ( ) . id
2124}
2225
2326export const validateMnemonic = ( mnemonic : string ) : boolean => {
2427 if ( ! window . remote ) {
25- console . warn ( 'remote is not supported' )
28+ console . warn ( REMOTE_MODULE_NOT_FOUND )
2629 return true
2730 }
2831 const { validateMnemonic : remoteValidateMnemonic } = window . remote . require ( './models/keys/mnemonic' )
@@ -31,7 +34,7 @@ export const validateMnemonic = (mnemonic: string): boolean => {
3134
3235export const generateMnemonic = ( ) : string => {
3336 if ( ! window . remote ) {
34- console . warn ( 'remote is not supported' )
37+ console . warn ( REMOTE_MODULE_NOT_FOUND )
3538 return ''
3639 }
3740 const { generateMnemonic : remoteGenerateMnemonic } = window . remote . require ( './models/keys/key' )
@@ -40,7 +43,7 @@ export const generateMnemonic = (): string => {
4043
4144export const showMessage = ( options : any , callback : Function ) => {
4245 if ( ! window . remote ) {
43- console . warn ( 'remote is not supported' )
46+ console . warn ( REMOTE_MODULE_NOT_FOUND )
4447 window . alert ( options . message )
4548 } else {
4649 window . remote . require ( 'electron' ) . dialog . showMessageBox ( options , callback )
@@ -49,7 +52,7 @@ export const showMessage = (options: any, callback: Function) => {
4952
5053export const showErrorMessage = ( title : string , content : string ) => {
5154 if ( ! window . remote ) {
52- console . warn ( 'remote is not supported' )
55+ console . warn ( REMOTE_MODULE_NOT_FOUND )
5356 window . alert ( `${ title } : ${ content } ` )
5457 } else {
5558 window . remote . require ( 'electron' ) . dialog . showErrorBox ( title , content )
@@ -58,7 +61,7 @@ export const showErrorMessage = (title: string, content: string) => {
5861
5962export const showOpenDialog = ( opt : { title : string ; message ?: string ; onUpload : Function } ) => {
6063 if ( ! window . remote ) {
61- window . alert ( 'remote is not supported' )
64+ window . alert ( REMOTE_MODULE_NOT_FOUND )
6265 }
6366 const { onUpload, ...options } = opt
6467 return window . remote . require ( 'electron' ) . dialog . showOpenDialog (
0 commit comments