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

chore(suite): device state to new object format #15064

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

martykan
Copy link
Member

@martykan martykan commented Oct 24, 2024

Description

To goal of this PR is to enable Suite to persist the full state object.
Suite is already saving both state and _state, so the persistence logic for the state is already handled, we just needed to start sending the state object instead of the string.

The approach in this PR is forward-compatible with Connect 10, where the state as string will be removed and replaced by the DeviceState object.

So this is implemented by updating Suite's TrezorDevice type to have state: DeviceState ahead of the change in Connect and by adapting the rest of the code. This includes a migration of the old persisted values.

Related Issue

Resolve #14972

@martykan martykan force-pushed the feat/suite-remember-device-state branch from ecd4144 to 5216969 Compare October 24, 2024 15:55
Copy link

github-actions bot commented Oct 24, 2024

Fingerprint is changed, new EAS Build(s) are now in pipeline.

Build with commit 762d683

Name Build Details
🤖 Android build View build page
DetailsDistribution: INTERNAL
Build profile: preview
SDK version: 51.0.0
App version: 24.10.2
🍎 iOS build View build page
DetailsDistribution: INTERNAL
Build profile: preview
SDK version: 51.0.0
App version: 24.10.2
Fingerprint diff
[
  {
    "op": "changed",
    "source": {
      "type": "contents",
      "id": "expoConfig",
      "contents": "{\"android\":{\"adaptiveIcon\":{\"backgroundColor\":\"#E59D17\",\"foregroundImage\":\"./assets/appIcon_android.png\",\"monochromeImage\":\"./assets/appIcon_android.png\"},\"intentFilters\":[{\"action\":\"VIEW\",\"autoVerify\":true,\"category\":[\"BROWSABLE\",\"DEFAULT\"],\"data\":[{\"host\":\"dev.suite.sldev.cz\",\"pathPattern\":\"/connect/.*/.*/deeplink/.*\",\"scheme\":\"https\"},{\"host\":\"dev.suite.sldev.cz\",\"pathPattern\":\"/connect/.*/deeplink/.*\",\"scheme\":\"https\"}]}],\"package\":\"io.trezor.suite.preview\",\"permissions\":[\"android.permission.CAMERA\"]},\"extra\":{\"commitHash\":\"34ec60b86ffe8633cead1b638d9bc0302d4696fe\",\"eas\":{\"projectId\":\"15998f8a-e75c-4b60-959d-6f68e5ff4936\"}},\"ios\":{\"associatedDomains\":[\"applinks:dev.suite.sldev.cz\"],\"bundleIdentifier\":\"io.trezor.suite.preview\",\"icon\":\"./assets/preview/appIcon.png\",\"infoPlist\":{\"ITSAppUsesNonExemptEncryption\":false,\"NSAppTransportSecurity\":{\"NSAllowsArbitraryLoads\":true,\"NSExceptionDomains\":{\"data.trezor.io\":{\"NSExceptionAllowsInsecureHTTPLoads\":true,\"NSIncludesSubdomains\":true},\"localhost\":{\"NSExceptionAllowsInsecureHTTPLoads\":true}}},\"NSCameraUsageDescription\":\"$(PRODUCT_NAME) needs access to your Camera to scan your XPUB.\",\"NSFaceIDUsageDescription\":\"$(PRODUCT_NAME) needs Face ID and Touch ID to keep sensitive data about your portfolio private.\",\"NSMicrophoneUsageDescription\":\"This app does not require access to the microphone.\",\"UIRequiredDeviceCapabilities\":[\"armv7\"]},\"supportsTablet\":true},\"name\":\"Trezor Suite Lite Preview\",\"orientation\":\"portrait\",\"owner\":\"trezorcompany-develop\",\"platforms\":[\"android\",\"ios\"],\"plugins\":[\"./plugins/withGradleProperties.js\",\"./plugins/withRemoveXcodeLocalEnv.js\",\"./plugins/withRemoveiOSNotificationEntitlement.js\",\"@trezor/react-native-usb/plugins/withUSBDevice.js\",[\"./plugins/withAndroidMainActivityAttributes.js\",{\"android:allowBackup\":false}],[\"@config-plugins/detox\",{\"subdomains\":\"*\"}],[\"@sentry/react-native/expo\",{\"organization\":\"satoshilabs\",\"project\":\"suite-native\",\"url\":\"https://sentry.io/\"}],[\"expo-build-properties\",{\"android\":{\"minSdkVersion\":28},\"ios\":{\"deploymentTarget\":\"14.0\"}}],[\"expo-camera\",{\"cameraPermission\":\"Allow $(PRODUCT_NAME) to access camera for QR code scanning.\",\"microphonePermission\":false,\"recordAudioAndroid\":false}],[\"expo-font\",{\"fonts\":[\"../../packages/theme/fonts/TTSatoshi-DemiBold.otf\",\"../../packages/theme/fonts/TTSatoshi-Medium.otf\",\"../../suite-common/icons/iconFontsMobile/TrezorSuiteIcons.ttf\"]}],[\"expo-image-picker\",{\"microphonePermission\":false,\"photosPermission\":\"Allow $(PRODUCT_NAME) to access your photos to let you import QR code images.\"}]],\"runtimeVersion\":\"9\",\"scheme\":\"trezorsuitelite\",\"sdkVersion\":\"51.0.0\",\"slug\":\"trezor-suite-preview\",\"splash\":{\"backgroundColor\":\"#25292E\",\"image\":\"./assets/splash_icon.png\",\"resizeMode\":\"contain\"},\"updates\":{\"requestHeaders\":{\"expo-channel-name\":\"preview\"},\"url\":\"https://u.expo.dev/15998f8a-e75c-4b60-959d-6f68e5ff4936\"},\"userInterfaceStyle\":\"automatic\",\"version\":\"24.10.2\"}",
      "reasons": [
        "expoConfig"
      ],
      "hash": "5cb5419a5b5a84b3f83376afd84ce101ceb464a6"
    }
  }
]

Learn more about 𝝠 Expo Github Action

Copy link

github-actions bot commented Oct 24, 2024

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 9
  • More info

Learn more about 𝝠 Expo Github Action

@martykan martykan force-pushed the feat/suite-remember-device-state branch from 5216969 to 762d683 Compare October 25, 2024 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

suite: start using device._state for connect calls
1 participant