-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into l10n_develop
- Loading branch information
Showing
23 changed files
with
148 additions
and
19 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "desktop", | ||
"productName": "Bloom", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Simple and secure web3 wallet for the IOTA and Shimmer ecosystem", | ||
"main": "public/build/main.process.js", | ||
"repository": "[email protected]:bloomwalletio/bloom.git", | ||
|
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
8 changes: 8 additions & 0 deletions
8
packages/shared/src/lib/auxiliary/country/actions/getAndUpdateCountryCode.ts
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,8 @@ | ||
import { CountryApi } from '../api' | ||
import { updateCountryCode } from '../stores' | ||
|
||
export async function getAndUpdateCountryCode(): Promise<void> { | ||
const api = new CountryApi() | ||
const countryCode = await api.getCountryCode() | ||
updateCountryCode(countryCode) | ||
} |
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 @@ | ||
export * from './getAndUpdateCountryCode' |
42 changes: 42 additions & 0 deletions
42
packages/shared/src/lib/auxiliary/country/api/country.api.ts
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,42 @@ | ||
import { BaseApi } from '@core/utils' | ||
|
||
interface IIpApiResponse { | ||
ip: string | ||
network: string | ||
version: string | ||
city: string | ||
region: string | ||
region_code: string | ||
country: string | ||
country_name: string | ||
country_code: string | ||
country_code_iso3: string | ||
country_capital: string | ||
country_tld: string | ||
continent_code: string | ||
in_eu: boolean | ||
postal: string | ||
latitude: number | ||
longitude: number | ||
timezone: string | ||
utc_offset: string | ||
country_calling_code: string | ||
currency: string | ||
currency_name: string | ||
languages: string | ||
country_area: number | ||
country_population: number | ||
asn: string | ||
org: string | ||
} | ||
|
||
export class CountryApi extends BaseApi { | ||
constructor() { | ||
super('https://ipapi.co') | ||
} | ||
|
||
async getCountryCode(): Promise<string | undefined> { | ||
const ipData = await this.get<IIpApiResponse>('json') | ||
return ipData?.country_code | ||
} | ||
} |
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 @@ | ||
export * from './country.api' |
Empty file.
9 changes: 9 additions & 0 deletions
9
packages/shared/src/lib/auxiliary/country/stores/country-code.store.ts
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,9 @@ | ||
import { writable } from 'svelte/store' | ||
|
||
export const countryCode = writable<string | undefined>(undefined) | ||
|
||
export function updateCountryCode(_countryCode: string | undefined): void { | ||
if (_countryCode) { | ||
countryCode?.set(_countryCode) | ||
} | ||
} |
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 @@ | ||
export * from './country-code.store' |
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 |
---|---|---|
|
@@ -6,4 +6,7 @@ export interface IAppParameters { | |
allowlists: { | ||
urls: string[] | ||
} | ||
geoFence: { | ||
buySell: string[] | ||
} | ||
} |
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 |
---|---|---|
|
@@ -5,5 +5,8 @@ | |
}, | ||
"allowlists": { | ||
"urls": ["https://tideprotocol.infura-ipfs.io"] | ||
}, | ||
"geoFence": { | ||
"buySell": ["GB"] | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/shared/src/lib/core/profile/constants/profile-version.constant.ts
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { AppStage } from '@core/app/enums' | ||
|
||
export const PROFILE_VERSION: Record<AppStage, number> = { | ||
[AppStage.ALPHA]: 20, | ||
[AppStage.ALPHA]: 21, | ||
[AppStage.BETA]: 1, | ||
[AppStage.PROD]: 11, | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/shared/src/lib/core/profile/migrations/actions/addDefaultIscChainsToIotaProfiles.ts
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,15 @@ | ||
import { DEFAULT_ISC_CHAINS_CONFIGURATIONS, SupportedStardustNetworkId } from '@core/network' | ||
import { IPersistedProfile } from '@core/profile/interfaces' | ||
|
||
export function addDefaultIscChainsToIotaProfiles(profile: IPersistedProfile): void { | ||
if (profile.network.id !== SupportedStardustNetworkId.Iota) { | ||
return | ||
} | ||
|
||
const chainConfiguration = DEFAULT_ISC_CHAINS_CONFIGURATIONS[SupportedStardustNetworkId.Iota] | ||
|
||
profile.network = { | ||
...profile.network, | ||
chainConfigurations: chainConfiguration ? [chainConfiguration] : [], | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
packages/shared/src/lib/core/profile/migrations/alpha/alpha-profile-migration-19-to-20.ts
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { IPersistedProfile } from '../../interfaces' | ||
import { migrateEvmContacts } from '../../migrations/actions/migrateEvmContacts' | ||
import { IPersistedProfile } from '@core/profile/interfaces' | ||
import { addDefaultIscChainsToIotaProfiles } from '../actions/addDefaultIscChainsToIotaProfiles' | ||
|
||
export function alphaProfileMigration19To20(existingProfile: unknown): Promise<void> { | ||
const profile = existingProfile as IPersistedProfile | ||
|
||
migrateEvmContacts(profile) | ||
addDefaultIscChainsToIotaProfiles(profile) | ||
|
||
return Promise.resolve() | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/shared/src/lib/core/profile/migrations/alpha/alpha-profile-migration-20-to-21.ts
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,10 @@ | ||
import { IPersistedProfile } from '@core/profile/interfaces' | ||
import { migrateEvmContacts } from '../../migrations/actions/migrateEvmContacts' | ||
|
||
export function alphaProfileMigration20To21(existingProfile: unknown): Promise<void> { | ||
const profile = existingProfile as IPersistedProfile | ||
|
||
migrateEvmContacts(profile) | ||
|
||
return Promise.resolve() | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './isFeatureEnabled' | ||
export * from './isFeatureGeoFenced' |
21 changes: 21 additions & 0 deletions
21
packages/shared/src/lib/features/utils/isFeatureGeoFenced.ts
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,21 @@ | ||
import { countryCode } from '@auxiliary/country/stores' | ||
import { appParameters } from '@core/app/stores' | ||
import { get } from 'svelte/store' | ||
|
||
export function isFeatureNotGeoFenced(featureString: string): boolean { | ||
const currentCountryCode = get(countryCode) | ||
const featurePathToCheck = featureString.split('.') | ||
const geoFence = get(appParameters)?.geoFence | ||
let previousFeatures = geoFence | ||
for (let i = 0; i < featurePathToCheck.length; i++) { | ||
const currentFeature = previousFeatures?.[featurePathToCheck[i]] | ||
if (!currentFeature) { | ||
return true | ||
} | ||
if (i === featurePathToCheck.length - 1) { | ||
return !currentFeature?.some((blockedCountry) => blockedCountry === currentCountryCode) | ||
} | ||
previousFeatures = currentFeature | ||
} | ||
return true | ||
} |