Skip to content

Commit

Permalink
chore: expo-web-browser
Browse files Browse the repository at this point in the history
  • Loading branch information
mastro993 committed Jan 24, 2024
1 parent 71d6507 commit ee24aa5
Show file tree
Hide file tree
Showing 12 changed files with 2,916 additions and 107 deletions.
8 changes: 8 additions & 0 deletions android/app/src/main/java/it/pagopa/io/app/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package it.pagopa.io.app;
import expo.modules.ReactActivityDelegateWrapper;

import android.content.pm.ActivityInfo;
import android.os.Build;
Expand Down Expand Up @@ -53,4 +54,11 @@ protected boolean isConcurrentRootEnabled() {
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}
}

@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
new ReactActivityDelegate(this, getMainComponentName())
);
}
}
16 changes: 13 additions & 3 deletions android/app/src/main/java/it/pagopa/io/app/MainApplication.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package it.pagopa.io.app;
import android.content.res.Configuration;
import expo.modules.ApplicationLifecycleDispatcher;
import expo.modules.ReactNativeHostWrapper;

import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
Expand All @@ -24,7 +27,7 @@ public class MainApplication extends Application implements ReactApplication {


private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
new ReactNativeHostWrapper(this, new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
Expand All @@ -47,10 +50,10 @@ protected List<ReactPackage> getPackages() {
packages.add(new ARTPackage());
return packages;
}
};
});

private final ReactNativeHost mNewArchitectureNativeHost =
new MainApplicationReactNativeHost(this);
new ReactNativeHostWrapper(this, new MainApplicationReactNativeHost(this));

@Override
public ReactNativeHost getReactNativeHost() {
Expand All @@ -68,6 +71,7 @@ public void onCreate() {
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
ApplicationLifecycleDispatcher.onApplicationCreate(this);
}


Expand Down Expand Up @@ -102,4 +106,10 @@ private static void initializeFlipper(
}
}


