Changed images and colors for the details page, and refreshed information after adding a participation

fix/Model_Details
Emre KARTAL 1 year ago
parent 542c8a6b3a
commit f6df5faf03

@ -1,38 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x49",
"green" : "0x49",
"red" : "0x49"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x49",
"green" : "0x49",
"red" : "0x49"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "PinkAllCoin.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Vector (1).png",
"filename" : "PinkBadge.png",
"idiom" : "universal",
"scale" : "1x"
},

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "UserPink.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

@ -1,6 +1,7 @@
{
"images" : [
{
"filename" : "Trophy.png",
"idiom" : "universal",
"scale" : "1x"
},

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

@ -38,7 +38,7 @@ struct BetLineLoading: View {
GeometryReader { geometry in
VStack(alignment: .leading,spacing: 0){
HStack(spacing: 5){
Text("OUI").font(.system(size: 25)).fontWeight(.bold).foregroundColor(AllInColors.bleue200)
Text("OUI").font(.system(size: 25)).fontWeight(.bold).foregroundColor(AllInColors.blue200)
Spacer()
Text("NON").font(.system(size: 25)).fontWeight(.bold).foregroundColor(AllInColors.pink100)
@ -61,34 +61,34 @@ struct BetLineLoading: View {
VStack(spacing: 1){
HStack(spacing: 5){
Image("BlueAllCoinIcon").resizable().frame(width:12, height: 12)
Text(yesParticipations.reduce(0, {x,y in x + y.stake}).description).font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.bleue200)
Text(yesParticipations.reduce(0, {x,y in x + y.stake}).description).font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.blue200)
Spacer()
Text(noParticipations.reduce(0, {x,y in x + y.stake}).description).font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.pink100)
Image("PinkBadge").resizable().frame(width:10, height: 14)
Image("PinkAllCoinIcon").resizable().frame(width:10, height: 14)
}
HStack(spacing: 5){
Image("BleuePersonIcon").resizable().frame(width:14, height: 12)
Text(yesParticipations.count.description).font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.bleue200)
Image("BluePersonIcon").resizable().frame(width:14, height: 12)
Text(yesParticipations.count.description).font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.blue200)
Spacer()
Text(noParticipations.count.description).font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.pink100)
Image("PinkBadge").resizable().frame(width:10, height: 14)
Image("PinkPersonIcon").resizable().frame(width:10, height: 14)
}
HStack(spacing: 5){
Image("BleueBadge").resizable().frame(width:10, height: 14)
Text(yesParticipations.max(by: { $0.stake < $1.stake })?.stake.description ?? "0").font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.bleue200)
Image("BlueBadgeIcon").resizable().frame(width:10, height: 14)
Text(yesParticipations.max(by: { $0.stake < $1.stake })?.stake.description ?? "0").font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.blue200)
Spacer()
Text(noParticipations.max(by: { $0.stake < $1.stake })?.stake.description ?? "0").font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.pink100)
Image("PinkBadge").resizable().frame(width:10, height: 14)
Image("PinkBadgeIcon").resizable().frame(width:10, height: 14)
}
HStack(spacing: 5){
Image("BleueTrophyIcon").resizable().frame(width:14, height: 13)
Text("1.2").font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.bleue200)
Image("BlueTrophyIcon").resizable().frame(width:14, height: 13)
Text("1.2").font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.blue200)
Spacer()
Text("1.2").font(.system(size: 15)).fontWeight(.bold).foregroundColor(AllInColors.pink100)
Image("PinkBadge").resizable().frame(width:10, height: 14)
Image("PinkTrophyIcon").resizable().frame(width:10, height: 14)
}
}

@ -65,6 +65,10 @@ struct DropDownAnswerMenu: View {
.frame(width: .infinity)
.background(AllInColors.componentBackgroundColor)
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10, style: .continuous)
.stroke(AllInColors.veryLightPurpleColor, lineWidth: 0.4)
)
}
}

