Skip to content

Commit 6dac08a

Browse files
committed
Added Sync button in map screen
- Implemented animation on processing/syncing the quest tags - added new assets for sync button - added UI for displaying badge count on yet to synced elements if any of the failed answers
1 parent 104b971 commit 6dac08a

File tree

9 files changed

+142
-8
lines changed

9 files changed

+142
-8
lines changed

GoInfoGame/GoInfoGame.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
C76DA1A12DF0679F00451E63 /* LongFormModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8C74C32C4FDE1000D28220 /* LongFormModel.swift */; };
162162
C77A4A262DF2AF3100DED8B0 /* SecureInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C77A4A252DF2AF3100DED8B0 /* SecureInputView.swift */; };
163163
C77EEBCF2DE59D3200494CB4 /* UndoMerge.swift in Sources */ = {isa = PBXBuildFile; fileRef = C77EEBCE2DE59D3200494CB4 /* UndoMerge.swift */; };
164+
C7BA83542E3C9C3600755BA7 /* QuestSyncButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7BA83532E3C9C3600755BA7 /* QuestSyncButton.swift */; };
164165
C7ED070F2D70E2EC001FFFE2 /* TokenRefresher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7ED070E2D70E2EC001FFFE2 /* TokenRefresher.swift */; };
165166
CFECB318461BB876B1621890 /* Pods_osmapi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4F37DA661B22FA87DF8282F /* Pods_osmapi.framework */; };
166167
FA18CAE22CC7CD89008247F2 /* KartaviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA18CAE12CC7CD89008247F2 /* KartaviewViewModel.swift */; };
@@ -499,6 +500,7 @@
499500
C75E47732E151058006D903A /* Kondapur.gpx */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Kondapur.gpx; sourceTree = "<group>"; };
500501
C77A4A252DF2AF3100DED8B0 /* SecureInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureInputView.swift; sourceTree = "<group>"; };
501502
C77EEBCE2DE59D3200494CB4 /* UndoMerge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UndoMerge.swift; sourceTree = "<group>"; };
503+
C7BA83532E3C9C3600755BA7 /* QuestSyncButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = QuestSyncButton.swift; path = GoInfoGame/UI/Map/QuestSyncButton.swift; sourceTree = SOURCE_ROOT; };
502504
C7ED070E2D70E2EC001FFFE2 /* TokenRefresher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenRefresher.swift; sourceTree = "<group>"; };
503505
C96303080D26026265099E0E /* Pods-GoInfoGame.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GoInfoGame.release.xcconfig"; path = "Target Support Files/Pods-GoInfoGame/Pods-GoInfoGame.release.xcconfig"; sourceTree = "<group>"; };
504506
D76D8E22AC705A38AFEA78B1 /* Pods-GoInfoGame-GoInfoGameUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GoInfoGame-GoInfoGameUITests.debug.xcconfig"; path = "Target Support Files/Pods-GoInfoGame-GoInfoGameUITests/Pods-GoInfoGame-GoInfoGameUITests.debug.xcconfig"; sourceTree = "<group>"; };
@@ -1287,6 +1289,7 @@
12871289
C71EB5A82E2100510009E610 /* SatellitePickerSheet.swift */,
12881290
C71EB5A92E2100510009E610 /* SatelliteServerResponse.swift */,
12891291
C71EB5AA2E2100510009E610 /* WMTSServer.swift */,
1292+
C7BA83532E3C9C3600755BA7 /* QuestSyncButton.swift */,
12901293
);
12911294
path = "Satellite Server";
12921295
sourceTree = "<group>";
@@ -2181,6 +2184,7 @@
21812184
973FC0012B46CD5D00878269 /* QuestsListUIView.swift in Sources */,
21822185
973FC01F2B50DE7E00878269 /* ImageGridItemView.swift in Sources */,
21832186
FA633CB42DD4843B00324404 /* BiometricAuthManager.swift in Sources */,
2187+
C7BA83542E3C9C3600755BA7 /* QuestSyncButton.swift in Sources */,
21842188
05CB71E02B0FAFD200DED821 /* GenericUIViewControllerRepresentable.swift in Sources */,
21852189
FAD5C4F32AFCBE700040C61A /* AppDelegate.swift in Sources */,
21862190
05DBBB622B164D9A00B6F110 /* RealOPElement.swift in Sources */,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "1.000",
8+
"blue" : "242",
9+
"green" : "62",
10+
"red" : "135"
11+
}
12+
},
13+
"idiom" : "universal"
14+
}
15+
],
16+
"info" : {
17+
"author" : "xcode",
18+
"version" : 1
19+
}
20+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "sync.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"template-rendering-intent" : "template"
14+
}
15+
}
1.75 KB
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "upload.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"template-rendering-intent" : "template"
14+
}
15+
}
Binary file not shown.

