Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom notifications #133

Merged
merged 38 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7965890
- Allow user to spawn custom notifications
liamaharon Apr 26, 2019
2e72580
- Improve userInitiatedNotify func name
liamaharon Apr 26, 2019
2d02ce5
Check assist is ready for userInitiatedNotify
liamaharon Apr 26, 2019
3cf8f87
Remove options param from userInitiatedNotify
liamaharon Apr 26, 2019
89327cf
Move notify method to assistInstance
liamaharon Apr 26, 2019
862596a
Add notity docs
liamaharon Apr 26, 2019
b60a15a
Merge branch 'develop' of github.com:liamaharon/assist into feature/c…
liamaharon Apr 26, 2019
073ddff
Improve notify docs
liamaharon Apr 26, 2019
66f2bd9
Improve comment
liamaharon Apr 26, 2019
137f395
Don't call setHeight when no notifications
liamaharon Apr 26, 2019
63f4108
Fix userInitiatedNotify validation
liamaharon Apr 26, 2019
505d039
Improve docs
liamaharon Apr 26, 2019
d9939d6
Merge branch 'develop' of github.com:blocknative/assist into feature/…
liamaharon Apr 29, 2019
a870a54
Merge branch 'develop' of github.com:blocknative/assist into feature/…
liamaharon Apr 30, 2019
6690204
Fix notify function signature in docs
liamaharon Apr 30, 2019
8d47b82
Improve notify docs example
liamaharon Apr 30, 2019
eff9c13
Improve import syntax
liamaharon Apr 30, 2019
95a7efd
Test for a potential difficult to detect bug
liamaharon Apr 30, 2019
83fc717
Merge branch 'develop' of github.com:blocknative/assist into feature/…
liamaharon May 1, 2019
af0a9b6
Fix notify customTimeout not working sometimes
liamaharon May 1, 2019
8827995
Mention HMTL can be embedded in customNotify msgs
liamaharon May 1, 2019
da119a8
Show timer in custom "pending" notification
liamaharon May 2, 2019
37d2974
Add ui-rendering tests for custom notify events
liamaharon May 2, 2019
9ee565d
Test that customTimeout works
liamaharon May 2, 2019
88138f0
Specify notify customTimeout in an options object
liamaharon May 2, 2019
d817573
- Fix customNotify bug
liamaharon May 2, 2019
dd3e5bb
Specify customTimeout type
liamaharon May 3, 2019
92639f6
Log custom events to the server
liamaharon May 6, 2019
c29dcfe
Improve test
liamaharon May 6, 2019
7e7c3f6
Update yarn.lock
liamaharon May 6, 2019
ad5d3b1
Improve tests
liamaharon May 6, 2019
0497849
Improve comment
liamaharon May 6, 2019
848a456
Validate customCode
liamaharon May 6, 2019
b148c2e
Limit customCode to 24 characters
liamaharon May 6, 2019
e327fa0
Improve user-initiated-notify tests
liamaharon May 6, 2019
8c9f73d
Increase test run speed
liamaharon May 6, 2019
1fb0a74
Improve customCode default
liamaharon May 6, 2019
b423ebb
change eventCode for custom notification
cmeisl May 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move notify method to assistInstance
  • Loading branch information
liamaharon committed Apr 26, 2019
commit 89327cf4089647432eb44a9e949fd1286f537b8a
1 change: 1 addition & 0 deletions src/__tests__/js/init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ test('Returns the dassist object', () => {
expect(assist).toHaveProperty('Contract')
expect(assist).toHaveProperty('Transaction')
expect(assist).toHaveProperty('getState')
expect(assist).toHaveProperty('notify')
})

test('Fails if we try to decorate without a web3 instance', () => {
Expand Down
5 changes: 3 additions & 2 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ function init(config) {
onboard,
Contract,
Transaction,
getState
getState,
notify
}

getState().then(state => {
Expand Down Expand Up @@ -480,4 +481,4 @@ function getState() {
})
}

export default { init, notify }
export default { init }
5 changes: 0 additions & 5 deletions src/js/logic/user-initiated-notify.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import uuid from 'uuid/v4'
import { handleEvent } from '../helpers/events'
import { state } from '../helpers/state'
import { getAllByQuery, removeNotification } from '../views/dom'

const defaultTimeout = eventCode => {
Expand All @@ -18,10 +17,6 @@ const defaultTimeout = eventCode => {
* A function that when called will dismiss the notification
*/
export default function userInitiatedNotify(eventCode, message, customTimeout) {
// Enforce assist must be initialized
if (!state.iframe)
throw new Error('assist must be initialized before calling notify')

// Validate message
if (!message || typeof message !== 'string')
throw new Error('Message is required')
Expand Down