Skip to content

Commit

Permalink
fix: iOS 17.4 build
Browse files Browse the repository at this point in the history
  • Loading branch information
dariodumlijan committed Mar 15, 2024
1 parent a417401 commit 22a5a0e
Show file tree
Hide file tree
Showing 19 changed files with 1,030 additions and 551 deletions.
13 changes: 8 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
{
"parser": "@babel/eslint-parser",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"requireConfigFile": false,
"ecmaVersion": 8
},
"plugins": [
"jest",
"react"
],
"extends": [
"plugin:react/recommended",
"@react-native",
"airbnb",
"airbnb/hooks"
],
"rules": {
"prettier/prettier": 0,
"arrow-parens": 0,
"class-methods-use-this": 0,
"consistent-return": 0,
Expand All @@ -21,9 +26,7 @@
"import/no-extraneous-dependencies": 0,
"import/no-named-as-default": 0,
"import/no-named-as-default-member": 0,
"import/no-unresolved": [
2
],
"import/no-unresolved": 2,
"import/prefer-default-export": 0,
"jsx-a11y/anchor-is-valid": 0,
"jsx-a11y/click-events-have-key-events": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Integration
name: Test

on:
push:
Expand All @@ -17,7 +17,7 @@ env:
NODE_VERSION: 18.0

jobs:
run_tests:
test:
name: Run Tests
runs-on: ubuntu-latest
timeout-minutes: 5
Expand All @@ -41,4 +41,4 @@ jobs:
# Run tests
- run: yarn tsc
- run: yarn lint
# - run: yarn test
- run: yarn test
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ yarn-error.log

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage
/cache

# Secrets
env.json
!/__mocks__/env.json

cache/
coverage/
!/__mocks__/env.json
26 changes: 26 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"files.associations": {
"*.ruby": "erb",
"*.erb": "gemfile",
"*.html.erb": "erb",
"__bit_reference": "cpp",
"__hash_table": "cpp",
"__split_buffer": "cpp",
"__tree": "cpp",
"array": "cpp",
"deque": "cpp",
"initializer_list": "cpp",
"ios": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"span": "cpp",
"string": "cpp",
"string_view": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"valarray": "cpp",
"vector": "cpp",
"*.ipp": "cpp"
}
}
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.13'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
# bound in the template on Cocoapods with next React Native release.
gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
17 changes: 12 additions & 5 deletions __tests__/Body.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'react-native';
import React from 'react';
import { Provider } from 'react-redux';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
Expand All @@ -7,18 +8,24 @@ import PortalProvider from '../app/components/containers/portal/PortalProvider';
import { store } from '../app/store';
import { GlobalTypes } from '../app/store/globalStore';

describe('Body tests', () => {
test('triggers API calls', () => {
const storeSpy = jest.spyOn(store, 'dispatch');
it('Body: triggers API calls', () => {
let container: renderer.ReactTestRenderer;
const dispatchSpy = jest.spyOn(store, 'dispatch');

renderer.create(
renderer.act(() => {
container = renderer.create(
<Provider store={store}>
<PortalProvider>
<Body />
</PortalProvider>
</Provider>,
);
});

expect(storeSpy).toHaveBeenCalledWith(expect.objectContaining({ type: GlobalTypes.GB_GET_DEPLOYMENT_DATA }));
renderer.act(() => {
container.unmount();
});

expect(dispatchSpy).toHaveBeenCalledWith(expect.objectContaining({ type: GlobalTypes.GB_GET_DEPLOYMENT_DATA }));
dispatchSpy.mockClear();
});
9 changes: 5 additions & 4 deletions app/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ import { reducer as globalStoreReducer } from './globalStore';
import { reducer as staticStoreReducer } from './staticStore';
import { config } from '../tokens';
import { isPromise } from '../utils';
import type { Dispatch } from '@reduxjs/toolkit';

function promiseMiddleware({ dispatch }) {
return (next) => (action) => {
function promiseMiddleware({ dispatch }: { dispatch: Dispatch }) {
return (next: (arg0: any) => any) => (action: { payload: Promise<any>; type: any; }) => {
if (action.payload && isPromise(action.payload)) {
action.payload
.then((payload) => {
.then((payload: any) => {
dispatch({
type: `${action.type}_FULFILLED`,
payload,
});
})
.catch((e) => {
.catch((e: { status: any; name: any; message: any; }) => {
console.error(
`REDUX: ${action.type}_REJECTED: statusCode = `,
(e && e.status) || '',
Expand Down
2 changes: 1 addition & 1 deletion app/store/staticStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const selectors = {
getAdmobIds: (state: RootState): AdmobIds => getAdmobIds(state),
};

export const reducer = (state, action: ReduxAction) => {
export const reducer = (state: any, action: ReduxAction) => {
switch (action.type) {
default:
return state || {};
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
};
};
2 changes: 1 addition & 1 deletion index.ts → index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { AppRegistry, LogBox } from 'react-native';
import App from './app/App';
import App from './app/App.tsx';
import { name } from './app.json';

LogBox.ignoreLogs(['Require cycle:']);
Expand Down
24 changes: 11 additions & 13 deletions ios/NegativeHarmony.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,13 @@
files = (
);
inputPaths = (
"$(SRCROOT)/.xcode.env.local",
"$(SRCROOT)/.xcode.env",
);
name = "Bundle React Native code and images";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
shellScript = "set -e\n\n# Fix for machines using nvm\nif [[ -s \"$HOME/.nvm/nvm.sh\" ]]; then\n. \"$HOME/.nvm/nvm.sh\"\nelif [[ -x \"$(command -v brew)\" && -s \"$(brew --prefix nvm)/nvm.sh\" ]]; then\n. \"$(brew --prefix nvm)/nvm.sh\"\nfi\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -642,9 +640,13 @@
PRODUCT_BUNDLE_IDENTIFIER = com.chimerastudio.negativeharmonyios;
PRODUCT_NAME = NegativeHarmony;
PROVISIONING_PROFILE_SPECIFIER = "Negative Harmony App Store Distribution";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 14.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
Expand Down Expand Up @@ -677,8 +679,12 @@
PRODUCT_BUNDLE_IDENTIFIER = com.chimerastudio.negativeharmonyios;
PRODUCT_NAME = NegativeHarmony;
PROVISIONING_PROFILE_SPECIFIER = "Negative Harmony App Store Distribution";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TVOS_DEPLOYMENT_TARGET = 14.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
Expand Down Expand Up @@ -751,11 +757,7 @@
"-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
OTHER_LDFLAGS = "$(inherited)";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down Expand Up @@ -822,11 +824,7 @@
"-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1",
);
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
OTHER_LDFLAGS = "$(inherited)";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down
2 changes: 1 addition & 1 deletion ios/NegativeHarmony/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
self.moduleName = @"NegativeHarmony";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
// self.initialProps = @{};
self.initialProps = @{};

return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ target 'NegativeHarmony' do
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => flipper_config,
# :flipper_configuration => flipper_config,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
Expand Down
Loading

0 comments on commit 22a5a0e

Please sign in to comment.