Skip to content

Commit

Permalink
Fix localizations
Browse files Browse the repository at this point in the history
  • Loading branch information
chiiya committed Feb 20, 2025
1 parent 66c1c42 commit 8654699
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
PASSES_APPLE_CERT="tests/certs/certificate.p12"
PASSES_APPLE_WWDR="tests/certs/wwdr.pem"
PASSES_APPLE_PASSWORD=
PASSES_APPLE_TEAM_ID=
PASSES_APPLE_IDENTIFIER=
10 changes: 5 additions & 5 deletions src/Apple/PassFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ protected function createLocalizations(Pass $pass, string $dir): void
file_put_contents($localizationDir.'/'.self::STRINGS_FILENAME, $strings);

foreach ($localization->images as $image) {
$filename = $localizationDir.'/'.($image->getName() ?? $image->getFilename());
$filename = $localizationDir.'/'.$this->getImageName($image).'.'.$image->getExtension();
copy($image->getPathname(), $filename);
}
}
Expand All @@ -368,7 +368,7 @@ protected function createLocalizations(Pass $pass, string $dir): void
protected function createManifest(string $dir): void
{
$manifest = [];
$files = new FilesystemIterator($dir);
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));

/** @var SplFileInfo $file */
foreach ($files as $file) {
Expand Down Expand Up @@ -451,13 +451,13 @@ protected function openssl_pkcs12_read_wrapper(string $pkcs12, string $passphras
// Try an alternative route using shell_exec to allow legacy support
// Try the shell_exec method with and without the -legacy flag
$commands = [
'openssl pkcs12 -in '.escapeshellarg($this->certificate)
.' -passin '.escapeshellarg('pass:'.$passphrase)
.' -passout '.escapeshellarg('pass:'.$passphrase),
'openssl pkcs12 -in '.escapeshellarg($this->certificate)
.' -passin '.escapeshellarg('pass:'.$passphrase)
.' -passout '.escapeshellarg('pass:'.$passphrase)
.' -legacy',
'openssl pkcs12 -in '.escapeshellarg($this->certificate)
.' -passin '.escapeshellarg('pass:'.$passphrase)
.' -passout '.escapeshellarg('pass:'.$passphrase),
];

foreach ($commands as $command) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Apple/PassFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public function test_create_pass(): void
$pass = new Coupon(
description: 'Example description',
organizationName: 'ACME',
passTypeIdentifier: 'pass.com.acme.test',
passTypeIdentifier: getenv('PASSES_APPLE_IDENTIFIER'),
serialNumber: '1890038600058',
teamIdentifier: '12345ABCD',
teamIdentifier: getenv('PASSES_APPLE_TEAM_ID'),
primaryFields: [new Field(key: 'primary', value: '::value::', label: 'Coupon')],
);
$pass
Expand Down

0 comments on commit 8654699

Please sign in to comment.