chore: Universal Linking for Android (#2324)

* android assetlinks.json config

* try renaming html to json

* update env example

* chore: fix styling

* chore: styling part 2

* test: add spec for android assetlinks

* minor fixes

* minor fixes

* remove android sha256 value from env example

* add default sh256 value

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
Ani Ravi 2021-06-02 08:46:45 -07:00 committed by GitHub
parent b0b4d9d6f5
commit 49be9e21c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 0 deletions

View file

@ -116,6 +116,10 @@ SLACK_CLIENT_SECRET=
### Change this env variable only if you are using a custom build mobile app ### Change this env variable only if you are using a custom build mobile app
## Mobile app env variables ## Mobile app env variables
IOS_APP_ID=6C953F3RX2.com.chatwoot.app IOS_APP_ID=6C953F3RX2.com.chatwoot.app
ANDROID_BUNDLE_ID=com.chatwoot.app
# https://developers.google.com/android/guides/client-auth (use keytool to print the fingerprint in the first section)
ANDROID_SHA256_CERT_FINGERPRINT=AC:73:8E:DE:EB:56:EA:CC:10:87:02:A7:65:37:7B:38:D4:5D:D4:53:F8:3B:FB:D3:C6:28:64:1D:AA:08:1E:D8
### Smart App Banner ### Smart App Banner

View file

@ -0,0 +1,5 @@
class AndroidAppController < ApplicationController
def assetlinks
render layout: false
end
end

View file

@ -0,0 +1,12 @@
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "<%= ENV['ANDROID_BUNDLE_ID'] %>",
"sha256_cert_fingerprints": [
"<%= ENV['ANDROID_SHA256_CERT_FINGERPRINT'] %>"
]
}
}
]

View file

@ -232,6 +232,7 @@ Rails.application.routes.draw do
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Routes for external service verifications # Routes for external service verifications
get 'apple-app-site-association' => 'apple_app#site_association' get 'apple-app-site-association' => 'apple_app#site_association'
get '.well-known/assetlinks.json' => 'android_app#assetlinks'
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Internal Monitoring Routes # Internal Monitoring Routes

View file

@ -0,0 +1,10 @@
require 'rails_helper'
describe '.well-known/assetlinks.json', type: :request do
describe 'GET /.well-known/assetlinks.json' do
it 'successfully retrieves assetlinks.json file' do
get '/.well-known/assetlinks.json'
expect(response).to have_http_status(:success)
end
end
end