Files
bsky-social-app/plugins/withAppDelegateReferrer.js
T

41 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const {withAppDelegate, CodeGenerator} = require('expo/config-plugins')
module.exports = config =>
withAppDelegate(config, config => {
let contents = config.modResults.contents
contents = CodeGenerator.mergeContents({
src: contents,
anchor: '// Linking API',
newSrc: `
// @generated begin referrer info deep links
let defaults = UserDefaults.standard
defaults.set(
options[.sourceApplication] as? String,
forKey: "referrerApp"
)
// @generated end referrer info deep links
`,
offset: 6,
tag: 'referrer info - deep links',
comment: '//',
}).contents
contents = CodeGenerator.mergeContents({
src: contents,
anchor: '// Universal Links',
newSrc: `
// @generated begin referrer info universal links
let defaults = UserDefaults.standard
defaults.set(userActivity.referrerURL, forKey: "referrer")
// @generated end referrer info universal links
`,
offset: 6,
tag: 'referrer info - universal links',
comment: '//',
}).contents
config.modResults.contents = contents
return config
})