Skip to content
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

Set up app for Expo SDK, add haptic feedback for long presses with Expo Haptics #3607

Merged
merged 11 commits into from
Jul 10, 2021
3 changes: 3 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

import com.android.build.OutputFile
Expand Down Expand Up @@ -209,6 +210,8 @@ dependencies {

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

addUnimodulesDependencies()

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.expensify.chat;

import com.expensify.chat.generated.BasePackageList;

import android.content.Context;
import android.database.CursorWindow;
import androidx.multidex.MultiDexApplication;
Expand All @@ -14,9 +16,16 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Arrays;

import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.SingletonModule;

public class MainApplication extends MultiDexApplication implements ReactApplication {

private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), null);

private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
Expand All @@ -31,6 +40,12 @@ protected List<ReactPackage> getPackages() {
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new PlaidPackage());

// Add unimodules
List<ReactPackage> unimodules = Arrays.<ReactPackage>asList(
new ModuleRegistryAdapter(mModuleRegistryProvider)
);
packages.addAll(unimodules);
return packages;
}

Expand Down
1 change: 1 addition & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
rootProject.name = 'ExpensifyCash'
apply from: '../node_modules/react-native-unimodules/gradle.groovy'; includeUnimodulesProjects()
include ':react-native-config'
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')
include ':@react-native-community_async-storage'
Expand Down
3 changes: 3 additions & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const platform = (platformIndex > 0) ? process.argv[platformIndex + 1] : 'web';
const platformExclude = platform === 'web' ? new RegExp(/\.desktop\.js$/) : new RegExp(/\.website\.js$/);

