import 'dart:async'; import 'package:regroup/Common/api_urls.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/data/network/network_api.dart'; import 'package:regroup/Global.dart'; import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/onboarding/Signup/Model/Onboarding/Individual/tellusIndividual.dart'; import 'package:shared_preferences/shared_preferences.dart'; class Onboard { Onboard(); Future> Postregisteration(updata) async { print("updata is $updata"); final response = await NetworkApiServices() .postApi(updata, ApiUrls.registeration, optionalpar: true); print("response is ${response.data}"); print("response message is ${response.message}"); if (response.status == ResponseStatus.SUCCESS) { //Map responseData = jsonDecode(response.data); return ResponseData( response.data['message'], ResponseStatus.SUCCESS); } return response; } Future> Postverifyregisteration(updata) async { print("updata is $updata"); final response = await NetworkApiServices() .postApi(updata, ApiUrls.verifyregisteration, optionalpar: true); print("response is ${response.data}"); print("response message is ${response.message}"); // final SharedPreferences prefs = await SharedPreferences.getInstance(); // Map res = response.data; // print("res is $res"); // await prefs.setString('access-token', res['data']['token']); // await prefs.setInt('isprofileupdate', res['data']['is_profile_updated']); // token = res['data']['token']; print("token is $token"); print("email is $emailid"); print("profile update value is $isprofileupdated"); if (response.status == ResponseStatus.SUCCESS) { //Map responseData = jsonDecode(response.data); final SharedPreferences prefs = await SharedPreferences.getInstance(); Map res = response.data; print("res is $res"); await prefs.setString('access-token', res['data']['token']); token = res['data']['token']; // if (response.data['status'] == "error") { // // return ResponseData( // // response.data['message'], ResponseStatus.SUCCESS); // return utils.showToast(response.data['message']); // } return ResponseData( response.data['message'], ResponseStatus.SUCCESS); } return response; } Future PosttellusIndividual(updata) async { print("updata is $updata"); SharedPreferences prefs = await SharedPreferences.getInstance(); final response = await NetworkApiServices().postApi(updata, ApiUrls.tellusIndividual); print("response is ${response.data}"); print("response message is ${response.message}"); if (response.status == ResponseStatus.SUCCESS) { if (response.data['status'] == 'success') { TellusIndividualModel tellusindiObj = TellusIndividualModel.fromJson(response.data); // await prefs.setString('fullname', tellusindiObj.data?.profile?.fullName ?? ""); // await prefs.setString('username', tellusindiObj.data?.profile?.userName ?? ""); // await prefs.setString('email', tellusindiObj.data?.profile?.emailAddress ?? ""); // await prefs.setString('phone', tellusindiObj.data?.profile?.phoneNumber ?? ""); // emailid = tellusindiObj.data?.profile?.emailAddress; // myusername = tellusindiObj.data?.profile?.userName; // fullname = tellusindiObj.data?.profile?.fullName; // phonenumber = tellusindiObj.data?.profile?.phoneNumber; } else { return ResponseData( response.data['message'], ResponseStatus.FAILED); } } return response; } Future> PostIndividualActivity(updata) async { print("updata is $updata"); final response = await NetworkApiServices().postApi( updata, ApiUrls.postindividualactivity, ); print("response is ${response.data}"); print("response message is ${response.message}"); return response; } Future> postGroups(updata) async { print("updata is $updata"); final response = await NetworkApiServices().postApi( updata, ApiUrls.postgroups, ); print("response is ${response.data}"); print("response message is ${response.message}"); return response; } Future> postCommunities(updata) async { print("updata is $updata"); final response = await NetworkApiServices().postApi( updata, ApiUrls.postcommunities, ); print("response is ${response.data}"); print("response message is ${response.message}"); return response; } Future> postUserdevice(updata) async { print("updata is $updata"); final response = await NetworkApiServices().postApi( updata, ApiUrls.postuserdevice, ); print("response is ${response.data}"); print("response message is ${response.message}"); return response; } }