<?php

// Mobile App Notifications - Credentials
// Save this file as mobileAppNotifications_credentials.php so your changes don't get overwritten when you upgrade the plugin.

//
// eg: getPushCredentialsFor('com.example.app', 'ANDROID_PUSH_TITLE');
function getPushCredentialsFor($appID, $key = '') {
  $credentialsByAppID = [];

  $credentialsByAppID['com.example.app'] = [
    'ANDROID_PUSH_TITLE'       => "Your app name here",     // Title you want shown on notifications, usually the app name
    'ANDROID_GOOGLE_API_KEY'   => "abcdefAIzaSyCI18itEmIzYs58EMDED9_vwUMg",                                    // Copy from /mobileAppBuilder/apps/yourApp/app-config.php in key: push-notifications-google-api-key
    'IOS_APSN_CERT_FILEPATH'   => absPath(__DIR__."/../mobileAppBuilder/apps/exampleApp/certificates/aps_production.pem"), // production certificate works for both beta and live - should be app specific cert files
    'IOS_APSN_CERT_PASSPHRASE' => 'd9293jh328',  // Put your private key's passphrase here
    'IOS_APSN_DEVMODE'         => true,          // sends to prod *AND* dev push servers, just to prod push server if false; (development builds only receive push notifications sent through the dev APSN server)
  ];
  
  // copy above example to add more apps below here:
  
  $credentialsByAppID['urbanhalal.com'] = [
    'ANDROID_PUSH_TITLE'       => "urbanhalal.com",     // Title you want shown on notifications, usually the app name
    'ANDROID_GOOGLE_API_KEY'   => $GLOBALS['SETTINGS']['firebaseKey'],                                     // Copy from /mobileAppBuilder/apps/yourApp/app-config.php in key: push-notifications-google-api-key
    'IOS_APSN_CERT_FILEPATH'   => absPath(__DIR__."/pc.pem"), // production certificate works for both beta and live - should be app specific cert files
    'IOS_APSN_CERT_PASSPHRASE' => '12345',                //UH@halal123                     // Put your private key's passphrase here
    'IOS_APSN_DEVMODE'         => $GLOBALS['SETTINGS']['iosAPNSDevMode'],                                  // sends to prod *AND* dev push servers, just to prod push server if false; (development builds only receive push notifications sent through the dev APSN server)
    'IOS_APP_BUNDLE_NAME'      => 'com.illume.urbanhalal'
  ];
  
  
  // error checking
  if (!isset($credentialsByAppID[$appID])) {
    $error = "Error: No push credentials for '$appID' in " .basename(__FILE__). "\n";
    @trigger_error($error, E_USER_WARNING);
    die($error);
  }
  
  //
  if ($key) { return $credentialsByAppID[$appID][$key]; }
  else      { return $credentialsByAppID[$appID]; }
  
}
