Skip to content

Commit

Permalink
Merge pull request #65 from ergoplatform/develop
Browse files Browse the repository at this point in the history
iOS 1.0.2120 RC, Android build 1.4.2120
  • Loading branch information
MrStahlfelge authored Dec 14, 2021
2 parents e679da1 + 4d72161 commit d94e5ce
Show file tree
Hide file tree
Showing 53 changed files with 966 additions and 201 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
- name: Setup Android build environment
uses: android-actions/[email protected]
- name: Build Android debug apks
run: ./gradlew clean app:assembleDebug
run: ./gradlew clean android:assembleDebug
- name: Release mainnet artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: app/build/outputs/apk/ergomainnet/debug/app-ergomainnet-debug.apk
asset_path: android/build/outputs/apk/ergomainnet/debug/android-ergomainnet-debug.apk
asset_name: ergowallet-mainnet-debug.apk
asset_content_type: application/zip
- name: Release testnet artifact
Expand All @@ -36,6 +36,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: app/build/outputs/apk/ergotestnet/debug/app-ergotestnet-debug.apk
asset_path: android/build/outputs/apk/ergotestnet/debug/android-ergotestnet-debug.apk
asset_name: ergowallet-testnet-debug.apk
asset_content_type: application/zip
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# Ergo Wallet Android
# Ergo Wallet App

<img src="https://user-images.githubusercontent.com/26038055/131368542-0e401c2c-35e4-449c-8423-ea259b39614b.png" align="right" width="250">

