WIP
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1C31C8842A53AE3E00350540 /* short_beep.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 1C31C8822A53AE3E00350540 /* short_beep.m4a */; };
|
||||
1C31C8852A53AE3E00350540 /* long_beep.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 1C31C8832A53AE3E00350540 /* long_beep.m4a */; };
|
||||
1C485C832A489B9C00A6F896 /* CompletedWorkouts.json in Resources */ = {isa = PBXBuildFile; fileRef = 1C485C822A489B9C00A6F896 /* CompletedWorkouts.json */; };
|
||||
1C485C872A4915C400A6F896 /* CreateWorkoutItemPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C485C862A4915C400A6F896 /* CreateWorkoutItemPickerView.swift */; };
|
||||
1C485C8A2A492BB400A6F896 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C485C892A492BB400A6F896 /* LoginView.swift */; };
|
||||
@@ -102,6 +104,8 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1C31C8822A53AE3E00350540 /* short_beep.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = short_beep.m4a; sourceTree = "<group>"; };
|
||||
1C31C8832A53AE3E00350540 /* long_beep.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = long_beep.m4a; sourceTree = "<group>"; };
|
||||
1C485C822A489B9C00A6F896 /* CompletedWorkouts.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = CompletedWorkouts.json; sourceTree = "<group>"; };
|
||||
1C485C862A4915C400A6F896 /* CreateWorkoutItemPickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateWorkoutItemPickerView.swift; sourceTree = "<group>"; };
|
||||
1C485C892A492BB400A6F896 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
|
||||
@@ -223,6 +227,8 @@
|
||||
1CF65A242A3972840042FFBD /* Werkout_ios */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1C31C8832A53AE3E00350540 /* long_beep.m4a */,
|
||||
1C31C8822A53AE3E00350540 /* short_beep.m4a */,
|
||||
1CF65A552A3AA6800042FFBD /* Werkout-ios-Info.plist */,
|
||||
1CF65A482A39FB910042FFBD /* JSON */,
|
||||
1CF65A252A3972840042FFBD /* Werkout_iosApp.swift */,
|
||||
@@ -473,6 +479,7 @@
|
||||
files = (
|
||||
1CF65A5F2A3BF5A60042FFBD /* Equipment.json in Resources */,
|
||||
1C485C832A489B9C00A6F896 /* CompletedWorkouts.json in Resources */,
|
||||
1C31C8852A53AE3E00350540 /* long_beep.m4a in Resources */,
|
||||
1CF65A4A2A39FBB10042FFBD /* WorkoutOne.json in Resources */,
|
||||
1CF65A652A3BF6BE0042FFBD /* AllWorkouts.json in Resources */,
|
||||
1CF65A332A3972850042FFBD /* Preview Assets.xcassets in Resources */,
|
||||
@@ -483,6 +490,7 @@
|
||||
1CF65A542A3A9AF30042FFBD /* Straight_Leg_Sit_Up.mp4 in Resources */,
|
||||
1CF65A2F2A3972850042FFBD /* Assets.xcassets in Resources */,
|
||||
1CF65A872A4400E10042FFBD /* ToDo in Resources */,
|
||||
1C31C8842A53AE3E00350540 /* short_beep.m4a in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -770,6 +778,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Werkout_watch Watch App/Werkout_watch Watch App.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
@@ -804,6 +813,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Werkout_watch Watch App/Werkout_watch Watch App.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import Foundation
|
||||
import WatchConnectivity
|
||||
import AVFoundation
|
||||
import HealthKit
|
||||
|
||||
enum WatchActions: Codable {
|
||||
case nextExercise
|
||||
@@ -40,6 +41,8 @@ class BridgeModule: NSObject, ObservableObject {
|
||||
public private(set) var totalCaloire: Float?
|
||||
public private(set) var heartRates: [Int]?
|
||||
|
||||
var audioPlayer: AVAudioPlayer?
|
||||
|
||||
func start(workout: Workout) {
|
||||
self.currentWorkout = workout
|
||||
currentWorkoutRunTimeInSeconds = 0
|
||||
@@ -52,11 +55,12 @@ class BridgeModule: NSObject, ObservableObject {
|
||||
startWorkoutTimer()
|
||||
workoutStartDate = Date()
|
||||
isInWorkout = true
|
||||
|
||||
|
||||
if WCSession.isSupported() {
|
||||
WCSession.default.delegate = self
|
||||
WCSession.default.activate()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func goToExerciseAt(index: Int) {
|
||||
@@ -178,13 +182,37 @@ class BridgeModule: NSObject, ObservableObject {
|
||||
|
||||
func playBeep() {
|
||||
#if os(iOS)
|
||||
AudioServicesPlaySystemSound(SystemSoundID(1052))
|
||||
if let path = Bundle.main.path(forResource: "short_beep", ofType: "m4a") {
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().setCategory(.playback,
|
||||
mode: .default,
|
||||
options: [.mixWithOthers, .allowAirPlay])
|
||||
try AVAudioSession.sharedInstance().setActive(true)
|
||||
|
||||
audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: path))
|
||||
audioPlayer?.play()
|
||||
} catch {
|
||||
print("ERROR")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
func playFinished() {
|
||||
#if os(iOS)
|
||||
AudioServicesPlaySystemSound(SystemSoundID(1070))
|
||||
if let path = Bundle.main.path(forResource: "long_beep", ofType: "m4a") {
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().setCategory(.playback,
|
||||
mode: .default,
|
||||
options: [.mixWithOthers, .allowAirPlay])
|
||||
try AVAudioSession.sharedInstance().setActive(true)
|
||||
|
||||
audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: path))
|
||||
audioPlayer?.play()
|
||||
} catch {
|
||||
print("ERROR")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -221,6 +249,16 @@ extension BridgeModule: WCSessionDelegate {
|
||||
print("inactive")
|
||||
case .activated:
|
||||
print("activated")
|
||||
#if os(iOS)
|
||||
let workoutConfiguration = HKWorkoutConfiguration()
|
||||
workoutConfiguration.activityType = .traditionalStrengthTraining
|
||||
workoutConfiguration.locationType = .indoor
|
||||
if WCSession.isSupported(), WCSession.default.activationState == .activated, WCSession.default.isWatchAppInstalled {
|
||||
HKHealthStore().startWatchApp(with: workoutConfiguration, completion: { (success, error) in
|
||||
print(error.debugDescription)
|
||||
})
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
|
||||
@@ -89,7 +89,7 @@ struct ExtExerciseList: View {
|
||||
HStack {
|
||||
if i == currentExerciseIdx {
|
||||
Image(systemName: "checkmark")
|
||||
.font(Font.system(size: 75))
|
||||
.font(Font.system(size: 55))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
@@ -97,7 +97,7 @@ struct ExtExerciseList: View {
|
||||
}
|
||||
|
||||
Text(obj.exercise.name)
|
||||
.font(Font.system(size: 75))
|
||||
.font(Font.system(size: 55))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
@@ -151,14 +151,16 @@ struct ExtCountdownView: View {
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.padding([.leading, .trailing])
|
||||
.padding(.leading)
|
||||
.padding(.trailing, 100)
|
||||
} else if let reps = currenExercise.reps {
|
||||
Text("\(reps)")
|
||||
.font(Font.system(size: 75))
|
||||
.scaledToFit()
|
||||
.minimumScaleFactor(0.01)
|
||||
.lineLimit(1)
|
||||
.padding([.leading, .trailing])
|
||||
.padding(.leading)
|
||||
.padding(.trailing, 100)
|
||||
}
|
||||
}
|
||||
.frame(height: metrics.size.height * 0.5)
|
||||
|
||||
@@ -2,9 +2,15 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.healthkit</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.healthkit.access</key>
|
||||
<array/>
|
||||
<key>com.apple.developer.healthkit.background-delivery</key>
|
||||
<true/>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
BIN
Werkout_ios/long_beep.m4a
Normal file
BIN
Werkout_ios/long_beep.m4a
Normal file
Binary file not shown.
BIN
Werkout_ios/short_beep.m4a
Normal file
BIN
Werkout_ios/short_beep.m4a
Normal file
Binary file not shown.
@@ -6,5 +6,7 @@
|
||||
<true/>
|
||||
<key>com.apple.developer.healthkit.access</key>
|
||||
<array/>
|
||||
<key>com.apple.developer.healthkit.background-delivery</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
Reference in New Issue
Block a user