GoInfoGame/GoInfoGame/UI/Map/MapView.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,14 @@ struct MapView: View {
219219
.navigationBarItems(leading: EmptyView())
220220
.toolbar {
221221

222+
ToolbarItem(placement: .navigationBarTrailing) {
223+
QuestSyncButton(badgeCount: 0, isSyncing: isSyncing, action: {
224+
debugPrint("Sync taped")
225+
})
226+
.frame(width: 20, height: 20)
227+
.foregroundStyle(Color("theme"))
228+
}
229+
222230
ToolbarItem(placement: .navigationBarTrailing) {
223231
Button(action: {
224232
debugPrint("satellite icon tapped")
@@ -240,14 +248,6 @@ struct MapView: View {
240248
.foregroundStyle(Color(red: 135/255, green: 62/255, blue: 242/255))
241249
}
242250
}
243-
244-
ToolbarItem(placement: .navigationBarTrailing) {
245-
if isSyncing {
246-
ProgressView()
247-
}else{
248-
EmptyView()
249-
}
250-
}
251251
}
252252
.toolbarBackground(.visible, for: .navigationBar)
253253
.onChange(of: showPopover) { newValue in
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
//
2+
// QuestSyncButton.swift
3+
// GoInfoGame
4+
//
5+
// Created by Prashamsa on 01/08/25.
6+
//
7+
8+
import SwiftUI
9+
10+
struct QuestSyncButton: View {
11+
var badgeCount: Int
12+
var isSyncing: Bool
13+
var action: () -> Void
14+
15+
@State private var rotationAngle: Double = 0
16+
17+
var body: some View {
18+
Button(action: action) {
19+
ZStack(alignment: .topTrailing) {
20+
Image("upload_sync")
21+
22+
if isSyncing {
23+
rotatingSyncIcon
24+
.offset(x: 5, y: -5)
25+
.onAppear {
26+
startRotating()
27+
}
28+
.onDisappear {
29+
rotationAngle = 0
30+
}
31+
} else if badgeCount > 0 {
32+
Text("\(badgeCount)")
33+
.font(.caption2)
34+
.padding(5)
35+
.background(Color.red)
36+
.foregroundColor(.white)
37+
.clipShape(Circle())
38+
.offset(x: 10, y: -10)
39+
}
40+
}
41+
}
42+
.buttonStyle(.plain)
43+
.onChange(of: isSyncing) { newValue in
44+
if newValue {
45+
startRotating()
46+
} else {
47+
rotationAngle = 0
48+
}
49+
}
50+
}
51+
52+
var rotatingSyncIcon: some View {
53+
Image("sync")
54+
.resizable()
55+
.scaledToFit()
56+
.frame(width: 12, height: 12)
57+
.foregroundStyle(.red)
58+
.rotationEffect(.degrees(rotationAngle), anchor: .center)
59+
}
60+
61+
private func startRotating() {
62+
rotationAngle = 0
63+
withAnimation(Animation.linear(duration: 1).repeatForever(autoreverses: false)) {
64+
rotationAngle = 360
65+
}
66+
}
67+
}
68+
69+
#Preview {
70+
QuestSyncButton(badgeCount: 01, isSyncing: true) {
71+
72+
}
73+
.foregroundStyle(Color.green)
74+
}

0 commit comments

Comments
 (0)