mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-30 11:31:29 +02:00
Conflict resolutions: - client/android/profile_manager.go: kept the thin adapter over client/mobile. The exported surface matches what main had (main's profileEmail was private and now lives in the shared package). - client/ios/NetBirdSDK/login.go: took main's version. Its DirectUpdateOrCreateConfig supersedes the branch's GetConfig overlay for preserving the profile name and keys, and it also handles the tvOS App Group sandbox where atomic writes are blocked. Keeping main's version also retains Auth.Stop() and its cancellable context. Follow-up from the merge: main's client/android/profile_state.go duplicated the shared client/mobile implementation, so it and its test are removed and login.go now calls mobile.ReadProfileEmail / mobile.WriteProfileEmail. profile_prefs.go goes through the shared ProfilePrefs instead of reaching into the removed serviceMgr field.
38 lines
843 B
Go
38 lines
843 B
Go
//go:build android
|
|
|
|
package android
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/netbirdio/netbird/client/internal/profilemanager"
|
|
)
|
|
|
|
type prefsStore interface {
|
|
Get(namespace string, v any) (bool, error)
|
|
Put(namespace string, v any) error
|
|
}
|
|
|
|
type profilePrefs struct {
|
|
prefs *profilemanager.Prefs
|
|
}
|
|
|
|
func newProfilePrefs(configDir, profileID string) (*profilePrefs, error) {
|
|
if configDir == "" || profileID == "" {
|
|
return nil, fmt.Errorf("profile prefs require a config dir and profile ID")
|
|
}
|
|
prefs, err := NewProfileManager(configDir).impl.ProfilePrefs(profileID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &profilePrefs{prefs: prefs}, nil
|
|
}
|
|
|
|
func (p *profilePrefs) Get(namespace string, v any) (bool, error) {
|
|
return p.prefs.Get(namespace, v)
|
|
}
|
|
|
|
func (p *profilePrefs) Put(namespace string, v any) error {
|
|
return p.prefs.Put(namespace, v)
|
|
}
|