Skip to content

Commit

Permalink
Merge pull request #39 from ProtonProtocol/develop
Browse files Browse the repository at this point in the history
Better transaction pagination
  • Loading branch information
Joey Harward authored Oct 14, 2021
2 parents 3c5f0c3 + c29600b commit 08e6f58
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 28 deletions.
20 changes: 10 additions & 10 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const val kotlinVersion = "1.5.21"
const val kotlinVersion = "1.5.31"
const val orchidVersion = "0.21.1"

object ProtonSdk {
const val versionCode = 46
const val versionName = "1.0.8"
const val versionCode = 47
const val versionName = "1.0.9"
}

object BuildPlugins {
Expand All @@ -44,7 +44,7 @@ object BuildPlugins {

object Android {
const val minSdk = 21
const val compileSdk = 30
const val compileSdk = 31
const val targetSdk = compileSdk
const val buildTools = "30.0.3"

Expand All @@ -57,17 +57,17 @@ object Android {

object Libraries {
private object Versions {
const val ktx = "1.6.0-beta01"
const val ktx = "1.6.0-rc01"
const val lifecycleLiveData = "2.3.1"
const val room = "2.3.0-rc01"
const val workManager = "2.5.0"
const val room = "2.4.0-alpha04"
const val workManager = "2.6.0"
const val okhttp3 = "5.0.0-alpha.2"
const val retrofit = "2.9.0"
const val dagger = "2.35.1"
const val dagger = "2.38.1"
const val daggerAssistedInject = "0.6.0"
const val coroutines = "1.4.0-M1"
const val coroutines = "1.5.2"
const val timber = "4.7.1"
const val gson = "2.8.6"
const val gson = "2.8.8"
const val guava = "30.1.1-jre"
const val esr = "1.0.1"
}
Expand Down
13 changes: 9 additions & 4 deletions protonsdk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@

<application>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
tools:node="remove"
android:exported="false" />
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ class ActionsModule {
}

@Suppress("unused", "UNUSED_PARAMETER")
suspend fun getActions(chainUrl: String, hyperionHistoryUrl: String, accountName: String, contract: String, symbol: String, limit: Int=250, skip: Int=0): Resource<List<AccountAction>> {
suspend fun getActions(chainUrl: String, hyperionHistoryUrl: String, accountName: String, contract: String, symbol: String, skip: Int=0, limit: Int=250): Resource<List<AccountAction>> {
return try {
val response = actionRepository.fetchAccountTokenActions(hyperionHistoryUrl, accountName, symbol, limit, skip)
val response = actionRepository.fetchAccountTokenActions(hyperionHistoryUrl, accountName, symbol, skip, limit)
if (response.isSuccessful) {
val jsonObject = response.body()

Expand Down
14 changes: 7 additions & 7 deletions protonsdk/src/main/java/com/metallicus/protonsdk/Proton.kt
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ class Proton private constructor(context: Context) {
}
}

suspend fun getActiveAccountActions(contract: String, symbol: String, limit: Int, skip: Int): Resource<List<Action>> {
suspend fun getActiveAccountActions(contract: String, symbol: String, skip: Int, limit: Int): Resource<List<Action>> {
return try {
val activeAccount = getActiveAccountAsync()

Expand All @@ -502,19 +502,19 @@ class Proton private constructor(context: Context) {
activeAccount.account.accountName,
contract,
symbol,
limit,
skip)
skip,
limit)
} catch (e: ProtonException) {
Resource.error(e)
} catch (e: Exception) {
Resource.error(e.localizedMessage.orEmpty())
}
}

fun getActiveAccountActionsLiveData(contract: String, symbol: String, limit: Int, skip: Int): LiveData<Resource<List<Action>>> = liveData {
fun getActiveAccountActionsLiveData(contract: String, symbol: String, skip: Int, limit: Int): LiveData<Resource<List<Action>>> = liveData {
emit(Resource.loading())

emit(getActiveAccountActions(contract, symbol, limit, skip))
emit(getActiveAccountActions(contract, symbol, skip, limit))
}

fun updateAccountName(pin: String, name: String): LiveData<Resource<ChainAccount>> = liveData {
Expand Down Expand Up @@ -786,7 +786,7 @@ class Proton private constructor(context: Context) {
val esrSessionList = accountModule.getESRSessions(/*activeAccount*/)
esrSessionList.forEach { esrSession ->
val esrSessionId = esrSession.id
if (!isESRSessionOpen(esrSessionId)) {
//if (!isESRSessionOpen(esrSessionId)) {
val request = Request.Builder().url(esrSession.receiveChannelUrl).build()

val logging = HttpLoggingInterceptor()
Expand Down Expand Up @@ -824,7 +824,7 @@ class Proton private constructor(context: Context) {
Timber.d("ESR Listener onFailure - $message")
}
))
}
//}
}
} catch (e: Exception) {
Timber.e(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ interface ProtonChainService {
@Query("account") account: String
): Response<JsonObject>

@GET//("/v2/history/get_actions?account=&transfer.symbol=&filter=&limit=&skip=")
@GET//("/v2/history/get_actions?account=&transfer.symbol=&filter=&skip=&limit=")
suspend fun getActions(
@Url url: String,
@Query("account") account: String,
@Query("transfer.symbol") symbol: String,
//@Query("filter") filter: String,
@Query("limit") limit: Int,
@Query("skip") skip: Int
@Query("skip") skip: Int,
@Query("limit") limit: Int
): Response<JsonObject>

@POST//("/v1/chain/get_table_rows")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class ActionRepository @Inject constructor(
}
}

suspend fun fetchAccountTokenActions(hyperionHistoryUrl: String, accountName: String, symbol: String, limit: Int=250, skip: Int=0): Response<JsonObject> {
return protonChainService.getActions("$hyperionHistoryUrl/v2/history/get_actions", accountName, symbol, limit, skip)
suspend fun fetchAccountTokenActions(hyperionHistoryUrl: String, accountName: String, symbol: String, skip: Int=0, limit: Int=250): Response<JsonObject> {
return protonChainService.getActions("$hyperionHistoryUrl/v2/history/get_actions", accountName, symbol, skip, limit)
}

suspend fun getAccountSystemTokenActions(accountName: String, contract: String, symbol: String): List<Action> {
Expand Down

0 comments on commit 08e6f58

Please sign in to comment.