From 14ee06ac4d8ca6e46aa82e3937db1ecb6f78bbaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 13 Apr 2016 13:55:54 +0100 Subject: [PATCH] Fallback method to find a current apk Like the Android client, treat the latest compatible version as the recommended version as a fallback method. Fixes #7. --- index.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/index.go b/index.go index 444847e..6853c59 100644 --- a/index.go +++ b/index.go @@ -243,17 +243,14 @@ func LoadIndexXML(r io.Reader) (*Index, error) { } func (a *App) CurApk() *Apk { - if a.CVCode == 0 { - if len(a.Apks) > 0 { - return &a.Apks[0] - } - return nil - } for i := range a.Apks { apk := a.Apks[i] if a.CVCode >= apk.VCode { return &apk } } + if len(a.Apks) > 0 { + return &a.Apks[0] + } return nil }