User.apilogintoUser constructor
User.apilogintoUser(
- APILogin response
Implementation
factory User.apilogintoUser(APILogin response) {
return User(
userID: response.playerID,
userName: response.username?.obs,
firstName: response.firstName?.obs,
lastName: response.lastName?.obs,
//ÖNEMLİ
detailInfo: response.detailInfo == null
? null
: Rxn(
UserDetailInfo(
about: Rxn(response.detailInfo!.about),
age: Rxn(response.detailInfo!.age),
email: Rxn(response.detailInfo!.email),
friends: Rxn(response.detailInfo!.friends),
posts: Rxn(response.detailInfo!.posts),
awards: Rxn(response.detailInfo!.awards),
phoneNumber: Rxn(response.detailInfo!.phoneNumber),
birthdayDate: Rxn(response.detailInfo!.birthdayDate),
inviteCode: Rxn(response.detailInfo!.inviteCode),
lastloginDate: Rxn(response.detailInfo!.lastloginDate),
lastloginDateV2: Rxn(response.detailInfo!.lastloginDateV2),
lastfailedDate: Rxn(response.detailInfo!.lastfailedDate),
country: response.detailInfo!.country == null
? Rxn()
: Rxn(
Country(
countryID: response.detailInfo!.country!.countryID,
name: response.detailInfo!.country!.name,
countryCode: response.detailInfo!.country!.code,
phoneCode: response.detailInfo!.country!.phonecode,
),
),
province: response.detailInfo!.province == null
? Rxn()
: Rxn(
Province(
provinceID: response.detailInfo!.province!.provinceID,
name: response.detailInfo!.province!.name,
plateCode: response.detailInfo!.province!.platecode,
phoneCode: response.detailInfo!.province!.phonecode,
),
),
),
),
//ÖNemli
registerDate: response.registeredDate,
burc: response.burc != null ? Rx(response.burc!) : null,
level: response.level?.obs,
levelColor: response.levelColor?.obs,
xp: response.levelXP?.obs,
avatar: response.avatar != null
? Media(
mediaID: response.avatar!.mediaID,
mediaType: MediaType.image,
mediaURL: MediaURL(
bigURL: Rx(response.avatar!.mediaURL.bigURL),
normalURL: Rx(response.avatar!.mediaURL.normalURL),
minURL: Rx(response.avatar!.mediaURL.minURL),
),
)
: null,
banner: response.avatar != null
? Media(
mediaID: response.banner!.mediaID,
mediaType: MediaType.image,
mediaURL: MediaURL(
bigURL: Rx(response.banner!.mediaURL.bigURL),
normalURL: Rx(response.banner!.mediaURL.normalURL),
minURL: Rx(response.banner!.mediaURL.minURL),
),
)
: null,
wallpaper: response.wallpaper != null
? Media(
mediaID: response.wallpaper!.mediaID,
mediaType: MediaType.image,
mediaURL: MediaURL(
bigURL: Rx(response.wallpaper!.mediaURL.bigURL),
normalURL: Rx(response.wallpaper!.mediaURL.normalURL),
minURL: Rx(response.wallpaper!.mediaURL.minURL),
),
)
: null,
displayName: response.displayName?.obs,
favTeam: response.favTeam != null
? Team(
teamID: response.favTeam!.teamID,
name: response.favTeam!.teamName,
logo: response.favTeam!.teamLogo.minURL,
)
: null,
job: response.job != null
? widgetjob.Job(
jobID: response.job!.jobID,
name: response.job!.jobName,
shortName: response.job!.jobShortName,
)
: null,
myFriends: response.arkadasliste
?.map(
(friend) => User(
displayName: friend.oyuncuKullaniciAdi.obs,
avatar: Media(
mediaID: 0,
mediaType: MediaType.image,
mediaURL: MediaURL(
bigURL: Rx(friend.oyuncuMinnakAvatar.bigURL),
normalURL: Rx(friend.oyuncuMinnakAvatar.normalURL),
minURL: Rx(friend.oyuncuMinnakAvatar.minURL),
),
),
),
)
.toList()
.obs,
popularGames: response.popularGames
?.map(
(e) => Game(
gameID: e.gameID!,
name: e.gameName!,
logo: Media(
mediaID: e.gameLogo!.mediaID,
mediaType: MediaType.image,
mediaURL: MediaURL(
bigURL: Rx(e.gameLogo!.mediaURL.bigURL),
normalURL: Rx(e.gameLogo!.mediaURL.normalURL),
minURL: Rx(
e.gameLogo!.mediaURL.minURL,
),
),
),
gameURL: e.gameURL!,
gameType: "-------- GİRİLMEDİ --------",
),
)
.toList()
.obs,
role: response.userRole != null
? Role(
roleID: response.userRole!.roleID,
name: response.userRole!.roleName,
color: response.userRole!.roleColor,
)
: null,
socialaccounts: response.socailAccounts != null
? Socialaccounts(
facebook: Rxn(response.socailAccounts!.facebook),
github: Rxn(response.socailAccounts!.github),
instagram: Rxn(response.socailAccounts!.instagram),
linkedin: Rxn(response.socailAccounts!.linkedin),
reddit: Rxn(response.socailAccounts!.reddit),
steam: Rxn(response.socailAccounts!.steam),
twitch: Rxn(response.socailAccounts!.twitch),
youtube: Rxn(response.socailAccounts!.youtube),
discord: Rxn(response.socailAccounts!.youtube),
).obs
: null,
);
}