Skip to content

Commit

Permalink
Add list of tracks available at runtime (#131)
Browse files Browse the repository at this point in the history
* Add list of tracks available at runtime

* Update log message

Co-authored-by: Olivér Falvai <[email protected]>
  • Loading branch information
Bart Wesselink and ofalvai authored Oct 4, 2021
1 parent e6614c2 commit e45fe90
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,21 @@ func updateTracks(configs Configs, service *androidpublisher.Service, appEdit *a
return nil
}

// listTracks lists the available tracks for an app
func listTracks(configs Configs, service *androidpublisher.Service, appEdit *androidpublisher.AppEdit) {
editsTracksService := androidpublisher.NewEditsTracksService(service)
listTracksCall := editsTracksService.List(configs.PackageName, appEdit.Id)

tracks, err := listTracksCall.Do()
if err != nil {
log.Warnf("Unable to fetch track list, error: %s", err)
}

for _, track := range tracks.Tracks {
log.Printf("- %s", track.Track)
}
}

func versionCodeMapToSlice(codeMap map[int64]int) []int64 {
var versionCodes []int64
for code, numArtifacts := range codeMap {
Expand Down Expand Up @@ -192,6 +207,13 @@ func executeEdit(service *androidpublisher.Service, configs Configs, changesNotS
log.Printf(" editID: %s", appEdit.Id)
log.Donef("Edit insert created")

//
// List tracks that are available in the Play Store
fmt.Println()
log.Infof("Available tracks on Google Play:")
listTracks(configs, service, appEdit)
log.Donef("Tracks listed")

//
// Upload applications
fmt.Println()
Expand Down

0 comments on commit e45fe90

Please sign in to comment.