Expo push notification in IOS - push-notification

Hi I am having some trouble activating associated domain for universal link. The apple AASA checker keep telling me there is no application associated with domain.
Have enabled associated domain in apple developer,
Served the /.well-known/apple-app-site-association
"applinks": {
"details": [
{
"appIDs": [ "****" ],
"components": [
{
"/": "/****",
"comment": "Matches any URL whose path starts with /****/"
}
]
}
]
}
}
add associatedDomains in app.json
delete credentials to regenerate them
Also:
Have tried to execute eas build:inspect to see what is generated, and I see in the .entitlements file it set it in "developer" mode
Seems weird but can't figure how to change that
<?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>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:*....</string>
</array>
</dict>
</plist>

Related

Custom Bundle with Symfony 6.2

I'm trying to create a Bundle to share some services and utility classes between my different projects.
I already did this while using Symfony 5.4. But now I want to migrate to PHP 8.1 using Symfony 6.2.
I don't know what I'm doing wrong, but my web projects just don't see the services I'm creating in my Bundle.
Step by step:
I created my web project that will use the Bundle with:
symfony new my-webapp --version="6.2.*" --webapp
I created the project for the Bundle using composer.json like this:
{
"name": "carlospauluk/my-bundle",
"type": "project",
"license": "proprietary",
"require": {
"php": ">=8.1"
},
"require-dev": {
"symfony/http-kernel": "6.2.*"
},
"autoload": {
"psr-4": {
"MyBundleNamespace\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"MyBundleNamespace\\Tests\\": "tests/"
}
}
}
Inside config/services.yaml, I changed it to:
parameters:
services:
_defaults:
autowire: true
autoconfigure: true
MyBundleNamespace\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
So I created my service in src/Service:
<?php
namespace MyBundleNamespace\Service;
class NumberGeneratorService
{
public function generate(int $max) {
return random_int(0, $max);
}
}
Apparently my service is correctly configured in the Bundle, right?
After that, in my my-webapp, in composer.json I added the local repository of my my-bundle folder:
,
"repositories": [
{
"type": "path",
"url": "../my-bundle"
}
]
and then...
composer require "carlospauluk/my-bundle #dev"
Okay, I was hoping that everything was already working, and that my NumberGeneratorService service was already available in my-webapp. But not. When I run:
php bin/console debug:container MyBundleNamespace
It returns:
No services found that match "MyBundleNamespace".
What could be missing?
When I set up my bundles in my projects using Symfony 5.4, I don't remember doing anything much different than this.
Could you help me please?
Both codes are here:
https://github.com/carlospauluk/my-bundle
https://github.com/carlospauluk/my-webapp
Thanks
Finally, after almost 3 days of trying, I figured out how it should be done.
I needed to implement the loadExtension method inside the /src/MyBundle.php
<?php
namespace MyBundleNamespace;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
class MyBundle extends AbstractBundle
{
public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void
{
$container->import(__DIR__ . '/Resources/config/services.xml');
}
}
And also had to create the /src/Resources/config/services.xml file
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="my_bundle_namespace.service.number_generator_service"
class="MyBundleNamespace\Service\NumberGeneratorService">
</service>
<service id="MyBundleNamespace\Service\NumberGeneratorService" public="true"
alias="my_bundle_namespace.service.number_generator_service"/>
</services>
</container>
Without this, it doesn't work.
The Symfony Framework is excellent, but it's unfortunate that its documentation is so weak and confusing in places.
For example, at https://symfony.com/doc/current/bundles.html about the they say "This empty class is the only piece you need to create the new bundle.", which we clearly see is not true. Without implementing the loadExtension method we cannot access any services inside the bundle. If they said that clearly, it would be much easier.
Symfony's documentation is too compreehnsive, despite being very shalow at some points.

How to create/define a sub resource via XML in API-Platform?

I am trying to create a sub resource via XML using Api Platform.
When I define the sub resource via a annotation on the entity, everything works as expected:
Entity/SocialProfile/SocialProfile.php
/**
* #ApiSubresource()
*
* #ORM\OneToMany(
* targetEntity="SoapSyliusSocialPlugin\Entity\Follow\Follow",
* mappedBy="follower",
* cascade={ "persist", "remove" }
* )
*/
protected $following;
Everything works as expected and I can then access the sub resource via the below path:
/api/v2/social-profiles/35471/followings
But when I try define this route/endpoint via .xml like the below:
Resources/config/api_resources/SocialProfile.xml
<?xml version="1.0" ?>
<resources xmlns="https://api-platform.com/schema/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="SoapSyliusSocialPlugin\Entity\SocialProfile\SocialProfile" shortName="SocialProfile">
<attribute name="validation_groups">sylius</attribute>
<subresourceOperations>
<subresourceOperation name="api_social_profiles_followings_get_subresource">
<attribute name="method">GET</attribute>
</subresourceOperation>
</subresourceOperations>
<property name="following" writable="false" readable="true">
<subresource resourceClass="SoapSyliusSocialPlugin\Entity\Follow\Follow" />
</property>
</resource>
</resources>
I am getting a:
404 No route found
I have tested my SocialProfile.xml file with a itemOperation & everything is working as expected.
I have updated my Resources/config/api_resources/SocialProfile.xml to look like the below, but I am still receiving a
404 route not found
<?xml version="1.0" ?>
<resources xmlns="https://api-platform.com/schema/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="SoapSyliusSocialPlugin\Entity\SocialProfile\SocialProfile" shortName="SocialProfile">
<attribute name="validation_groups">sylius</attribute>
<itemOperations></itemOperations>
<property name="following" writable="false" readable="true">
<subresource resourceClass="SoapSyliusSocialPlugin\Entity\Follow\Follow" collection="true"/>
</property>
</resource>
</resources>
The configuration for the entity holding the subresource (SocialProfile, in this example).
<?xml version="1.0" ?>
<resources xmlns="https://api-platform.com/schema/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="SoapSyliusSocialPlugin\Entity\SocialProfile\SocialProfile" shortName="SocialProfile">
<attribute name="validation_groups">sylius</attribute>
<property name="following" writable="false" readable="true">
<subresource resourceClass="SoapSyliusSocialPlugin\Entity\Follow\Follow" />
</property>
</resource>
</resources>
To configure things like normalization groups for the subresource, you do it in the other end of the relationship:
<?xml version="1.0" ?>
<resources xmlns="https://api-platform.com/schema/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="SoapSyliusSocialPlugin\Entity\Follow\Follow" shortName="Follow">
<subresourceOperations>
<subresourceOperation name="api_social_profiles_followings_get_subresource">
<attribute name="method">GET</attribute>
</subresourceOperation>
</subresourceOperations>
</resource>
</resources>
Try with this. I have a few setup this way and working. If there is something wrong above should be because something does not match your class/resource names exactly, but you should be able to tweak that to fix it.
Note that in the second version of the configuration in your question you removed all itemOperations. You should have at least the basic get item operation so the library is able to build IRIs.

