diff --git a/core/AppBuilder.js b/core/AppBuilder.js index 87083ec2f3..26418ef4b1 100644 --- a/core/AppBuilder.js +++ b/core/AppBuilder.js @@ -40,6 +40,7 @@ function createApplication(appContext) { super(props); this.store = null; + this.state = { appReady: false }; } getChildContext() { @@ -113,7 +114,7 @@ function createApplication(appContext) { this, appContext.extensions, 'appWillMount', - ); + ).then(() => this.setState({ appReady: true })); } componentDidMount() { @@ -135,6 +136,12 @@ function createApplication(appContext) { } render() { + const { appReady } = this.state; + + if (!appReady) { + return null; + } + const { extensions } = appContext; const mainContent = renderMainContent(this, extensions); const renderedContent = renderProviders(extensions, mainContent); @@ -182,7 +189,7 @@ export class AppBuilder { * * @param {Function} renderFunction Navigation bar render function */ - setRenderNavigationBar(renderFunction = () => {}) { + setRenderNavigationBar(renderFunction = () => { }) { this[APP_CONTEXT].renderNavigationBar = renderFunction; return this; } diff --git a/core/services/builder.js b/core/services/builder.js index f17fc6ca35..4e205698a3 100644 --- a/core/services/builder.js +++ b/core/services/builder.js @@ -94,7 +94,8 @@ export function createAppContextConsumer(extensions) { res({ ...value, ...contextValue, - })} + }) + } ); }, diff --git a/core/services/lifecycle.js b/core/services/lifecycle.js index e245e10985..2326c77106 100644 --- a/core/services/lifecycle.js +++ b/core/services/lifecycle.js @@ -1,3 +1,4 @@ +import _ from 'lodash'; import { extractFlattenedNamedExports } from './exports'; import { prioritizeItems } from './priority'; @@ -11,24 +12,17 @@ import { prioritizeItems } from './priority'; * @returns {Promise} that will be resolved at the end of all lifecycle functions */ export function callLifecycleFunction(app, extensions, functionName) { - const promises = []; - const lifecycleFunctions = extractFlattenedNamedExports(extensions, functionName); + const lifecycleFunctions = extractFlattenedNamedExports( + extensions, + functionName, + ); const prioritizedLifecycleFunctions = prioritizeItems(lifecycleFunctions); - prioritizedLifecycleFunctions.forEach((lifecycleFunction) => { - if (typeof lifecycleFunction === 'function') { - const result = lifecycleFunction(app); - - if (result instanceof Promise) { - const wrappedPromise = new Promise(resolve => - result - .then(() => resolve()) - .catch(() => resolve()) - ); - promises.push(wrappedPromise); - } - } - }); - - return Promise.all(promises); + return _.reduce( + prioritizedLifecycleFunctions, + (result, lifeCycle) => { + return result.then(() => lifeCycle(app)); + }, + Promise.resolve(), + ); } diff --git a/core/services/priority.js b/core/services/priority.js index 0345bbafe3..7ac38943ec 100644 --- a/core/services/priority.js +++ b/core/services/priority.js @@ -4,6 +4,7 @@ export const priorities = Object.freeze({ NAVIGATION: 200, AUTH: 300, REDUX: 500, + FIREBASE: 700, NETWORKING: 900, DEFAULT: 5000, LAST: Number(Infinity), diff --git a/package.json b/package.json index f53dbba0ce..9434bf52ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@shoutem/platform", - "version": "6.0.1", + "version": "7.0.0", "scripts": { "android": "react-native run-android", "build": "node scripts/build", diff --git a/package.template.json b/package.template.json index f53dbba0ce..9434bf52ec 100644 --- a/package.template.json +++ b/package.template.json @@ -1,6 +1,6 @@ { "name": "@shoutem/platform", - "version": "6.0.1", + "version": "7.0.0", "scripts": { "android": "react-native run-android", "build": "node scripts/build", diff --git a/patches/react-native+0.66.0.patch b/patches/react-native+0.66.0.patch index 4d4770913f..234d6c8dc3 100644 --- a/patches/react-native+0.66.0.patch +++ b/patches/react-native+0.66.0.patch @@ -18,3 +18,24 @@ index c498ba6..0765f28 100755 set -e # Support Homebrew on M1 +diff --git a/node_modules/react-native/React/Views/RCTModalHostView.m b/node_modules/react-native/React/Views/RCTModalHostView.m +index bea9e08..68d80d8 100644 +--- a/node_modules/react-native/React/Views/RCTModalHostView.m ++++ b/node_modules/react-native/React/Views/RCTModalHostView.m +@@ -116,10 +116,12 @@ - (void)didUpdateReactSubviews + + - (void)dismissModalViewController + { +- if (_isPresented) { +- [_delegate dismissModalHostView:self withViewController:_modalViewController animated:[self hasAnimationType]]; +- _isPresented = NO; +- } ++ dispatch_async(dispatch_get_main_queue(), ^{ ++ if (self->_isPresented) { ++ [self->_delegate dismissModalHostView:self withViewController:self->_modalViewController animated:[self hasAnimationType]]; ++ self->_isPresented = NO; ++ } ++ }); + } + + - (void)didMoveToWindow diff --git a/platform/platform.json b/platform/platform.json index 6de4b08113..81c7e35b3a 100644 --- a/platform/platform.json +++ b/platform/platform.json @@ -1,7 +1,7 @@ { - "version": "6.0.1", - "mobileAppVersion": "6.0.1", - "releaseNotes": "* Reworked RSS feed resolution resulting in more optimised feed fetching and parsing", + "version": "7.0.0", + "mobileAppVersion": "7.0.0", + "releaseNotes": "* Improved prioritization of lifecycle functions execution\n* Improved preview build caching mechanism.", "settings": { "DEV-appetizeKey": "e4jq4nuwkw6z6ejfp62zu2q8ur", "QA-appetizeKey": "b6p3zptqr2j28wb4qymhnbn3dr", @@ -23,24 +23,24 @@ "dependencies": { "shoutem.about": "~6.0.0", "shoutem.analytics": "~4.0.2", - "shoutem.application": "~4.1.1", + "shoutem.application": "~4.1.2", "shoutem.audio": "~4.0.2", - "shoutem.auth": "~5.0.2", + "shoutem.auth": "~5.1.0", "shoutem.camera": "~5.0.0", - "shoutem.cms": "~5.0.1", + "shoutem.cms": "~6.0.0", "shoutem.code-push": "~4.1.1", "shoutem.deals": "~6.0.1", "shoutem.events": "~5.0.0", - "shoutem.favorites": "~5.0.0", - "shoutem.firebase": "~4.1.1", + "shoutem.favorites": "~6.0.0", + "shoutem.firebase": "~4.1.2", "shoutem.flurry-analytics": "~4.0.2", - "shoutem.i18n": "~4.0.4", + "shoutem.i18n": "~4.0.5", "shoutem.ical-events": "~5.0.0", "shoutem.layouts": "~7.0.0", - "shoutem.loyalty": "~5.0.1", - "shoutem.navigation": "~5.0.1", + "shoutem.loyalty": "~6.0.0", + "shoutem.navigation": "~5.0.4", "shoutem.news": "~6.0.0", - "shoutem.notification-center": "~5.0.1", + "shoutem.notification-center": "~7.0.0", "shoutem.page": "~5.0.0", "shoutem.people": "~5.0.0", "shoutem.permissions": "~4.0.3", @@ -49,22 +49,22 @@ "shoutem.places": "~6.0.0", "shoutem.preview": "~4.0.2", "shoutem.products": "~5.0.0", - "shoutem.push-notifications": "~4.0.2", - "shoutem.redux": "~4.1.2", - "shoutem.rss": "~5.0.0", - "shoutem.rss-monitoring": "~4.1.0", + "shoutem.push-notifications": "~4.0.3", + "shoutem.redux": "~4.1.3", + "shoutem.rss": "~5.0.1", + "shoutem.rss-monitoring": "~4.1.1", "shoutem.rss-news": "~5.1.0", "shoutem.rss-photos": "~5.1.0", "shoutem.rss-videos": "~5.1.0", - "shoutem.rubicon-theme": "~5.0.0", - "shoutem.social": "~7.0.1", + "shoutem.rubicon-theme": "~5.0.1", + "shoutem.social": "~8.0.0", "shoutem.sub-navigation": "~4.0.2", - "shoutem.theme": "~5.0.0", - "shoutem.user-profile": "~3.0.0", + "shoutem.theme": "~5.0.1", + "shoutem.user-profile": "~4.0.0", "shoutem.video": "~7.0.0", "shoutem.vimeo": "~5.1.0", - "shoutem.web-view": "~5.0.0", + "shoutem.web-view": "~5.0.1", "shoutem.wordpress": "~5.0.0", - "shoutem.youtube": "~5.0.1" + "shoutem.youtube": "~5.0.2" } }