Official Ergo Wallet for Android ([official announcement](https://ergoplatform.org/en/blog/2021-07-29-ergo-for-android-released/))
Official Ergo Wallet App ([official announcement](https://ergoplatform.org/en/blog/2021-07-29-ergo-for-android-released/))

[<img alt="Get it on Google Play" height="80" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png">](https://play.google.com/store/apps/details?id=org.ergoplatform.android)
<a href="https://play.google.com/store/apps/details?id=org.ergoplatform.android"><img alt="Get it on Google Play" src="https://user-images.githubusercontent.com/11427267/75923897-483f3b00-5e66-11ea-8ec7-e86887afea51.png"></a>
<a href="https://testflight.apple.com/join/MRyG2qfm"><img alt="Download App Store" src="https://user-images.githubusercontent.com/11427267/75923896-47a6a480-5e66-11ea-87c1-3ec73ebcf7a5.png"></a>

Features:
* generating wallets, restoring wallets in a way compatible to Yoroi and Ergo node
* you can add read-only wallets without entering your secrets to watch balance or to prepare transactions for [cold wallet devices](https://github.com/ergoplatform/ergo-wallet-android/wiki/Cold-wallet)
* you can add read-only wallets without entering your secrets to watch balance or to prepare transactions for [cold wallet devices](https://github.com/ergoplatform/ergo-wallet-app/wiki/Cold-wallet)
* no need to make a full sync, this is a lightweight client
* Requesting payments by showing QR code or sharing a link
* Sending payments, manually or by scanning a QR code
* Displays and sends tokens and NFT
* Your secrets are stored password-encrypted or authentication-protected
* Show wallet balance, configurable comparison fiat currency

You need at least Android 7 to run Ergo Wallet.
You need at least Android 7 or iOS 13 to run Ergo Wallet.

Visit the [Ergo Discord](https://discord.gg/kj7s7nb) to give feedback.

### Download and install the APK manually

Apart from Google Play, you can download the app APKs from the [releases section](https://github.com/ergoplatform/ergo-wallet-android/releases) to sideload.
Apart from Google Play, you can download the app APKs from the [releases section](https://github.com/ergoplatform/ergo-wallet-app/releases) to sideload.
There are APKs available for Testnet and Mainnet, and as a debug build and release build.

**Debug builds** are built on GitHub.
Expand All @@ -48,6 +49,6 @@ If you want to tip the developer for making this app, thanks in advance! Send yo
[9ewA9T53dy5qvAkcR5jVCtbaDW2XgWzbLPs5H4uCJJavmA4fzDx](https://explorer.ergoplatform.com/payment-request?address=9ewA9T53dy5qvAkcR5jVCtbaDW2XgWzbLPs5H4uCJJavmA4fzDx&amount=0&description=)

### Testing on Testnet
You can test the testnet debug build on testnet. Generate a new wallet and send
You can test the testnet Android debug build on testnet or build the iOS version yourself for testnet. Generate a new wallet and send
yourself some test Ergos by visiting https://testnet.ergofaucet.org/

4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId "org.ergoplatform.android"
minSdkVersion 24
targetSdkVersion 30
versionCode 2117
versionName "1.4.2117"
versionCode 2120
versionName "1.4.2120"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
8 changes: 8 additions & 0 deletions android/src/main/java/org/ergoplatform/android/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@ import androidx.appcompat.app.AppCompatDelegate
import org.ergoplatform.NodeConnector
import org.ergoplatform.appkit.NetworkType
import org.ergoplatform.isErgoMainNet
import org.ergoplatform.utils.LogUtils

class App : Application() {

companion object {
var lastStackTrace: String? = null
private set
}

override fun onCreate() {
super.onCreate()
isErgoMainNet = (StageConstants.NETWORK_TYPE == NetworkType.MAINNET)
val preferences = Preferences(applicationContext)
AppCompatDelegate.setDefaultNightMode(preferences.dayNightMode)
NodeConnector.getInstance().loadPreferenceValues(preferences)

LogUtils.stackTraceLogger = { lastStackTrace = it }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import org.ergoplatform.android.App
import org.ergoplatform.android.BuildConfig
import org.ergoplatform.android.Preferences
import org.ergoplatform.android.R
import org.ergoplatform.android.databinding.FragmentSettingsBinding
import org.ergoplatform.android.ui.AndroidStringProvider
import org.ergoplatform.android.ui.enableLinks
import org.ergoplatform.android.ui.navigateSafe
import org.ergoplatform.android.ui.showDialogWithCopyOption
import org.ergoplatform.settings.SettingsUiLogic
import java.util.*

class SettingsFragment : Fragment() {

Expand Down Expand Up @@ -62,6 +63,15 @@ class SettingsFragment : Fragment() {
binding.buttonConnectionSettings.setOnClickListener {
findNavController().navigateSafe(SettingsFragmentDirections.actionNavigationSettingsToConnectionSettingsDialogFragment())
}

binding.containerDebugInformation.visibility =
if (App.lastStackTrace.isNullOrBlank()) View.GONE else View.VISIBLE

binding.buttonDebugInformation.setOnClickListener {
App.lastStackTrace?.let {
showDialogWithCopyOption(requireContext(), it)
}
}
}

private fun changeDayNightMode(mode: Int) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.ergoplatform.android.tokens

import android.view.LayoutInflater
import android.view.View
import android.widget.LinearLayout
import org.ergoplatform.android.databinding.EntryWalletTokenBinding
import org.ergoplatform.android.databinding.EntryWalletTokenDetailsBinding
import org.ergoplatform.persistance.WalletToken
import org.ergoplatform.tokens.isSingularToken
import org.ergoplatform.utils.formatTokenAmounts

fun inflateAndBindTokenView(
Expand All @@ -24,4 +27,27 @@ fun inflateAndBindTokenView(
walletToken.amount ?: 0,
walletToken.decimals,
)
}

fun inflateAndBindDetailedTokenEntryView(
walletToken: WalletToken,
linearLayout: LinearLayout,
layoutInflater: LayoutInflater
) {
val itemBinding =
EntryWalletTokenDetailsBinding.inflate(
layoutInflater,
linearLayout,
true
)

itemBinding.labelTokenName.text = walletToken.name
itemBinding.labelTokenId.text = walletToken.tokenId
itemBinding.labelTokenVal.text =
formatTokenAmounts(
walletToken.amount ?: 0,
walletToken.decimals,
)
itemBinding.labelTokenVal.visibility =
if (walletToken.isSingularToken()) View.GONE else View.VISIBLE
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,18 @@ class ChooseTokenListDialogFragment : BottomSheetDialogFragment() {

private fun onChooseToken(tokenId: String) {
ViewModelProvider(parentFragment as ViewModelStoreOwner).get(SendFundsViewModel::class.java)
.uiLogic.newTokenChoosen(tokenId)
.uiLogic.newTokenChosen(tokenId)
dismiss()
}

private inner class ViewHolder internal constructor(binding: FragmentChooseTokenDialogItemBinding) :
private inner class ViewHolder(binding: FragmentChooseTokenDialogItemBinding) :
RecyclerView.ViewHolder(binding.root) {

internal val name: TextView = binding.labelTokenName
val tokenName: TextView = binding.labelTokenName
val tokenId: TextView = binding.labelTokenId
}

private inner class DisplayTokenAdapter internal constructor(private val items: List<WalletToken>) :
private inner class DisplayTokenAdapter(private val items: List<WalletToken>) :
RecyclerView.Adapter<ViewHolder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
Expand All @@ -74,8 +75,9 @@ class ChooseTokenListDialogFragment : BottomSheetDialogFragment() {

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val token = items.get(position)
holder.name.text = token.name
holder.name.setOnClickListener { onChooseToken(token.tokenId!!) }
holder.tokenName.text = token.name
holder.tokenId.text = token.tokenId
holder.itemView.setOnClickListener { onChooseToken(token.tokenId!!) }
}

override fun getItemCount(): Int {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package org.ergoplatform.android.transactions

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
import com.google.zxing.integration.android.IntentIntegrator
import org.ergoplatform.ErgoAmount
Expand All @@ -23,6 +19,7 @@ import org.ergoplatform.android.databinding.FragmentColdWalletSigningBinding
import org.ergoplatform.android.ui.AbstractAuthenticationFragment
import org.ergoplatform.android.ui.ProgressBottomSheetDialogFragment
import org.ergoplatform.android.ui.QrPagerAdapter
import org.ergoplatform.android.ui.showDialogWithCopyOption
import org.ergoplatform.explorer.client.model.AssetInstanceInfo
import org.ergoplatform.transactions.reduceBoxes

Expand Down Expand Up @@ -123,18 +120,7 @@ class ColdWalletSigningFragment : AbstractAuthenticationFragment() {
snackbar.setAction(
R.string.label_details
) {
MaterialAlertDialogBuilder(requireContext())
.setMessage(errorMsg)
.setPositiveButton(R.string.button_copy) { _, _ ->
val clipboard = ContextCompat.getSystemService(
requireContext(),
ClipboardManager::class.java
)
val clip = ClipData.newPlainText("", errorMsg)
clipboard?.setPrimaryClip(clip)
}
.setNegativeButton(R.string.label_dismiss, null)
.show()
showDialogWithCopyOption(requireContext(), errorMsg)
}
}
snackbar.setAnchorView(R.id.nav_view).show()
Expand Down
Loading

0 comments on commit d94e5ce

Please sign in to comment.