conflict resolved
This commit is contained in:
@@ -29,4 +29,7 @@ class ApiUrls {
|
||||
static const googlelogin = "${baseUrl}sign-in-with-google-login";
|
||||
|
||||
static const storeDetailsOfOAuth = "${baseUrl}update-user-account-type";
|
||||
|
||||
static const getuserdetails = "${baseUrl}get-auth-user-data";
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class NetworkApiServices {
|
||||
}
|
||||
Response response;
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
token = prefs.getString('token');
|
||||
token = prefs.getString('access-token');
|
||||
print("url is $url");
|
||||
log(token.toString());
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
String? myusername;
|
||||
String? fullname;
|
||||
String? token;
|
||||
String? emailid;
|
||||
int? isprofileupdated;
|
||||
|
||||
@@ -27,19 +27,212 @@ class LoginModel {
|
||||
|
||||
class Data {
|
||||
String? accessToken;
|
||||
int? id;
|
||||
UserData? userData;
|
||||
|
||||
Data({this.accessToken, this.id});
|
||||
Data({this.accessToken, this.userData});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
accessToken = json['access-token'];
|
||||
id = json['id'];
|
||||
userData = json['user_data'] != null
|
||||
? new UserData.fromJson(json['user_data'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['access-token'] = this.accessToken;
|
||||
data['id'] = this.id;
|
||||
if (this.userData != null) {
|
||||
data['user_data'] = this.userData!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class UserData {
|
||||
int? id;
|
||||
int? principalTypeXid;
|
||||
int? principalSourceXid;
|
||||
String? oneSignalPlayerId;
|
||||
String? googleId;
|
||||
String? appleId;
|
||||
String? facebookId;
|
||||
String? microsoftId;
|
||||
String? userName;
|
||||
String? pin;
|
||||
String? fullName;
|
||||
String? gender;
|
||||
String? dateOfBirth;
|
||||
String? phoneNumber;
|
||||
String? otherPhoneNumber;
|
||||
String? emailAddress;
|
||||
String? addressLine1;
|
||||
String? addressLine2;
|
||||
String? cityXid;
|
||||
String? stateXid;
|
||||
String? countryXid;
|
||||
String? postCode;
|
||||
String? lastLoginDatetime;
|
||||
String? profilePhoto;
|
||||
String? referralCode;
|
||||
String? description;
|
||||
String? about;
|
||||
String? position;
|
||||
String? trainingScores;
|
||||
String? height;
|
||||
String? weight;
|
||||
String? battingAverage;
|
||||
int? isProfileUpdated;
|
||||
String? isActive;
|
||||
int? groupNotification;
|
||||
int? communityNotification;
|
||||
int? followerNotification;
|
||||
int? newFollowerNotification;
|
||||
int? directMessageNotification;
|
||||
String? createdBy;
|
||||
String? modifiedBy;
|
||||
String? deletedAt;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
|
||||
UserData(
|
||||
{this.id,
|
||||
this.principalTypeXid,
|
||||
this.principalSourceXid,
|
||||
this.oneSignalPlayerId,
|
||||
this.googleId,
|
||||
this.appleId,
|
||||
this.facebookId,
|
||||
this.microsoftId,
|
||||
this.userName,
|
||||
this.pin,
|
||||
this.fullName,
|
||||
this.gender,
|
||||
this.dateOfBirth,
|
||||
this.phoneNumber,
|
||||
this.otherPhoneNumber,
|
||||
this.emailAddress,
|
||||
this.addressLine1,
|
||||
this.addressLine2,
|
||||
this.cityXid,
|
||||
this.stateXid,
|
||||
this.countryXid,
|
||||
this.postCode,
|
||||
this.lastLoginDatetime,
|
||||
this.profilePhoto,
|
||||
this.referralCode,
|
||||
this.description,
|
||||
this.about,
|
||||
this.position,
|
||||
this.trainingScores,
|
||||
this.height,
|
||||
this.weight,
|
||||
this.battingAverage,
|
||||
this.isProfileUpdated,
|
||||
this.isActive,
|
||||
this.groupNotification,
|
||||
this.communityNotification,
|
||||
this.followerNotification,
|
||||
this.newFollowerNotification,
|
||||
this.directMessageNotification,
|
||||
this.createdBy,
|
||||
this.modifiedBy,
|
||||
this.deletedAt,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
|
||||
UserData.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
principalTypeXid = json['principal_type_xid'];
|
||||
principalSourceXid = json['principal_source_xid'];
|
||||
oneSignalPlayerId = json['one_signal_player_id'];
|
||||
googleId = json['google_id'];
|
||||
appleId = json['apple_id'];
|
||||
facebookId = json['facebook_id'];
|
||||
microsoftId = json['microsoft_id'];
|
||||
userName = json['user_name'];
|
||||
pin = json['pin'];
|
||||
fullName = json['full_name'];
|
||||
gender = json['gender'];
|
||||
dateOfBirth = json['date_of_birth'];
|
||||
phoneNumber = json['phone_number'];
|
||||
otherPhoneNumber = json['other_phone_number'];
|
||||
emailAddress = json['email_address'];
|
||||
addressLine1 = json['address_line1'];
|
||||
addressLine2 = json['address_line2'];
|
||||
cityXid = json['city_xid'];
|
||||
stateXid = json['state_xid'];
|
||||
countryXid = json['country_xid'];
|
||||
postCode = json['post_code'];
|
||||
lastLoginDatetime = json['last_login_datetime'];
|
||||
profilePhoto = json['profile_photo'];
|
||||
referralCode = json['referral_code'];
|
||||
description = json['description'];
|
||||
about = json['about'];
|
||||
position = json['position'];
|
||||
trainingScores = json['training_scores'];
|
||||
height = json['height'];
|
||||
weight = json['weight'];
|
||||
battingAverage = json['batting_average'];
|
||||
isProfileUpdated = json['is_profile_updated'];
|
||||
isActive = json['is_active'];
|
||||
groupNotification = json['group_notification'];
|
||||
communityNotification = json['community_notification'];
|
||||
followerNotification = json['follower_notification'];
|
||||
newFollowerNotification = json['new_follower_notification'];
|
||||
directMessageNotification = json['direct_message_notification'];
|
||||
createdBy = json['created_by'];
|
||||
modifiedBy = json['modified_by'];
|
||||
deletedAt = json['deleted_at'];
|
||||
createdAt = json['created_at'];
|
||||
updatedAt = json['updated_at'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['principal_type_xid'] = this.principalTypeXid;
|
||||
data['principal_source_xid'] = this.principalSourceXid;
|
||||
data['one_signal_player_id'] = this.oneSignalPlayerId;
|
||||
data['google_id'] = this.googleId;
|
||||
data['apple_id'] = this.appleId;
|
||||
data['facebook_id'] = this.facebookId;
|
||||
data['microsoft_id'] = this.microsoftId;
|
||||
data['user_name'] = this.userName;
|
||||
data['pin'] = this.pin;
|
||||
data['full_name'] = this.fullName;
|
||||
data['gender'] = this.gender;
|
||||
data['date_of_birth'] = this.dateOfBirth;
|
||||
data['phone_number'] = this.phoneNumber;
|
||||
data['other_phone_number'] = this.otherPhoneNumber;
|
||||
data['email_address'] = this.emailAddress;
|
||||
data['address_line1'] = this.addressLine1;
|
||||
data['address_line2'] = this.addressLine2;
|
||||
data['city_xid'] = this.cityXid;
|
||||
data['state_xid'] = this.stateXid;
|
||||
data['country_xid'] = this.countryXid;
|
||||
data['post_code'] = this.postCode;
|
||||
data['last_login_datetime'] = this.lastLoginDatetime;
|
||||
data['profile_photo'] = this.profilePhoto;
|
||||
data['referral_code'] = this.referralCode;
|
||||
data['description'] = this.description;
|
||||
data['about'] = this.about;
|
||||
data['position'] = this.position;
|
||||
data['training_scores'] = this.trainingScores;
|
||||
data['height'] = this.height;
|
||||
data['weight'] = this.weight;
|
||||
data['batting_average'] = this.battingAverage;
|
||||
data['is_profile_updated'] = this.isProfileUpdated;
|
||||
data['is_active'] = this.isActive;
|
||||
data['group_notification'] = this.groupNotification;
|
||||
data['community_notification'] = this.communityNotification;
|
||||
data['follower_notification'] = this.followerNotification;
|
||||
data['new_follower_notification'] = this.newFollowerNotification;
|
||||
data['direct_message_notification'] = this.directMessageNotification;
|
||||
data['created_by'] = this.createdBy;
|
||||
data['modified_by'] = this.modifiedBy;
|
||||
data['deleted_at'] = this.deletedAt;
|
||||
data['created_at'] = this.createdAt;
|
||||
data['updated_at'] = this.updatedAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:regroup/Utils/Common/CustomNextButton.dart';
|
||||
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
||||
import 'package:regroup/Utils/Common/googleOAuthService.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
|
||||
@@ -156,18 +157,17 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
final data = await LoginAPI().loginApi(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
// await global.setname();
|
||||
Get.snackbar(
|
||||
"Success!",
|
||||
'Login successful!',
|
||||
duration: const Duration(seconds: 2),
|
||||
colorText: Colors.white,
|
||||
backgroundColor: Colors.green,
|
||||
margin: const EdgeInsets.all(8),
|
||||
snackStyle: SnackStyle.FLOATING,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
|
||||
Get.toNamed(RouteName.mainscreen);
|
||||
// Get.snackbar(
|
||||
// "Success!",
|
||||
// 'Login successful!',
|
||||
// duration: const Duration(seconds: 2),
|
||||
// colorText: Colors.white,
|
||||
// backgroundColor: Colors.green,
|
||||
// margin: const EdgeInsets.all(8),
|
||||
// snackStyle: SnackStyle.FLOATING,
|
||||
// snackPosition: SnackPosition.BOTTOM,
|
||||
// );
|
||||
return utils.showToast(data.message);
|
||||
} else if (data.status == ResponseStatus.FAILED) {
|
||||
Get.snackbar(
|
||||
"Error!",
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
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/Login/Model/LoginModel.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class LoginAPI {
|
||||
@@ -14,8 +17,46 @@ class LoginAPI {
|
||||
if (response.data['status'] == 'success') {
|
||||
LoginModel loginObj = LoginModel.fromJson(response.data);
|
||||
await prefs.setString('access-token', loginObj.data!.accessToken!);
|
||||
await prefs.setString(
|
||||
'fullname', loginObj.data?.userData?.fullName ?? "");
|
||||
await prefs.setString(
|
||||
'username', loginObj.data?.userData?.userName ?? "");
|
||||
await prefs.setString(
|
||||
'email', loginObj.data?.userData?.emailAddress ?? "");
|
||||
await prefs.setString(
|
||||
'phone', loginObj.data?.userData?.phoneNumber ?? "");
|
||||
|
||||
token = loginObj.data!.accessToken;
|
||||
emailid = loginObj.data?.userData?.emailAddress;
|
||||
myusername = loginObj.data?.userData?.userName;
|
||||
fullname = loginObj.data?.userData?.fullName;
|
||||
phonenumber = loginObj.data?.userData?.phoneNumber;
|
||||
|
||||
print("token is ${loginObj.data!.accessToken!}");
|
||||
|
||||
if (loginObj.data?.userData?.isProfileUpdated == 0) {
|
||||
String? accountype =
|
||||
loginObj.data?.userData?.principalTypeXid.toString();
|
||||
|
||||
if (accountype == "1") {
|
||||
print('tell us individyal');
|
||||
Get.toNamed(RouteName.tellusindividualscreen,
|
||||
// arguments: {
|
||||
// 'pageroute' : "mainscreen"
|
||||
// }
|
||||
);
|
||||
} else if (accountype == "2") {
|
||||
print('tell us business');
|
||||
|
||||
Get.toNamed(RouteName.tellusbusinessscreen,
|
||||
// arguments: {
|
||||
// 'pageroute' : "mainscreen"
|
||||
// }
|
||||
);
|
||||
}
|
||||
} else {
|
||||
Get.toNamed(RouteName.mainscreen);
|
||||
}
|
||||
} else {
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.FAILED);
|
||||
|
||||
117
lib/main.dart
117
lib/main.dart
@@ -1,5 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
@@ -42,25 +41,30 @@ class MyApp extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
var _connectionStatus = ConnectivityResult.values.toString();
|
||||
final Connectivity _connectivity = Connectivity();
|
||||
late StreamSubscription<ConnectivityResult> _connectivitySubscription;
|
||||
Future<void> checkInternet() async {
|
||||
final connectivityResult = await (Connectivity().checkConnectivity());
|
||||
// var _connectionStatus = ConnectivityResult.values.toString();
|
||||
// final Connectivity _connectivity = Connectivity();
|
||||
// late StreamSubscription<ConnectivityResult> _connectivitySubscription;
|
||||
|
||||
if (connectivityResult == ConnectivityResult.wifi ||
|
||||
connectivityResult == ConnectivityResult.mobile) {
|
||||
setState(() {
|
||||
_connectionStatus = connectivityResult.toString();
|
||||
print("has internet");
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_connectionStatus = connectivityResult.toString();
|
||||
print("no internet");
|
||||
});
|
||||
}
|
||||
}
|
||||
List<ConnectivityResult> _connectionStatus = [ConnectivityResult.none];
|
||||
final Connectivity _connectivity = Connectivity();
|
||||
late StreamSubscription<List<ConnectivityResult>> _connectivitySubscription;
|
||||
|
||||
// Future<void> checkInternet() async {
|
||||
// final connectivityResult = await (Connectivity().checkConnectivity());
|
||||
|
||||
// if (connectivityResult == ConnectivityResult.wifi ||
|
||||
// connectivityResult == ConnectivityResult.mobile) {
|
||||
// setState(() {
|
||||
// _connectionStatus = connectivityResult.toString();
|
||||
// print("has internet");
|
||||
// });
|
||||
// } else {
|
||||
// setState(() {
|
||||
// _connectionStatus = connectivityResult.toString();
|
||||
// print("no internet");
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<void> initConnectivity() async {
|
||||
late List<ConnectivityResult> result;
|
||||
@@ -80,21 +84,84 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
return _updateConnectionStatus(result);
|
||||
}
|
||||
|
||||
Future<void> _updateConnectionStatus(List<ConnectivityResult> result) async {
|
||||
setState(() {
|
||||
_connectionStatus = result.toString();
|
||||
});
|
||||
// Future<void> _updateConnectionStatus(List<ConnectivityResult> result) async {
|
||||
// setState(() {
|
||||
// _connectionStatus = result.toString();
|
||||
// });
|
||||
|
||||
// // ignore: avoid_print
|
||||
// print('Connectivity changed: $_connectionStatus');
|
||||
// }
|
||||
|
||||
Future<void> _updateConnectionStatus(List<ConnectivityResult> result) async {
|
||||
// setState(() {
|
||||
// _connectionStatus = result;
|
||||
// });
|
||||
|
||||
if (result.contains(ConnectivityResult.wifi) || result.contains(ConnectivityResult.mobile)) {
|
||||
setState(() {
|
||||
_connectionStatus = result;
|
||||
Get.back(result: true);
|
||||
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_connectionStatus = result;
|
||||
Get.toNamed(RouteName.nointernet);
|
||||
});
|
||||
// Get.toNamed(RouteName.nointernet);
|
||||
}
|
||||
// ignore: avoid_print
|
||||
print('Connectivity changed: $_connectionStatus');
|
||||
}
|
||||
|
||||
Future<void> _getStoragePermission() async {
|
||||
DeviceInfoPlugin plugin = DeviceInfoPlugin();
|
||||
AndroidDeviceInfo android = await plugin.androidInfo;
|
||||
if (android.version.sdkInt < 33) {
|
||||
if (await Permission.storage.request().isGranted) {
|
||||
// setState(() {
|
||||
// permissionGranted = true;
|
||||
// });
|
||||
} else if (await Permission.storage.request().isPermanentlyDenied) {
|
||||
await openAppSettings();
|
||||
await utils.showToast("Permission denied.");
|
||||
}
|
||||
// else if (await Permission.audio.request().isDenied) {
|
||||
// // setState(() {
|
||||
// // permissionGranted = false;
|
||||
// // });
|
||||
// }
|
||||
} else {
|
||||
if (await Permission.photos.request().isGranted) {
|
||||
// await utils.showToast("Permission granted.");
|
||||
// setState(() {
|
||||
// permissionGranted = true;
|
||||
// });
|
||||
} else if (await Permission.photos.request().isPermanentlyDenied) {
|
||||
await openAppSettings();
|
||||
await utils.showToast("Permission denied.");
|
||||
} else if (await Permission.photos.request().isDenied) {
|
||||
await openAppSettings();
|
||||
await utils.showToast("Permission denied.");
|
||||
// setState(() {
|
||||
// permissionGranted = false;
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
initConnectivity();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
// _connectivitySubscription =
|
||||
// _connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
|
||||
_connectivitySubscription =
|
||||
_connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
|
||||
|
||||
//do not remove this coomented code
|
||||
// if (Platform.isAndroid) {
|
||||
// _getStoragePermission();
|
||||
// }
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
332
lib/onboarding/Signup/Model/GetUserdetailsModel.dart
Normal file
332
lib/onboarding/Signup/Model/GetUserdetailsModel.dart
Normal file
@@ -0,0 +1,332 @@
|
||||
class GetuserdetailsModel {
|
||||
String? status;
|
||||
int? statusCode;
|
||||
String? message;
|
||||
Data? data;
|
||||
|
||||
GetuserdetailsModel({this.status, this.statusCode, this.message, this.data});
|
||||
|
||||
GetuserdetailsModel.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
statusCode = json['status_code'];
|
||||
message = json['message'];
|
||||
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['status_code'] = this.statusCode;
|
||||
data['message'] = this.message;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
UserData? userData;
|
||||
List<UserCommunity>? userCommunity;
|
||||
List<UserGroups>? userGroups;
|
||||
|
||||
Data({this.userData, this.userCommunity, this.userGroups});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
userData = json['userData'] != null
|
||||
? new UserData.fromJson(json['userData'])
|
||||
: null;
|
||||
if (json['userCommunity'] != null) {
|
||||
userCommunity = <UserCommunity>[];
|
||||
json['userCommunity'].forEach((v) {
|
||||
userCommunity!.add(new UserCommunity.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['userGroups'] != null) {
|
||||
userGroups = <UserGroups>[];
|
||||
json['userGroups'].forEach((v) {
|
||||
userGroups!.add(new UserGroups.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.userData != null) {
|
||||
data['userData'] = this.userData!.toJson();
|
||||
}
|
||||
if (this.userCommunity != null) {
|
||||
data['userCommunity'] =
|
||||
this.userCommunity!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.userGroups != null) {
|
||||
data['userGroups'] = this.userGroups!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class UserData {
|
||||
int? id;
|
||||
int? principalTypeXid;
|
||||
String? googleId;
|
||||
String? appleId;
|
||||
String? userName;
|
||||
String? fullName;
|
||||
String? gender;
|
||||
String? dateOfBirth;
|
||||
String? phoneNumber;
|
||||
String? emailAddress;
|
||||
String? addressLine1;
|
||||
String? addressLine2;
|
||||
String? postCode;
|
||||
String? lastLoginDatetime;
|
||||
String? profilePhoto;
|
||||
int? isProfileUpdated;
|
||||
String? isActive;
|
||||
String? createdAt;
|
||||
|
||||
UserData(
|
||||
{this.id,
|
||||
this.principalTypeXid,
|
||||
this.googleId,
|
||||
this.appleId,
|
||||
this.userName,
|
||||
this.fullName,
|
||||
this.gender,
|
||||
this.dateOfBirth,
|
||||
this.phoneNumber,
|
||||
this.emailAddress,
|
||||
this.addressLine1,
|
||||
this.addressLine2,
|
||||
this.postCode,
|
||||
this.lastLoginDatetime,
|
||||
this.profilePhoto,
|
||||
this.isProfileUpdated,
|
||||
this.isActive,
|
||||
this.createdAt});
|
||||
|
||||
UserData.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
principalTypeXid = json['principal_type_xid'];
|
||||
googleId = json['google_id'];
|
||||
appleId = json['apple_id'];
|
||||
userName = json['user_name'];
|
||||
fullName = json['full_name'];
|
||||
gender = json['gender'];
|
||||
dateOfBirth = json['date_of_birth'];
|
||||
phoneNumber = json['phone_number'];
|
||||
emailAddress = json['email_address'];
|
||||
addressLine1 = json['address_line1'];
|
||||
addressLine2 = json['address_line2'];
|
||||
postCode = json['post_code'];
|
||||
lastLoginDatetime = json['last_login_datetime'];
|
||||
profilePhoto = json['profile_photo'];
|
||||
isProfileUpdated = json['is_profile_updated'];
|
||||
isActive = json['is_active'];
|
||||
createdAt = json['created_at'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['principal_type_xid'] = this.principalTypeXid;
|
||||
data['google_id'] = this.googleId;
|
||||
data['apple_id'] = this.appleId;
|
||||
data['user_name'] = this.userName;
|
||||
data['full_name'] = this.fullName;
|
||||
data['gender'] = this.gender;
|
||||
data['date_of_birth'] = this.dateOfBirth;
|
||||
data['phone_number'] = this.phoneNumber;
|
||||
data['email_address'] = this.emailAddress;
|
||||
data['address_line1'] = this.addressLine1;
|
||||
data['address_line2'] = this.addressLine2;
|
||||
data['post_code'] = this.postCode;
|
||||
data['last_login_datetime'] = this.lastLoginDatetime;
|
||||
data['profile_photo'] = this.profilePhoto;
|
||||
data['is_profile_updated'] = this.isProfileUpdated;
|
||||
data['is_active'] = this.isActive;
|
||||
data['created_at'] = this.createdAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class UserCommunity {
|
||||
int? id;
|
||||
int? iamPrincipalXid;
|
||||
int? manageCommunityXid;
|
||||
String? joinedAt;
|
||||
int? isActive;
|
||||
CommunityData? communityData;
|
||||
|
||||
UserCommunity(
|
||||
{this.id,
|
||||
this.iamPrincipalXid,
|
||||
this.manageCommunityXid,
|
||||
this.joinedAt,
|
||||
this.isActive,
|
||||
this.communityData});
|
||||
|
||||
UserCommunity.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
iamPrincipalXid = json['iam_principal_xid'];
|
||||
manageCommunityXid = json['manage_community_xid'];
|
||||
joinedAt = json['joined_at'];
|
||||
isActive = json['is_active'];
|
||||
communityData = json['community_data'] != null
|
||||
? new CommunityData.fromJson(json['community_data'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['iam_principal_xid'] = this.iamPrincipalXid;
|
||||
data['manage_community_xid'] = this.manageCommunityXid;
|
||||
data['joined_at'] = this.joinedAt;
|
||||
data['is_active'] = this.isActive;
|
||||
if (this.communityData != null) {
|
||||
data['community_data'] = this.communityData!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class CommunityData {
|
||||
int? id;
|
||||
String? communityProfilePhoto;
|
||||
String? communityBannerImage;
|
||||
String? communityName;
|
||||
String? communityLocation;
|
||||
String? communityDescription;
|
||||
int? communityTypeXid;
|
||||
int? activityXid;
|
||||
int? isActive;
|
||||
String? createdAt;
|
||||
|
||||
CommunityData(
|
||||
{this.id,
|
||||
this.communityProfilePhoto,
|
||||
this.communityBannerImage,
|
||||
this.communityName,
|
||||
this.communityLocation,
|
||||
this.communityDescription,
|
||||
this.communityTypeXid,
|
||||
this.activityXid,
|
||||
this.isActive,
|
||||
this.createdAt});
|
||||
|
||||
CommunityData.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
communityProfilePhoto = json['community_profile_photo'];
|
||||
communityBannerImage = json['community_banner_image'];
|
||||
communityName = json['community_name'];
|
||||
communityLocation = json['community_location'];
|
||||
communityDescription = json['community_description'];
|
||||
communityTypeXid = json['community_type_xid'];
|
||||
activityXid = json['activity_xid'];
|
||||
isActive = json['is_active'];
|
||||
createdAt = json['created_at'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['community_profile_photo'] = this.communityProfilePhoto;
|
||||
data['community_banner_image'] = this.communityBannerImage;
|
||||
data['community_name'] = this.communityName;
|
||||
data['community_location'] = this.communityLocation;
|
||||
data['community_description'] = this.communityDescription;
|
||||
data['community_type_xid'] = this.communityTypeXid;
|
||||
data['activity_xid'] = this.activityXid;
|
||||
data['is_active'] = this.isActive;
|
||||
data['created_at'] = this.createdAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class UserGroups {
|
||||
int? id;
|
||||
int? iamPrincipalXid;
|
||||
int? manageGroupXid;
|
||||
String? createdAt;
|
||||
GroupData? groupData;
|
||||
|
||||
UserGroups(
|
||||
{this.id,
|
||||
this.iamPrincipalXid,
|
||||
this.manageGroupXid,
|
||||
this.createdAt,
|
||||
this.groupData});
|
||||
|
||||
UserGroups.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
iamPrincipalXid = json['iam_principal_xid'];
|
||||
manageGroupXid = json['manage_group_xid'];
|
||||
createdAt = json['created_at'];
|
||||
groupData = json['group_data'] != null
|
||||
? new GroupData.fromJson(json['group_data'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['iam_principal_xid'] = this.iamPrincipalXid;
|
||||
data['manage_group_xid'] = this.manageGroupXid;
|
||||
data['created_at'] = this.createdAt;
|
||||
if (this.groupData != null) {
|
||||
data['group_data'] = this.groupData!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupData {
|
||||
int? id;
|
||||
int? manageGroupTypeXid;
|
||||
String? title;
|
||||
String? backgroundImage;
|
||||
String? groupImage;
|
||||
String? link;
|
||||
String? description;
|
||||
int? isActive;
|
||||
String? createdAt;
|
||||
|
||||
GroupData(
|
||||
{this.id,
|
||||
this.manageGroupTypeXid,
|
||||
this.title,
|
||||
this.backgroundImage,
|
||||
this.groupImage,
|
||||
this.link,
|
||||
this.description,
|
||||
this.isActive,
|
||||
this.createdAt});
|
||||
|
||||
GroupData.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
manageGroupTypeXid = json['manage_group_type_xid'];
|
||||
title = json['title'];
|
||||
backgroundImage = json['background_image'];
|
||||
groupImage = json['group_image'];
|
||||
link = json['link'];
|
||||
description = json['description'];
|
||||
isActive = json['is_active'];
|
||||
createdAt = json['created_at'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['manage_group_type_xid'] = this.manageGroupTypeXid;
|
||||
data['title'] = this.title;
|
||||
data['background_image'] = this.backgroundImage;
|
||||
data['group_image'] = this.groupImage;
|
||||
data['link'] = this.link;
|
||||
data['description'] = this.description;
|
||||
data['is_active'] = this.isActive;
|
||||
data['created_at'] = this.createdAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
class TellusIndividualModel {
|
||||
String? status;
|
||||
int? statusCode;
|
||||
String? message;
|
||||
Data? data;
|
||||
|
||||
TellusIndividualModel(
|
||||
{this.status, this.statusCode, this.message, this.data});
|
||||
|
||||
TellusIndividualModel.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
statusCode = json['status_code'];
|
||||
message = json['message'];
|
||||
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
data['status_code'] = this.statusCode;
|
||||
data['message'] = this.message;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
Profile? profile;
|
||||
|
||||
Data({this.profile});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
profile =
|
||||
json['profile'] != null ? new Profile.fromJson(json['profile']) : null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.profile != null) {
|
||||
data['profile'] = this.profile!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Profile {
|
||||
int? id;
|
||||
int? principalTypeXid;
|
||||
int? principalSourceXid;
|
||||
String? oneSignalPlayerId;
|
||||
String? googleId;
|
||||
String? appleId;
|
||||
String? facebookId;
|
||||
String? microsoftId;
|
||||
String? userName;
|
||||
String? pin;
|
||||
String? fullName;
|
||||
String? gender;
|
||||
String? dateOfBirth;
|
||||
String? phoneNumber;
|
||||
String? otherPhoneNumber;
|
||||
String? emailAddress;
|
||||
String? addressLine1;
|
||||
String? addressLine2;
|
||||
String? cityXid;
|
||||
String? stateXid;
|
||||
String? countryXid;
|
||||
String? postCode;
|
||||
String? lastLoginDatetime;
|
||||
String? profilePhoto;
|
||||
String? referralCode;
|
||||
String? description;
|
||||
String? about;
|
||||
String? position;
|
||||
String? trainingScores;
|
||||
String? height;
|
||||
String? weight;
|
||||
String? battingAverage;
|
||||
int? isProfileUpdated;
|
||||
String? isActive;
|
||||
int? groupNotification;
|
||||
int? communityNotification;
|
||||
int? followerNotification;
|
||||
int? newFollowerNotification;
|
||||
int? directMessageNotification;
|
||||
String? createdBy;
|
||||
String? modifiedBy;
|
||||
String? deletedAt;
|
||||
String? createdAt;
|
||||
String? updatedAt;
|
||||
|
||||
Profile(
|
||||
{this.id,
|
||||
this.principalTypeXid,
|
||||
this.principalSourceXid,
|
||||
this.oneSignalPlayerId,
|
||||
this.googleId,
|
||||
this.appleId,
|
||||
this.facebookId,
|
||||
this.microsoftId,
|
||||
this.userName,
|
||||
this.pin,
|
||||
this.fullName,
|
||||
this.gender,
|
||||
this.dateOfBirth,
|
||||
this.phoneNumber,
|
||||
this.otherPhoneNumber,
|
||||
this.emailAddress,
|
||||
this.addressLine1,
|
||||
this.addressLine2,
|
||||
this.cityXid,
|
||||
this.stateXid,
|
||||
this.countryXid,
|
||||
this.postCode,
|
||||
this.lastLoginDatetime,
|
||||
this.profilePhoto,
|
||||
this.referralCode,
|
||||
this.description,
|
||||
this.about,
|
||||
this.position,
|
||||
this.trainingScores,
|
||||
this.height,
|
||||
this.weight,
|
||||
this.battingAverage,
|
||||
this.isProfileUpdated,
|
||||
this.isActive,
|
||||
this.groupNotification,
|
||||
this.communityNotification,
|
||||
this.followerNotification,
|
||||
this.newFollowerNotification,
|
||||
this.directMessageNotification,
|
||||
this.createdBy,
|
||||
this.modifiedBy,
|
||||
this.deletedAt,
|
||||
this.createdAt,
|
||||
this.updatedAt});
|
||||
|
||||
Profile.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
principalTypeXid = json['principal_type_xid'];
|
||||
principalSourceXid = json['principal_source_xid'];
|
||||
oneSignalPlayerId = json['one_signal_player_id'];
|
||||
googleId = json['google_id'];
|
||||
appleId = json['apple_id'];
|
||||
facebookId = json['facebook_id'];
|
||||
microsoftId = json['microsoft_id'];
|
||||
userName = json['user_name'];
|
||||
pin = json['pin'];
|
||||
fullName = json['full_name'];
|
||||
gender = json['gender'];
|
||||
dateOfBirth = json['date_of_birth'];
|
||||
phoneNumber = json['phone_number'];
|
||||
otherPhoneNumber = json['other_phone_number'];
|
||||
emailAddress = json['email_address'];
|
||||
addressLine1 = json['address_line1'];
|
||||
addressLine2 = json['address_line2'];
|
||||
cityXid = json['city_xid'];
|
||||
stateXid = json['state_xid'];
|
||||
countryXid = json['country_xid'];
|
||||
postCode = json['post_code'];
|
||||
lastLoginDatetime = json['last_login_datetime'];
|
||||
profilePhoto = json['profile_photo'];
|
||||
referralCode = json['referral_code'];
|
||||
description = json['description'];
|
||||
about = json['about'];
|
||||
position = json['position'];
|
||||
trainingScores = json['training_scores'];
|
||||
height = json['height'];
|
||||
weight = json['weight'];
|
||||
battingAverage = json['batting_average'];
|
||||
isProfileUpdated = json['is_profile_updated'];
|
||||
isActive = json['is_active'];
|
||||
groupNotification = json['group_notification'];
|
||||
communityNotification = json['community_notification'];
|
||||
followerNotification = json['follower_notification'];
|
||||
newFollowerNotification = json['new_follower_notification'];
|
||||
directMessageNotification = json['direct_message_notification'];
|
||||
createdBy = json['created_by'];
|
||||
modifiedBy = json['modified_by'];
|
||||
deletedAt = json['deleted_at'];
|
||||
createdAt = json['created_at'];
|
||||
updatedAt = json['updated_at'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['principal_type_xid'] = this.principalTypeXid;
|
||||
data['principal_source_xid'] = this.principalSourceXid;
|
||||
data['one_signal_player_id'] = this.oneSignalPlayerId;
|
||||
data['google_id'] = this.googleId;
|
||||
data['apple_id'] = this.appleId;
|
||||
data['facebook_id'] = this.facebookId;
|
||||
data['microsoft_id'] = this.microsoftId;
|
||||
data['user_name'] = this.userName;
|
||||
data['pin'] = this.pin;
|
||||
data['full_name'] = this.fullName;
|
||||
data['gender'] = this.gender;
|
||||
data['date_of_birth'] = this.dateOfBirth;
|
||||
data['phone_number'] = this.phoneNumber;
|
||||
data['other_phone_number'] = this.otherPhoneNumber;
|
||||
data['email_address'] = this.emailAddress;
|
||||
data['address_line1'] = this.addressLine1;
|
||||
data['address_line2'] = this.addressLine2;
|
||||
data['city_xid'] = this.cityXid;
|
||||
data['state_xid'] = this.stateXid;
|
||||
data['country_xid'] = this.countryXid;
|
||||
data['post_code'] = this.postCode;
|
||||
data['last_login_datetime'] = this.lastLoginDatetime;
|
||||
data['profile_photo'] = this.profilePhoto;
|
||||
data['referral_code'] = this.referralCode;
|
||||
data['description'] = this.description;
|
||||
data['about'] = this.about;
|
||||
data['position'] = this.position;
|
||||
data['training_scores'] = this.trainingScores;
|
||||
data['height'] = this.height;
|
||||
data['weight'] = this.weight;
|
||||
data['batting_average'] = this.battingAverage;
|
||||
data['is_profile_updated'] = this.isProfileUpdated;
|
||||
data['is_active'] = this.isActive;
|
||||
data['group_notification'] = this.groupNotification;
|
||||
data['community_notification'] = this.communityNotification;
|
||||
data['follower_notification'] = this.followerNotification;
|
||||
data['new_follower_notification'] = this.newFollowerNotification;
|
||||
data['direct_message_notification'] = this.directMessageNotification;
|
||||
data['created_by'] = this.createdBy;
|
||||
data['modified_by'] = this.modifiedBy;
|
||||
data['deleted_at'] = this.deletedAt;
|
||||
data['created_at'] = this.createdAt;
|
||||
data['updated_at'] = this.updatedAt;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,8 @@ class _TellusaboutBusinessState extends State<TellusaboutBusiness> {
|
||||
});
|
||||
}
|
||||
|
||||
// String pagename = Get.arguments["pageroute"];
|
||||
|
||||
String getBusinessTypeId(String selectedBusinessType) {
|
||||
if (selectedBusinessType.contains("Retail")) {
|
||||
return '1';
|
||||
@@ -101,7 +103,13 @@ class _TellusaboutBusinessState extends State<TellusaboutBusiness> {
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
|
||||
Get.toNamed(RouteName.businessletusunderstandstep1);
|
||||
// if (pagename == "nextscreen") {
|
||||
Get.toNamed(RouteName.businessletusunderstandstep1);
|
||||
|
||||
// } else if (pagename == "mainscreen") {
|
||||
// Get.toNamed(RouteName.mainscreen);
|
||||
// }
|
||||
|
||||
} else if (data.status == ResponseStatus.FAILED) {
|
||||
Get.snackbar(
|
||||
"Error!",
|
||||
|
||||
@@ -36,6 +36,9 @@ class _TellusaboutIndividualState extends State<TellusaboutIndividual> {
|
||||
TextEditingController datecontroller = TextEditingController();
|
||||
TextEditingController locationcontroller = TextEditingController();
|
||||
|
||||
// String pagename = Get.arguments["pageroute"];
|
||||
|
||||
|
||||
DateTime? _selectedDate;
|
||||
final photographController = TextEditingController();
|
||||
|
||||
@@ -162,7 +165,12 @@ class _TellusaboutIndividualState extends State<TellusaboutIndividual> {
|
||||
utils.showToast("tell us done Successfully!");
|
||||
Get.back();
|
||||
// Get.toNamed(RouteName.individualprofilestep1);
|
||||
Get.toNamed(RouteName.individualactivitystep2);
|
||||
// if (pagename == "nextscreen") {
|
||||
Get.toNamed(RouteName.individualactivitystep2);
|
||||
|
||||
// } else if (pagename == "mainscreen") {
|
||||
// Get.toNamed(RouteName.mainscreen);
|
||||
// }
|
||||
} else {
|
||||
Get.back();
|
||||
return utils.showToast(data.message);
|
||||
|
||||
@@ -52,10 +52,18 @@ class _VerifyuserScreenStateState extends State<VerifyuserScreenState> {
|
||||
|
||||
if (accounttype == 'Individual') {
|
||||
print('individual selected');
|
||||
Get.toNamed(RouteName.tellusindividualscreen);
|
||||
Get.toNamed(RouteName.tellusindividualscreen,
|
||||
// arguments: {
|
||||
// 'pageroute' : "nextscreen"
|
||||
// }
|
||||
);
|
||||
} else if (accounttype == 'Business') {
|
||||
print('business selected');
|
||||
Get.toNamed(RouteName.tellusbusinessscreen);
|
||||
Get.toNamed(RouteName.tellusbusinessscreen,
|
||||
// arguments: {
|
||||
// 'pageroute' : "nextscreen"
|
||||
// }
|
||||
);
|
||||
}
|
||||
|
||||
return utils.showToast(data.message);
|
||||
|
||||
72
lib/onboarding/Signup/view_model/getUserprofile.dart
Normal file
72
lib/onboarding/Signup/view_model/getUserprofile.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
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/GetUserdetailsModel.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
GetuserdetailsModel? getuserobj;
|
||||
|
||||
|
||||
class Getuserdetails {
|
||||
Getuserdetails();
|
||||
|
||||
Future<ResponseData<dynamic>> Getuser() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response = await NetworkApiServices().getApi(ApiUrls.getuserdetails);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
dynamic responseData = response.data;
|
||||
|
||||
if (responseData is Map<String, dynamic>) {
|
||||
// Assuming response data is a map
|
||||
getuserobj = GetuserdetailsModel.fromJson(responseData);
|
||||
|
||||
await prefs.setString('fullname', getuserobj?.data?.userData?.fullName ?? "");
|
||||
await prefs.setString('username', getuserobj?.data?.userData?.userName ?? "");
|
||||
await prefs.setString('email', getuserobj?.data?.userData?.emailAddress ?? "");
|
||||
await prefs.setString('phone', getuserobj?.data?.userData?.phoneNumber ?? "");
|
||||
|
||||
emailid = prefs.getString('email');
|
||||
myusername = prefs.getString('username');
|
||||
fullname = prefs.getString('fullname');
|
||||
phonenumber = prefs.getString('phone');
|
||||
|
||||
|
||||
} else if (responseData is String) {
|
||||
// Parse the JSON string into a map
|
||||
Map<String, dynamic> jsonMap;
|
||||
try {
|
||||
jsonMap = json.decode(responseData);
|
||||
} catch (e) {
|
||||
return ResponseData<dynamic>(
|
||||
"Error decoding JSON string: $responseData",
|
||||
ResponseStatus.FAILED);
|
||||
}
|
||||
|
||||
|
||||
await prefs.setString('fullname', getuserobj?.data?.userData?.fullName ?? "");
|
||||
await prefs.setString('username', getuserobj?.data?.userData?.userName ?? "");
|
||||
await prefs.setString('email', getuserobj?.data?.userData?.emailAddress ?? "");
|
||||
await prefs.setString('phone', getuserobj?.data?.userData?.phoneNumber ?? "");
|
||||
|
||||
emailid = prefs.getString('email');
|
||||
myusername = prefs.getString('username');
|
||||
fullname = prefs.getString('fullname');
|
||||
phonenumber = prefs.getString('phone');
|
||||
|
||||
|
||||
} else {
|
||||
// Handle other types if necessary
|
||||
return ResponseData<dynamic>(
|
||||
"Unexpected response format", ResponseStatus.FAILED);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ 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/onboarding/Signup/Model/Onboarding/Individual/tellusIndividual.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class Onboard {
|
||||
@@ -28,12 +29,9 @@ class Onboard {
|
||||
Map<String, dynamic> res = response.data;
|
||||
print("res is $res");
|
||||
await prefs.setString('access-token', res['data']['token']);
|
||||
await prefs.setString('email', res['data']['email']);
|
||||
await prefs.setInt('isprofileupdate', res['data']['is_profile_updated']);
|
||||
// await prefs.setInt('isprofileupdate', res['data']['is_profile_updated']);
|
||||
|
||||
token = res['data']['token'];
|
||||
emailid = res['data']['email'];
|
||||
isprofileupdated = res['data']['is_profile_updated'];
|
||||
|
||||
print("token is $token");
|
||||
print("email is $emailid");
|
||||
@@ -44,11 +42,30 @@ class Onboard {
|
||||
|
||||
Future<ResponseData> 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<dynamic>(
|
||||
response.data['message'], ResponseStatus.FAILED);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,11 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:regroup/Global.dart';
|
||||
import 'package:regroup/Utils/Common/NoInternet.dart';
|
||||
import 'package:regroup/onboarding/Signup/view_model/getUserprofile.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
// import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
@@ -20,8 +23,8 @@ class SplashScreen extends StatefulWidget {
|
||||
|
||||
class _SplashScreenState extends State<SplashScreen> {
|
||||
// var _connectionStatus;
|
||||
// final Connectivity _connectivity = Connectivity();
|
||||
// List<ConnectivityResult> _connectionStatus = [ConnectivityResult.none];
|
||||
final Connectivity _connectivity = Connectivity();
|
||||
List<ConnectivityResult> _connectionStatus = [ConnectivityResult.none];
|
||||
|
||||
// Future<void> checkInternet() async {
|
||||
// final connectivityResult = await (Connectivity().checkConnectivity());
|
||||
@@ -39,58 +42,147 @@ class _SplashScreenState extends State<SplashScreen> {
|
||||
// }
|
||||
// }
|
||||
|
||||
// Future<void> initConnectivity() async {
|
||||
// late List<ConnectivityResult> result;
|
||||
// try {
|
||||
// result = await _connectivity.checkConnectivity();
|
||||
// } on PlatformException catch (e) {
|
||||
// log('Couldn\'t check connectivity status', error: e);
|
||||
// return;
|
||||
// }
|
||||
Future<void> initConnectivity() async {
|
||||
late List<ConnectivityResult> result;
|
||||
try {
|
||||
result = await _connectivity.checkConnectivity();
|
||||
} on PlatformException catch (e) {
|
||||
log('Couldn\'t check connectivity status', error: e);
|
||||
return;
|
||||
}
|
||||
|
||||
// if (!mounted) {
|
||||
// return Future.value(null);
|
||||
// }
|
||||
if (!mounted) {
|
||||
return Future.value(null);
|
||||
}
|
||||
|
||||
// return _updateConnectionStatus(result);
|
||||
// }
|
||||
return _updateConnectionStatus(result);
|
||||
}
|
||||
|
||||
// Future<void> _updateConnectionStatus(List<ConnectivityResult> result) async {
|
||||
// setState(() {
|
||||
// _connectionStatus = result;
|
||||
// });
|
||||
Future<void> _updateConnectionStatus(List<ConnectivityResult> result) async {
|
||||
setState(() {
|
||||
_connectionStatus = result;
|
||||
});
|
||||
|
||||
// // ignore: avoid_print
|
||||
// print('Connectivity changed: $_connectionStatus');
|
||||
// }
|
||||
// ignore: avoid_print
|
||||
print('Connectivity changed: $_connectionStatus');
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
// initConnectivity();
|
||||
initConnectivity();
|
||||
log(_connectionStatus.toString());
|
||||
|
||||
// log(_connectionStatus.toString());
|
||||
// Future.delayed(Duration(seconds: 2), () async {
|
||||
// var result = await Get.to(NoInternet());
|
||||
// if (result != null && result) {
|
||||
// Timer(const Duration(seconds: 1), () async {
|
||||
// Get.toNamed(RouteName.onboarding1);
|
||||
|
||||
// });
|
||||
// }
|
||||
// } else {
|
||||
// Timer(const Duration(seconds: 2), () async {
|
||||
// Get.toNamed(RouteName.onboarding1);
|
||||
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
Future.delayed(Duration(seconds: 2), () async {
|
||||
Timer(const Duration(seconds: 1), () async {
|
||||
Get.toNamed(RouteName.onboarding1);
|
||||
});
|
||||
if (_connectionStatus.contains(ConnectivityResult.none)) {
|
||||
var result = await Get.to(NoInternet());
|
||||
if (result != null && result) {
|
||||
print('this is first');
|
||||
Timer(const Duration(seconds: 1), () async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
token = prefs.getString('access-token');
|
||||
emailid = prefs.getString('email');
|
||||
myusername = prefs.getString('username');
|
||||
fullname = prefs.getString('fullname');
|
||||
phonenumber = prefs.getString('phone');
|
||||
|
||||
if (token == null || token!.isEmpty) {
|
||||
Get.toNamed(RouteName.onboarding1);
|
||||
} else {
|
||||
Getuserdetails().Getuser().then((value) {
|
||||
print(getuserobj!.data!.userData!.isProfileUpdated!);
|
||||
// .then((value) {
|
||||
if (getuserobj?.data?.userData?.isProfileUpdated == 0) {
|
||||
String? accountype =
|
||||
getuserobj?.data?.userData?.principalTypeXid.toString();
|
||||
|
||||
if (accountype == "1") {
|
||||
Get.toNamed(RouteName.tellusindividualscreen,
|
||||
// arguments: {'pageroute': "mainscreen"}
|
||||
);
|
||||
} else if (accountype == "2") {
|
||||
Get.toNamed(RouteName.tellusbusinessscreen,
|
||||
// arguments: {'pageroute': "mainscreen"}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
Get.toNamed(RouteName.mainscreen);
|
||||
}
|
||||
});
|
||||
// print(getuserobj!.data!.userData!.isProfileUpdated!);
|
||||
|
||||
// // .then((value) {
|
||||
// if (getuserobj?.data?.userData?.isProfileUpdated == 0) {
|
||||
// String? accountype =
|
||||
// getuserobj?.data?.userData?.principalTypeXid.toString();
|
||||
|
||||
// if (accountype == "1") {
|
||||
// Get.toNamed(RouteName.tellusindividualscreen,
|
||||
// arguments: {
|
||||
// 'pageroute' : "mainscreen"
|
||||
// }
|
||||
// );
|
||||
// } else if (accountype == "2") {
|
||||
// Get.toNamed(RouteName.tellusbusinessscreen);
|
||||
// }
|
||||
// } else {
|
||||
// Get.toNamed(RouteName.mainscreen);
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
Timer(const Duration(seconds: 2), () async {
|
||||
print('this is second');
|
||||
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
token = prefs.getString('access-token');
|
||||
emailid = prefs.getString('email');
|
||||
myusername = prefs.getString('username');
|
||||
fullname = prefs.getString('fullname');
|
||||
phonenumber = prefs.getString('phone');
|
||||
|
||||
if (token == null || token!.isEmpty) {
|
||||
Get.toNamed(RouteName.onboarding1);
|
||||
} else {
|
||||
Getuserdetails().Getuser().then((value) {
|
||||
print(getuserobj!.data!.userData!.isProfileUpdated!);
|
||||
// .then((value) {
|
||||
if (getuserobj?.data?.userData?.isProfileUpdated == 0) {
|
||||
String? accountype =
|
||||
getuserobj?.data?.userData?.principalTypeXid.toString();
|
||||
|
||||
if (accountype == "1") {
|
||||
Get.toNamed(RouteName.tellusindividualscreen,
|
||||
// arguments: {'pageroute': "mainscreen"}
|
||||
);
|
||||
} else if (accountype == "2") {
|
||||
Get.toNamed(RouteName.tellusbusinessscreen,
|
||||
// arguments: {'pageroute': "mainscreen"}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
Get.toNamed(RouteName.mainscreen);
|
||||
}
|
||||
});
|
||||
|
||||
// }
|
||||
// );
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Future.delayed(Duration(seconds: 2), () async {
|
||||
// Timer(const Duration(seconds: 1), () async {
|
||||
// Get.toNamed(RouteName.onboarding1);
|
||||
// });
|
||||
// });
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user