Skip to content

Commit

Permalink
Remove MOBILE Onboarding (#46)
Browse files Browse the repository at this point in the history
* remove MOBILE from hotspot types

* remove params
  • Loading branch information
kent-williams authored Feb 3, 2025
1 parent d4652de commit 2b0bfd4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 38 deletions.
9 changes: 1 addition & 8 deletions src/features/hotspots/root/hotspotTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ export const FREEDOM_FI_MAKER_NAME = 'freedomfi'
export const FREEDOM_FI_MAKER_ADDRESS =
'13y2EqUUzyQhQGtDSoXktz8m5jHNSiwAKLTYnHNxZq2uH5GGGym'

export const getHotspotTypes = (makerNameOrAddress?: string): HotspotType[] => {
if (
makerNameOrAddress?.toLowerCase().includes(FREEDOM_FI_MAKER_NAME) ||
makerNameOrAddress === FREEDOM_FI_MAKER_ADDRESS
) {
return ['IOT', 'MOBILE']
}

export const getHotspotTypes = (): HotspotType[] => {
return ['IOT']
}
18 changes: 2 additions & 16 deletions src/features/hotspots/setup/HotspotSetupConfirmLocationScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import React, { useCallback, useMemo, useState } from 'react'
import { ActivityIndicator, ScrollView } from 'react-native'
import { useTranslation } from 'react-i18next'
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'
import {
useOnboarding,
AssertData,
useSolana,
AddGatewayV1,
} from '@helium/react-native-sdk'
import { useOnboarding, AssertData, useSolana } from '@helium/react-native-sdk'
import { useAsync } from 'react-async-hook'
import { first, last } from 'lodash'
import animalName from 'angry-purple-tiger'
Expand Down Expand Up @@ -57,16 +52,7 @@ const HotspotSetupConfirmLocationScreen = () => {
try {
let networkTypes = params.hotspotNetworkTypes
if (!networkTypes?.length) {
if (params.addGatewayTxn) {
const gatewayTxn = AddGatewayV1.fromString(params.addGatewayTxn)
networkTypes = getHotspotTypes(gatewayTxn.payer?.b58)
} else {
// onboarding record lookup agressively rate limits, only lookup if absolutely necessary
const onboardingRecord = await getOnboardingRecord(
params.hotspotAddress,
)
networkTypes = getHotspotTypes(onboardingRecord?.maker.name)
}
networkTypes = getHotspotTypes()
}

const locationParams = {
Expand Down
24 changes: 10 additions & 14 deletions src/features/hotspots/setup/HotspotTxnsProgressScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,23 +214,19 @@ const HotspotTxnsProgressScreen = () => {

let networkTypes = params.hotspotNetworkTypes
if (!networkTypes?.length) {
if (params.addGatewayTxn) {
const gatewayTxn = AddGatewayV1.fromString(params.addGatewayTxn)
networkTypes = getHotspotTypes(gatewayTxn.payer?.b58)
handleLog({ message: 'Getting onboard record' })
// onboarding record lookup agressively rate limits, only lookup if absolutely necessary
const onboardingRecord = await getOnboardingRecord(
params.hotspotAddress || '',
)
if (onboardingRecord) {
handleLog({ message: 'Got onboard record' })
} else {
handleLog({ message: 'Getting onboard record' })
// onboarding record lookup agressively rate limits, only lookup if absolutely necessary
const onboardingRecord = await getOnboardingRecord(
params.hotspotAddress || '',
)
if (onboardingRecord) {
handleLog({ message: 'Got onboard record' })
} else {
handleLog({ message: 'Could not get onboard record' })
}
networkTypes = getHotspotTypes(onboardingRecord?.maker.name)
handleLog({ message: 'Could not get onboard record' })
}

networkTypes = getHotspotTypes()

handleLog({
message: `Networks to onboard - ${networkTypes?.join(',')}`,
})
Expand Down

0 comments on commit 2b0bfd4

Please sign in to comment.