Skip to content

Commit

Permalink
Fetch user id for first time user.
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-f committed Nov 20, 2023
1 parent 7f03704 commit a41db28
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions internalsdk/session_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,37 +294,31 @@ func (m *SessionModel) initSessionModel(opts *SessionModelOpts) error {
if err != nil {
return err
}
userIdStr := fmt.Sprintf("%d", userId)
countryCode, err := m.GetCountryCode()
if err != nil {
return err
}
//Get all the Plans
userIdStr := fmt.Sprintf("%d", userId)
if userId == 0 {
tempUserId, err := m.GetUserID()
if err != nil {
return err
}
userIdStr = fmt.Sprintf("%d", tempUserId)
}

// Run Plans in background
// go func() {
// data, err := apimodels.PlansV3(opts.DeviceID, userIdStr, lang, toekns, countryCode)
// if err != nil {
// log.Errorf("Error while Plans v3 request:", err) // Optional: log the error
// return
// }
// log.Debugf("Plans Response", data)
// }()

// //Get all the Plans

//Know Issue
//When use install app first time
// Plans API is failing
err = getPlansV3(m.baseModel, opts.DeviceID, userIdStr, lang, token, countryCode)
if err != nil {
log.Debugf("Plans V3 error: %v", err)
return err
}

return nil
}

func getPlansV3(m *baseModel, deviceId string, userId string, lang string, token string, countyCode string) error {
//
log.Debugf("Request data deviceID %v userId %v lang %v token %v countyCode %v", deviceId, userId, lang, token, countyCode)
plans, err := apimodels.PlansV3(deviceId, userId, lang, token, countyCode)
if err != nil {
log.Debugf("Plans V3 error: %v", err)
Expand Down

0 comments on commit a41db28

Please sign in to comment.