Files
iNaturalistReactNative/ios/Podfile
Johannes Klein a52996f535 Changes to the way permissions are asked for (#1793)
* Replace name in permission requests

* TakePhoto TS

* PermissionGate TS

* Type

* PermissionGateContainer TS

* Interface

* Types

* LocationGate TS

* Remove LocationPermissionGate from Camera

* Remove write only permission

* Type

* ObsPhotoSelectionList TS

* Code style

* Show the improve with location button

* Create useLocationPermission.tsx

* Use new hook on suggestions

* Doc comment

* Use new hook in camera view

* Add strings

* Refactor Explore main content

* Use permission hook on RootExplore

* Add no location permission component

* Rename function

* Prop request permissions and use with button

* Default to Nearby label

* Remove Node type

* Projects TS

* Use useLocationPermission hook in projects screen

* Add string

* Prop permission down

* Refactor list render

* Refactor tab id into enum

* Tab type

* On nearby tab if without permission show button to prompt

* Leftovers

* Remove location permission gate from ObsEdit

* Use location permission hook on evidence section

* SearchBar TS

* Do not autoFocus on search bar in location picker.

Closes #1743

* Update type

* LocationSearch TS

* Show location permission gate on location picker's mount

* Add location permission to CurrentLocationButton

* Remove unused props of Map

* Remove unused exports from useMapLocation

* Migration

* Revert "Show location permission gate on location picker's mount"

This reverts commit 30ff75698c53d54d0b14cd2bd629f7155b743bf8.

* Add callbacks to useLocationPermission hook

* Show location permission ask on Obs Edit

* Remove unused string

* Reset explore filters should set location always to worldwide

* Add helper function to show place text in Explore

* Remove unused state of filter modal

* Show place text in filters modal with helper

* Show location permission button only for Nearby explore state

* Add a placeMode state

* Do not send placeMode to API

* Also treat limited permission as yes

* useLocationPermission in ExploreLocationSearch

* Refactor to setting place mode

Instead of logic based on the translated text of the place_guess string that is stored in ExploreContext, we are switching to an enum state that signifies which mode to show on explore:
1.) Nearby: Filters explore results based on the user's location. This also has a state without location permission that does not query the API.
2.) Place: Filtering by a specific place (as retrieved by /places API).
3.) Worldwide: Retrieve worldwide results, i.e. not having a place filter set.
4.) Map area: Filtering explore results precisely to the map rectangle shown on the explore map.

* Remove import from test

* Remove export

* Use blocked title only for blocked permission asks

* Move gallery permission container to Tab navigator as are the others

* Add gallery save title

* Split location permission explanation into two

* Update strings.ftl

* Only nav to location picker if permission was not  granted

* Check permission on app being foregrounded

* The location permission part is handled by useLocationPermission

* Do not store permission result in hook

* Use hasPermission from permissions hook

* Update fetchUserLocation.e2e-mock

* Move hook one higher

* Show user location if permission is given

* PermissionGate callbacks should use useCallback

* Add permission hook to map usage

* Fix test

* Update layout to be asserted

* Add location permission hook to Explore

* Remove console.log

* Few TS fixes

* Indentation

* Remove superficial check

* Update Podfile.lock
2024-07-12 11:00:24 +02:00

150 lines
5.7 KiB
Ruby

# frozen_string_literal: true
# setup instructions from https://www.npmjs.com/package/react-native-permissions
def node_require(script)
# Resolve script with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
"require.resolve(
'#{script}',
{paths: [process.argv[1]]},
)", __dir__]).strip
end
node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')
platform :ios, min_ios_version_supported
prepare_react_native_project!
# ⬇️ uncomment wanted permissions
setup_permissions([
# 'AppTrackingTransparency',
# 'BluetoothPeripheral',
# 'Calendars',
'Camera',
# 'Contacts',
# 'FaceID',
'LocationAccuracy',
'LocationAlways',
'LocationWhenInUse',
'MediaLibrary',
'Microphone',
# 'Motion',
# 'Notifications',
'PhotoLibrary',
# 'PhotoLibraryAddOnly',
# 'Reminders',
# 'Siri',
# 'SpeechRecognition',
# 'StoreKit',
])
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
# dependencies: {
# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
# flipper_config = ENV["NO_FLIPPER"] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
linkage = ENV["USE_FRAMEWORKS"]
unless linkage.nil?
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! linkage: linkage.to_sym
end
target "iNaturalistReactNative" do
config = use_native_modules!
use_react_native!(
path: config[:reactNativePath],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# :flipper_configuration => flipper_config,
# An absolute path to your application root.
app_path: "#{Pod::Config.instance.installation_root}/.."
)
pod "React-jsi", path: "../node_modules/react-native/ReactCommon/jsi", modular_headers: true
pod "react-native-config", path: "../node_modules/react-native-config"
pod "RNVectorIcons", path: "../node_modules/react-native-vector-icons"
envfiles = {
"Debug" => "$(PODS_ROOT)/../../.env.staging",
"Release" => "$(PODS_ROOT)/../../.env"
}.freeze
post_install do | installer |
# use different .env files for staging and production
# https://github.com/luggit/react-native-config#ios-1
installer.pods_project.targets.each do | target |
target.build_configurations.each do | build_config |
# the following two lines allow the app to build with XCode 14.3 RC
# https://stackoverflow.com/questions/72729591/fbreactnativespec-h-error-after-upgrading-from-0-68-x-to-0-69-0/74487309#74487309
build_config.build_settings["SWIFT_VERSION"] = "5.2"
build_config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "12.4"
if target.name == "react-native-config"
build_config.build_settings["ENVFILE"] = envfiles[build_config.name]
end
end
end
# code below appears to be necessary for building pods with XCode 14: https://github.com/facebook/react-native/issues/34673#issuecomment-1252114414
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
mac_catalyst_enabled: false
)
# Add these lines for Xcode 14 builds
installer.generated_projects.each do | project |
project.targets.each do | target |
target.build_configurations.each do | build_config |
build_config.build_settings["DEVELOPMENT_TEAM"] = "iNaturalist, LLC"
end
end
end
# End of added lines
# https://github.com/Agontuk/react-native-geolocation-service/issues/287#issuecomment-980772489
installer.pods_project.targets.each do | target |
target.build_configurations.each do | build_config |
build_config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
# code below appears to be necessary for building pods with XCode 14:
# https://github.com/facebook/react-native/issues/34673#issuecomment-1252114414
build_config.build_settings["DEVELOPMENT_TEAM"] = "iNaturalist, LLC"
build_config.build_settings["APPLICATION_EXTENSION_API_ONLY"] = "NO"
build_config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "$(inherited)"
end
end
installer.target_installation_results.pod_target_installation_results.each do | _pod_name, inst_result |
inst_result.native_target.build_configurations.each do | build_config |
# For third party modules who have React-bridging dependency to search correct headers
build_config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
build_config.build_settings["HEADER_SEARCH_PATHS"] +=
'"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging" '
build_config.build_settings["HEADER_SEARCH_PATHS"] +=
'"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers" '
end
end
# react_native_post_install(installer)
`sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`
end
end
target "iNaturalistReactNative-ShareExtension" do
use_react_native!(
# to enable hermes on iOS, change `false` to `true` and then install pods
hermes_enabled: true
)
pod "RNShareMenu", path: "../node_modules/react-native-share-menu"
# Manually link packages here to keep your extension bundle size minimal
end