Skip to content

Commit

Permalink
layout updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jchanvfx committed Mar 2, 2021
1 parent bb3f0bd commit a0059ec
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion LesmillsNZ WatchKit Extension/FitnessClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct FitnessClass {
struct FitnessClass: Codable {
let name: String
let color: String
let instructor1: String
Expand Down
17 changes: 5 additions & 12 deletions LesmillsNZ WatchKit Extension/FitnessClasses.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,11 @@
import Foundation

class FitnessClasses: ObservableObject {
@Published var clubId: String
@Published var allClasses: [String: [FitnessClass]]
@Published var isLoading: Bool
@Published var clubId: String = ""
@Published var allClasses: [String: [FitnessClass]] = [:]
@Published var isLoading: Bool = false
@Published var lastSynced: String? = nil

init() {
self.clubId = ""
self.allClasses = [:]
self.isLoading = false
}

// creates the time table request when the current club id.
func createRequest() {
if self.clubId == "" {
Expand All @@ -32,15 +26,14 @@ class FitnessClasses: ObservableObject {
}

// callback method when the request data has been recieved.
func onRequestRecieved(requestData: [String: [FitnessClass]]) {
private func onRequestRecieved(_ data: [String: [FitnessClass]]) {
DispatchQueue.main.async {
self.isLoading = false
self.allClasses = requestData
self.allClasses = data

let formatter = DateFormatter()
formatter.dateFormat = "E dd/MM - h:mm a"
self.lastSynced = formatter.string(from: Date())
}
}

}
26 changes: 15 additions & 11 deletions LesmillsNZ WatchKit Extension/ScheduleListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,27 +125,31 @@ struct ScheduleListView: View {
.resizable()
.scaledToFit()
.frame(width:150)
.padding(.top, 5)
.padding(.top, 8)
.listRowBackground(Color.black)
RoundedRectangle(cornerRadius: 3)
.fill(Color.accentColor)
.frame(height: 1)
}.listRowBackground(Color.black)

// disclaimer info.
VStack {
DisclaimerInfoView()
if fitnessClasses.lastSynced != nil {
RoundedRectangle(cornerRadius: 3)
.fill(Color.gray)
.frame(height: 1)
.padding(.vertical, 5)
// sync info.
if fitnessClasses.lastSynced != nil {
VStack {
Text("Timetable Last Synced:\n\(fitnessClasses.lastSynced!)")
.multilineTextAlignment(.center)
.foregroundColor(Color(hex: "#00d6d3"))
.font(.system(size: 12))
}
}.listRowBackground(Color.black)
RoundedRectangle(cornerRadius: 3)
.fill(Color(hex: "#525252"))
.frame(height: 1)
.padding(.vertical, 5)
}.listRowBackground(Color.black)
}

// disclaimer info.
DisclaimerInfoView()
.padding(.top, 10)
.listRowBackground(Color.black)
}
} else {
// club note set view.
Expand Down
6 changes: 5 additions & 1 deletion LesmillsNZ WatchKit Extension/TimetableRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ func createTimetableRequest(
request.httpMethod = "POST"
request.httpBody = bodyData

let config = URLSessionConfiguration.default
config.waitsForConnectivity = true
config.timeoutIntervalForResource = 60

// Create the HTTP request
URLSession.shared.dataTask(with: request) {
URLSession(configuration: config).dataTask(with: request) {
data, response, error in

// Handle the request.
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions LesmillsNZ WatchKit Extension/WorkoutInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct WorkoutInfoView: View {
VStack {
Text(info.name)
.font(.system(size: 14))
.fontWeight(.semibold)
Text("with")
.font(.system(size: 10))
.foregroundColor(.gray)
Expand Down
8 changes: 4 additions & 4 deletions LesmillsNZ.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
851096F625DB4B850002295E /* TimetableRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 851096F525DB4B850002295E /* TimetableRequest.swift */; };
8510970125DB89650002295E /* LocationsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8510970025DB89650002295E /* LocationsListView.swift */; };
8534476625E389D500FF167C /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8534476525E389D500FF167C /* Utils.swift */; };
8534476625E389D500FF167C /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8534476525E389D500FF167C /* Utilities.swift */; };
85440DD025D7D1AB003567D9 /* WorkoutInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85440DCF25D7D1AB003567D9 /* WorkoutInfoView.swift */; };
85440DD525D7D1BF003567D9 /* WorkoutRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85440DD425D7D1BF003567D9 /* WorkoutRowView.swift */; };
85440DDD25D92B00003567D9 /* ScheduleListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85440DDC25D92B00003567D9 /* ScheduleListView.swift */; };
Expand Down Expand Up @@ -79,7 +79,7 @@
/* Begin PBXFileReference section */
851096F525DB4B850002295E /* TimetableRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimetableRequest.swift; sourceTree = "<group>"; };
8510970025DB89650002295E /* LocationsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationsListView.swift; sourceTree = "<group>"; };
8534476525E389D500FF167C /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
8534476525E389D500FF167C /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = "<group>"; };
85440DCF25D7D1AB003567D9 /* WorkoutInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutInfoView.swift; sourceTree = "<group>"; };
85440DD425D7D1BF003567D9 /* WorkoutRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutRowView.swift; sourceTree = "<group>"; };
85440DDC25D92B00003567D9 /* ScheduleListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleListView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -180,11 +180,11 @@
children = (
85AC5BC325D7CC8F0014D4F3 /* LesmillsNZApp.swift */,
8589D0B925EC397C00006C53 /* ComplicationController.swift */,
8534476525E389D500FF167C /* Utils.swift */,
85AC5BC725D7CC910014D4F3 /* Assets.xcassets */,
85AE6F2425DB8D70002D9F28 /* locations.json */,
85AC5BCC25D7CC910014D4F3 /* Info.plist */,
85AC5BC925D7CC910014D4F3 /* Preview Content */,
8534476525E389D500FF167C /* Utilities.swift */,
85E4A2BF25DFA35000D90DCE /* Model.swift */,
85AE6F1925DB8ACE002D9F28 /* Locations.swift */,
851096F525DB4B850002295E /* TimetableRequest.swift */,
Expand Down Expand Up @@ -349,7 +349,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8534476625E389D500FF167C /* Utils.swift in Sources */,
8534476625E389D500FF167C /* Utilities.swift in Sources */,
85AC5BC425D7CC8F0014D4F3 /* LesmillsNZApp.swift in Sources */,
85E4A2C825DFC53B00D90DCE /* MainView.swift in Sources */,
85440DD525D7D1BF003567D9 /* WorkoutRowView.swift in Sources */,
Expand Down
Binary file not shown.

0 comments on commit a0059ec

Please sign in to comment.