Skip to content

Commit

Permalink
Merge pull request #1308 from dashpay/dashpay
Browse files Browse the repository at this point in the history
feat(dashpay): merge dashpay branch with DashPay functions disabled.
  • Loading branch information
HashEngineering authored Sep 27, 2024
2 parents 72b20a3 + a8a20e9 commit 2ab6b93
Show file tree
Hide file tree
Showing 738 changed files with 57,060 additions and 1,214 deletions.
Binary file added .deploy/google-services.json.gpg
Binary file not shown.
97 changes: 97 additions & 0 deletions .github/workflows/dashpay.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: DashPay CI

on:
push:
branches: [ dashpay ]
pull_request:
branches: [ dashpay, dashpay-* ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Get build number from run id
run: |
echo "build_number=$((80000))" >> $GITHUB_ENV
- name: Get the support email
env:
SUPPORT_EMAIL: "${{ secrets.INTERNAL_SUPPORT_EMAIL }}"
run: |
echo "SUPPORT_EMAIL=$SUPPORT_EMAIL" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.3'

- name: Generate cache key
run: bash .deploy/checksum.sh checksum.txt

- name: Gem caching
uses: actions/cache@v2
continue-on-error: true
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Setup fastlane
run: |
gem install bundler:2.2.26
gem install google-cloud-storage
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Cache Gradle packages
uses: actions/cache@v2
continue-on-error: true
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('checksum.txt') }}

- name: Decrypt secrets
run: |
gpg -d --passphrase "${{ secrets.KEYSTORE_KEY }}" --batch .deploy/keystore.jks.gpg > .deploy/keystore.jks
- name: Extract Secrets
run: |
echo "$GOOGLE_SERVICES_JSON" > wallet/google-services.json
echo "$SERVICE_PROPERTIES" > service.properties
echo "$LOCAL_PROPERTIES" > local.properties
echo "$APP_DISTRIBUTION_KEY_JSON" > .deploy/app-distribution-key.json
echo "$GC_STORAGE_SERVICE_ACCOUNT_KEY_JSON" > .deploy/gc-storage-service-account.json
env:
GOOGLE_SERVICES_JSON : ${{secrets.GOOGLE_SERVICES_JSON}}
SERVICE_PROPERTIES: ${{secrets.SERVICE_PROPERTIES}}
LOCAL_PROPERTIES: ${{secrets.LOCAL_PROPERTIES}}
APP_DISTRIBUTION_KEY_JSON: ${{secrets.APP_DISTRIBUTION_KEY_JSON}}
GC_STORAGE_SERVICE_ACCOUNT_KEY_JSON: ${{secrets.GC_STORAGE_SERVICE_ACCOUNT_KEY_JSON}}

- name: Test
run: bundle exec fastlane test flavor:"" type:"debug"

- name: Build
if: github.event_name == 'pull_request'
run: bundle exec fastlane build flavor:"staging" type:"release" storepass:"${{ secrets.SIGNING_STORE_PASS }}" versioncode:"${{ env.build_number }}"

- name: Staging Build and Firebase Distribution
if: github.event_name == 'push'
run: bundle exec fastlane build_distribute flavor:"staging" type:"release" storepass:"${{ secrets.SIGNING_STORE_PASS }}" versioncode:"${{ env.build_number }}" comment:"Up to date Dash Wallet TestNet build" appid:"1:1039839682638:android:bbcfa8c9939ee993ea631f" testgroup:"qa"
9 changes: 3 additions & 6 deletions .github/workflows/manual_distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
flavor:
description: 'Flavor'
required: true
default: '_testNet3'
default: 'staging'
type:
description: 'Type'
required: true
Expand All @@ -37,11 +37,8 @@ jobs:
"staging": {
"firebase_app_id": "1:1039839682638:android:bbcfa8c9939ee993ea631f"
},
"schnapps": {
"firebase_app_id": "1:1039839682638:android:12d2ad31cc39093cea631f"
},
"devnet": {
"firebase_app_id": "1:1039839682638:android:fdff563e24b69c5fea631f"
"firebase_app_id": "1:1039839682638:android:12d2ad31cc39093cea631f"
}
}
Expand Down Expand Up @@ -122,6 +119,6 @@ jobs:

- name: Test
run: bundle exec fastlane test flavor:"${{ github.event.inputs.flavor }}" type:"${{ github.event.inputs.type }}" versioncode:"${{ env.build_number }}" storepass:"${{ secrets.SIGNING_STORE_PASS }}"

- name: Build and Firebase Distribution
run: bundle exec fastlane build_distribute flavor:"${{ github.event.inputs.flavor }}" type:"${{ github.event.inputs.type }}" versioncode:"${{ env.build_number }}" storepass:"${{ secrets.SIGNING_STORE_PASS }}" comment:"${{ github.event.inputs.taskID }}" appid:"${{ env.firebase_app_id }}" testgroup:"qa"
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

7 changes: 7 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ source_lang = en
type = ANDROID
lang_map = sl_SI: sl, zh_TW: zh-rTW

