Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Merge remote-tracking branch 'origin/stores' into watch

Duarte Santos3b1483e88111
diff --cc .github/workflows/ios.yml
index e363bbbbd,c7e51e0e0..6682dc3e6
--- a/.github/workflows/ios.yml
+++ b/.github/workflows/ios.yml
@@@ -42,9 -42,9 +42,12 @@@ jobs
# The phone build, copied into ios/App/App/public; cap sync runs pod install.
- run: npm run build:mobile
working-directory: frontend
+ # The asset pack downloader extension, until the project with it is committed (does nothing then).
+ - run: ruby ios/ci/add-asset-downloader.rb
+ working-directory: frontend
+ # The Apple Watch app (ios/App/Watch), added to the project for the run and embedded in App.app.
+ - run: ruby ios/ci/add-watch-app.rb
+ working-directory: frontend
- name: Build for the simulator
working-directory: frontend/ios/App
run: |
@@@ -135,8 -106,8 +138,10 @@@
working-directory: frontend
- run: npm run build:mobile && rm -rf ios/App/App/public/exercise-media
working-directory: frontend
+ - run: ruby ios/ci/add-asset-downloader.rb
+ working-directory: frontend
+ - run: ruby ios/ci/add-watch-app.rb
+ working-directory: frontend
- run: ruby ios/ci/add-ui-tests.rb
working-directory: frontend
- name: Run the UI tests
@@@ -186,8 -157,8 +191,10 @@@
working-directory: frontend
- run: npm run build:mobile
working-directory: frontend
+ - run: ruby ios/ci/add-asset-downloader.rb
+ working-directory: frontend
+ - run: ruby ios/ci/add-watch-app.rb
+ working-directory: frontend
- name: Archive, unsigned
working-directory: frontend/ios/App
run: |
diff --cc frontend/ios/App/App.xcodeproj/project.pbxproj
index 3e5fb13e9,4f02ee15d..4e4ca6f14
--- a/frontend/ios/App/App.xcodeproj/project.pbxproj
+++ b/frontend/ios/App/App.xcodeproj/project.pbxproj
@@@ -22,8 -22,8 +22,9 @@@
AA0200000000000000000006 /* RestTone.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0200000000000000000005 /* RestTone.swift */; };
AA0200000000000000000008 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = AA0200000000000000000007 /* PrivacyInfo.xcprivacy */; };
AA0300000000000000000002 /* DeviceAuthPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0300000000000000000001 /* DeviceAuthPlugin.swift */; };
+ AA0400000000000000000002 /* AnimationPacksPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0400000000000000000001 /* AnimationPacksPlugin.swift */; };
AA0300000000000000000004 /* NudgeCheckPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0300000000000000000003 /* NudgeCheckPlugin.swift */; };
+ AA0500000000000000000002 /* WatchBridgePlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0500000000000000000001 /* WatchBridgePlugin.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@@ -46,8 -46,9 +47,10 @@@
AA0200000000000000000005 /* RestTone.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestTone.swift; sourceTree = "<group>"; };
AA0200000000000000000007 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
AA0300000000000000000001 /* DeviceAuthPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceAuthPlugin.swift; sourceTree = "<group>"; };
+ AA0400000000000000000001 /* AnimationPacksPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimationPacksPlugin.swift; sourceTree = "<group>"; };
+ AA0400000000000000000003 /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = "<group>"; };
AA0300000000000000000003 /* NudgeCheckPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NudgeCheckPlugin.swift; sourceTree = "<group>"; };
+ AA0500000000000000000001 /* WatchBridgePlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchBridgePlugin.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@@ -99,8 -100,9 +102,10 @@@
AA0200000000000000000003 /* RestAlertPlugin.swift */,
AA0200000000000000000005 /* RestTone.swift */,
AA0300000000000000000001 /* DeviceAuthPlugin.swift */,
+ AA0400000000000000000001 /* AnimationPacksPlugin.swift */,
+ AA0400000000000000000003 /* App.entitlements */,
AA0300000000000000000003 /* NudgeCheckPlugin.swift */,
+ AA0500000000000000000001 /* WatchBridgePlugin.swift */,
AA0200000000000000000007 /* PrivacyInfo.xcprivacy */,
504EC30B1FED79650016851F /* Main.storyboard */,
504EC30E1FED79650016851F /* Assets.xcassets */,
@@@ -244,8 -246,8 +249,9 @@@
AA0200000000000000000004 /* RestAlertPlugin.swift in Sources */,
AA0200000000000000000006 /* RestTone.swift in Sources */,
AA0300000000000000000002 /* DeviceAuthPlugin.swift in Sources */,
+ AA0400000000000000000002 /* AnimationPacksPlugin.swift in Sources */,
AA0300000000000000000004 /* NudgeCheckPlugin.swift in Sources */,
+ AA0500000000000000000002 /* WatchBridgePlugin.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --cc frontend/ios/App/App/MainViewController.swift
index a0140bcb8,46cf0e14b..a62eef5bc
--- a/frontend/ios/App/App/MainViewController.swift
+++ b/frontend/ios/App/App/MainViewController.swift
@@@ -12,8 -12,8 +12,9 @@@ class MainViewController: CAPBridgeView
bridge?.registerPluginInstance(PrintPlugin())
bridge?.registerPluginInstance(RestAlertPlugin())
bridge?.registerPluginInstance(DeviceAuthPlugin())
+ bridge?.registerPluginInstance(AnimationPacksPlugin())
bridge?.registerPluginInstance(NudgeCheckPlugin())
+ bridge?.registerPluginInstance(WatchBridgePlugin())
// After loadView has finished: the view is the web view only once it has.
if ProcessInfo.processInfo.arguments.contains(MainViewController.pendingProbeArgument) {
DispatchQueue.main.async { [weak self] in self?.showPendingProbe() }
diff --cc scripts/ios/finish-ipa.sh
index 8c692b469,0603e735f..dc483ae43
--- a/scripts/ios/finish-ipa.sh
+++ b/scripts/ios/finish-ipa.sh
@@@ -9,7 -9,8 +9,9 @@@
# certificate. No Mac needed: rcodesign signs on Linux.
#
# Usage:
- # [WATCH_PROFILE=<watch.mobileprovision>] scripts/ios/finish-ipa.sh <App-unsigned.ipa> <dist.p12> <p12-password-file> <profile.mobileprovision> [out.ipa]
+ # scripts/ios/finish-ipa.sh <App-unsigned.ipa> <dist.p12> <p12-password-file> <profile.mobileprovision> [out.ipa]
+ # EXT_PROFILE=<extension.mobileprovision> ... once the IPA carries the asset pack downloader
++# WATCH_PROFILE=<watch.mobileprovision> ... once the IPA carries the Apple Watch app
#
# Before: the phone build with the app's animations, from the same commit as the IPA:
# cd frontend && VITE_CLIP_EXT=webp APP_MEDIA_DIR=/mnt/backup-hdd/opengym-media/build-appwebp npm run build:mobile
@@@ -63,28 -64,30 +65,50 @@@ plistlib.dump(e, open(sys.argv[2], 'wb'
print('profile:', p['Name'], '| team', p['TeamIdentifier'][0], '| expires', p['ExpirationDate'])
PY
+ # The asset pack downloader extension (Background Assets, ios/App/AnimationPacksDownloader) is
+ # signed with its own App Store profile, given as EXT_PROFILE: its bundle id and its entitlements
+ # (the App Group it shares with the app) are its own.
+ EXT="$APP/Extensions/AnimationPacksDownloader.appex"
+ EXT_SIGN=()
+ if [ -d "$EXT" ]; then
+ [ -n "${EXT_PROFILE:-}" ] || { echo "the IPA carries AnimationPacksDownloader.appex: set EXT_PROFILE to its App Store profile" >&2; exit 1; }
+ cp "$EXT_PROFILE" "$EXT/embedded.mobileprovision"
+ openssl smime -inform der -verify -noverify -in "$EXT_PROFILE" -out "$WORK/ext-profile.plist" 2>/dev/null
+ python3 - "$WORK/ext-profile.plist" "$WORK/ext-entitlements.plist" <<'PY'
+ import plistlib, sys
+ p = plistlib.load(open(sys.argv[1], 'rb'))
+ e = dict(p['Entitlements'])
+ e['get-task-allow'] = False
+ assert e['application-identifier'].endswith('.ch.opengym.app.AnimationPacksDownloader'), e['application-identifier']
+ assert 'group.ch.opengym.app' in e.get('com.apple.security.application-groups', []), 'the extension profile has no App Group'
+ plistlib.dump(e, open(sys.argv[2], 'wb'))
+ print('extension profile:', p['Name'], '| expires', p['ExpirationDate'])
+ PY
+ EXT_SIGN=(--entitlements-xml-file "Extensions/AnimationPacksDownloader.appex/AnimationPacksDownloader:$WORK/ext-entitlements.plist")
+ fi
+
+# The Apple Watch app (App.app/Watch/OpenGymWatch.app) is signed with its own App Store profile,
+# given as WATCH_PROFILE: its bundle id and its entitlements (HealthKit) come from that profile.
+WATCH_SIGN=()
+WATCH="$APP/Watch/OpenGymWatch.app"
+if [ -d "$WATCH" ]; then
+ [ -n "${WATCH_PROFILE:-}" ] || { echo "the IPA carries the watch app: set WATCH_PROFILE to its App Store profile" >&2; exit 1; }
+ cp "$WATCH_PROFILE" "$WATCH/embedded.mobileprovision"
+ openssl smime -inform der -verify -noverify -in "$WATCH_PROFILE" -out "$WORK/watch-profile.plist" 2>/dev/null
+ python3 - "$WORK/watch-profile.plist" "$WORK/watch-entitlements.plist" <<'PY'
+import plistlib, sys
+p = plistlib.load(open(sys.argv[1], 'rb'))
+e = dict(p['Entitlements'])
+e['get-task-allow'] = False
+assert e['application-identifier'].endswith('.ch.opengym.app.watchkitapp'), e['application-identifier']
+plistlib.dump(e, open(sys.argv[2], 'wb'))
+print('watch profile:', p['Name'], '| expires', p['ExpirationDate'])
+PY
+ WATCH_SIGN=(--entitlements-xml-file "Watch/OpenGymWatch.app/OpenGymWatch:$WORK/watch-entitlements.plist")
+fi
+
"$RCODESIGN" sign --p12-file "$P12" --p12-password-file "$P12PASS" \
- --entitlements-xml-file "App:$WORK/entitlements.plist" "${WATCH_SIGN[@]}" "$APP"
- --entitlements-xml-file "App:$WORK/entitlements.plist" "${EXT_SIGN[@]}" "$APP"
++ --entitlements-xml-file "App:$WORK/entitlements.plist" "${EXT_SIGN[@]}" "${WATCH_SIGN[@]}" "$APP"
(cd "$WORK/ipa" && rm -f "$OUT" && python3 -m zipfile -c "$OUT" Payload)
echo "signed: $OUT ($(du -h "$OUT" | cut -f1), $CLIPS animations)"