-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
306 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 15 additions & 10 deletions
25
WatchIron Extension/Assets.xcassets/Complication.complicationset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,53 @@ | ||
{ | ||
"assets" : [ | ||
{ | ||
"idiom" : "watch", | ||
"filename" : "Circular.imageset", | ||
"idiom" : "watch", | ||
"role" : "circular" | ||
}, | ||
{ | ||
"idiom" : "watch", | ||
"filename" : "Extra Large.imageset", | ||
"idiom" : "watch", | ||
"role" : "extra-large" | ||
}, | ||
{ | ||
"idiom" : "watch", | ||
"filename" : "Graphic Bezel.imageset", | ||
"idiom" : "watch", | ||
"role" : "graphic-bezel" | ||
}, | ||
{ | ||
"idiom" : "watch", | ||
"filename" : "Graphic Circular.imageset", | ||
"idiom" : "watch", | ||
"role" : "graphic-circular" | ||
}, | ||
{ | ||
"idiom" : "watch", | ||
"filename" : "Graphic Corner.imageset", | ||
"idiom" : "watch", | ||
"role" : "graphic-corner" | ||
}, | ||
{ | ||
"filename" : "Graphic Extra Large.imageset", | ||
"idiom" : "watch", | ||
"role" : "graphic-extra-large" | ||
}, | ||
{ | ||
"filename" : "Graphic Large Rectangular.imageset", | ||
"idiom" : "watch", | ||
"role" : "graphic-large-rectangular" | ||
}, | ||
{ | ||
"idiom" : "watch", | ||
"filename" : "Modular.imageset", | ||
"idiom" : "watch", | ||
"role" : "modular" | ||
}, | ||
{ | ||
"idiom" : "watch", | ||
"filename" : "Utilitarian.imageset", | ||
"idiom" : "watch", | ||
"role" : "utilitarian" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...n/Assets.xcassets/Complication.complicationset/Graphic Extra Large.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "watch", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "watch", | ||
"scale" : "2x", | ||
"screen-width" : "<=145" | ||
}, | ||
{ | ||
"idiom" : "watch", | ||
"scale" : "2x", | ||
"screen-width" : ">183" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"auto-scaling" : "auto" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// MainContentView.swift | ||
// WatchIron Extension | ||
// | ||
// Created by Karim Abou Zeid on 02.11.19. | ||
// Copyright © 2019 Karim Abou Zeid Software. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import WatchKit | ||
import HealthKit | ||
|
||
struct ContentView: View { | ||
var body: some View { | ||
_ContentView() | ||
.environmentObject(WorkoutSessionManagerStore.shared) | ||
} | ||
} | ||
|
||
private struct _ContentView: View { | ||
@EnvironmentObject var workoutSessionManagerStore: WorkoutSessionManagerStore | ||
|
||
@State private var selectedTab = "workout" | ||
|
||
@ViewBuilder | ||
var body: some View { | ||
if workoutSessionManagerStore.workoutSessionManager != nil { | ||
TabView(selection: $selectedTab) { | ||
OptionsView() | ||
.tag("options") | ||
|
||
WorkoutSessionView(workoutSessionManager: workoutSessionManagerStore.workoutSessionManager!) | ||
.tag("workout") | ||
|
||
NowPlayingView() | ||
.tag("now playing") | ||
} | ||
} else { | ||
Group { | ||
if let s = errorMessage { | ||
Text(s).foregroundColor(.red) | ||
} else { | ||
Text("Start a workout on your iPhone.") | ||
} | ||
}.onAppear { | ||
self.selectedTab = "workout" | ||
} | ||
} | ||
} | ||
|
||
private var errorMessage: String? { | ||
guard HKHealthStore.isHealthDataAvailable() else { | ||
return "HealthKit is not available on this device." | ||
} | ||
|
||
switch WorkoutSessionManager.healthStore.authorizationStatus(for: .workoutType()) { | ||
case .notDetermined: | ||
return nil | ||
case .sharingAuthorized: | ||
return nil | ||
case .sharingDenied: | ||
return "Not authorized for Apple Health. You can authorize Iron in the settings app." | ||
@unknown default: | ||
return nil | ||
} | ||
} | ||
} | ||
|
||
#if DEBUG | ||
struct ContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ContentView() | ||
} | ||
} | ||
#endif |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.