App Search API Validation Tool displays "example.com is returning 469. Please check your url and try again."

I am online a fresh webpage for the purpose of universal links. I put the file in .well-known folder.
In the server log I can see that Applebot got 200 on "GET /.well-known/apple-app-site-association HTTP/1.1"
The only error displayed in the App Search API Validation Tool is:
"example.com is returning 469. Please check your url and try again."
I used another tool to check it - branch.io AASA Validator and it displays no errors.
Also make sure you don't have any robots.txt file in the root that disables Applebot
Robots.txt: allow only major SE
https://support.apple.com/en-us/HT204683
Looks like apple changed the format of AASA file. According to this official document, the old presentation
{
"applinks": {
"apps": [],
"details": [
{
"appID": "{PREFIX}.{BUNDLE_ID}",
"paths": ["*"]
}
]
}
}
Had already changed to:
{
"applinks": {
"details": [
{
"appIDs": [
"{PREFIX}.{BUNDLE_ID}"
],
"components": [
{
"/": "/*"
}
]
}
]
}
}
Considering backward compatibility, you can try writing in this format:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "{PREFIX}.{BUNDLE_ID}",
"paths": ["*"],
"appIDs": [
"{PREFIX}.{BUNDLE_ID}"
],
"components": [
{
"/": "/*"
}
]
}
]
}
}
This works for me, hope it helps.
What worked for me was adding image metadata on top of title and description metadata. I also added Touch icons, but I do not think it caused the issue since it works fine on another website I have without it.
Required metadata seems to be: Title, description and Image (og:image was the missing one in my case)
For metadata check out: The Open Graph Protocol
For icons check out: Developer Apple - Configuring Web Applications

I want to load a local html file through chrome custom tab, is that workable?

Currently I put my html file in assets, and I load it in WebView. Can I load it through chrome custom tab?
Actually there is a way.
in AndroidManifest.xml
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths" />
</provider>
define provider paths
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
name="external_files"
path="." />
</paths>
And then just extract your local file to external dir
val file = File(activity.externalCacheDir, "hello.html")
val bytes = resources.openRawResource(R.raw.hello).use { it.readBytes() }
FileOutputStream(file).use { it.write(bytes) }
val uri = FileProvider.getUriForFile(activity, "${activity.packageName}.provider", file)
CustomTabsIntent.Builder()
.build()
.also { it.intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) }
.launchUrl(activity, uri)
No, it is not possible to open file:// URLs in customtabs.

Passing arguments to an Assetic filter service from config.yml

I've written my own Assetic filter, contained within a Symfony2 Bundle, in order to compile CommonJS modules into a single file. It's called cjsDeliveryBundle, but let's leave that aside for now.
I want to be able to set different options on the filter from my config_dev.yml and config_prod.yml files.
The filter has a single public setter: setMinifyIdentifiers, which accepts a boolean. I read the Symfony2 documentation on setter injection and added the following to my config.yml:
assetic:
filters:
cssrewrite: ~
cjs_delivery:
resource: "%kernel.root_dir%/../src/MattCG/cjsDeliveryBundle/Resources/config/services.xml"
calls:
- [ setMinifyIdentifiers, [ true ] ]
The following is the services.xml for my Bundle.
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="matt_cg.cjs_delivery_filter.class">MattCG\cjsDeliveryBundle\Assetic\Filter\cjsDeliveryFilter</parameter>
<parameter key="matt_cg.cjs_delivery_filter.minify_identifiers">null</parameter>
</parameters>
<services>
<service id="matt_cg.cjs_delivery_filter" class="%matt_cg.cjs_delivery_filter.class%">
<tag name="assetic.filter" alias="cjs_delivery"></tag>
<call method="setMinifyIdentifiers">
<argument>%matt_cg.cjs_delivery_filter.minify_identifiers%</argument>
</call>
</service>
</services>
</container>
The filter works fine, except that the setter is never called with true as an argument. What am I doing wrong?
Got it. The solution is to have separate YAML parameters files for each environment and to specify the filter parameters in each one.
So here's what I did in my case.
Remove the - { resource: parameters.yml } from the imports: directive in config.yml.
Remove the parameters.yml file and put the parameters in two new files instead: parameters_dev.yml and parameters_prod.yml.
Add - { resource: parameters_dev.yml } to the imports: directive in config_dev.yml and - { resource: parameters_prod.yml } to the imports: directive in config_prod.yml.
Add matt_cg.cjs_delivery_filter.minify_identifiers: true to the parameters: directive in parameters_prod.yml.

Resources