-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from ergoplatform/ios-improvements
iOS Build 2117
- Loading branch information
Showing
33 changed files
with
974 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
common-jvm/src/main/java/org/ergoplatform/tokens/TokenUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.ergoplatform.tokens | ||
|
||
import org.ergoplatform.persistance.WalletToken | ||
|
||
/** | ||
* logic to fill tokens in wallet overview screen | ||
*/ | ||
fun fillTokenOverview(tokens: List<WalletToken>, addToken: (WalletToken) -> Unit, addMoreTokenHint: (Int) -> Unit) { | ||
val maxTokensToShow = 5 | ||
val dontShowAll = tokens.size > maxTokensToShow | ||
val tokensSorted = tokens.sortedBy { it.name?.lowercase() } | ||
val tokensToShow = | ||
(if (dontShowAll) tokensSorted.subList( | ||
0, | ||
maxTokensToShow - 1 | ||
) else tokensSorted) | ||
tokensToShow.forEach { | ||
addToken.invoke(it) | ||
} | ||
|
||
// in case we don't show all items, add a hint that not all items were shown | ||
if (dontShowAll) { | ||
addMoreTokenHint.invoke((tokens.size - maxTokensToShow + 1)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
common-jvm/src/test/java/org/ergoplatform/TokenAmountTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.ergoplatform | ||
|
||
import junit.framework.TestCase | ||
import org.junit.Assert | ||
|
||
class TokenAmountTest : TestCase() { | ||
|
||
fun testTestToString() { | ||
|
||
Assert.assertEquals("1", TokenAmount(1, 0).toStringTrimTrailingZeros()) | ||
Assert.assertEquals("10", TokenAmount(100, 1).toStringTrimTrailingZeros()) | ||
Assert.assertEquals("10.0", TokenAmount(100, 1).toString()) | ||
Assert.assertEquals("10.5", TokenAmount(1050, 2).toStringTrimTrailingZeros()) | ||
Assert.assertEquals("10", TokenAmount(1000, 2).toStringTrimTrailingZeros()) | ||
Assert.assertEquals("0", TokenAmount(0, 2).toStringTrimTrailingZeros()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
app.version=0.3.2116 | ||
app.version=0.6.2117 | ||
app.id=org.ergoplatform.ios | ||
app.mainclass=org.ergoplatform.ios.Main | ||
app.executable=ErgoWallet | ||
app.build=2116 | ||
app.build=2117 | ||
app.name=Ergo Wallet |
Oops, something went wrong.