const includeModules = [
'expo-constants',
'expo-permissions',
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
'react-native-animatable',
'react-native-reanimated',
'react-native-picker-select',
Expand All @@ -20,6 +22,7 @@ const includeModules = [
'react-native-modal',
'react-native-onyx',
'react-native-gesture-handler',
'@unimodules',
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
].join('|');

const webpackConfig = {
Expand Down
4 changes: 3 additions & 1 deletion ios/ExpensifyCash/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>
#import <UMCore/UMAppDelegateWrapper.h>

@interface AppDelegate : UMAppDelegateWrapper <UIApplicationDelegate, RCTBridgeDelegate>

@property (nonatomic, strong) UIWindow *window;

Expand Down
22 changes: 22 additions & 0 deletions ios/ExpensifyCash/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

#import <UserNotifications/UserNotifications.h>

#import <UMCore/UMModuleRegistry.h>
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>


#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
Expand All @@ -29,6 +34,12 @@ static void InitializeFlipper(UIApplication *application) {
}
#endif

@interface AppDelegate () <RCTBridgeDelegate>

@property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Expand All @@ -40,6 +51,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
InitializeFlipper(application);
#endif

self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];


RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"ExpensifyCash"
Expand All @@ -52,6 +66,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
[super application:application didFinishLaunchingWithOptions:launchOptions];

// Define UNUserNotificationCenter
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
Expand All @@ -62,6 +77,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
// If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!
return extraModules;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
Expand Down
2 changes: 2 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'

platform :ios, '11.0'

target 'ExpensifyCash' do
use_unimodules!
permissions_path = '../node_modules/react-native-permissions/ios'

pod 'Plaid', '~> 2.1.2'
Expand Down
117 changes: 113 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ PODS:
- boost-for-react-native (1.63.0)
- CocoaAsyncSocket (7.6.5)
- DoubleConversion (1.1.6)
- EXConstants (10.1.3):
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
- UMConstantsInterface
- UMCore
- EXFileSystem (11.0.2):
- UMCore
- UMFileSystemInterface
- EXHaptics (10.0.0):
- UMCore
- EXImageLoader (2.1.1):
- React-Core
- UMCore
- UMImageLoaderInterface
- EXPermissions (12.0.1):
- UMCore
- UMPermissionsInterface
- FBLazyVector (0.64.1)
- FBReactNativeSpec (0.64.1):
- RCT-Folly (= 2020.01.13.00)
Expand Down Expand Up @@ -492,6 +507,28 @@ PODS:
- React-Core
- RNSVG (12.1.0):
- React
- UMAppLoader (2.1.0)
- UMBarCodeScannerInterface (6.1.0):
- UMCore
- UMCameraInterface (6.1.0):
- UMCore
- UMConstantsInterface (6.1.0):
- UMCore
- UMCore (7.1.0)
- UMFaceDetectorInterface (6.1.0)
- UMFileSystemInterface (6.1.0)
- UMFontInterface (6.1.0)
- UMImageLoaderInterface (6.1.0)
- UMPermissionsInterface (6.1.0):
- UMCore
- UMReactNativeAdapter (6.2.2):
- React-Core
- UMCore
- UMFontInterface
- UMSensorsInterface (6.1.0):
- UMCore
- UMTaskManagerInterface (6.1.0):
- UMCore
- urbanairship-react-native (11.0.1):
- Airship (= 14.3.0)
- React-Core
Expand All @@ -501,6 +538,11 @@ PODS:

DEPENDENCIES:
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- EXConstants (from `../node_modules/expo-constants/ios`)
- EXFileSystem (from `../node_modules/expo-file-system/ios`)
- EXHaptics (from `../node_modules/expo-haptics/ios`)
- EXImageLoader (from `../node_modules/expo-image-loader/ios`)
- EXPermissions (from `../node_modules/expo-permissions/ios`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
- Flipper (= 0.75.1)
Expand Down Expand Up @@ -576,6 +618,19 @@ DEPENDENCIES:
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNSVG (from `../node_modules/react-native-svg`)
- UMAppLoader (from `../node_modules/unimodules-app-loader/ios`)
- UMBarCodeScannerInterface (from `../node_modules/unimodules-barcode-scanner-interface/ios`)
- UMCameraInterface (from `../node_modules/unimodules-camera-interface/ios`)
- UMConstantsInterface (from `../node_modules/unimodules-constants-interface/ios`)
- "UMCore (from `../node_modules/@unimodules/core/ios`)"
- UMFaceDetectorInterface (from `../node_modules/unimodules-face-detector-interface/ios`)
- UMFileSystemInterface (from `../node_modules/unimodules-file-system-interface/ios`)
- UMFontInterface (from `../node_modules/unimodules-font-interface/ios`)
- UMImageLoaderInterface (from `../node_modules/unimodules-image-loader-interface/ios`)
- UMPermissionsInterface (from `../node_modules/unimodules-permissions-interface/ios`)
- "UMReactNativeAdapter (from `../node_modules/@unimodules/react-native-adapter/ios`)"
- UMSensorsInterface (from `../node_modules/unimodules-sensors-interface/ios`)
- UMTaskManagerInterface (from `../node_modules/unimodules-task-manager-interface/ios`)
- urbanairship-react-native (from `../node_modules/urbanairship-react-native`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

Expand Down Expand Up @@ -611,6 +666,16 @@ SPEC REPOS:
EXTERNAL SOURCES:
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
EXConstants:
:path: "../node_modules/expo-constants/ios"
EXFileSystem:
:path: "../node_modules/expo-file-system/ios"
EXHaptics:
:path: "../node_modules/expo-haptics/ios"
EXImageLoader:
:path: "../node_modules/expo-image-loader/ios"
EXPermissions:
:path: "../node_modules/expo-permissions/ios"
FBLazyVector:
:path: "../node_modules/react-native/Libraries/FBLazyVector"
FBReactNativeSpec:
Expand Down Expand Up @@ -717,6 +782,32 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-screens"
RNSVG:
:path: "../node_modules/react-native-svg"
UMAppLoader:
:path: "../node_modules/unimodules-app-loader/ios"
UMBarCodeScannerInterface:
:path: "../node_modules/unimodules-barcode-scanner-interface/ios"
UMCameraInterface:
:path: "../node_modules/unimodules-camera-interface/ios"
UMConstantsInterface:
:path: "../node_modules/unimodules-constants-interface/ios"
UMCore:
:path: "../node_modules/@unimodules/core/ios"
UMFaceDetectorInterface:
:path: "../node_modules/unimodules-face-detector-interface/ios"
UMFileSystemInterface:
:path: "../node_modules/unimodules-file-system-interface/ios"
UMFontInterface:
:path: "../node_modules/unimodules-font-interface/ios"
UMImageLoaderInterface:
:path: "../node_modules/unimodules-image-loader-interface/ios"
UMPermissionsInterface:
:path: "../node_modules/unimodules-permissions-interface/ios"
UMReactNativeAdapter:
:path: "../node_modules/@unimodules/react-native-adapter/ios"
UMSensorsInterface:
:path: "../node_modules/unimodules-sensors-interface/ios"
UMTaskManagerInterface:
:path: "../node_modules/unimodules-task-manager-interface/ios"
marcaaron marked this conversation as resolved.
Show resolved Hide resolved
urbanairship-react-native:
:path: "../node_modules/urbanairship-react-native"
Yoga:
Expand All @@ -726,9 +817,14 @@ SPEC CHECKSUMS:
Airship: 7609d263d3a207f112d6db066af5852b80af6819
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
DoubleConversion: cde416483dac037923206447da6e1454df403714
EXConstants: c00cd53a17a65b2e53ddb3890e4e74d3418e406e
EXFileSystem: 35769beb727d5341d1276fd222710f9704f7164e
EXHaptics: 337c160c148baa6f0e7166249f368965906e346b
EXImageLoader: 1ad8b491fd0f3200b57b37ecb1801abeb6549926
EXPermissions: ea8d63dd052737765bd350b2ca7cee9bcfd5e18e
FBLazyVector: 7b423f9e248eae65987838148c36eec1dbfe0b53
FBReactNativeSpec: 7c304782592aaf95fe9fc6add0746906d6562739
FBReactNativeSpec: b15821921060872c380643b0392daa279e2f0309
Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999
FirebaseAnalytics: 3bb096873ee0d7fa4b6c70f5e9166b6da413cc7f
FirebaseCore: d3a978a3cfa3240bf7e4ba7d137fdf5b22b628ec
Expand All @@ -742,7 +838,7 @@ SPEC CHECKSUMS:
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
Flipper-RSocket: 127954abe8b162fcaf68d2134d34dc2bd7076154
FlipperKit: 8a20b5c5fcf9436cac58551dc049867247f64b00
glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
GoogleAppMeasurement: a6a3a066369828db64eda428cb2856dc1cdc7c4e
GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833
GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3
Expand Down Expand Up @@ -802,10 +898,23 @@ SPEC CHECKSUMS:
RNReanimated: b8c8004b43446e3c2709fe64b2b41072f87428ad
RNScreens: e8e8dd0588b5da0ab57dcca76ab9b2d8987757e0
RNSVG: ce9d996113475209013317e48b05c21ee988d42e
UMAppLoader: aae896b81e3fcaa6528992e2e19ec8db38c2cedd
UMBarCodeScannerInterface: 96a01d81ff0c7febbfefc2d7396db9e7462d8c68
UMCameraInterface: 8ad433fdadca22703ebeb614d42b814092d38d69
UMConstantsInterface: 55c79ca258a3ede70480fed85e3843899cd47ea3
UMCore: 0da048c9753abcea0042258e6ad0fed77811f7e1
UMFaceDetectorInterface: 4db950a25e785796a237bcebb8fff05078c4fb61
UMFileSystemInterface: 4a92ee36e6c2757833031718f8496690fa931280
UMFontInterface: 81a951117d03f57aa636fba3992adefd0191f200
UMImageLoaderInterface: 5cd09b41630dc8aef7619fabc497c01c0f6b715c
UMPermissionsInterface: 4351145563e703c521fe2299e08227bc3584b94a
UMReactNativeAdapter: 7b458ca3d4497b5114e6bb766b223432bad22d8a
UMSensorsInterface: 50439b47826e716a514cbd7384aebe9ab4fde5f4
UMTaskManagerInterface: 482155764886069beb1bc7fcf6036f12e4ad0751
urbanairship-react-native: d415a12e67ba93bf3ce914df9a310b66a88a5cc3
Yoga: a7de31c64fe738607e7a3803e3f591a4b1df7393
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: e2cbcef0a80ad10b622900511a519e73949d415d
PODFILE CHECKSUM: 2b0558e25f01204512de38c2f656a63b5d86d19c

COCOAPODS: 1.10.1
Loading