diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/giftEarnImage.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/giftEarnImage.imageset/Contents.json new file mode 100644 index 0000000..ff04e21 --- /dev/null +++ b/Sources/AllInApp/AllIn/Assets.xcassets/giftEarnImage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "GiftEarn.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/giftEarnImage.imageset/GiftEarn.png b/Sources/AllInApp/AllIn/Assets.xcassets/giftEarnImage.imageset/GiftEarn.png new file mode 100644 index 0000000..234dca6 Binary files /dev/null and b/Sources/AllInApp/AllIn/Assets.xcassets/giftEarnImage.imageset/GiftEarn.png differ diff --git a/Sources/AllInApp/AllIn/Assets.xcassets/giftImage.imageset/Contents.json b/Sources/AllInApp/AllIn/Assets.xcassets/giftImage.imageset/Contents.json new file mode 100644 index 0000000..6267595 --- /dev/null +++ b/Sources/AllInApp/AllIn/Assets.xcassets/giftImage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Gift.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/giftImage.imageset/Gift.png b/Sources/AllInApp/AllIn/Assets.xcassets/giftImage.imageset/Gift.png new file mode 100644 index 0000000..49e6dcd Binary files /dev/null and b/Sources/AllInApp/AllIn/Assets.xcassets/giftImage.imageset/Gift.png differ diff --git a/Sources/AllInApp/AllIn/ContentView.swift b/Sources/AllInApp/AllIn/ContentView.swift index 34be80a..a8f4a2d 100644 --- a/Sources/AllInApp/AllIn/ContentView.swift +++ b/Sources/AllInApp/AllIn/ContentView.swift @@ -10,7 +10,7 @@ import DependencyInjection struct ContentView: View { - @State private var show = true + @State private var show = false @Inject var authService: IAuthService @ObservedObject var loggedState = AppStateContainer.shared.loggedState @@ -30,11 +30,17 @@ struct ContentView: View { } .onAppear { authService.refreshAuthentication() + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + withAnimation { + show = true + } + } } .overlay( Group { if show { DailyGiftPage(show: $show) + .transition(.opacity) } } ) diff --git a/Sources/AllInApp/AllIn/Views/DailyGiftPage.swift b/Sources/AllInApp/AllIn/Views/DailyGiftPage.swift index dfc7a63..45b7d11 100644 --- a/Sources/AllInApp/AllIn/Views/DailyGiftPage.swift +++ b/Sources/AllInApp/AllIn/Views/DailyGiftPage.swift @@ -2,41 +2,82 @@ // DailyGiftPage.swift // AllIn // -// Created by étudiant on 02/02/2024. +// Created by Emre on 02/02/2024. // import SwiftUI struct DailyGiftPage: View { + + enum Step { + case first + case end + } + + @State private var step: Step = .first + @Binding var show: Bool + var body: some View { - LinearGradient( - gradient: Gradient(colors: [ - Color.black.opacity(0.5), - Color.black.opacity(0.9) - ]), - startPoint: .top, - endPoint: .bottom - ) - .edgesIgnoringSafeArea(.all) - - VStack{ - Text("Récompense quotidienne") - .font(.title) - .foregroundColor(.white) - .padding() + GeometryReader { geometry in + LinearGradient( + gradient: Gradient(colors: [ + Color.black.opacity(0.6), + Color.black.opacity(0.9) + ]), + startPoint: .top, + endPoint: .bottom + ) + .edgesIgnoringSafeArea(.all) - Button("Fermer") { - show.toggle() + VStack { + Text("Récompense quotidienne") + .textStyle(weight: .bold, color: .white, size: 25) + + Group { + switch step { + case .first: + Image("giftImage") + .transition(.opacity) + case .end: + ZStack { + Image("giftEarnImage") + .transition(.opacity) + HStack { + Text("+ 123") + .textStyle(weight: .black, color: .white, size: 55) + Image("allcoinWhiteIcon") + .resizable() + .frame(width: 40, height: 40) + } + } + } + } + .frame(width: geometry.size.width * 0.8, height: geometry.size.height * 0.4) + .onTapGesture { + withAnimation { + switch step { + case .first: + step = .end + case .end: + step = .first + show.toggle() + } + } + } + + Text("Votre récompense quotidienne est débloquée tous les jours à 00:00 UTC et vous permet d’obtenir entre 10 et 150 Allcoins.") + .textStyle(weight: .medium, color: .white, size: 13) + .multilineTextAlignment(.center) + .padding(.horizontal, geometry.size.width * 0.13) + .opacity(0.67) } - .padding() - .background(Color.blue) - .foregroundColor(.white) - .cornerRadius(10) + .frame(width: geometry.size.width, height: geometry.size.height) } } } + struct DailyGiftPage_Previews: PreviewProvider { static var previews: some View { DailyGiftPage(show: .constant(false)) diff --git a/Sources/AllInApp/AllIn/Views/LoginView.swift b/Sources/AllInApp/AllIn/Views/LoginView.swift index 11d5392..7873f19 100644 --- a/Sources/AllInApp/AllIn/Views/LoginView.swift +++ b/Sources/AllInApp/AllIn/Views/LoginView.swift @@ -139,7 +139,6 @@ struct LoginView: View { focusedField = nil } } - } }