@ -40,16 +40,16 @@ struct ParticipationModal: View {
HStack{
Text("Faites vos paris")
.font(.system(size: 18))
.foregroundColor(AllInColors.blackTitleColor)
.foregroundColor(AllInColors.primaryTextColor)
.fontWeight(.semibold)
Spacer()
AllcoinsCounter(backgroundColor: AllInColors.purpleAccentColor, foregroundColor: AllInColors.whiteColor)
AllcoinsCounter(backgroundColor: AllInColors.purpleAccentColor, foregroundColor: .white)
}
.padding(.leading, 15)
VStack(alignment: .leading){
Text(description)
.font(.system(size: 13))
.foregroundColor(AllInColors.grey100Color)
.foregroundColor(AllInColors.primaryTextColor)
.fontWeight(.light)
DropDownAnswerMenu(selectedOption: $selectedOption, options: options)
@ -80,12 +80,12 @@ struct ParticipationModal: View {
HStack{
Text("Gains possibles")
.font(.system(size: 13))
.foregroundColor(AllInColors.blackTitleColor)
.foregroundColor(AllInColors.primaryTextColor)
.fontWeight(.regular)
Spacer()
Text("231")
.font(.system(size: 13))
.foregroundColor(AllInColors.blackTitleColor)
.foregroundColor(AllInColors.primaryTextColor)
.fontWeight(.light)
}
.padding(.top, 10).padding(.bottom, 0)

@ -29,6 +29,12 @@ struct AllInColors {
static let loginPurpleColor = Color("LoginPurpleColor")
static let whiteColor = Color("WhiteColor")
// Details
static let blue200 = Color("Blue200")
static let purple200 = Color("Purple200")
static let pink200 = Color("Pink200")
static let pink100 = Color("Pink100")
// Others
static let backgroundColor = Color("BackgroundColor")
static let darkBlueColor = Color("DarkBlueColor")
@ -48,11 +54,7 @@ struct AllInColors {
static let componentBackgroundColor = Color("ComponentBackgroundColor")
static let underComponentBackgroundColor = Color("UnderComponentBackgroundColor")
static let winBannerBackground = Color("WinBannerBackground")
static let blackTitleColor = Color("BlackTitleColor")
static let bleue200 = Color("Bleue200")
static let purple200 = Color("Purple200")
static let pink200 = Color("Pink200")
static let pink100 = Color("Pink100")
// Gradients
static let primaryGradient = LinearGradient(
gradient: Gradient(colors: [AllInColors.pinkAccentColor, AllInColors.blueAccentColor]),
@ -66,7 +68,7 @@ struct AllInColors {
)
static let BlueBetGradiant = LinearGradient(
gradient: Gradient(colors: [AllInColors.bleue200, AllInColors.purple200]),
gradient: Gradient(colors: [AllInColors.blue200, AllInColors.purple200]),
startPoint: .leading,
endPoint: .trailing
)

@ -38,7 +38,15 @@ class DetailsViewModel: ObservableObject {
} else {
rep = "No"
}
manager.addParticipation(withId: id, withAnswer: rep, andStake: stake)
manager.addParticipation(withId: id, withAnswer: rep, andStake: stake) { statusCode in
switch statusCode {
case 201:
AppStateContainer.shared.user?.nbCoins -= stake
self.getItem(withId: self.id)
default:
break
}
}
}
}
}

@ -51,7 +51,7 @@ public struct UserApiManager: UserDataManager {
fatalError("Not implemented yet")
}
public func addParticipation(withId id: String, withAnswer answer: String, andStake stake: Int) {
public func addParticipation(withId id: String, withAnswer answer: String, andStake stake: Int, completion : @escaping (Int)-> ()) {
let url = URL(string: allInApi + "participations/add")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
@ -69,6 +69,7 @@ public struct UserApiManager: UserDataManager {
print ("ALLIN : Add Participation")
if let httpResponse = response as? HTTPURLResponse {
print(httpResponse.statusCode)
completion(httpResponse.statusCode)
}
}.resume()
}

@ -40,7 +40,9 @@ public struct Manager {
}
}
public func addParticipation(withId id: String, withAnswer answer: String, andStake stake: Int) {
userDataManager.addParticipation(withId: id, withAnswer: answer, andStake: stake)
public func addParticipation(withId id: String, withAnswer answer: String, andStake stake: Int, completion : @escaping (Int)-> ()) {
userDataManager.addParticipation(withId: id, withAnswer: answer, andStake: stake) { status in
completion(status)
}
}
}

@ -17,7 +17,7 @@ public struct User {
public private(set) var email: String
/// The number of coins associated with the user.
public private(set) var nbCoins: Int
public var nbCoins: Int
/// List of friends associated with the user.
public private(set) var friends: [User]

@ -12,5 +12,5 @@ public protocol UserDataManager {
func addBet(bet: Bet, completion : @escaping (Int)-> ())
func getFriends() -> [User]
func getOldBets(withIndex index: Int, withCount count: Int, completion: @escaping ([Bet]) -> Void)
func addParticipation(withId id: String, withAnswer answer: String, andStake stake: Int)
func addParticipation(withId id: String, withAnswer answer: String, andStake stake: Int, completion : @escaping (Int)-> ())
}

Loading…
Cancel
Save