-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(android): update permissions plugin (#12)
Signed-off-by: Berend Sliedrecht <[email protected]>
- Loading branch information
1 parent
a131ebf
commit cea5578
Showing
9 changed files
with
22,565 additions
and
15,999 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,4 @@ object MdocDataTransferManager { | |
|
||
}.build() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,15 @@ | ||
import { type ConfigPlugin, withInfoPlist, withPlugins, withPodfile } from '@expo/config-plugins' | ||
import type { ExpoConfig } from '@expo/config-types' | ||
import type { Props } from '.' | ||
import { type ConfigPlugin, withInfoPlist } from '@expo/config-plugins' | ||
|
||
const withIosPodfile: ConfigPlugin<Props> = (expoConfig: ExpoConfig, props) => | ||
withPodfile(expoConfig, (c) => { | ||
if (!props.ios?.buildStatic) return c | ||
const staticLibraries = `mdoc_data_transfer_static_libraries=[${props.ios.buildStatic.map((i) => `"${i}"`).join(', ')}]` | ||
if (c.modResults.contents.includes('mdoc_data_transfer_static_libraries')) { | ||
c.modResults.contents = c.modResults.contents.replace(/mdoc_data_transfer_static_libraries=.*/, staticLibraries) | ||
} else { | ||
c.modResults.contents += staticLibraries | ||
} | ||
|
||
if (c.modResults.contents.includes('Pod::BuildType.static_library')) return c | ||
|
||
c.modResults.contents += ` | ||
pre_install do |installer| | ||
installer.pod_targets.each do |pod| | ||
if mdoc_data_transfer_static_libraries.include?(pod.name) | ||
def pod.build_type; | ||
Pod::BuildType.static_library | ||
end | ||
end | ||
end | ||
end | ||
` | ||
return c | ||
}) | ||
const BLUETOOTH_ALWAYS = 'Allow $(PRODUCT_NAME) to connect to bluetooth devices for data sharing' | ||
|
||
const withIosBluetoothUsage: ConfigPlugin<Props> = (config, props) => { | ||
return withInfoPlist(config, (c) => { | ||
const defaultDescription = 'This app uses Bluetooth to connect to external devices for credential sharing.' | ||
|
||
const usageDescription = props?.ios?.bluetoothDescription || defaultDescription | ||
|
||
if (c.ios?.infoPlist) { | ||
c.ios.infoPlist.NSBluetoothAlwaysUsageDescription = usageDescription | ||
export const withIos: ConfigPlugin<{ | ||
bluetoothAlwaysPermission?: string | false | ||
}> = (c, { bluetoothAlwaysPermission } = {}) => { | ||
return withInfoPlist(c, (config) => { | ||
if (bluetoothAlwaysPermission !== false) { | ||
config.modResults.NSBluetoothAlwaysUsageDescription = | ||
bluetoothAlwaysPermission || config.modResults.NSBluetoothAlwaysUsageDescription || BLUETOOTH_ALWAYS | ||
} | ||
|
||
return c | ||
return config | ||
}) | ||
} | ||
|
||
export const withIos: ConfigPlugin<Props> = (config, props) => | ||
withPlugins(config, [ | ||
[withIosPodfile, props], | ||
[withIosBluetoothUsage, props], | ||
]) |
Oops, something went wrong.