@@ -90,11 +90,33 @@ struct ContentView: View {
9090
9191 self . ext4ExtensionState = states [ ext4ExtensionIdentifier] ?? . notDetermined
9292
93- let timeSinceLastAskedForRating = lastAskedForRating. timeIntervalSinceNow. magnitude
94- let secondsPerMonth = Double ( 60 * 60 * 24 * 7 * 30 )
95- if appearsActive && timeSinceLastAskedForRating > secondsPerMonth {
96- lastAskedForRating = Date . now
97- requestReview ( )
93+ if !isSignedForDirectDistribution( ) {
94+ let timeSinceLastAskedForRating = lastAskedForRating. timeIntervalSinceNow. magnitude
95+ let secondsPerMonth = Double ( 60 * 60 * 24 * 7 * 30 )
96+ if appearsActive && timeSinceLastAskedForRating > secondsPerMonth {
97+ lastAskedForRating = Date . now
98+ requestReview ( )
99+ }
100+ }
101+ }
102+
103+ func isSignedForDirectDistribution( ) -> Bool {
104+ var code : SecCode ? = nil
105+ SecCodeCopySelf ( SecCSFlags ( ) , & code)
106+ guard let code else { return true }
107+ var staticCode : SecStaticCode ? = nil
108+ SecCodeCopyStaticCode ( code, SecCSFlags ( ) , & staticCode)
109+ guard let staticCode else { return true }
110+ var dict : CFDictionary ?
111+ SecCodeCopySigningInformation ( staticCode, SecCSFlags ( rawValue: kSecCSSigningInformation) , & dict)
112+ guard let info = dict as? [ CFString : Any ] , let certificates = info [ kSecCodeInfoCertificates] as? [ SecCertificate ] else {
113+ return true
114+ }
115+ return certificates. contains { cert in
116+ var commonName : CFString ? = nil
117+ SecCertificateCopyCommonName ( cert, & commonName)
118+ guard let commonName = commonName as? String else { return false }
119+ return commonName. contains ( " Developer ID Application " )
98120 }
99121 }
100122
0 commit comments