Skip to content

Commit

Permalink
DashPay: Send payment | Contact UI (#464)
Browse files Browse the repository at this point in the history
* Add Sending To on Enter Amount and Confirm Screens

* PlatformRepo: Add contact keychains to wallet when updating contacts

* Add NotificationItem to handle many types of notifications

* Add Preliminary History to Profile Page if contact was accepted

* Add username support to Transaction Details screens

* DashPayUserActivity: only show history if its a full contact

* BlockchainService: Add reset bloom filters action

Submit new bloom filters when contact is added

* DashPayUserActivity: Update screen after Send/Accept (was broken earlier)

* Use correct flow Send -> Select a Contact -> Contacts Screen
-> contact -> Enter Amount
-> Confirm -> Authenticate -> Results -> Profile/History

* Don't update contacts if there is no dashpay contract or the username is not completely registered

* Replace runBlocking in two places

* Use loadDistinct when getting profile information

* Move RoomDatabaseExtensions to data

* Basic implementation of blockchainIdentity caching

* Moved PlatformRepo initialization into main thread.

* Changed the way of performing periodic contacts sync by replacing Handler with direct coroutine approach

Co-authored-by: Tomasz Ludek <tomasz@dash.org>
  • Loading branch information
HashEngineering and tomasz-ludek authored Aug 4, 2020
1 parent b8c0815 commit 437e12c
Show file tree
Hide file tree
Showing 35 changed files with 1,185 additions and 172 deletions.
4 changes: 2 additions & 2 deletions wallet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "androidx.core:core-ktx:1.2.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4"
implementation "androidx.core:core-ktx:1.3.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8"

implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
Expand Down
11 changes: 11 additions & 0 deletions wallet/res/layout/activity_dashpay_user.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,15 @@

</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notifications_rv"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/payContactBtn"
app:layout_constraintBottom_toBottomOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
51 changes: 51 additions & 0 deletions wallet/res/layout/dialog_confirm_transaction.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
</LinearLayout>

<LinearLayout
android:id="@+id/sendtoaddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
Expand Down Expand Up @@ -137,6 +138,56 @@

</LinearLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/sendtouser"
android:layout_width="match_parent"
android:layout_height="51dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@drawable/top_separator"
android:orientation="horizontal">

<TextView
android:id="@+id/sendto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="7dp"
android:text="@string/dialog_confirm_pay_to"
android:textColor="@color/dash_gray"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>

<ImageView
android:id="@+id/avatar"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/displayname"/>

<TextView
android:id="@+id/displayname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="7dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:textColor="@color/dash_black"
android:textSize="16sp"
android:singleLine="true"
android:ellipsize="end"
android:text="John Doe" />
</androidx.constraintlayout.widget.ConstraintLayout>

<LinearLayout
android:id="@+id/payee_verified_by_pane"
android:layout_width="match_parent"
Expand Down
46 changes: 46 additions & 0 deletions wallet/res/layout/enter_amount_fragment.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dash_lighter_gray"
Expand Down Expand Up @@ -169,6 +170,51 @@
android:paddingBottom="8dp"
android:textSize="@dimen/transaction_fee_text_size" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/userinfo"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_gravity="center_vertical"
android:background="@drawable/top_bottom_separator"
android:orientation="horizontal">

<TextView
android:id="@+id/sendto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="15dp"
android:layout_marginEnd="7dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:text="@string/send_coins_to_username" />

<ImageView
android:id="@+id/avatar"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/displayname"/>

<TextView
android:id="@+id/displayname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="7dp"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:maxLines="1"
android:ellipsize="end"
android:text="John Doe" />
</androidx.constraintlayout.widget.ConstraintLayout>

<de.schildbach.wallet.ui.widget.NumericKeyboardView
android:id="@+id/numeric_keyboard"
android:layout_width="match_parent"
Expand Down
125 changes: 125 additions & 0 deletions wallet/res/layout/notification_transaction_row.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginLeft="11dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="10dp"
android:gravity="center">

<TextView
android:id="@+id/transaction_row_primary_status"
style="@style/MontserratMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="6dp"
android:textColor="@color/primary_status"
android:textSize="14sp"
tools:text="Receiving" />

<TextView
android:id="@+id/transaction_row_secondary_status"
style="@style/MontserratMedium.B.12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/transaction_row_primary_status"
android:layout_toEndOf="@id/transaction_row_primary_status"
android:layout_toRightOf="@id/transaction_row_primary_status"
android:textColor="@color/secondary_status"
tools:text="Processing" />

<TextView
android:id="@+id/transaction_row_time"
style="@style/MontserratRegular.MG.12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/transaction_row_primary_status"
android:layout_alignParentLeft="true"
android:layout_marginRight="4dp"
android:layout_marginBottom="5dp"
android:layout_toLeftOf="@id/rate_container"
android:ellipsize="end"
android:lines="1"
android:paddingLeft="10dp"
android:paddingRight="6dp"
android:textColor="@color/dash_gray"
tools:text="August 30, 11:28 AM" />

<LinearLayout
android:id="@+id/dash_amount_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/transaction_row_primary_status"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginRight="11dp"
android:gravity="center|right"
android:orientation="horizontal">

<TextView
android:id="@+id/transaction_amount_signal"
style="@style/MontserratMedium.MG"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:textSize="17sp"
tools:text="+"
tools:visibility="visible" />

<ImageView
android:id="@+id/dash_amount_symbol"
android:layout_width="18.62dp"
android:layout_height="14.63dp"
android:layout_marginTop="1dp"
android:layout_marginEnd="4dp"
android:layout_marginRight="4dp"
app:srcCompat="@drawable/ic_dash_symbol_gray" />

<org.dash.wallet.common.ui.CurrencyTextView
android:id="@+id/transaction_row_value"
style="@style/MontserratMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
tools:text="4.3939" />

</LinearLayout>

<FrameLayout
android:id="@+id/rate_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/dash_amount_container"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingEnd="15dp"
android:paddingRight="15dp">

<org.dash.wallet.common.ui.CurrencyTextView
android:id="@+id/transaction_row_fiat"
style="@style/MontserratMedium.MG.12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/dash_gray"
tools:text="350.98" />

<TextView
android:id="@+id/transaction_row_rate_not_available"
style="@style/MontserratMedium.MG.12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/transaction_row_rate_not_available"
android:textColor="@color/dash_gray"
tools:text="Not available"
tools:visibility="visible" />

</FrameLayout>

</RelativeLayout>
55 changes: 55 additions & 0 deletions wallet/res/layout/transaction_result_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,61 @@

</LinearLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/user_container"
android:layout_width="match_parent"
android:layout_height="51dp"
android:layout_gravity="center_vertical"
android:orientation="horizontal">

<TextView
android:id="@+id/user_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="7dp"
android:text="@string/dialog_confirm_pay_to"
android:textColor="@color/dash_gray"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>

<ImageView
android:id="@+id/avatar"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/displayname"/>

<TextView
android:id="@+id/displayname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="7dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:textColor="@color/dash_black"
android:textSize="16sp"
android:singleLine="true"
android:ellipsize="end"
android:text="John Doe" />

<View
android:id="@+id/separator7"
style="@style/SuccessfulTransactionSeparator"
android:layout_marginTop="12dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/displayname" />

</androidx.constraintlayout.widget.ConstraintLayout>

<FrameLayout
android:id="@+id/inputs_container"
android:layout_width="match_parent"
Expand Down
5 changes: 5 additions & 0 deletions wallet/res/values/strings-extra.xml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
<string name="transaction_details_sent_from">Sent from</string>
<string name="transaction_details_sent_to">Sent to</string>
<string name="transaction_details_received_at">Received at</string>
<string name="transaction_details_received_from">Received from</string>
<string name="transaction_details_moved_from">Moved from</string>
<string name="transaction_details_moved_internally_to">Internally moved to</string>

Expand Down Expand Up @@ -408,4 +409,8 @@
<string name="notifications_you_have_accepted">You have accepted the contact request from %s</string>

<string name="identity_complete_message">Your username %s has been successfully created on the Dash Network</string>

<string name="scan_to_pay_username_dialog_message">Not a valid Dash Username or Identity\n\n%s</string>
<string name="send_coins_to_username">Sending to</string>

</resources>
5 changes: 1 addition & 4 deletions wallet/src/de/schildbach/wallet/WalletApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import org.bitcoinj.wallet.Wallet;
import org.bitcoinj.wallet.WalletProtobufSerializer;
import org.dashevo.dashpay.BlockchainIdentity;
import org.dashevo.platform.Platform;
import org.dash.wallet.common.Configuration;
import org.dash.wallet.common.ResetAutoLogoutTimerHandler;
import org.dash.wallet.integration.uphold.data.UpholdClient;
Expand Down Expand Up @@ -245,8 +244,6 @@ public void uncaughtException(final Thread thread, final Throwable throwable) {
activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);

blockchainServiceIntent = new Intent(this, BlockchainServiceImpl.class);

PlatformRepo.Companion.initPlatformRepo(this);
}

public void setWallet(Wallet newWallet) {
Expand Down Expand Up @@ -306,7 +303,7 @@ private void initUphold() {
}

private void initPlatform() {
PlatformRepo.Companion.getInstance().startUpdateTimer();
PlatformRepo.initPlatformRepo(this);
}

public void maybeStartAutoLogoutTimer() {
Expand Down
Loading

0 comments on commit 437e12c

Please sign in to comment.