Compare commits

..

8 Commits

@ -52,13 +52,13 @@ struct BinaryBetLine: View {
HStack{ HStack{
Spacer() Spacer()
Rectangle() Rectangle()
.frame(width: min(CGFloat(1-self.value) * geometry.size.width, geometry.size.width), height: 17) .frame(width: min(CGFloat(1-self.value) * geometry.size.width, geometry.size.width-20), height: 17)
.foregroundStyle(AllInColors.PinkBetGradiant).cornerRadius(999) .foregroundStyle(AllInColors.PinkBetGradiant).cornerRadius(999)
} }
HStack(spacing: 0) { HStack(spacing: 0) {
Rectangle() Rectangle()
.frame(width: min(CGFloat(self.value) * geometry.size.width, geometry.size.width), height: 17) .frame(width: min(CGFloat(self.value) * geometry.size.width, geometry.size.width-20), height: 17)
.foregroundStyle(AllInColors.BlueBetGradiant) .foregroundStyle(AllInColors.BlueBetGradiant)
.cornerRadius(999) .cornerRadius(999)
Image("loadingHeartIcon") Image("loadingHeartIcon")

@ -34,7 +34,7 @@ struct CustomBetLine: View {
} }
func getFlameImage(for answer: AnswerDetail) -> String { func getFlameImage(for answer: AnswerDetail) -> String {
return answer == sortedAnswers.first ? "PinkFlame" : "BlueFlame" return answer == sortedAnswers.first ? "pinkFlameIcon" : "blueFlameIcon"
} }
var body: some View { var body: some View {
@ -57,7 +57,7 @@ struct CustomBetLine: View {
ZStack(alignment: .leading) { ZStack(alignment: .leading) {
HStack(spacing: 0) { HStack(spacing: 0) {
Rectangle() Rectangle()
.frame(width: min(percentage * geometry.size.width, geometry.size.width), height: 17) .frame(width: min(percentage * geometry.size.width, geometry.size.width-20), height: 17)
.foregroundStyle(getGradiant(for: answer)) .foregroundStyle(getGradiant(for: answer))
.cornerRadius(999, corners: [.topLeft, .bottomLeft]) .cornerRadius(999, corners: [.topLeft, .bottomLeft])
Image(getFlameImage(for: answer)) Image(getFlameImage(for: answer))

@ -20,7 +20,7 @@ struct DropDownAnswerMenu: View {
HStack{ HStack{
Text(selectedAnswer.response) Text(selectedAnswer.response)
.textStyle(weight: .bold, color: AllInColors.blueAccentColor, size: 20) .textStyle(weight: .bold, color: AllInColors.blueAccentColor, size: 20)
Text(selectedAnswer.odds.description) Text("\(selectedAnswer.odds, specifier: "%.2f")")
.textStyle(weight: .bold, color: AllInColors.lightPurpleColor, size: 10) .textStyle(weight: .bold, color: AllInColors.lightPurpleColor, size: 10)
Spacer() Spacer()
@ -44,7 +44,7 @@ struct DropDownAnswerMenu: View {
HStack{ HStack{
Text(answer.response) Text(answer.response)
.textStyle(weight: .bold, color: AllInColors.blueAccentColor, size: 20) .textStyle(weight: .bold, color: AllInColors.blueAccentColor, size: 20)
Text(answer.odds.description) Text("\(answer.odds, specifier: "%.2f")")
.textStyle(weight: .bold, color: AllInColors.lightPurpleColor, size: 10) .textStyle(weight: .bold, color: AllInColors.lightPurpleColor, size: 10)
Spacer() Spacer()
} }

@ -12,7 +12,6 @@ struct Menu: View {
@Inject var authService: IAuthService @Inject var authService: IAuthService
let parameters: [(String, String, String, String)] = [ let parameters: [(String, String, String, String)] = [
("videoGameImage", String(localized: "drawer_create_a_bet"), String(localized: "drawer_create_a_bet_subtitle"), "CreationBet"), ("videoGameImage", String(localized: "drawer_create_a_bet"), String(localized: "drawer_create_a_bet_subtitle"), "CreationBet"),
("globeImage", String(localized: "drawer_public_bets"), String(localized: "drawer_public_bets_subtitle"), "Bet"), ("globeImage", String(localized: "drawer_public_bets"), String(localized: "drawer_public_bets_subtitle"), "Bet"),
@ -40,7 +39,7 @@ struct Menu: View {
HStack(spacing: 30) { HStack(spacing: 30) {
Spacer() Spacer()
VStack(){ VStack(){
Text(AppStateContainer.shared.user?.bestWin.description ?? "0") Text(AppStateContainer.shared.user?.bestWin ?? 0, format: .number)
.fontWeight(.heavy) .fontWeight(.heavy)
.font(.system(size: 15)) .font(.system(size: 15))
.foregroundColor(.white) .foregroundColor(.white)
@ -50,7 +49,7 @@ struct Menu: View {
.foregroundColor(AllInColors.grey600Color) .foregroundColor(AllInColors.grey600Color)
} }
VStack(){ VStack(){
Text(AppStateContainer.shared.user?.bestWin.description ?? "0") Text(AppStateContainer.shared.user!.bestWin, format: .number)
.fontWeight(.heavy) .fontWeight(.heavy)
.font(.system(size: 15)) .font(.system(size: 15))
.foregroundColor(.white) .foregroundColor(.white)
@ -60,7 +59,7 @@ struct Menu: View {
.foregroundColor(AllInColors.grey600Color) .foregroundColor(AllInColors.grey600Color)
} }
VStack(){ VStack(){
Text(AppStateContainer.shared.user?.nbFriends.description ?? "0") Text(AppStateContainer.shared.user!.nbFriends, format: .number)
.fontWeight(.heavy) .fontWeight(.heavy)
.font(.system(size: 15)) .font(.system(size: 15))
.foregroundColor(.white) .foregroundColor(.white)
@ -104,6 +103,9 @@ struct Menu: View {
.frame(maxWidth: .infinity,alignment: .leading) .frame(maxWidth: .infinity,alignment: .leading)
.background(AllInColors.primaryColor) .background(AllInColors.primaryColor)
.edgesIgnoringSafeArea(.bottom) .edgesIgnoringSafeArea(.bottom)
.onAppear {
authService.refreshAuthentication()
}
} }
} }

@ -14,7 +14,7 @@ struct OddCapsule: View {
var odd: Float = 0.0 var odd: Float = 0.0
var body: some View { var body: some View {
HStack(alignment: .center) { HStack(alignment: .center) {
Text("x\(odd.description)") Text("x\(odd, specifier: "%.2f")")
.fontWeight(.bold) .fontWeight(.bold)
.foregroundColor(foregroundColor) .foregroundColor(foregroundColor)
} }

@ -73,7 +73,7 @@ struct RecapBetCard: View {
.overlay { .overlay {
AllInColors.primaryGradient.frame(width: 50) AllInColors.primaryGradient.frame(width: 50)
.mask( .mask(
Text("1630").font(.system(size: 15)).fontWeight(.medium) Text(betResult.amount.description).font(.system(size: 15)).fontWeight(.medium)
) )
} }
.padding(0) .padding(0)
@ -89,7 +89,8 @@ struct RecapBetCard: View {
HStack{ HStack{
Text("Côte totale").font(.system(size: 15)).fontWeight(.medium) Text("Côte totale").font(.system(size: 15)).fontWeight(.medium)
Spacer() Spacer()
Text("3,46") // TODO bind le odd
Text("1,0")
.textStyle(weight: .bold, color: .white, size: 18) .textStyle(weight: .bold, color: .white, size: 18)
.padding([.leading,.trailing],10) .padding([.leading,.trailing],10)
.padding([.top,.bottom],5) .padding([.top,.bottom],5)

@ -19,16 +19,16 @@ struct ResultBanner: View {
}.frame(height: 80) }.frame(height: 80)
HStack(spacing: 20){ HStack(spacing: 20){
HStack{ HStack{
Image("BlueAllCoinIcon").resizable().frame(maxWidth: 12, maxHeight: 12) Image("blueAllCoinIcon").resizable().frame(maxWidth: 12, maxHeight: 12)
Text(finalAnswer.stake.description).font(.system(size: 16)).fontWeight(.semibold).foregroundStyle(AllInColors.blueGrey800Color) Text(finalAnswer.stake.description).font(.system(size: 16)).fontWeight(.semibold).foregroundStyle(AllInColors.blueGrey800Color)
} }
HStack{ HStack{
Image("BleuePersonIcon").resizable().frame(maxWidth: 15, maxHeight: 12) Image("bluePersonIcon").resizable().frame(maxWidth: 15, maxHeight: 12)
Text(finalAnswer.username).font(.system(size: 16)).fontWeight(.semibold).foregroundStyle(AllInColors.blueGrey800Color) Text(finalAnswer.username).font(.system(size: 16)).fontWeight(.semibold).foregroundStyle(AllInColors.blueGrey800Color)
} }
HStack{ HStack{
Image("BleueTrophyIcon").resizable().frame(maxWidth: 15, maxHeight: 12) Image("blueTrophyIcon").resizable().frame(maxWidth: 15, maxHeight: 12)
Text(odds.description).font(.system(size: 16)).fontWeight(.semibold).foregroundStyle(AllInColors.blueGrey800Color) Text("\(odds, specifier: "%.2f")").font(.system(size: 16)).fontWeight(.semibold).foregroundStyle(AllInColors.blueGrey800Color)
} }
} }
} }

@ -42,13 +42,15 @@ struct ReviewCard: View {
VStack(alignment: .center,spacing:0){ VStack(alignment: .center,spacing:0){
HStack(){ HStack(){
Spacer() Spacer()
Text(amount.description) if bet.status == .finished {
.foregroundColor(.white) Text(amount.description)
.font(.system(size: 25)) .foregroundColor(.white)
.fontWeight(.bold) .font(.system(size: 25))
Image("allcoinWhiteIcon") .fontWeight(.bold)
.resizable() Image("allcoinWhiteIcon")
.frame(width: 18, height: 20) .resizable()
.frame(width: 18, height: 20)
}
switch bet.status { switch bet.status {
case .waiting, .inProgress: case .waiting, .inProgress:
@ -82,9 +84,8 @@ struct ReviewCard: View {
.frame(width: .infinity) .frame(width: .infinity)
.padding(.all,2) .padding(.all,2)
.background(backgroundColor()) .background(backgroundColor())
.cornerRadius(20, corners: [.bottomLeft,.bottomRight]) .cornerRadius(20, corners: [.bottomLeft,.bottomRight])
.border(width: 1, edges: [.top], color: AllInColors.delimiterGrey)
} }
.onTapGesture { .onTapGesture {
showDetails.toggle() showDetails.toggle()
@ -93,14 +94,20 @@ struct ReviewCard: View {
} }
} }
private func backgroundColor() -> Color { private func backgroundColor() -> some View {
switch bet.status { Group {
case .inProgress, .waiting, .closing: if bet.status == .finished && isWin {
return AllInColors.grey50Color AllInColors.primaryGradient
case .finished: } else {
return Color.black switch bet.status {
case .cancelled: case .inProgress, .waiting, .closing:
return Color.red AllInColors.grey50Color
case .finished:
Color.black
case .cancelled:
Color.red
}
}
}
} }
}
} }

@ -178,7 +178,7 @@
/// Notification /// Notification
"notification_title_end_bet_date" = "Who will be the winners?"; "notification_title_end_bet_date" = "Who will be the winners?";
"notification_subtitle_end_bet_date %@" = "The %@ bet has reached its deadline. Go to the app to enter the winning answer.";` "notification_subtitle_end_bet_date %@" = "The %@ bet has reached its deadline. Go to the app to enter the winning answer.";
/// Empty Views /// Empty Views

@ -28,6 +28,7 @@
"network_error_text" = "Assurez-vous d\'être bien connecté au réseau puis réessayez."; "network_error_text" = "Assurez-vous d\'être bien connecté au réseau puis réessayez.";
/// Bet type /// Bet type
"bet_type_binary" = "Oui / Non"; "bet_type_binary" = "Oui / Non";
"bet_type_match" = "Match sportif"; "bet_type_match" = "Match sportif";
"bet_type_custom" = "Réponses personnalisées"; "bet_type_custom" = "Réponses personnalisées";

@ -13,7 +13,7 @@ import Combine
class BetViewModel: ObservableObject { class BetViewModel: ObservableObject {
@Inject var manager: Manager @Inject var manager: Manager
@Inject var authService: IAuthService
@Published var popularBet: Bet? @Published var popularBet: Bet?
@Published private(set) var bets: [Bet] = [] @Published private(set) var bets: [Bet] = []
@Published var betsOver: [BetDetail] = [] @Published var betsOver: [BetDetail] = []
@ -58,6 +58,7 @@ class BetViewModel: ObservableObject {
self.betsWon = bets self.betsWon = bets
if !self.betsWon.isEmpty { if !self.betsWon.isEmpty {
self.showingSheetWon = true self.showingSheetWon = true
self.authService.refreshAuthentication()
} }
} }
} }

@ -26,13 +26,20 @@ class DetailsViewModel: ObservableObject {
} }
func getItem(withId id: String) { func getItem(withId id: String) {
let semaphore = DispatchSemaphore(value: 0)
manager.getBet(withId: id) { bet in manager.getBet(withId: id) { bet in
DispatchQueue.main.async {
self.betDetail = bet self.betDetail = bet
if let firstAnswer = bet.answers.first { if let firstAnswer = bet.answers.first {
self.selectedAnswer = firstAnswer self.selectedAnswer = firstAnswer
} }
} semaphore.signal()
}
let result = semaphore.wait(timeout: DispatchTime.now() + .seconds(2))
if result == .timedOut {
print("The request has exceeded the deadline")
return
} }
} }

@ -59,7 +59,7 @@ struct DetailsView: View {
.background(StatusValues.1) .background(StatusValues.1)
if viewModel.betDetail != nil{ if viewModel.betDetail != nil{
ScrollView { ScrollView {
VStack(alignment: .leading, spacing: 5) { VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 3) { HStack(spacing: 3) {
Spacer() Spacer()
Text("bet_proposed_by_format") Text("bet_proposed_by_format")
@ -132,6 +132,7 @@ struct DetailsView: View {
Spacer() Spacer()
} }
.padding([.trailing,.leading], 15) .padding([.trailing,.leading], 15)
.padding(.bottom, 100)
} }
.frame(maxWidth: .infinity, maxHeight: (geometry.size.height + geometry.safeAreaInsets.bottom) - 50) .frame(maxWidth: .infinity, maxHeight: (geometry.size.height + geometry.safeAreaInsets.bottom) - 50)

@ -64,22 +64,26 @@ struct FriendsView: View {
} }
.padding(.top, 50) .padding(.top, 50)
.tag(0) .tag(0)
VStack(alignment: .center, spacing: 0) { ScrollView{
if(viewModel.requests.isEmpty){ VStack(alignment: .center, spacing: 0) {
EmptyInfo(emoji:"📬", title: "Aucune demande d'amis en attente", explain: "").padding(.top, 40) if(viewModel.requests.isEmpty){
} EmptyInfo(emoji:"📬", title: "Aucune demande d'amis en attente", explain: "").padding(.top, 40)
else{
ScrollView(showsIndicators: false){
ForEach(viewModel.requests, id: \.self) { request in
Friend(user: request, isRequest: true, viewModel: viewModel)
}
} }
.refreshable { else{
viewModel.getRequests() ScrollView(showsIndicators: false){
ForEach(viewModel.requests, id: \.self) { request in
Friend(user: request, isRequest: true, viewModel: viewModel)
}
}
.refreshable {
viewModel.getRequests()
}
.padding(.top, 25)
} }
.padding(.top, 25) Spacer()
} }
Spacer() }.refreshable {
viewModel.getRequests()
} }
.padding(.top, 50) .padding(.top, 50)
.tag(1) .tag(1)

@ -936,7 +936,7 @@
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"AllIn/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"AllIn/Preview Content\"";
DEVELOPMENT_TEAM = 35KQ5BDC64; DEVELOPMENT_TEAM = P39ZK4GA2T;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "All In"; INFOPLIST_KEY_CFBundleDisplayName = "All In";
@ -970,7 +970,7 @@
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"AllIn/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"AllIn/Preview Content\"";
DEVELOPMENT_TEAM = 35KQ5BDC64; DEVELOPMENT_TEAM = P39ZK4GA2T;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "All In"; INFOPLIST_KEY_CFBundleDisplayName = "All In";
@ -1074,7 +1074,7 @@
CODE_SIGN_ENTITLEMENTS = AllInWidgetsExtension.entitlements; CODE_SIGN_ENTITLEMENTS = AllInWidgetsExtension.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 35KQ5BDC64; DEVELOPMENT_TEAM = P39ZK4GA2T;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AllInWidgets/Info.plist; INFOPLIST_FILE = AllInWidgets/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = AllInWidgets; INFOPLIST_KEY_CFBundleDisplayName = AllInWidgets;
@ -1102,7 +1102,7 @@
CODE_SIGN_ENTITLEMENTS = AllInWidgetsExtension.entitlements; CODE_SIGN_ENTITLEMENTS = AllInWidgetsExtension.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 35KQ5BDC64; DEVELOPMENT_TEAM = P39ZK4GA2T;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AllInWidgets/Info.plist; INFOPLIST_FILE = AllInWidgets/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = AllInWidgets; INFOPLIST_KEY_CFBundleDisplayName = AllInWidgets;

@ -343,7 +343,7 @@
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 35KQ5BDC64; DEVELOPMENT_TEAM = P39ZK4GA2T;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
@ -382,7 +382,7 @@
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 35KQ5BDC64; DEVELOPMENT_TEAM = P39ZK4GA2T;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";

Loading…
Cancel
Save