Browse Source

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.
pull/8/head
Daniel Martí 10 years ago
parent
commit
14ee06ac4d
  1. 9
      index.go

9
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
}

Loading…
Cancel
Save