Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

feat: Mod Settings says until when the install is signed

My-Name-Is-Jeff8ca06b958d34
diff --git a/harness/mod-settings/README.md b/harness/mod-settings/README.md
index 3fd8c3fe..cf6b8f07 100644
--- a/harness/mod-settings/README.md
+++ b/harness/mod-settings/README.md
@@ -21,5 +21,10 @@ effects, Vibrations, Live Activity, AirPods gestures and Listening stats; Lock s
All flags; Mod with the version. Flipping Redesigned UI on in the native look offers the restart and swaps Home &
Library for Albums & artists in place.
+`App/About/Signing.m` is the real one. A free Apple ID's "Signed until" row joins the top section once the
+.app holds an `embedded.mobileprovision` whose `ExpirationDate` is under eight days after its `CreationDate`; the
+parser takes a plain XML plist as well as a signed one, so one written by hand will do (copy it in after
+`build.sh`, before `simctl install`).
+
What it does not cover: the pages the rows open, the row the mod adds to Spotify's settings list and side drawer,
and iOS below 26, where the switch warns first.
diff --git a/harness/mod-settings/build.sh b/harness/mod-settings/build.sh
index 4526be50..5c66440a 100755
--- a/harness/mod-settings/build.sh
+++ b/harness/mod-settings/build.sh
@@ -11,7 +11,7 @@ SDK=$(xcrun --sdk iphonesimulator --show-sdk-path)
xcrun -sdk iphonesimulator clang -target arm64-apple-ios17.0-simulator -fobjc-arc -g -O0 \
-I"$SRC" -I"$SRC/App" -isysroot "$SDK" -Wall -Werror -Wno-deprecated-declarations -DSG_VERSION=\"1.0.0-harness\" \
"$(dirname "$0")/main.m" "$(dirname "$0")/../scene.m" "$(dirname "$0")/stubs.m" \
- "$OUT"/gen/ModSettings.m "$SRC"/App/Pages.m \
+ "$OUT"/gen/ModSettings.m "$SRC"/App/Pages.m "$SRC"/App/About/Signing.m \
"$SRC"/Settings/SGPage.m "$SRC"/Settings/SGPageStyle.m "$SRC"/Settings/SGModPage.m "$SRC"/Settings/SGGlowSwitch.m \
"$SRC"/Core/SGLog.m "$SRC"/Core/SGPrefs.m "$SRC"/Core/SGViewTree.m "$SRC"/Core/SGFlagForce.m "$SRC"/Core/SGUIMode.m \
-framework UIKit -framework QuartzCore -framework CoreGraphics -framework Foundation \
diff --git a/harness/mod-settings/stubs.m b/harness/mod-settings/stubs.m
index 51c86831..06763fef 100644
--- a/harness/mod-settings/stubs.m
+++ b/harness/mod-settings/stubs.m
@@ -1,6 +1,5 @@
// What Mod Settings' main page links to and reads, stood in for: every page is an empty page of its own
-// name, the values beside the chevrons are what a fresh install reads, and the update and signing checks do
-// nothing.
+// name, the values beside the chevrons are what a fresh install reads, and the update check does nothing.
#import <UIKit/UIKit.h>
#import "Core/SGCore.h"
#import "Settings/SGModPage.h"
@@ -40,8 +39,9 @@ BOOL SGSingSpatial(void) { return NO; }
void SGCheckForUpdate(BOOL force) {}
void SGWatchForUpdates(void) {}
-void SGCheckSigningOnce(void) {}
-SGModRow *SGSigningWarningRow(void) { return nil; }
+// Signing.m is the real one: its row stays away while the harness's own signature is sound, and its
+// "Signed until" row shows once the .app holds an embedded.mobileprovision (README).
+BOOL SGOnboardingShowing(void) { return NO; }
// Environment.m's red row, as a phone with EeveeSpotify injected too shows it.
NSArray<SGModRow *> *SGEnvironmentWarningRows(void) {
if (!SGHarnessWarning) return @[];
diff --git a/tweak/Sources/App/About/About.h b/tweak/Sources/App/About/About.h
index b202237e..93340b9a 100644
--- a/tweak/Sources/App/About/About.h
+++ b/tweak/Sources/App/About/About.h
@@ -51,6 +51,10 @@ BOOL SGSigningOpensFromLockScreen(void); // YES when unreadable, so a build
SGModRow *SGSigningWarningRow(void); // nil while the signature is sound
void SGCheckSigningOnce(void);
void SGShowSigningFixIfPending(void); // the sheet the tour held back, if any
+// When the provisioning profile the build is signed with runs out, read from embedded.mobileprovision:
+// nil without one. A free Apple ID's lasts a week, after which Spotify no longer opens.
+BOOL SGSigningWeekLong(void);
+SGModRow *SGSigningExpiryRow(void); // "Signed until …", nil without a profile
// Backup.m: the settings out to a JSON file through the share sheet, and back in from one, replacing
// what is set and restarting.
diff --git a/tweak/Sources/App/About/AboutSettings.m b/tweak/Sources/App/About/AboutSettings.m
index a525f178..9e8747da 100644
--- a/tweak/Sources/App/About/AboutSettings.m
+++ b/tweak/Sources/App/About/AboutSettings.m
@@ -49,12 +49,13 @@ UIViewController *SGAboutPage(void) {
withSymbol(SGActionRow(@"Welcome tour", nil, ^{ SGShowOnboarding(); }), @"map"),
]];
if (SGWhatsNewChanges().count) [links insertObject:withSymbol(SGActionRow(@"What's New", nil, ^{ SGShowWhatsNew(); }), @"sparkles") atIndex:links.count - 1];
+ NSMutableArray<SGModRow *> *build = [NSMutableArray arrayWithObjects:updates,
+ SGStatRow(@"Version", ^NSString *{ return @(SG_VERSION); }),
+ SGStatRow(@"Spotify", ^NSString *{ return spotify; }), nil];
+ SGModRow *signedUntil = SGSigningExpiryRow();
+ if (signedUntil) [build addObject:signedUntil];
return [[SGModPage alloc] initWithTitle:@"Mod" intro:nil sections:@[
- SGSection(nil, @[
- updates,
- SGStatRow(@"Version", ^NSString *{ return @(SG_VERSION); }),
- SGStatRow(@"Spotify", ^NSString *{ return spotify; }),
- ]),
+ SGSection(nil, build),
SGSection(nil, links),
SGSection(nil, @[
withSymbol(SGActionRow(@"Export settings", nil, ^{ SGExportSettings(); }), @"square.and.arrow.up"),
diff --git a/tweak/Sources/App/About/Signing.m b/tweak/Sources/App/About/Signing.m
index 30eb7eba..1419afb4 100644
--- a/tweak/Sources/App/About/Signing.m
+++ b/tweak/Sources/App/About/Signing.m
@@ -109,6 +109,62 @@ void SGCheckSigningOnce(void) {
}];
}
+#pragma mark - when the signature runs out
+
+// embedded.mobileprovision is a CMS envelope around a plain XML plist, so the plist is cut out by its
+// first "<?xml" and its last "</plist>" rather than taken through a CMS decoder. No profile is a build
+// installed without one (TrollStore, a jailbreak), which never runs out.
+static NSDictionary *profile(void) {
+ static NSDictionary *cached;
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ NSString *path = [NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"];
+ NSData *data = path ? [NSData dataWithContentsOfFile:path] : nil;
+ if (!data) return;
+ NSData *open = [@"<?xml" dataUsingEncoding:NSUTF8StringEncoding], *close = [@"</plist>" dataUsingEncoding:NSUTF8StringEncoding];
+ NSRange start = [data rangeOfData:open options:0 range:NSMakeRange(0, data.length)];
+ NSRange end = [data rangeOfData:close options:NSDataSearchBackwards range:NSMakeRange(0, data.length)];
+ if (start.location == NSNotFound || end.location == NSNotFound || NSMaxRange(end) <= start.location) return;
+ NSData *plist = [data subdataWithRange:NSMakeRange(start.location, NSMaxRange(end) - start.location)];
+ id parsed = [NSPropertyListSerialization propertyListWithData:plist options:0 format:NULL error:NULL];
+ if ([parsed isKindOfClass:NSDictionary.class]) cached = parsed;
+ });
+ return cached;
+}
+
+static NSDate *dateIn(NSString *key) {
+ id date = profile()[key];
+ return [date isKindOfClass:NSDate.class] ? date : nil;
+}
+
+static NSDate *expiry(void) {
+ return dateIn(@"ExpirationDate");
+}
+
+// A free Apple ID's profile lasts seven days, a paid account's up to a year; a day over a week allows
+// for the clock the profile was cut by.
+BOOL SGSigningWeekLong(void) {
+ NSDate *created = dateIn(@"CreationDate"), *expires = expiry();
+ return created && expires && [expires timeIntervalSinceDate:created] < 8 * 24 * 60 * 60;
+}
+
+// The row's value has little room, so it is the day; a week-long profile, which runs out at an hour of
+// a day this week, gives the hour under the title.
+SGModRow *SGSigningExpiryRow(void) {
+ NSDate *expires = expiry();
+ if (!expires) return nil;
+ BOOL week = SGSigningWeekLong();
+ NSDateFormatter *day = [NSDateFormatter new];
+ if (week) [day setLocalizedDateFormatFromTemplate:@"EEEMMMd"]; // "Mon, Oct 12"
+ else day.dateStyle = NSDateFormatterMediumStyle; // "Oct 6, 2027"
+ NSString *value = [day stringFromDate:expires];
+ SGModRow *row = SGStatRow(@"Signed until", ^NSString *{ return value; });
+ if (week) row.subtitle = [NSString stringWithFormat:@"At %@. A free Apple ID signs for 7 days.",
+ [NSDateFormatter localizedStringFromDate:expires dateStyle:NSDateFormatterNoStyle
+ timeStyle:NSDateFormatterShortStyle]];
+ return row;
+}
+
void SGShowSigningFixIfPending(void) {
if (!sg_fixPending) return;
sg_fixPending = NO;
diff --git a/tweak/Sources/App/ModSettings.x b/tweak/Sources/App/ModSettings.x
index 180307ad..f24c8206 100644
--- a/tweak/Sources/App/ModSettings.x
+++ b/tweak/Sources/App/ModSettings.x
@@ -50,6 +50,8 @@ static UIViewController *modSettingsPage(void) {
SGModRow *signing = SGSigningWarningRow();
NSMutableArray<SGModRow *> *warnings = [NSMutableArray arrayWithArray:SGEnvironmentWarningRows()];
if (signing) [warnings insertObject:signing atIndex:0];
+ // A free Apple ID's week runs out with no warning from iOS, so its date waits here too, not only under Mod.
+ if (SGSigningWeekLong()) [warnings addObject:SGWithSymbol(SGSigningExpiryRow(), @"clock.badge.exclamationmark")];
if (warnings.count) [sections addObject:SGSection(nil, warnings)];
// The rows of one look are asked again as Redesigned UI is flipped, so the page shows what the restart brings.