diff --git a/wallet/.gitignore b/wallet/.gitignore index 0a745c64e2..e67b65d841 100644 --- a/wallet/.gitignore +++ b/wallet/.gitignore @@ -4,4 +4,4 @@ res/drawable-*/stat_notify_received.png prod/release _testNet3/release staging/release -schnapps/release \ No newline at end of file +devnet/release \ No newline at end of file diff --git a/wallet/build.gradle b/wallet/build.gradle index b333fd7a3d..93439ef5c8 100644 --- a/wallet/build.gradle +++ b/wallet/build.gradle @@ -293,7 +293,7 @@ android { res.srcDirs = ["staging/res"] } devnet { - res.srcDirs = ["schnapps/res"] + res.srcDirs = ["devnet/res"] } } flavorDimensions "default" @@ -363,7 +363,7 @@ android { buildConfigField("String", "ZENLEDGER_CLIENT_SECRET", "\"\"") } devnet { - applicationId = "org.dash.dashpay.schnapps" + applicationId = "org.dash.dashpay.devnet" def imgurClientId = props.getProperty("UPHOLD_CLIENT_ID_SANDBOX") def imgurClientSecret = props.getProperty("UPHOLD_CLIENT_SECRET_SANDBOX") if (imgurClientId == null) { @@ -372,9 +372,14 @@ android { if (imgurClientSecret == null) { imgurClientSecret = "\"UPHOLD_CLIENT_SECRET\"" } - applicationId = "org.dash.wallet.devnet" buildConfigField("String", "UPHOLD_CLIENT_ID", "\"UPHOLD_CLIENT_ID\"") buildConfigField("String", "UPHOLD_CLIENT_SECRET", "\"UPHOLD_CLIENT_SECRET\"") + def topperKeyId = props.getProperty("TOPPER_KEY_ID_SANDBOX", "\"TOPPER_KEY_ID\"") + def topperWidgetId = props.getProperty("TOPPER_WIDGET_ID_SANDBOX", "\"TOPPER_WIDGET_ID\"") + def topperPrivateKey = props.getProperty("TOPPER_PRIVATE_KEY_SANDBOX", "\"TOPPER_PRIVATE_KEY\"") + buildConfigField("String", "TOPPER_KEY_ID", topperKeyId) + buildConfigField("String", "TOPPER_WIDGET_ID", topperWidgetId) + buildConfigField("String", "TOPPER_PRIVATE_KEY", topperPrivateKey) buildConfigField("String", "ZENLEDGER_CLIENT_ID", "\"\"") buildConfigField("String", "ZENLEDGER_CLIENT_SECRET", "\"\"") } diff --git a/wallet/schnapps/res/drawable-xhdpi/currency_symbol_dash.png b/wallet/devnet/res/drawable-xhdpi/currency_symbol_dash.png similarity index 100% rename from wallet/schnapps/res/drawable-xhdpi/currency_symbol_dash.png rename to wallet/devnet/res/drawable-xhdpi/currency_symbol_dash.png diff --git a/wallet/schnapps/res/drawable-xhdpi/currency_symbol_mdash.png b/wallet/devnet/res/drawable-xhdpi/currency_symbol_mdash.png similarity index 100% rename from wallet/schnapps/res/drawable-xhdpi/currency_symbol_mdash.png rename to wallet/devnet/res/drawable-xhdpi/currency_symbol_mdash.png diff --git a/wallet/schnapps/res/drawable-xhdpi/currency_symbol_udash.png b/wallet/devnet/res/drawable-xhdpi/currency_symbol_udash.png similarity index 100% rename from wallet/schnapps/res/drawable-xhdpi/currency_symbol_udash.png rename to wallet/devnet/res/drawable-xhdpi/currency_symbol_udash.png diff --git a/wallet/schnapps/res/mipmap-hdpi/ic_launcher.png b/wallet/devnet/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from wallet/schnapps/res/mipmap-hdpi/ic_launcher.png rename to wallet/devnet/res/mipmap-hdpi/ic_launcher.png diff --git a/wallet/schnapps/res/mipmap-mdpi/ic_launcher.png b/wallet/devnet/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from wallet/schnapps/res/mipmap-mdpi/ic_launcher.png rename to wallet/devnet/res/mipmap-mdpi/ic_launcher.png diff --git a/wallet/schnapps/res/mipmap-xhdpi/ic_launcher.png b/wallet/devnet/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from wallet/schnapps/res/mipmap-xhdpi/ic_launcher.png rename to wallet/devnet/res/mipmap-xhdpi/ic_launcher.png diff --git a/wallet/schnapps/res/mipmap-xxhdpi/ic_launcher.png b/wallet/devnet/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from wallet/schnapps/res/mipmap-xxhdpi/ic_launcher.png rename to wallet/devnet/res/mipmap-xxhdpi/ic_launcher.png diff --git a/wallet/schnapps/res/mipmap-xxxhdpi/ic_launcher.png b/wallet/devnet/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from wallet/schnapps/res/mipmap-xxxhdpi/ic_launcher.png rename to wallet/devnet/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/wallet/schnapps/res/values/ic_launcher_background.xml b/wallet/devnet/res/values/ic_launcher_background.xml similarity index 100% rename from wallet/schnapps/res/values/ic_launcher_background.xml rename to wallet/devnet/res/values/ic_launcher_background.xml diff --git a/wallet/schnapps/res/values/strings-extra.xml b/wallet/devnet/res/values/strings-extra.xml similarity index 100% rename from wallet/schnapps/res/values/strings-extra.xml rename to wallet/devnet/res/values/strings-extra.xml diff --git a/wallet/schnapps/res/values/values.xml b/wallet/devnet/res/values/values.xml similarity index 100% rename from wallet/schnapps/res/values/values.xml rename to wallet/devnet/res/values/values.xml diff --git a/wallet/src/de/schildbach/wallet/Constants.java b/wallet/src/de/schildbach/wallet/Constants.java index e80e37e95b..d93af96b39 100644 --- a/wallet/src/de/schildbach/wallet/Constants.java +++ b/wallet/src/de/schildbach/wallet/Constants.java @@ -125,7 +125,6 @@ public final class Constants { break; } case "devnet": { - // Schnapps Devnet BIP44_PATH = DeterministicKeyChain.BIP44_ACCOUNT_ZERO_PATH_TESTNET; NETWORK_PARAMETERS = OuzoDevNetParams.get(); String devNetName = ((DevNetParams)NETWORK_PARAMETERS).getDevNetName(); diff --git a/wallet/src/de/schildbach/wallet/payments/RequestWalletBalanceTask.java b/wallet/src/de/schildbach/wallet/payments/RequestWalletBalanceTask.java index 21084aa117..5d5e5c42a1 100644 --- a/wallet/src/de/schildbach/wallet/payments/RequestWalletBalanceTask.java +++ b/wallet/src/de/schildbach/wallet/payments/RequestWalletBalanceTask.java @@ -340,7 +340,7 @@ boolean requestWalletBalanceFromBlockExplorers(Address address) { blockExplorers.push(new Pair<>("https://insight.dash.org/insight-api/addr/", UnspentAPI.Insight)); } else if (BuildConfig.FLAVOR.equals("_testNet3") || BuildConfig.FLAVOR.equals("staging")) { blockExplorers.push(new Pair<>("https://insight.testnet.networks.dash.org:3002/insight-api/addr/", UnspentAPI.Insight)); - } else if (BuildConfig.FLAVOR.equals("schnapps")) { + } else if (BuildConfig.FLAVOR.equals("devnet")) { blockExplorers.push(new Pair<>(String.format("http://insight.%s.networks.dash.org:3002/insight-api/addr/", Constants.NETWORK_PARAMETERS.getDevNetName().substring("devnet-".length())), UnspentAPI.Insight)); } diff --git a/wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt b/wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt index 0d294f8da6..7b4dd926da 100644 --- a/wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt +++ b/wallet/src/de/schildbach/wallet/ui/EditProfileActivity.kt @@ -46,7 +46,6 @@ import androidx.lifecycle.lifecycleScope import com.amulyakhare.textdrawable.TextDrawable import com.bumptech.glide.Glide import com.bumptech.glide.signature.ObjectKey -import com.google.android.gms.auth.api.identity.AuthorizationRequest import com.google.android.gms.auth.api.identity.AuthorizationResult import com.google.android.gms.auth.api.identity.Identity import com.google.android.gms.common.api.Scope @@ -57,6 +56,7 @@ import de.schildbach.wallet.Constants import de.schildbach.wallet.database.entity.DashPayProfile import de.schildbach.wallet.livedata.Status import de.schildbach.wallet.ui.dashpay.* +import de.schildbach.wallet.ui.dashpay.utils.GoogleDriveService import de.schildbach.wallet.ui.dashpay.utils.display import de.schildbach.wallet.ui.dashpay.work.UpdateProfileError import de.schildbach.wallet.ui.send.SendCoinsActivity @@ -337,11 +337,7 @@ class EditProfileActivity : LockScreenActivity() { } private fun authorizeGoogleDrive() { - val authorizationRequest = AuthorizationRequest - .builder() - .setRequestedScopes( - listOf(Scope(DriveScopes.DRIVE)) - ).build() + val authorizationRequest = editProfileViewModel.getGoogleDriveAuthRequest() Identity.getAuthorizationClient(this@EditProfileActivity) .authorize(authorizationRequest) diff --git a/wallet/src/de/schildbach/wallet/ui/dashpay/EditProfileViewModel.kt b/wallet/src/de/schildbach/wallet/ui/dashpay/EditProfileViewModel.kt index afd339099e..e034d3fac6 100644 --- a/wallet/src/de/schildbach/wallet/ui/dashpay/EditProfileViewModel.kt +++ b/wallet/src/de/schildbach/wallet/ui/dashpay/EditProfileViewModel.kt @@ -22,6 +22,7 @@ import android.os.Environment import android.provider.Settings import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope +import com.google.android.gms.auth.api.identity.AuthorizationRequest import com.google.api.client.googleapis.auth.oauth2.GoogleCredential import com.google.api.client.http.HttpRequestInitializer import dagger.hilt.android.lifecycle.HiltViewModel @@ -284,4 +285,8 @@ class EditProfileViewModel @Inject constructor( suspend fun hasEnoughCredits(): CreditBalanceInfo { return platformRepo.getIdentityBalance() } + + fun getGoogleDriveAuthRequest(): AuthorizationRequest { + return googleDriveService.getAuthRequest() + } } \ No newline at end of file diff --git a/wallet/src/de/schildbach/wallet/ui/dashpay/utils/GoogleDriveService.kt b/wallet/src/de/schildbach/wallet/ui/dashpay/utils/GoogleDriveService.kt index edf63056dd..6027965d44 100644 --- a/wallet/src/de/schildbach/wallet/ui/dashpay/utils/GoogleDriveService.kt +++ b/wallet/src/de/schildbach/wallet/ui/dashpay/utils/GoogleDriveService.kt @@ -1,11 +1,14 @@ package de.schildbach.wallet.ui.dashpay.utils import android.content.Context +import com.google.android.gms.auth.api.identity.AuthorizationRequest +import com.google.android.gms.common.api.Scope import com.google.api.client.http.ByteArrayContent import com.google.api.client.http.HttpRequestInitializer import com.google.api.client.http.javanet.NetHttpTransport import com.google.api.client.json.gson.GsonFactory import com.google.api.services.drive.Drive +import com.google.api.services.drive.DriveScopes import com.google.api.services.drive.model.File import com.google.api.services.drive.model.Permission import dagger.hilt.android.qualifiers.ApplicationContext @@ -91,4 +94,10 @@ class GoogleDriveService( } } } + + fun getAuthRequest() = AuthorizationRequest + .builder() + .setRequestedScopes( + listOf(Scope(DriveScopes.DRIVE_FILE)) + ).build() } \ No newline at end of file