File tree Expand file tree Collapse file tree 7 files changed +26
-10
lines changed Expand file tree Collapse file tree 7 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ export interface WalletModule {
82
82
preferred ?: boolean
83
83
desktop ?: boolean
84
84
mobile ?: boolean
85
+ osExclusions ?: Array < string >
85
86
}
86
87
87
88
export interface Helpers {
@@ -209,6 +210,7 @@ export interface AppState {
209
210
networkId : number
210
211
version : string
211
212
mobileDevice : boolean
213
+ os : string
212
214
darkMode : boolean
213
215
autoSelectWallet : string
214
216
walletSelectInProgress : boolean
Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ function operaTouch(
37
37
link : 'https://www.opera.com/mobile/touch' ,
38
38
installMessage : extensionInstallMessage ,
39
39
mobile : true ,
40
- preferred
40
+ preferred,
41
+ osExclusions : [ 'Android' ]
41
42
}
42
43
}
43
44
Original file line number Diff line number Diff line change @@ -37,7 +37,9 @@ function opera(
37
37
link : 'https://www.opera.com/' ,
38
38
installMessage : extensionInstallMessage ,
39
39
desktop : true ,
40
- preferred
40
+ mobile : true ,
41
+ preferred,
42
+ osExclusions : [ 'iOS' ]
41
43
}
42
44
}
43
45
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import {
14
14
walletInterface
15
15
} from './stores'
16
16
17
- import { isMobileDevice } from './utilities'
17
+ import { getDeviceInfo } from './utilities'
18
18
import { initializeBlocknative } from './services'
19
19
import { validateInit , validateConfig } from './validation'
20
20
@@ -45,12 +45,15 @@ function init(initialization: Initialization): API {
45
45
46
46
initializeBlocknative ( dappId , networkId )
47
47
48
+ const { os, isMobile } = getDeviceInfo ( )
49
+
48
50
app . update ( ( store : AppState ) => ( {
49
51
...store ,
50
52
dappId,
51
53
networkId,
52
54
version,
53
- mobileDevice : isMobileDevice ( ) ,
55
+ mobileDevice : isMobile ,
56
+ os,
54
57
darkMode
55
58
} ) )
56
59
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export const app: WritableStore = writable({
18
18
networkId : 1 ,
19
19
version : '' ,
20
20
mobileDevice : false ,
21
+ os : '' ,
21
22
darkMode : false ,
22
23
walletSelectInProgress : false ,
23
24
walletSelectCompleted : false ,
Original file line number Diff line number Diff line change @@ -161,11 +161,15 @@ export function getProviderName(provider: any): string | undefined {
161
161
}
162
162
}
163
163
164
- export function isMobileDevice ( ) {
164
+ export function getDeviceInfo ( ) {
165
165
const browser = bowser . getParser ( window . navigator . userAgent )
166
+ const { name } = browser . getOS ( )
166
167
const { type } = browser . getPlatform ( )
167
168
168
- return type !== 'desktop'
169
+ return {
170
+ isMobile : type !== 'desktop' ,
171
+ os : name
172
+ }
169
173
}
170
174
171
175
export function networkName ( id : number ) : string {
Original file line number Diff line number Diff line change 44
44
45
45
let selectedWalletModule: WalletModule
46
46
47
- const { mobileDevice } = get (app )
47
+ const { mobileDevice, os } = get (app )
48
48
let { heading, description, wallets } = module
49
49
50
50
let primaryWallets: WalletModule []
59
59
60
60
wallets = await wallets
61
61
62
- const deviceWallets = (wallets as WalletModule []).filter (
63
- wallet => wallet [mobileDevice ? ' mobile' : ' desktop' ]
64
- )
62
+ const deviceWallets = (wallets as WalletModule [])
63
+ .filter (wallet => wallet [mobileDevice ? ' mobile' : ' desktop' ])
64
+ .filter (wallet => {
65
+ const { osExclusions = [] } = wallet
66
+ return ! osExclusions .includes (os )
67
+ })
65
68
66
69
if (appState .autoSelectWallet ) {
67
70
const module = deviceWallets .find (
You can’t perform that action at this time.
0 commit comments