Skip to content

Add contacts import nitro module #54459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
bf0ca57
Merge branch 'main' of https://github.com/Expensify/App
perunt Dec 23, 2024
7a548c8
Revert "Revert "Revert "Revert "Contacts import(51018)""""
perunt Dec 23, 2024
6f1e3da
bump nitro
perunt Jan 6, 2025
7abab7e
modify HybridContactsModule
perunt Jan 6, 2025
434a9f9
generate specs
perunt Jan 6, 2025
e704e6b
Merge branch '@perunt/rerevert-contacts-import-module' of https://git…
perunt Jan 6, 2025
fce6f6b
lint
perunt Jan 6, 2025
9f0acad
Merge branch '@perunt/rerevert-contacts-import-module' of https://git…
perunt Jan 10, 2025
1d85e9a
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Jan 10, 2025
7c8fc7f
fix android
perunt Jan 10, 2025
924ce0e
import
perunt Jan 13, 2025
9be4449
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Jan 13, 2025
40ab11f
typecheck
perunt Jan 13, 2025
524fdec
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Jan 16, 2025
4ad7f0b
bump nitro to 0.21.0
perunt Jan 16, 2025
be5e87a
Merge branch 'main'
perunt Jan 16, 2025
d54e954
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Feb 20, 2025
27c0243
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Feb 20, 2025
ab4e4b5
lint
perunt Feb 21, 2025
3ed4384
fix: new eslint rules
perunt Feb 21, 2025
3a7122d
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Mar 18, 2025
15c0c9c
bump nitro
perunt Mar 24, 2025
0841825
use one tsconfig
perunt Mar 24, 2025
087cfaa
remove node modules from nitro module
perunt Mar 24, 2025
45be028
clean tsconfig
perunt Mar 24, 2025
ac69b81
codegen
perunt Mar 24, 2025
6179f6d
fix: Nitro breaking changes
perunt Mar 24, 2025
defe8e9
move from interface to type
perunt Mar 26, 2025
22bb0fa
rename
perunt Mar 26, 2025
3bd8809
specs + add empty module
perunt Mar 26, 2025
fbdba00
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Mar 26, 2025
2010959
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Mar 27, 2025
2caedc0
rename to ExpensifyNitroUtils
perunt Mar 27, 2025
73e62fd
fix cpp adapter
perunt Mar 27, 2025
320b3d9
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Mar 28, 2025
68c1f72
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Mar 31, 2025
e1b14b0
clean spec
perunt Apr 1, 2025
ee672e4
ашч context
perunt Apr 1, 2025
a4b5bd5
lint
perunt Apr 1, 2025
3422a85
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Apr 1, 2025
8862d5b
fix tsconfig
perunt Apr 2, 2025
c68a372
clean podfile
perunt Apr 2, 2025
c27b93c
clean gitignore
perunt Apr 2, 2025
f8646ff
use java 17
perunt Apr 2, 2025
37cdd4b
clean
perunt Apr 2, 2025
bd9c456
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Apr 8, 2025
f873d1d
podfile checksum
perunt Apr 8, 2025
75ebc09
change buildConfiguration
perunt Apr 9, 2025
ffceb88
add types
perunt Apr 16, 2025
e9274cd
rename
perunt Apr 21, 2025
dcaa5a0
update requestContactPermission in HybridContactsModule(kotlin)
perunt Apr 21, 2025
d86b2f8
move projection to const
perunt Apr 21, 2025
c8cd538
use CONTACT_FIELDS
perunt Apr 21, 2025
dd0a20c
refactor: improve code readability with early returns and static cons…
perunt Apr 21, 2025
95faeb2
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Apr 21, 2025
c827792
lint: export types
perunt Apr 22, 2025
e776c07
chore: resolve eslint errors triggered by merge conflict resolution
perunt Apr 22, 2025
ec4dec3
chore: fix useOnyx linter errors by adding canBeMissing parameters
perunt Apr 22, 2025
1940b44
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Apr 22, 2025
5a30f42
lint
perunt Apr 22, 2025
6583a01
fix AvatarSource type compatibility issues
perunt Apr 22, 2025
85a5f81
chore: fix useOnyx linter errors by adding canBeMissing parameters af…
perunt Apr 22, 2025
1ff99a0
use import type
perunt Apr 22, 2025
833f23a
adjust kotlin file
perunt Apr 22, 2025
280d84d
use better naming
perunt Apr 23, 2025
956c5b2
clean package file
perunt Apr 23, 2025
0d620a1
add explanations for ` @inline(__always)`
perunt Apr 23, 2025
2beeb99
rename callback
perunt Apr 23, 2025
74f1e9b
change name of allReportNameValuePairs due to conflicts
perunt Apr 23, 2025
8e9e278
Merge branch 'main' of https://github.com/Expensify/App into @perunt/…
perunt Apr 23, 2025
af5fcc6
rename to `@expensify/nitro-utils`
perunt Apr 23, 2025
fc36ad1
refactor import/export
perunt Apr 25, 2025
5582bd8
fix type
perunt Apr 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ web/gtm.js
src/libs/SearchParser/searchParser.js
src/libs/SearchParser/autocompleteParser.js
help/_scripts/**
modules/**
1 change: 1 addition & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# Add any project specific keep options here:
-keep class com.expensify.chat.BuildConfig { *; }
-keep class com.facebook.** { *; }
-keep class com.margelo.nitro.** { *; }
-keep, allowoptimization, allowobfuscation class expo.modules.** { *; }

# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Expand Down
1 change: 1 addition & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ prepare_react_native_project!

setup_permissions([
'Camera',
'Contacts',
'LocationAccuracy',
'LocationAlways',
'LocationWhenInUse'
Expand Down
57 changes: 55 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,28 @@ PODS:
- AppAuth/Core
- AppLogs (0.1.0)
- boost (1.84.0)
- ContactsModule (0.0.1):
- DoubleConversion
- glog
- hermes-engine
- NitroModules
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- DoubleConversion (1.1.6)
- EXAV (14.0.7):
- ExpoModulesCore
Expand Down Expand Up @@ -287,6 +309,29 @@ PODS:
- nanopb/encode (= 2.30908.0)
- nanopb/decode (2.30908.0)
- nanopb/encode (2.30908.0)
- NitroModules (0.20.1):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-callinvoker
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-jsi
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- Onfido (29.7.2)
- onfido-react-native-sdk (10.6.0):
- DoubleConversion
Expand Down Expand Up @@ -2750,6 +2795,7 @@ DEPENDENCIES:
- AirshipServiceExtension
- AppLogs (from `../node_modules/react-native-app-logs/AppLogsPod`)
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- ContactsModule (from `../modules/ContactsNitroModule`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- EXAV (from `../node_modules/expo-av/ios`)
- EXImageLoader (from `../node_modules/expo-image-loader/ios`)
Expand All @@ -2765,6 +2811,7 @@ DEPENDENCIES:
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- lottie-react-native (from `../node_modules/lottie-react-native`)
- NitroModules (from `../node_modules/react-native-nitro-modules`)
- "onfido-react-native-sdk (from `../node_modules/@onfido/react-native-sdk`)"
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCT-Folly/Fabric (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
Expand Down Expand Up @@ -2915,6 +2962,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-app-logs/AppLogsPod"
boost:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
ContactsModule:
:path: "../modules/ContactsNitroModule"
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
EXAV:
Expand Down Expand Up @@ -2946,6 +2995,8 @@ EXTERNAL SOURCES:
:tag: hermes-2024-08-15-RNv0.75.1-4b3bf912cc0f705b51b71ce1a5b8bd79b93a451b
lottie-react-native:
:path: "../node_modules/lottie-react-native"
NitroModules:
:path: "../node_modules/react-native-nitro-modules"
onfido-react-native-sdk:
:path: "../node_modules/@onfido/react-native-sdk"
RCT-Folly:
Expand Down Expand Up @@ -3160,6 +3211,7 @@ SPEC CHECKSUMS:
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
AppLogs: 3bc4e9b141dbf265b9464409caaa40416a9ee0e0
boost: 26992d1adf73c1c7676360643e687aee6dda994b
ContactsModule: 21671b28654413dc28795d1afc3b12eaffa28ed1
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
EXAV: afa491e598334bbbb92a92a2f4dd33d7149ad37f
EXImageLoader: ab589d67d6c5f2c33572afea9917304418566334
Expand Down Expand Up @@ -3199,6 +3251,7 @@ SPEC CHECKSUMS:
MapboxMaps: e76b14f52c54c40b76ddecd04f40448e6f35a864
MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
NitroModules: c1081a4948f78e7c1f00402fb63db54fc06ae186
Onfido: f3af62ea1c9a419589c133e3e511e5d2c4f3f8af
onfido-react-native-sdk: 4ccfdeb10f9ccb4a5799d2555cdbc2a068a42c0d
Plaid: c32f22ffce5ec67c9e6147eaf6c4d7d5f8086d89
Expand Down Expand Up @@ -3295,7 +3348,7 @@ SPEC CHECKSUMS:
RNLiveMarkdown: f19d3c962fba4fb87bb9bc27ce9119216d86d92e
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
rnmapbox-maps: 460d6ff97ae49c7d5708c3212c6521697c36a0c4
RNPermissions: 0b1429b55af59d1d08b75a8be2459f65a8ac3f28
RNPermissions: 9e5c26aaa982fe00743281f6f47fbdc050ebc58f
RNReactNativeHapticFeedback: 73756a3477a5a622fa16862a3ab0d0fc5e5edff5
RNReanimated: d95f865e1e42c34ca56b987e0719a8c72fc02dbc
RNScreens: de6e57426ba0e6cbc3fb5b4f496e7f08cb2773c2
Expand All @@ -3311,6 +3364,6 @@ SPEC CHECKSUMS:
VisionCamera: c95a8ad535f527562be1fb05fb2fd324578e769c
Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8

PODFILE CHECKSUM: 615266329434ea4a994dccf622008a2197313c88
PODFILE CHECKSUM: e744fa802b4bee097ff8d1977dd8f79d16b21547

COCOAPODS: 1.15.2
78 changes: 78 additions & 0 deletions modules/ContactsNitroModule/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# OSX
#
.DS_Store

# XDE
.expo/

# VSCode
.vscode/
jsconfig.json

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IJ
#
.classpath
.cxx
.gradle
.idea
.project
.settings
local.properties
android.iml

# Cocoapods
#
example/ios/Pods

# Ruby
example/vendor/

# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Expo
.expo/

# Turborepo
.turbo/

# generated by bob
lib/
1 change: 1 addition & 0 deletions modules/ContactsNitroModule/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
29 changes: 29 additions & 0 deletions modules/ContactsNitroModule/ContactsModule.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
s.name = "ContactsModule"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]

s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/mrousavy/nitro.git", :tag => "#{s.version}" }

s.source_files = [
# Implementation (Swift)
"ios/**/*.{swift}",
# Autolinking/Registration (Objective-C++)
"ios/**/*.{m,mm}",
# Implementation (C++ objects)
"cpp/**/*.{hpp,cpp}",
]

load 'nitrogen/generated/ios/ContactsModule+autolinking.rb'
add_nitrogen_files(s)

install_modules_dependencies(s)
end
29 changes: 29 additions & 0 deletions modules/ContactsNitroModule/android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
project(ContactsModule)
cmake_minimum_required(VERSION 3.9.0)

set (PACKAGE_NAME ContactsModule)
set (CMAKE_VERBOSE_MAKEFILE ON)
set (CMAKE_CXX_STANDARD 20)

# Define C++ library and add all sources
add_library(${PACKAGE_NAME} SHARED
src/main/cpp/cpp-adapter.cpp
)

# Add Nitrogen specs :)
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/ContactsModule+autolinking.cmake)

# Set up local includes
include_directories(
"src/main/cpp"
"../cpp"
)

find_library(LOG_LIB log)

# Link all libraries together
target_link_libraries(
${PACKAGE_NAME}
${LOG_LIB}
android # <-- Android core
)
Loading
Loading