view/daily-gift #18

Merged
emre.kartal merged 4 commits from view/daily-gift into master 1 year ago

@ -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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

@ -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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

@ -10,6 +10,7 @@ import DependencyInjection
struct ContentView: View { struct ContentView: View {
@State private var show = false
@Inject var authService: IAuthService @Inject var authService: IAuthService
@ObservedObject var loggedState = AppStateContainer.shared.loggedState @ObservedObject var loggedState = AppStateContainer.shared.loggedState
@ -29,9 +30,22 @@ struct ContentView: View {
} }
.onAppear { .onAppear {
authService.refreshAuthentication() authService.refreshAuthentication()
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
withAnimation {
show = true
} }
} }
} }
.overlay(
Group {
if show {
DailyGiftPage(show: $show)
.transition(.opacity)
}
}
)
}
}
struct ContentView_Previews: PreviewProvider { struct ContentView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {

@ -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 dobtenir 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))
}
}

@ -139,7 +139,6 @@ struct LoginView: View {
focusedField = nil focusedField = nil
} }
} }
} }
} }

@ -71,6 +71,7 @@
ECB7BC6C2B2F43EE002A6654 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB7BC6B2B2F43EE002A6654 /* AppState.swift */; }; ECB7BC6C2B2F43EE002A6654 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB7BC6B2B2F43EE002A6654 /* AppState.swift */; };
ECB7BC702B336E28002A6654 /* RegisterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB7BC6F2B336E28002A6654 /* RegisterViewModel.swift */; }; ECB7BC702B336E28002A6654 /* RegisterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB7BC6F2B336E28002A6654 /* RegisterViewModel.swift */; };
ECCD244A2B4DE8010071FA9E /* Api in Frameworks */ = {isa = PBXBuildFile; productRef = ECCD24492B4DE8010071FA9E /* Api */; }; ECCD244A2B4DE8010071FA9E /* Api in Frameworks */ = {isa = PBXBuildFile; productRef = ECCD24492B4DE8010071FA9E /* Api */; };
ECED90B52B6D9CEC00F50937 /* DailyGiftPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECED90B42B6D9CEC00F50937 /* DailyGiftPage.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@ -172,6 +173,7 @@
ECB7BC692B2F410A002A6654 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; ECB7BC692B2F410A002A6654 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
ECB7BC6B2B2F43EE002A6654 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; }; ECB7BC6B2B2F43EE002A6654 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
ECB7BC6F2B336E28002A6654 /* RegisterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterViewModel.swift; sourceTree = "<group>"; }; ECB7BC6F2B336E28002A6654 /* RegisterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterViewModel.swift; sourceTree = "<group>"; };
ECED90B42B6D9CEC00F50937 /* DailyGiftPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyGiftPage.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -309,6 +311,7 @@
1244EF5F2B4EC31E00374ABF /* HistoricBetView.swift */, 1244EF5F2B4EC31E00374ABF /* HistoricBetView.swift */,
123590B32B51792000F7AEBD /* DetailsView.swift */, 123590B32B51792000F7AEBD /* DetailsView.swift */,
123225D82B67B46100D30BB3 /* BetEndingValidationView.swift */, 123225D82B67B46100D30BB3 /* BetEndingValidationView.swift */,
ECED90B42B6D9CEC00F50937 /* DailyGiftPage.swift */,
); );
path = Views; path = Views;
sourceTree = "<group>"; sourceTree = "<group>";
@ -534,6 +537,7 @@
EC650A4C2B25E9C7003AFCAD /* RankingView.swift in Sources */, EC650A4C2B25E9C7003AFCAD /* RankingView.swift in Sources */,
EC7A882B2B28D1E0004F226A /* DropDownMenu.swift in Sources */, EC7A882B2B28D1E0004F226A /* DropDownMenu.swift in Sources */,
EC7A882D2B28D8A1004F226A /* CreationBetView.swift in Sources */, EC7A882D2B28D8A1004F226A /* CreationBetView.swift in Sources */,
ECED90B52B6D9CEC00F50937 /* DailyGiftPage.swift in Sources */,
EC6B96CF2B24B8D900FC1C58 /* Config.swift in Sources */, EC6B96CF2B24B8D900FC1C58 /* Config.swift in Sources */,
1244EF602B4EC31E00374ABF /* HistoricBetView.swift in Sources */, 1244EF602B4EC31E00374ABF /* HistoricBetView.swift in Sources */,
EC30770B2B24D9160060E34D /* WelcomeView.swift in Sources */, EC30770B2B24D9160060E34D /* WelcomeView.swift in Sources */,

Loading…
Cancel
Save