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 29d03fc..a8f4a2d 100644 --- a/Sources/AllInApp/AllIn/ContentView.swift +++ b/Sources/AllInApp/AllIn/ContentView.swift @@ -10,6 +10,7 @@ import DependencyInjection struct ContentView: View { + @State private var show = false @Inject var authService: IAuthService @ObservedObject var loggedState = AppStateContainer.shared.loggedState @@ -29,7 +30,20 @@ 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 new file mode 100644 index 0000000..62e9390 --- /dev/null +++ b/Sources/AllInApp/AllIn/Views/DailyGiftPage.swift @@ -0,0 +1,120 @@ +// +// DailyGiftPage.swift +// AllIn +// +// Created by Emre on 02/02/2024. +// + +import SwiftUI + +struct DailyGiftPage: View { + + enum Step { + case first + case end + } + + @State private var step: Step = .first + @State private var scale: CGFloat = 1.0 + @State private var scale2: CGFloat = 0 + @State private var rotate: CGFloat = 1 + @Binding var show: Bool + + var body: some View { + GeometryReader { geometry in + LinearGradient( + gradient: Gradient(colors: [ + Color.black.opacity(0.6), + Color.black.opacity(0.9) + ]), + startPoint: .top, + endPoint: .bottom + ) + .edgesIgnoringSafeArea(.all) + + VStack { + Text("Récompense quotidienne") + .textStyle(weight: .bold, color: .white, size: 25) + + Group { + switch step { + case .first: + Image("giftImage") + .transition( + .asymmetric( + insertion: .scale(scale: 0.9).combined(with: .opacity), + removal: .scale(scale: 1.7).combined(with: .opacity)) + ) + .scaleEffect(scale) + .rotationEffect(.degrees(Double(scale) * 10), anchor: .center) + .rotationEffect(.degrees(-10), anchor: .center) + .onAppear { + withAnimation(Animation.easeInOut(duration: 1).repeatForever()) { + scale = 1.1 + } + } + case .end: + ZStack { + Image("giftEarnImage") + .rotationEffect(.degrees(Double(rotate) * 10), anchor: .center) + .rotationEffect(.degrees(-10), anchor: .center) + .onAppear { + withAnimation(Animation.easeInOut(duration: 1).repeatForever()) { + rotate = 1.3 + } + } + HStack { + Text("+ 123") + .textStyle(weight: .black, color: .white, size: 55) + Image("allcoinWhiteIcon") + .resizable() + .frame(width: 40, height: 40) + } + } + .scaleEffect(scale2) + .onAppear { + withAnimation(Animation.easeInOut(duration: 0.8)) { + scale2 = 1.0 + } + DispatchQueue.main.asyncAfter(deadline: .now() + 3) { + withAnimation { + show = false + step = .first + } + } + } + .onDisappear { + scale2 = 0 + } + } + } + .frame(width: geometry.size.width * 0.8, height: geometry.size.height * 0.4) + .onTapGesture { + withAnimation { + switch step { + case .first: + step = .end + case .end: + show = false + step = .first + } + } + } + + 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) + } + .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 } } - } } diff --git a/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj b/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj index 9d640e0..b3c871e 100644 --- a/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj +++ b/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj @@ -71,6 +71,7 @@ ECB7BC6C2B2F43EE002A6654 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB7BC6B2B2F43EE002A6654 /* AppState.swift */; }; ECB7BC702B336E28002A6654 /* RegisterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB7BC6F2B336E28002A6654 /* RegisterViewModel.swift */; }; ECCD244A2B4DE8010071FA9E /* Api in Frameworks */ = {isa = PBXBuildFile; productRef = ECCD24492B4DE8010071FA9E /* Api */; }; + ECED90B52B6D9CEC00F50937 /* DailyGiftPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECED90B42B6D9CEC00F50937 /* DailyGiftPage.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -172,6 +173,7 @@ ECB7BC692B2F410A002A6654 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; ECB7BC6B2B2F43EE002A6654 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = ""; }; ECB7BC6F2B336E28002A6654 /* RegisterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterViewModel.swift; sourceTree = ""; }; + ECED90B42B6D9CEC00F50937 /* DailyGiftPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyGiftPage.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -309,6 +311,7 @@ 1244EF5F2B4EC31E00374ABF /* HistoricBetView.swift */, 123590B32B51792000F7AEBD /* DetailsView.swift */, 123225D82B67B46100D30BB3 /* BetEndingValidationView.swift */, + ECED90B42B6D9CEC00F50937 /* DailyGiftPage.swift */, ); path = Views; sourceTree = ""; @@ -534,6 +537,7 @@ EC650A4C2B25E9C7003AFCAD /* RankingView.swift in Sources */, EC7A882B2B28D1E0004F226A /* DropDownMenu.swift in Sources */, EC7A882D2B28D8A1004F226A /* CreationBetView.swift in Sources */, + ECED90B52B6D9CEC00F50937 /* DailyGiftPage.swift in Sources */, EC6B96CF2B24B8D900FC1C58 /* Config.swift in Sources */, 1244EF602B4EC31E00374ABF /* HistoricBetView.swift in Sources */, EC30770B2B24D9160060E34D /* WelcomeView.swift in Sources */,