Skip to content

Commit

Permalink
feat: adds backward compatibility for ExpoNotificationsServiceInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
joemugen committed Feb 15, 2024
1 parent 1e967f2 commit fbe16ec
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ExpoNotificationsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ final class ExpoNotificationsServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/expo-notifications.php', 'expo-notifications');

$this->app->bind(ExpoTokenStorageInterface::class, config('expo-notifications.drivers.token'));
$this->app->bind(ExpoTicketStorageInterface::class, config('expo-notifications.drivers.ticket'));
$this->app->bind(ExpoPendingNotificationStorageInterface::class, config('expo-notifications.drivers.notification'));
Expand All @@ -34,6 +36,8 @@ public function register(): void
$app->make(ExpoTicketStorageInterface::class)
);
});

$this->backwardCompatibilityBind();
}

public function boot(): void
Expand All @@ -60,4 +64,13 @@ public function boot(): void
);
}
}

/**
* @deprecated Bind first argument should be the abstraction.
* This method is just here for backward compatibility and can be dropped once the major version reach 1.x.x
*/
private function backwardCompatibilityBind(): void
{
$this->app->alias(ExpoNotificationsServiceInterface::class, ExpoNotificationsService::class);
}
}

0 comments on commit fbe16ec

Please sign in to comment.