Skip to content

Commit

Permalink
detect if installed with trollstore
Browse files Browse the repository at this point in the history
  • Loading branch information
Avangelista committed Jan 30, 2023
1 parent f405d96 commit bf66a3a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 9 deletions.
14 changes: 14 additions & 0 deletions ResSet16.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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.private.security.no-container</key>
<true/>
<key>platform-application</key>
<true/>
<key>com.apple.security.exception.files.absolute-path.read-write</key>
<array>
<string>/</string>
</array>
</dict>
</plist>
8 changes: 6 additions & 2 deletions ResSet16.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
21B1A927298574CB00AF13C1 /* Alert++.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21B1A926298574CB00AF13C1 /* Alert++.swift */; };
21B1A92929857B5200AF13C1 /* DeviceFeatures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21B1A92829857B5200AF13C1 /* DeviceFeatures.swift */; };
21B1A92B29858E7A00AF13C1 /* ipabuild.sh in Resources */ = {isa = PBXBuildFile; fileRef = 21B1A92A29858E7A00AF13C1 /* ipabuild.sh */; };
25378CE0298761740008553C /* ResSet16.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 25378CDF298761730008553C /* ResSet16.entitlements */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -36,6 +37,7 @@
21B1A92829857B5200AF13C1 /* DeviceFeatures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceFeatures.swift; sourceTree = "<group>"; };
21B1A92A29858E7A00AF13C1 /* ipabuild.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ipabuild.sh; sourceTree = "<group>"; };
21F2FD53298729A200CA5B0E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
25378CDF298761730008553C /* ResSet16.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = ResSet16.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -61,6 +63,7 @@
21B1A9012985743000AF13C1 = {
isa = PBXGroup;
children = (
25378CDF298761730008553C /* ResSet16.entitlements */,
21B1A92A29858E7A00AF13C1 /* ipabuild.sh */,
21B1A90C2985743000AF13C1 /* ResSet16 */,
21B1A90B2985743000AF13C1 /* Products */,
Expand Down Expand Up @@ -170,6 +173,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
25378CE0298761740008553C /* ResSet16.entitlements in Resources */,
21B1A9152985743100AF13C1 /* Preview Assets.xcassets in Resources */,
21B1A92B29858E7A00AF13C1 /* ipabuild.sh in Resources */,
21B1A9122985743100AF13C1 /* Assets.xcassets in Resources */,
Expand Down Expand Up @@ -246,7 +250,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -300,7 +304,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down
Binary file not shown.
Binary file modified ResSet16/Assets.xcassets/.DS_Store
Binary file not shown.
18 changes: 13 additions & 5 deletions ResSet16/ResSet16App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ struct ResSet16App: App {
#if targetEnvironment(simulator)
#else
var supported = false
var needsTrollStore = false
if #available(iOS 16.2, *) {
// supported = false
supported = false
} else if #available(iOS 16.0, *) {
supported = true
needsTrollStore = false
} else if #available(iOS 15.7.2, *) {
// supported = false
supported = false
} else if #available(iOS 15.0, *) {
supported = true
} else {
// supported = false
needsTrollStore = false
} else if #available(iOS 14.0, *) {
supported = true
needsTrollStore = true
}

if !supported {
Expand All @@ -44,10 +48,14 @@ struct ResSet16App: App {
// Check if application is entitled
try FileManager.default.contentsOfDirectory(at: URL(fileURLWithPath: "/var/mobile"), includingPropertiesForKeys: nil)
} catch {
if needsTrollStore {
UIApplication.shared.alert(title: "Use TrollStore", body: "You must install this app with TrollStore for it to work with this version of iOS. Please close the app.", withButton: false)
return
}
// Use MacDirtyCOW to gain r/w
grant_full_disk_access() { error in
if (error != nil) {
UIApplication.shared.alert(body: "\(String(describing: error?.localizedDescription))\nPlease close the app and retry.")
UIApplication.shared.alert(body: "\(String(describing: error?.localizedDescription))\nPlease close the app and retry.", withButton: false)
return
}
}
Expand Down
4 changes: 2 additions & 2 deletions ipabuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ if [ -e "$TARGET_APP/embedded.mobileprovision" ]; then
fi

# # Add entitlements
# echo "Adding entitlements"
# ldid -S"$WORKING_LOCATION/entitlements.plist" "$TARGET_APP/$APPLICATION_NAME"
echo "Adding entitlements"
ldid -S"$WORKING_LOCATION/$APPLICATION_NAME.entitlements" "$TARGET_APP/$APPLICATION_NAME"

# Package .ipa
rm -rf Payload
Expand Down

0 comments on commit bf66a3a

Please sign in to comment.