@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
}
}
3 changes: 3 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ include ':@react-native-community_datetimepicker'
project(':@react-native-community_datetimepicker').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/datetimepicker/android')
include ':react-native-art'
project(':react-native-art').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/art/android')

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
1 change: 1 addition & 0 deletions ios/ItaliaApp-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import <Expo/Expo.h>
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
Expand Down
46 changes: 44 additions & 2 deletions ios/ItaliaApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
28E4866232804051B865FC10 /* RobotoMono-RegularItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5389C36762A04AE69D762289 /* RobotoMono-RegularItalic.ttf */; };
2AD40B9924CB049500E4124A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2AD40B9824CB049500E4124A /* LaunchScreen.storyboard */; };
3A3CA4696BA44782A02FE37E /* TitilliumWeb-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B021D4CC17ED4D54B7944FED /* TitilliumWeb-SemiBold.ttf */; };
4AB5E4A24A70980899AA5234 /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7185D68AE95C6CC7E09C7C84 /* ExpoModulesProvider.swift */; };
4D331CF68DAC4800A6D6297A /* TitilliumWeb-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 11C2483C363E432BB4D0A583 /* TitilliumWeb-Regular.ttf */; };
570BBC8FC70C4A76ABF035AC /* TitilliumWeb-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 163BC670599B42509D4D138E /* TitilliumWeb-Light.ttf */; };
668F6CA367F172F6864226CD /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67EA4A69F1DB7B286474145D /* ExpoModulesProvider.swift */; };
69A5E1839C924EE5B8CD9470 /* ReadexPro-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2C584AD92CB24628B1AA76DE /* ReadexPro-Regular.ttf */; };
6B44A74498354CC19B90FE9C /* TitilliumWeb-ExtraLightItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6754714BBEF54AA59833C0EB /* TitilliumWeb-ExtraLightItalic.ttf */; };
72E4B1EFF7D4414483079F91 /* TitilliumWeb-SemiBoldItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CED8B1FF1E254583BB3F285F /* TitilliumWeb-SemiBoldItalic.ttf */; };
Expand Down Expand Up @@ -91,8 +93,10 @@
5389C36762A04AE69D762289 /* RobotoMono-RegularItalic.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "RobotoMono-RegularItalic.ttf"; path = "../assets/fonts/RobotoMono/RobotoMono-RegularItalic.ttf"; sourceTree = "<group>"; };
640E574519CA4183B230AF22 /* RobotoMono-LightItalic.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "RobotoMono-LightItalic.ttf"; path = "../assets/fonts/RobotoMono/RobotoMono-LightItalic.ttf"; sourceTree = "<group>"; };
6754714BBEF54AA59833C0EB /* TitilliumWeb-ExtraLightItalic.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "TitilliumWeb-ExtraLightItalic.ttf"; path = "../assets/fonts/TitilliumWeb/TitilliumWeb-ExtraLightItalic.ttf"; sourceTree = "<group>"; };
67EA4A69F1DB7B286474145D /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-ItaliaApp/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
6A786CC45B2D4B77BDF55C1D /* TitilliumWeb-Black.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "TitilliumWeb-Black.ttf"; path = "../assets/fonts/TitilliumWeb/TitilliumWeb-Black.ttf"; sourceTree = "<group>"; };
6C4A0A2AB90C8575993DF1E1 /* Instabug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Instabug.framework; path = "../node_modules/instabug-reactnative/ios/Instabug.framework"; sourceTree = "<group>"; };
7185D68AE95C6CC7E09C7C84 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-ItaliaApp-ItaliaAppTests/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
76E4CEA78E3F4060ABB59808 /* RobotoMono-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "RobotoMono-Regular.ttf"; path = "../assets/fonts/RobotoMono/RobotoMono-Regular.ttf"; sourceTree = "<group>"; };
7A83F0572152B12C000C6389 /* ItaliaApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = ItaliaApp.entitlements; path = ItaliaApp/ItaliaApp.entitlements; sourceTree = "<group>"; };
875B0C3A5326413494A9311A /* DMMono-Medium.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "DMMono-Medium.ttf"; path = "../assets/fonts/DMMono/DMMono-Medium.ttf"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -205,6 +209,15 @@
name = Resources;
sourceTree = "<group>";
};
42DF4125DB3EC05AE583CDCA /* ExpoModulesProviders */ = {
isa = PBXGroup;
children = (
EAC7ACCDE689D795BC9749F6 /* ItaliaApp */,
9D14DFA9EA8B31AE3B1F2490 /* ItaliaAppTests */,
);
name = ExpoModulesProviders;
sourceTree = "<group>";
};
591602A69619994F43D34A93 /* Pods */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -235,6 +248,7 @@
132A5D6B2032B79F00AB7333 /* Recovered References */,
D4DC8E1B3B2C5EA1E4968752 /* Frameworks */,
591602A69619994F43D34A93 /* Pods */,
42DF4125DB3EC05AE583CDCA /* ExpoModulesProviders */,
);
indentWidth = 2;
sourceTree = "<group>";
Expand All @@ -250,6 +264,14 @@
name = Products;
sourceTree = "<group>";
};
9D14DFA9EA8B31AE3B1F2490 /* ItaliaAppTests */ = {
isa = PBXGroup;
children = (
7185D68AE95C6CC7E09C7C84 /* ExpoModulesProvider.swift */,
);
name = ItaliaAppTests;
sourceTree = "<group>";
};
D4DC8E1B3B2C5EA1E4968752 /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand All @@ -262,6 +284,14 @@
name = Frameworks;
sourceTree = "<group>";
};
EAC7ACCDE689D795BC9749F6 /* ItaliaApp */ = {
isa = PBXGroup;
children = (
67EA4A69F1DB7B286474145D /* ExpoModulesProvider.swift */,
);
name = ItaliaApp;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -548,6 +578,7 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ItaliaApp/Pods-ItaliaApp-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
"${PODS_ROOT}/Mixpanel/Mixpanel/Images/MPArrowLeft.png",
"${PODS_ROOT}/Mixpanel/Mixpanel/Images/[email protected]",
"${PODS_ROOT}/Mixpanel/Mixpanel/Images/MPArrowRight.png",
Expand All @@ -569,6 +600,7 @@
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MPArrowLeft.png",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/[email protected]",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MPArrowRight.png",
Expand Down Expand Up @@ -640,6 +672,7 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ItaliaApp-ItaliaAppTests/Pods-ItaliaApp-ItaliaAppTests-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
"${PODS_ROOT}/Mixpanel/Mixpanel/Images/MPArrowLeft.png",
"${PODS_ROOT}/Mixpanel/Mixpanel/Images/[email protected]",
"${PODS_ROOT}/Mixpanel/Mixpanel/Images/MPArrowRight.png",
Expand All @@ -661,6 +694,7 @@
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MPArrowLeft.png",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/[email protected]",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MPArrowRight.png",
Expand Down Expand Up @@ -693,6 +727,7 @@
buildActionMask = 2147483647;
files = (
00E356F31AD99517003FC87E /* ItaliaAppTests.m in Sources */,
4AB5E4A24A70980899AA5234 /* ExpoModulesProvider.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -702,6 +737,7 @@
files = (
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
668F6CA367F172F6864226CD /* ExpoModulesProvider.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -757,8 +793,10 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = "it.teamdigitale.app.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ItaliaApp.app/ItaliaApp";
};
name = Debug;
Expand All @@ -779,8 +817,10 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = "it.teamdigitale.app.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ItaliaApp.app/ItaliaApp";
};
name = Release;
Expand Down Expand Up @@ -815,13 +855,14 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = it.pagopa.app.io;
PRODUCT_NAME = ItaliaApp;
PROVISIONING_PROFILE = "0848c226-68ec-4314-ad27-50803db95257";
PROVISIONING_PROFILE_SPECIFIER = "match Development it.pagopa.app.io";
SWIFT_OBJC_BRIDGING_HEADER = "ItaliaApp-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.2;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
Expand Down Expand Up @@ -856,12 +897,13 @@
"-ObjC",
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = it.pagopa.app.io;
PRODUCT_NAME = ItaliaApp;
PROVISIONING_PROFILE = "0848c226-68ec-4314-ad27-50803db95257";
PROVISIONING_PROFILE_SPECIFIER = "match AppStore it.pagopa.app.io";
SWIFT_OBJC_BRIDGING_HEADER = "ItaliaApp-Bridging-Header.h";
SWIFT_VERSION = 5.2;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
Expand Down
3 changes: 2 additions & 1 deletion ios/ItaliaApp/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#import <React/RCTBridgeDelegate.h>
#import <Expo/Expo.h>
#import <UIKit/UIKit.h>
#import <UserNotifications/UNUserNotificationCenter.h> // react-native-push-notification-ios

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate> // UNUserNotificationCenterDelegate react-native-push-notification-ios
@interface AppDelegate : EXAppDelegateWrapper <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate> // UNUserNotificationCenterDelegate react-native-push-notification-ios

@property (nonatomic, strong) UIWindow *window;

Expand Down
7 changes: 4 additions & 3 deletions ios/ItaliaApp/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
RCTAppSetupPrepareApp(application);
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
#if RCT_NEW_ARCH_ENABLED
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
Expand All @@ -37,14 +37,14 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
#endif
NSDictionary *initProps = [self prepareInitialProps];
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"IO", initProps);
UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"IO" initialProperties:initProps];
if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
UIViewController *rootViewController = [self.reactDelegate createRootViewController];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
Expand All @@ -53,6 +53,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;

[super application:application didFinishLaunchingWithOptions:launchOptions];
return YES;
}
// react-native-push-notification-ios
Expand Down
9 changes: 9 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
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-permissions/scripts/setup'
Expand All @@ -17,6 +18,14 @@ production = ENV["PRODUCTION"] == "1"
IS_CI = ENV['CI']

target 'ItaliaApp' do
use_expo_modules!
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
config = use_native_modules!

pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios'
Expand Down
Loading

0 comments on commit ee24aa5

Please sign in to comment.