diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/BlackTitleColor.colorset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/BlackTitleColor.colorset/Contents.json deleted file mode 100644 index 0e54db2..0000000 --- a/Sources/AllInApp/AllIn/Assets.xcassets/BlackTitleColor.colorset/Contents.json +++ /dev/null @@ -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 - } -} diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/Bleue200.colorset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/Blue200.colorset/Contents.json similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/Bleue200.colorset/Contents.json rename to Sources/AllInApp/AllIn/Assets.xcassets/Blue200.colorset/Contents.json diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/BleueBadge.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/BlueBadgeIcon.imageset/Contents.json similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/BleueBadge.imageset/Contents.json rename to Sources/AllInApp/AllIn/Assets.xcassets/BlueBadgeIcon.imageset/Contents.json diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/BleueBadge.imageset/Vector.png b/Sources/AllInApp/AllIn/Assets.xcassets/BlueBadgeIcon.imageset/Vector.png similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/BleueBadge.imageset/Vector.png rename to Sources/AllInApp/AllIn/Assets.xcassets/BlueBadgeIcon.imageset/Vector.png diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/BleueCoin.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/BlueCoinIcon.imageset/Contents.json similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/BleueCoin.imageset/Contents.json rename to Sources/AllInApp/AllIn/Assets.xcassets/BlueCoinIcon.imageset/Contents.json diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/BleueCoin.imageset/Group 107 (1).png b/Sources/AllInApp/AllIn/Assets.xcassets/BlueCoinIcon.imageset/Group 107 (1).png similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/BleueCoin.imageset/Group 107 (1).png rename to Sources/AllInApp/AllIn/Assets.xcassets/BlueCoinIcon.imageset/Group 107 (1).png diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/BleuePersonIcon.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/BluePersonIcon.imageset/Contents.json similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/BleuePersonIcon.imageset/Contents.json rename to Sources/AllInApp/AllIn/Assets.xcassets/BluePersonIcon.imageset/Contents.json diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/BleuePersonIcon.imageset/Group 179.png b/Sources/AllInApp/AllIn/Assets.xcassets/BluePersonIcon.imageset/Group 179.png similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/BleuePersonIcon.imageset/Group 179.png rename to Sources/AllInApp/AllIn/Assets.xcassets/BluePersonIcon.imageset/Group 179.png diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/BleueTrophyIcon.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/BlueTrophyIcon.imageset/Contents.json similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/BleueTrophyIcon.imageset/Contents.json rename to Sources/AllInApp/AllIn/Assets.xcassets/BlueTrophyIcon.imageset/Contents.json diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/BleueTrophyIcon.imageset/Group 210.png b/Sources/AllInApp/AllIn/Assets.xcassets/BlueTrophyIcon.imageset/Group 210.png similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/BleueTrophyIcon.imageset/Group 210.png rename to Sources/AllInApp/AllIn/Assets.xcassets/BlueTrophyIcon.imageset/Group 210.png diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/PinkAllCoinIcon.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/PinkAllCoinIcon.imageset/Contents.json new file mode 100644 index 0000000..e297038 --- /dev/null +++ b/Sources/AllInApp/AllIn/Assets.xcassets/PinkAllCoinIcon.imageset/Contents.json @@ -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 + } +} diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/PinkAllCoinIcon.imageset/PinkAllCoin.png b/Sources/AllInApp/AllIn/Assets.xcassets/PinkAllCoinIcon.imageset/PinkAllCoin.png new file mode 100644 index 0000000..d2f70ea Binary files /dev/null and b/Sources/AllInApp/AllIn/Assets.xcassets/PinkAllCoinIcon.imageset/PinkAllCoin.png differ diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/PinkBadge.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/PinkBadgeIcon.imageset/Contents.json similarity index 87% rename from Sources/AllInApp/AllIn/Assets.xcassets/PinkBadge.imageset/Contents.json rename to Sources/AllInApp/AllIn/Assets.xcassets/PinkBadgeIcon.imageset/Contents.json index b0b4a62..4af4160 100644 --- a/Sources/AllInApp/AllIn/Assets.xcassets/PinkBadge.imageset/Contents.json +++ b/Sources/AllInApp/AllIn/Assets.xcassets/PinkBadgeIcon.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "Vector (1).png", + "filename" : "PinkBadge.png", "idiom" : "universal", "scale" : "1x" }, diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/PinkBadge.imageset/Vector (1).png b/Sources/AllInApp/AllIn/Assets.xcassets/PinkBadgeIcon.imageset/PinkBadge.png similarity index 100% rename from Sources/AllInApp/AllIn/Assets.xcassets/PinkBadge.imageset/Vector (1).png rename to Sources/AllInApp/AllIn/Assets.xcassets/PinkBadgeIcon.imageset/PinkBadge.png diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/PinkPersonIcon.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/PinkPersonIcon.imageset/Contents.json new file mode 100644 index 0000000..e551332 --- /dev/null +++ b/Sources/AllInApp/AllIn/Assets.xcassets/PinkPersonIcon.imageset/Contents.json @@ -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 + } +} diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/PinkPersonIcon.imageset/UserPink.png b/Sources/AllInApp/AllIn/Assets.xcassets/PinkPersonIcon.imageset/UserPink.png new file mode 100644 index 0000000..e0589b2 Binary files /dev/null and b/Sources/AllInApp/AllIn/Assets.xcassets/PinkPersonIcon.imageset/UserPink.png differ diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/Image.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/PinkTrophyIcon.imageset/Contents.json similarity index 89% rename from Sources/AllInApp/AllIn/Assets.xcassets/Image.imageset/Contents.json rename to Sources/AllInApp/AllIn/Assets.xcassets/PinkTrophyIcon.imageset/Contents.json index a19a549..5a28f80 100644 --- a/Sources/AllInApp/AllIn/Assets.xcassets/Image.imageset/Contents.json +++ b/Sources/AllInApp/AllIn/Assets.xcassets/PinkTrophyIcon.imageset/Contents.json @@ -1,6 +1,7 @@ { "images" : [ { + "filename" : "Trophy.png", "idiom" : "universal", "scale" : "1x" }, diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/PinkTrophyIcon.imageset/Trophy.png b/Sources/AllInApp/AllIn/Assets.xcassets/PinkTrophyIcon.imageset/Trophy.png new file mode 100644 index 0000000..42868e7 Binary files /dev/null and b/Sources/AllInApp/AllIn/Assets.xcassets/PinkTrophyIcon.imageset/Trophy.png differ diff --git a/Sources/AllInApp/AllIn/Components/BetLineLoading.swift b/Sources/AllInApp/AllIn/Components/BetLineLoading.swift index 5d841af..a250915 100644 --- a/Sources/AllInApp/AllIn/Components/BetLineLoading.swift +++ b/Sources/AllInApp/AllIn/Components/BetLineLoading.swift @@ -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) } } diff --git a/Sources/AllInApp/AllIn/Components/DropDownAnswerMenu.swift b/Sources/AllInApp/AllIn/Components/DropDownAnswerMenu.swift index b3c3c99..f7b301e 100644 --- a/Sources/AllInApp/AllIn/Components/DropDownAnswerMenu.swift +++ b/Sources/AllInApp/AllIn/Components/DropDownAnswerMenu.swift @@ -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) + ) } } diff --git a/Sources/AllInApp/AllIn/Components/ParticipationModal.swift b/Sources/AllInApp/AllIn/Components/ParticipationModal.swift index 04f33a3..05f2998 100644 --- a/Sources/AllInApp/AllIn/Components/ParticipationModal.swift +++ b/Sources/AllInApp/AllIn/Components/ParticipationModal.swift @@ -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) diff --git a/Sources/AllInApp/AllIn/Ressources/Colors.swift b/Sources/AllInApp/AllIn/Ressources/Colors.swift index ae60939..93f3746 100644 --- a/Sources/AllInApp/AllIn/Ressources/Colors.swift +++ b/Sources/AllInApp/AllIn/Ressources/Colors.swift @@ -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 ) diff --git a/Sources/AllInApp/AllIn/ViewModels/DetailsViewModel.swift b/Sources/AllInApp/AllIn/ViewModels/DetailsViewModel.swift index 3615836..432e1ba 100644 --- a/Sources/AllInApp/AllIn/ViewModels/DetailsViewModel.swift +++ b/Sources/AllInApp/AllIn/ViewModels/DetailsViewModel.swift @@ -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 + } + } } } } diff --git a/Sources/Api/Sources/Api/UserApiManager.swift b/Sources/Api/Sources/Api/UserApiManager.swift index a1c297d..59a79cc 100644 --- a/Sources/Api/Sources/Api/UserApiManager.swift +++ b/Sources/Api/Sources/Api/UserApiManager.swift @@ -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() } diff --git a/Sources/Model/Sources/Model/Manager.swift b/Sources/Model/Sources/Model/Manager.swift index 276efa9..b8cbc23 100644 --- a/Sources/Model/Sources/Model/Manager.swift +++ b/Sources/Model/Sources/Model/Manager.swift @@ -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) + } } } diff --git a/Sources/Model/Sources/Model/User.swift b/Sources/Model/Sources/Model/User.swift index df0e958..f9fb2c1 100644 --- a/Sources/Model/Sources/Model/User.swift +++ b/Sources/Model/Sources/Model/User.swift @@ -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] diff --git a/Sources/Model/Sources/Model/UserDataManager.swift b/Sources/Model/Sources/Model/UserDataManager.swift index f3f348f..2fdc461 100644 --- a/Sources/Model/Sources/Model/UserDataManager.swift +++ b/Sources/Model/Sources/Model/UserDataManager.swift @@ -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)-> ()) }