diff --git a/action_create.go b/action_create.go index 832ae1e..2df1d4b 100644 --- a/action_create.go +++ b/action_create.go @@ -21,6 +21,9 @@ type CreateOptions struct { Language string Model string Manufacturer string + OsName string + OsVersion string + IsMobile bool } // Create ... @@ -63,6 +66,12 @@ func (payload CreateOptions) newDevice() Device { // Get userAgent data osName, osVersion, isMobile := getUserAgentData(payload.UserAgent) + if osName == "" || osVersion == "" { + osName = payload.OsName + osVersion = payload.OsVersion + isMobile = payload.IsMobile + } + userID, _ := mongodb.NewIDFromString(payload.UserID) return Device{ ID: mongodb.NewObjectID(), diff --git a/action_update.go b/action_update.go index 5d2c229..81f9044 100644 --- a/action_update.go +++ b/action_update.go @@ -21,6 +21,9 @@ type UpdateOptions struct { Language string Model string Manufacturer string + OsName string + OsVersion string + IsMobile bool } // UpdateByDeviceID ... @@ -46,6 +49,11 @@ func (s Service) UpdateByDeviceID(deviceID string, payload UpdateOptions) error // Get userAgent data osName, osVersion, isMobile := getUserAgentData(payload.UserAgent) + if osName == "" || osVersion == "" { + osName = payload.OsName + osVersion = payload.OsVersion + isMobile = payload.IsMobile + } // Setup update data userID, _ := mongodb.NewIDFromString(payload.UserID)