Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix "Repais bid" * Improve UX * PR comments * Refactor deeplink Co-authored-by: Chi Kei Chan <chikeichan@gmail.com>
- Loading branch information
1 parent
8723c0b
commit 9a684c7
Showing
8 changed files
with
80 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { setDeeplink } from '../ducks/app'; | ||
import { clientStub as aClientStub } from '../background/analytics/client'; | ||
const analytics = aClientStub(() => require('electron').ipcRenderer); | ||
import { store } from '../store/configureStore'; | ||
import * as methods from './methods'; | ||
|
||
export default function handleDeeplink(message) { | ||
const url = new URL(message); | ||
const state = store.getState(); | ||
const isLocked = state.wallet.isLocked; | ||
|
||
analytics.track('deeplink', { | ||
pathname: url.pathname, | ||
}); | ||
|
||
// pathname = "//method/" | ||
const [method] = url.pathname.substr(2).split('/'); | ||
const handler = methods[method]; | ||
|
||
if (typeof handler === 'function') { | ||
if (isLocked) { | ||
store.dispatch(setDeeplink(message)); | ||
return; | ||
} | ||
|
||
methods[method](message); | ||
} else { | ||
console.error('Unknown deeplink:', message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { history } from '../../store/configureStore'; | ||
|
||
export default message => { | ||
const url = new URL(message); | ||
const params = url.searchParams; | ||
const name = params.get('name'); | ||
const presignJSONString = params.get('presign'); | ||
|
||
if (presignJSONString) { | ||
store.dispatch(setDeeplinkParams({ presignJSONString })); | ||
} | ||
|
||
if (name) { | ||
history.push(`/exchange`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { default as fulfillauction } from './fulfillauction'; | ||
export { default as openmanager } from './openmanager'; | ||
export { default as openname } from './openname'; | ||
export { default as updaterecord } from './updaterecord'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { history } from '../../store/configureStore'; | ||
|
||
export default message => { | ||
const name = new URL(message).searchParams.get('name'); | ||
|
||
history.push(`/domain_manager/${name}`); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { history } from '../../store/configureStore'; | ||
|
||
export default message => { | ||
const name = new URL(message).searchParams.get('name'); | ||
|
||
history.push(`/domain/${name}`); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { history, store } from '../../store/configureStore'; | ||
import { setDeeplinkParams } from '../../ducks/app'; | ||
|
||
export default message => { | ||
const url = new URL(message); | ||
const params = url.searchParams; | ||
const name = params.get('name'); | ||
const txt = params.get('txt'); | ||
|
||
if (txt) { | ||
store.dispatch(setDeeplinkParams({ txt })); | ||
} | ||
history.push(`/domain_manager/${name}`); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters