client: support runtime changes of app id
This commit is contained in:
parent
3b5d143dc5
commit
c42bec118e
1 changed files with 15 additions and 0 deletions
|
@ -155,6 +155,21 @@ func NewAppClient(serverURL, userID, appID, appVersion string) (*AppClient, erro
|
||||||
return ac, nil
|
return ac, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ac *AppClient) SetAppID(appID string) error {
|
||||||
|
if appID == ac.appID {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := ac.apps[appID]; ok {
|
||||||
|
return fmt.Errorf("omaha: duplicate app %q", appID)
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(ac.apps, ac.appID)
|
||||||
|
ac.appID = appID
|
||||||
|
ac.apps[appID] = ac
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// SetVersion changes the application version.
|
// SetVersion changes the application version.
|
||||||
func (ac *AppClient) SetVersion(version string) error {
|
func (ac *AppClient) SetVersion(version string) error {
|
||||||
if version == "" {
|
if version == "" {
|
||||||
|
|
Loading…
Reference in a new issue