@exodus/market-history 7.1.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@7.1.0...@exodus/market-history@7.2.0) (2023-12-08)
7
+
8
+ ### Features
9
+
10
+ - **market-history:** update when coming back from background ([#4974](https://github.com/ExodusMovement/exodus-hydra/issues/4974)) ([7da86fd](https://github.com/ExodusMovement/exodus-hydra/commit/7da86fdd3d3627c9f89ae8b50adf24b5f77eb47b))
11
+
6
12
  ## [7.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@7.0.0...@exodus/market-history@7.1.0) (2023-08-29)
7
13
 
8
14
  ### Features
package/module/index.js CHANGED
@@ -266,6 +266,7 @@ class MarketHistoryMonitor extends ExodusModule {
266
266
  )
267
267
  }
268
268
  }
269
+
269
270
  #updateNewAssets = async (assetNames) => {
270
271
  const currency = this.#currency
271
272
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/market-history",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "Fetches historical prices for assets",
5
5
  "author": "Exodus Movement Inc.",
6
6
  "license": "UNLICENSED",
@@ -32,14 +32,14 @@
32
32
  "devDependencies": {
33
33
  "@exodus/assets": "^8.0.94",
34
34
  "@exodus/assets-base": "^8.1.6",
35
- "@exodus/assets-feature": "^1.4.0",
36
- "@exodus/atoms": "^5.5.0",
35
+ "@exodus/assets-feature": "^4.0.0",
36
+ "@exodus/atoms": "^6.0.2",
37
37
  "@exodus/bitcoin-meta": "^1.0.1",
38
38
  "@exodus/ethereum-meta": "^1.0.30",
39
- "@exodus/locale": "^2.0.0",
40
- "@exodus/rates-monitor": "^4.0.1",
41
- "@exodus/redux-dependency-injection": "^2.0.1",
42
- "@exodus/storage-memory": "^2.1.0",
39
+ "@exodus/locale": "^2.0.2",
40
+ "@exodus/rates-monitor": "^4.0.2",
41
+ "@exodus/redux-dependency-injection": "^3.0.0",
42
+ "@exodus/storage-memory": "^2.1.1",
43
43
  "eslint": "^8.44.0",
44
44
  "events": "^3.3.0",
45
45
  "jest": "^29.1.2",
@@ -56,5 +56,5 @@
56
56
  "type": "git",
57
57
  "url": "git+https://github.com/ExodusMovement/exodus-hydra.git"
58
58
  },
59
- "gitHead": "eee9fe0952865a3f6ab094c4c2205c75b4a37de7"
59
+ "gitHead": "ad7d8c91f6aeb9a506a7998778e16f66da4a5511"
60
60
  }
package/plugin/index.js CHANGED
@@ -1,8 +1,28 @@
1
1
  import { createAtomObserver } from '@exodus/atoms'
2
2
 
3
- const createMarketHistoryLifecyclePlugin = ({ marketHistoryMonitor, marketHistoryAtom, port }) => {
3
+ const createMarketHistoryLifecyclePlugin = ({
4
+ marketHistoryMonitor,
5
+ marketHistoryAtom,
6
+ appProcessAtom,
7
+ port,
8
+ }) => {
9
+ let unobserve
10
+
4
11
  const observer = createAtomObserver({ port, atom: marketHistoryAtom, event: 'marketHistory' })
5
- observer.register()
12
+
13
+ const onStart = () => {
14
+ if (!appProcessAtom) return
15
+
16
+ let previousMode
17
+
18
+ unobserve = appProcessAtom.observe(({ mode }) => {
19
+ const isBackFromBackground = previousMode === 'background' && mode === 'active'
20
+
21
+ if (isBackFromBackground) marketHistoryMonitor.update('hour')
22
+
23
+ previousMode = mode
24
+ })
25
+ }
6
26
 
7
27
  const onLoad = () => {
8
28
  observer.start()
@@ -14,16 +34,17 @@ const createMarketHistoryLifecyclePlugin = ({ marketHistoryMonitor, marketHistor
14
34
 
15
35
  const onStop = () => {
16
36
  observer.unregister()
37
+ unobserve?.()
17
38
  }
18
39
 
19
- return { onUnlock, onLoad, onStop }
40
+ return { onStart, onUnlock, onLoad, onStop }
20
41
  }
21
42
 
22
43
  const marketHistoryLifecyclePluginDefinition = {
23
44
  id: 'marketHistoryLifecyclePlugin',
24
45
  type: 'plugin',
25
46
  factory: createMarketHistoryLifecyclePlugin,
26
- dependencies: ['marketHistoryMonitor', 'marketHistoryAtom', 'port'],
47
+ dependencies: ['marketHistoryMonitor', 'marketHistoryAtom', 'appProcessAtom?', 'port'],
27
48
  }
28
49
 
29
50
  export default marketHistoryLifecyclePluginDefinition
@@ -2,4 +2,5 @@ const marketHistoryInitialState = {
2
2
  loaded: false,
3
3
  data: {},
4
4
  }
5
+
5
6
  export default marketHistoryInitialState
@@ -13,4 +13,5 @@ const getFiatValueWithFallbackSelector = {
13
13
  { selector: 'getPriceWithFallback' },
14
14
  ],
15
15
  }
16
+
16
17
  export default getFiatValueWithFallbackSelector
@@ -47,4 +47,5 @@ const getPriceWithFallbackSelector = {
47
47
  { selector: 'getHourlyPrice' },
48
48
  ],
49
49
  }
50
+
50
51
  export default getPriceWithFallbackSelector