[o:dash:p:dash-mobile-wallets:r:strings-dashpay]
file_filter = wallet/res/values-<lang>/strings-dashpay.xml
source_file = wallet/res/values/strings-dashpay.xml
source_lang = en
type = ANDROID
lang_map = sl_SI: sl, zh_TW: zh-rTW

[o:dash:p:dash-mobile-wallets:r:strings-uphold]
file_filter = integrations/uphold/src/main/res/values-<lang>/strings-uphold.xml
source_file = integrations/uphold/src/main/res/values/strings-uphold.xml
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Welcome to _Dash Wallet_, a standalone Dash payment app for your Android device!
This project contains several sub-projects:

* __wallet__:
The Android app itself. This is probably what you're searching for.
The Android app itself. This is probably what you're searching for. [wallet README](wallet/README.md)
* __common__:
Contains common components used by integrations.
* __features__:
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
kotlin_version = '1.9.23'
coroutinesVersion = '1.6.4'
ok_http_version = '4.9.1'
dashjVersion = '21.0.0'
dashjVersion = '21.1.0'
hiltVersion = '2.51'
hiltCompilerVersion = '1.2.0'
hiltWorkVersion = '1.0.0'
Expand All @@ -22,7 +22,7 @@ buildscript {
preferenceVersion = '1.2.0'

// Utils
slf4jVersion = '1.7.32'
slf4jVersion = '2.0.7'
desugaringLibraryVersion = '1.1.5'

// UI
Expand Down
2 changes: 2 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ dependencies {
//noinspection GradleDependency
implementation "com.google.zxing:core:$zxingVersion"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:$swipeRefreshLayoutVersion"
implementation 'com.github.amulyakhare:textdrawable:558677ea31'

// DI
implementation "com.google.dagger:hilt-android:$hiltVersion"
ksp "com.google.dagger:hilt-compiler:$hiltVersion"
implementation 'javax.inject:javax.inject:1'

testImplementation "junit:junit:$junitVersion"
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoVersion"
Expand Down
89 changes: 89 additions & 0 deletions common/src/main/java/org/dash/wallet/common/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ public class Configuration {
public static final String PREFS_RESTORING_BACKUP = "restoring_backup";
public static final String PREFS_V7_REDESIGN_TUTORIAL_COMPLETED = "v7_tutorial_completed";
public static final String PREFS_PIN_LENGTH = "pin_length";
private static final String PREFS_IMGUR_DELETE_HASH = "imgur_delete_hash";
private static final String PREFS_UPLOAD_POLICY = "upload_policy_accepted_";
private static final String PREFS_DEV_MODE = "developer_mode";
private static final String PREFS_INVITER = "inviter";
private static final String PREFS_INVITER_CONTACT_REQUEST_SENT_INFO = "inviter_contact_request_sent_info";
private static final String PREFS_ONBOARDING_STAGE = "onboarding_state";
private static final String PREFS_ONBOARDING_INVITE = "inviter_onboarding_invite";
private static final String PREFS_ONBOARDING_INVITE_USERNAME = "inviter_onboarding_invite_username";
private static final String PREFS_ONBOARDING_INVITE_PROCESSING = "inviter_onboarding_invite_processing";

public static final String PREFS_KEY_LAST_UPHOLD_BALANCE = "last_uphold_balance";

Expand All @@ -87,6 +96,8 @@ public class Configuration {
public static final String PREFS_KEY_SHOW_TAX_CATEGORY_EXPLAINER = "show_tax_catagory_explainer";
public static final String PREFS_KEY_SHOW_TAX_CATEGORY_INSTALLTIME = "show_tax_catagory_install_time";

private static final long DISABLE_NOTIFICATIONS = -1;

// CrowdNode
public static final String PREFS_KEY_CROWDNODE_ACCOUNT_ADDRESS = "crowdnode_account_address";
public static final String PREFS_KEY_CROWDNODE_PRIMARY_ADDRESS = "crowdnode_primary_address";
Expand Down Expand Up @@ -222,6 +233,10 @@ public boolean getRemindBackupSeed() {
return prefs.getBoolean(PREFS_KEY_REMIND_BACKUP_SEED, true);
}

public void setLastRestoreTime() {
prefs.edit().putLong(PREFS_KEY_LAST_RESTORE, System.currentTimeMillis());
}

public long getLastRestoreTime() {
return prefs.getLong(PREFS_KEY_LAST_RESTORE, 0);
}
Expand Down Expand Up @@ -361,6 +376,80 @@ public void setPinLength(int pinLength) {
prefs.edit().putInt(PREFS_PIN_LENGTH, pinLength).apply();
}

public String getImgurDeleteHash() {
return prefs.getString(PREFS_IMGUR_DELETE_HASH, "");
}

public void setImgurDeleteHash(String deleteHash) {
prefs.edit().putString(PREFS_IMGUR_DELETE_HASH, deleteHash).apply();
}

public Boolean getAcceptedUploadPolicy(String service) {
return prefs.getBoolean(PREFS_UPLOAD_POLICY + service, false);
}

public void setAcceptedUploadPolicy(String service, Boolean accepted) {
prefs.edit().putBoolean(PREFS_UPLOAD_POLICY + service, accepted).apply();
}

public Boolean getDeveloperMode() {
return BuildConfig.DEBUG || prefs.getBoolean(PREFS_DEV_MODE, false);
}

public void setDeveloperMode(boolean activate) {
prefs.edit().putBoolean(PREFS_DEV_MODE, activate).apply();
}

public String getInviter() {
return prefs.getString(PREFS_INVITER, null);
}

public void setInviter(String iviter) {
prefs.edit().putString(PREFS_INVITER, iviter).apply();
}

public Boolean getInviterContactRequestSentInfoShown() {
return prefs.getBoolean(PREFS_INVITER_CONTACT_REQUEST_SENT_INFO, false);
}

public void setInviterContactRequestSentInfoShown(Boolean shown) {
prefs.edit().putBoolean(PREFS_INVITER_CONTACT_REQUEST_SENT_INFO, shown).apply();
}

public boolean getOnboardingInviteProcessing() {
return getOnboardingInvite() != null && prefs.getBoolean(PREFS_ONBOARDING_INVITE_PROCESSING, true);
}

public void setOnboardingInviteProcessingDone() {
prefs.edit().putBoolean(PREFS_ONBOARDING_INVITE_PROCESSING, false).apply();
}

public int getOnboardingStage() {
return prefs.getInt(PREFS_ONBOARDING_STAGE, 0);
}

public void setOnboardingStage(final int onboardingStage) {
prefs.edit().putInt(PREFS_ONBOARDING_STAGE, onboardingStage).apply();
}

public Uri getOnboardingInvite() {
String invite = prefs.getString(PREFS_ONBOARDING_INVITE, null);
return invite != null ? Uri.parse(invite) : null;
}

public void setOnboardingInvite(final Uri onboardingInvite) {
prefs.edit().putBoolean(PREFS_ONBOARDING_INVITE_PROCESSING, true).apply();
prefs.edit().putString(PREFS_ONBOARDING_INVITE, onboardingInvite.toString()).apply();
}

public String getOnboardingInviteUsername() {
return prefs.getString(PREFS_ONBOARDING_INVITE_USERNAME, null);
}

public void setOnboardingInviteUsername(final String username) {
prefs.edit().putString(PREFS_ONBOARDING_INVITE_USERNAME, username).apply();
}

public long getLastEncryptKeysTime() {
return prefs.getLong(PREFS_KEY_LAST_ENCRYPT_KEYS, 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public void onUserInteraction() {
((AutoLogoutTimerHandler) getApplication()).resetAutoLogoutTimer();
}

public void imitateUserInteraction() {
onUserInteraction();
}

@Override
protected void onDestroy() {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.dash.wallet.common

import android.app.Dialog
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment

abstract class InteractionAwareDialogFragment : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialogBuilder = AlertDialog.Builder(requireContext())
.setView(initCustomView())

val dialog = dialogBuilder.create()

setCallback(dialog)
return dialog
}

private fun setCallback(dialog: AlertDialog) {
dialog.window!!.callback = UserInteractionAwareCallback(dialog.window!!.callback, requireActivity())
}

protected abstract fun initCustomView(): View

protected fun imitateUserInteraction() {
requireActivity().onUserInteraction()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ import org.bitcoinj.core.*
import org.bitcoinj.wallet.CoinSelector
import org.bitcoinj.wallet.Wallet
import org.bitcoinj.wallet.WalletExtension
import org.bitcoinj.wallet.authentication.AuthenticationGroupExtension
import org.bitcoinj.wallet.authentication.AuthenticationKeyUsage
import org.dash.wallet.common.services.LeftoverBalanceException
import org.dash.wallet.common.transactions.TransactionWrapper
import org.dash.wallet.common.transactions.TransactionWrapperFactory
import org.dash.wallet.common.transactions.filters.TransactionFilter
import kotlin.jvm.Throws

Expand All @@ -47,6 +49,8 @@ interface WalletDataProvider {
coinSelector: CoinSelector? = null
): Flow<Coin>

fun canAffordIdentityCreation(): Boolean

// Treat @withConfidence with care - it may produce a lot of events and affect performance.
fun observeTransactions(withConfidence: Boolean = false, vararg filters: TransactionFilter): Flow<Transaction>

Expand All @@ -56,7 +60,7 @@ interface WalletDataProvider {

fun getTransactions(vararg filters: TransactionFilter): Collection<Transaction>

fun wrapAllTransactions(vararg wrappers: TransactionWrapper): Collection<TransactionWrapper>
fun wrapAllTransactions(vararg wrappers: TransactionWrapperFactory): Collection<TransactionWrapper>

fun attachOnWalletWipedListener(listener: () -> Unit)

Expand Down
Loading

0 comments on commit 2ab6b93

Please sign in to comment.