Skip to content

Commit

Permalink
feat: android: screens (ports new app structure to android) (#911)
Browse files Browse the repository at this point in the history
* feat: android: partially NewSeedBackup screen

* feat: android: create random seed

* feat: android: partially recover seed and fix seed selection

* feat: android: restore seed

* feat: android: basic transaction signing

* feat: android: author and network in tx preview

* chore: android: upgrade gradle

* feat: android: derive key (no pw)

* feat: android: new kay confirm password

* feat: android: network selector

* feat: android: export key

* fix: android: parse all tx card sets

* feat: android: log menu with checksum

* feat: android: lock app on failed auth, offer to unlock

* style: android: bigbutton shading

* style: android: settings card

* feat: android: remove seed

* feat: android: backup screen

* feat: android: verifier screen

* fix: android: pass error message to alert

* feat: android: all remaining screens mwp

* feat: android: nits in settings screen

* feat: android: mwp all screens

* feat: android: add multiexport and address import screens

* feat: android: landing screen

* style: android: landing screen

* feat: android: warn user to turn on airplane mode on first launch

* style: android: color dark-light theming

* fix: android: nasty lazy list non-recomposing fix

* style: android: fonts and network card

* style: android: prettier seed recover screen

* style: android: paint the shield

* style: android: paint the shield less annoyingly

* style: android: big button

* style: android: text entry fields

* feat: wipe on onboard to kill old db (probably useless on android but implementations?)

* style: android: nits

* style: android: footer

* style: android: settings verifier card

* feat: android: backup self-destruct and styles

* style: modal backdrop look

* fix: android: cleaner log lazy column addressing

* feat: android: nicer frame counter

* chore: update gradle

* style: android: unified alert style

* style: android: history cards

* style: sndroid: extended cards stub

* style: android: all TX cards

* build: os-specific Cargo.lock

* fix: wrong cargo file

* fix: build script typos

* revert: return lost Cargo file

* fix: android: unified json pubkey identifiers

* fix: more reasonable auth request message

* fix: android: lint

* chore: lint and updates

* feat: android: key swipe and multiselect

* feat: android: unlock for wipe

* feat: android: put signature on rails

* feat: android: handle hardware back button

* fix: android: prevent multiselect bottom bar hiding

* fix: android: sort keys by path

* refactor: lint

* ci: rust test for both platforms

* chore: bump version number

* fix: android: close network selector on click outside

* fix: android: screen-wide scroll surface in backup

* fix: android: small fixes in network details screen

* fix: android: forbid blank seedname

* fix: android: base64 screen user comment

* style: android: align seed name entry on top

* ci: rename test stage in rust-test.yml

Co-authored-by: Denis Pisarev <17856421+TriplEight@users.noreply.github.com>

* ci: parallel rust tests

* feat: android: request camera permission

* style: android: align seedphrase left

* style: android: enable airplane mode message alignment

* fix: android: messy airplane mode detection with onboarding

* style: android: status bar color

* style: android: docs and landing

* style: android: key manager screen nits

* style: copy seedmanager element into seedselector (temporarily)

* style: android: setting screen nits

* feat: android: done button on signature screen

* style: spacers for checkboxes

* fix: android: seed name in transaction author card

* style: android: use crypto font in seed name entry

* style: android: crypto font on derivation screen

* fix: android: gracefully disable seed key

* style: android: larger network selector

* style: android: padding for export key qr

* style: key manager nits

* style: android: remove left blank space in text entry field

* fix: android: enable buttons under signature

* style: android: show seed name on key derive

* feat: android: close key menu on tap outside

* style: android: text input padding

* style: paddings under text enrties

* feat: android: sort backup screen

* fix: android: properly decode comment

* test: ignore os message content (#930)

* test: ignore os message content

* test: ignore os message content, this time in all instances

* feat: android: fallback to biometric if strongbox is unavailable

* style: android: keymanager icons

* fix: android: strongbox detection fix

* fix: android: update seed phrase validity on button push

* refactor: android lint

* style: android: top bar look

* style: android: multiselect select all button position

* style: android: input fields

* style: android: remove background in passive settings buttons

* fix: android: disable multiselect actions when nothing is selected

* style: android: multiselect key card look

* style: android: pubkey font for seed

Co-authored-by: Denis Pisarev <17856421+TriplEight@users.noreply.github.com>
Co-authored-by: varovainen <99664267+varovainen@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 24, 2022
1 parent 71cc544 commit 4a3a0e3
Show file tree
Hide file tree
Showing 157 changed files with 13,554 additions and 1,664 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust backend test
name: Rust backend test for android

on:
pull_request:
Expand All @@ -18,6 +18,10 @@ jobs:
- name: Checkout submodules
shell: bash
run: git submodule update --init --recursive
- name: Rust build
- name: cargo test
shell: bash
run: cd rust && cargo test && cd ..
run: |
cd rust
cp os-specific-lock/android/Cargo.lock .
cargo test
cd ..
27 changes: 27 additions & 0 deletions .github/workflows/rust-test-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Rust backend test for ios

on:
pull_request:
push:
branches:
- master
- stable
jobs:
check:
name: Check
runs-on: macos-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 50
- name: Checkout submodules
shell: bash
run: git submodule update --init --recursive
- name: cargo test
shell: bash
run: |
cd rust
cp os-specific-lock/ios/Cargo.lock .
cargo test
cd ..
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ ios/NativeSigner/Database/Database/*
# rust
rust/target
rust/*/target
rust/Cargo.lock
rust/signer/Cargo.toml
rust/db_handling/signer_database
rust/qrcode_static/*.png
rust/files/for_signing/*
Expand Down
39 changes: 20 additions & 19 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ plugins {
id 'com.android.application'
id 'kotlin-android'
}
apply plugin: 'kotlin-android'

android {
compileSdk 31
compileSdk 32

defaultConfig {
applicationId "io.parity.signer"
minSdk 23
targetSdk 31
versionCode 46600
versionName "4.6.6"
targetSdk 32
versionCode 50100
versionName "5.0.1"
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
Expand Down Expand Up @@ -43,42 +44,42 @@ android {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"
pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
resources {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
jniLibs {
pickFirsts += ['lib/armeabi-v7a/libc++_shared.so', 'lib/arm64-v8a/libc++_shared.so', 'lib/x86/libc++_shared.so', 'lib/x86_64/libc++_shared.so']
}
}
buildToolsVersion '31.0.0'
compileSdkVersion 31
compileSdk 32
ndkVersion '23.0.7599858'
}

dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation 'androidx.compose.material:material:1.0.5'
implementation 'androidx.compose.material:material:1.1.0'
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.activity:activity-compose:1.4.0'
implementation 'androidx.compose.runtime:runtime-livedata:1.0.5'
implementation 'androidx.compose.runtime:runtime-livedata:1.1.0'
implementation 'androidx.security:security-crypto:1.1.0-alpha03'
implementation 'androidx.biometric:biometric:1.1.0'
implementation 'androidx.security:security-crypto-ktx:1.1.0-alpha03'
implementation 'androidx.camera:camera-core:1.0.2'
implementation 'androidx.camera:camera-lifecycle:1.0.2'
implementation 'androidx.camera:camera-view:1.0.0-alpha31'
implementation 'androidx.camera:camera-camera2:1.0.2'
implementation 'com.google.mlkit:barcode-scanning:17.0.0'
implementation 'androidx.camera:camera-view:1.1.0-beta01'
implementation 'androidx.camera:camera-camera2:1.1.0-beta01'
implementation 'com.google.mlkit:barcode-scanning:17.0.2'
implementation "androidx.compose.material:material-icons-extended:$compose_version"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.core:core-ktx:1.7.0"
}
1 change: 0 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.ParitySigner.NoActionBar"
android:screenOrientation="portrait">
<intent-filter>
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/java/io/parity/signer/Buttons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ enum class ButtonID {
Shield,
SelectKey,
GoForward,
Derive,
Delete,
NewSeed,
RecoverSeed,
Expand All @@ -39,13 +38,14 @@ enum class ButtonID {
RemoveKey,
RemoveSeed,
ClearLog,
CreateLogComment,
ShowLogDetails,
Swipe,
LongTap,
SelectAll,
Increment,
ShowDocuments,
ExportMultiselect;
ExportMultiSelect;


fun getName(): String {
Expand Down
117 changes: 80 additions & 37 deletions android/app/src/main/java/io/parity/signer/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
package io.parity.signer

import android.os.Bundle
import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import io.parity.signer.modals.WaitingScreen
import io.parity.signer.models.SignerDataModel
import io.parity.signer.ui.theme.ParitySignerTheme
import androidx.compose.ui.unit.dp
import io.parity.signer.components.BigButton
import io.parity.signer.components.BottomBar
import io.parity.signer.components.TopBar
import io.parity.signer.models.SignerDataModel
import io.parity.signer.models.pushButton
import io.parity.signer.screens.LandingView
import io.parity.signer.screens.WaitingScreen
import io.parity.signer.ui.theme.ParitySignerTheme
import io.parity.signer.ui.theme.Text600

@ExperimentalMaterialApi
@ExperimentalAnimationApi
Expand Down Expand Up @@ -43,52 +53,85 @@ class MainActivity : AppCompatActivity() {
fun SignerApp(signerDataModel: SignerDataModel) {
ParitySignerTheme {
val onBoardingDone = signerDataModel.onBoardingDone.observeAsState()
val authenticated = signerDataModel.authenticated.observeAsState()
val signerScreen = signerDataModel.screen.observeAsState()
val signerModal = signerDataModel.modal.observeAsState()
val signerAlert = signerDataModel.alert.observeAsState()
val shieldAlert = signerDataModel.alertState.observeAsState()
val footer = signerDataModel.footer.observeAsState()

when (onBoardingDone.value) {
OnBoardingState.Yes -> {
//Structure to contain all app
Scaffold(
topBar = {
TopBar(signerDataModel = signerDataModel)
},
bottomBar = {
BottomBar(signerDataModel = signerDataModel)
if (authenticated.value == true) {
BackHandler {
signerDataModel.pushButton(ButtonID.GoBack)
}
//Structure to contain all app
Scaffold(
topBar = {
TopBar(signerDataModel = signerDataModel)
},
bottomBar = {
if(footer.value == true) BottomBar(signerDataModel = signerDataModel)
}
) { innerPadding ->
Box(modifier = Modifier.padding(innerPadding)) {
ScreenSelector(signerScreen.value, signerDataModel)
ModalSelector(
modal = signerModal.value ?: SignerModal.Empty,
signerDataModel = signerDataModel
)
AlertSelector(
alert = signerAlert.value ?: SignerAlert.Empty,
signerDataModel = signerDataModel
)
}
}
) { innerPadding ->
Box(modifier = Modifier.padding(innerPadding)) {
ScreenSelector(signerScreen.value, signerDataModel)
ModalSelector(modal = signerModal.value?: SignerModal.Empty, signerDataModel = signerDataModel)
AlertSelector(alert = signerAlert.value?: SignerAlert.Empty, signerDataModel = signerDataModel)
} else {
Column(verticalArrangement = Arrangement.Center) {
Spacer(Modifier.weight(0.5f))
BigButton(
text = "Unlock app",
action = {
signerDataModel.authentication.authenticate(signerDataModel.activity) {
signerDataModel.totalRefresh()
}
})
Spacer(Modifier.weight(0.5f))
}
}
}
OnBoardingState.No -> {
//TODO: onboarding
AlertDialog(
onDismissRequest = { /*TODO: make sure it is nothing*/ },
buttons = {
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor = MaterialTheme.colors.background,
contentColor = MaterialTheme.colors.onBackground,
),
onClick = {
signerDataModel.onBoard()
}
) {
Text("Accept")
}
},
title = { Text("Terms and conditions") },
text = { Text(onBoardingDone.value.toString()) }
)
if (shieldAlert.value == ShieldAlert.None) {
LandingView(signerDataModel = signerDataModel)
} else {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.padding(12.dp)
) {
Text(
"Please enable airplane mode",
color = MaterialTheme.colors.Text600
)
}
}
}
OnBoardingState.InProgress -> {
WaitingScreen()
if (authenticated.value == true) {
WaitingScreen()
} else {
Column(verticalArrangement = Arrangement.Center) {
Spacer(Modifier.weight(0.5f))
BigButton(
text = "Unlock app",
action = {
signerDataModel.lateInit()
})
Spacer(Modifier.weight(0.5f))
}
}
}
null -> TODO()
}
}
}
Loading

0 comments on commit 4a3a0e3

Please sign in to comment.