Skip to content

Commit

Permalink
Merge pull request #68 from shoutem/release/2.4.1-rc.0
Browse files Browse the repository at this point in the history
Release/2.4.1 - master
  • Loading branch information
majaklajic authored Sep 2, 2020
2 parents cd66657 + e8762c2 commit 814b936
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 18 deletions.
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
android:allowBackup="true"
android:label="${appName}"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:requestLegacyExternalStorage="true">

<activity
android:name=".MainActivity"
Expand Down
6 changes: 5 additions & 1 deletion core/AppBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import {
getApplicationCanonicalObject,
renderMainContent,
renderProviders,
createAppContextConsumer,
} from './services';

const APP_CONTEXT = Symbol('appContext');

export let AppContextProvider;

// Temporarily ignoring cyclic dependency warnings and deprecated lifecycle
// methods until package maintainers can resolve these
YellowBox.ignoreWarnings([
Expand Down Expand Up @@ -178,7 +181,7 @@ export class AppBuilder {
*
* @param {Function} renderFunction Navigation bar render function
*/
setRenderNavigationBar(renderFunction = () => {}) {
setRenderNavigationBar(renderFunction = () => { }) {
this[APP_CONTEXT].renderNavigationBar = renderFunction;
return this;
}
Expand All @@ -195,6 +198,7 @@ export class AppBuilder {
const appContext = Object.assign({}, this[APP_CONTEXT]);

assertExtensionsExist(appContext.extensions);
AppContextProvider = createAppContextConsumer(appContext.extensions);

appContext.screens = getApplicationCanonicalObject('screens', appContext);
appContext.themes = getApplicationCanonicalObject('themes', appContext);
Expand Down
2 changes: 1 addition & 1 deletion core/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { AppBuilder } from './AppBuilder';
export { AppBuilder, AppContextProvider } from './AppBuilder';

export {
after,
Expand Down
32 changes: 32 additions & 0 deletions core/services/builder.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import React, { PureComponent } from 'react';
import _ from 'lodash';

export function assertNotEmpty(target, errorMessage) {
if (!target) {
throw new Error(errorMessage);
Expand Down Expand Up @@ -49,6 +52,35 @@ export function renderProviders(extensions, mainContent) {
return renderedContent;
}

export function createAppContextConsumer(extensions) {
return class Consumer extends PureComponent {
render() {
const { children } = this.props;

const contexts = _.reduce(extensions, (res, extension) => {
if (extension.context) {
res.push(extension.context);
}
return res;
}, []);

const renderer = _.reduce(contexts, (res, Context) => {
return value => (
<Context.Consumer>
{contextValue => res({
...value,
...contextValue,
})
}
</Context.Consumer>
);
}, value => children(value));

return renderer({});
}
};
}

/**
* Extracts all of the canonical objects from provided extension. This function will
* return an object that has exported canonical type object assigned to it name
Expand Down
3 changes: 2 additions & 1 deletion core/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ export {
getApplicationCanonicalObject,
renderMainContent,
renderProviders,
createAppContextConsumer,
} from './builder';

export {
canonicalResource,
canonicalRenderResource,
} from './resource.js';
} from './resource';

export {
extractNamedExports,
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ install! 'cocoapods', :deterministic_uuids => false
target 'ShoutemApp' do
config = use_native_modules!

use_react_native!(:path => config["reactNativePath"])
use_react_native!

## <Extension dependencies>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shoutem/platform",
"version": "2.4.0",
"version": "2.4.1",
"scripts": {
"android": "react-native run-android",
"build": "node scripts/build",
Expand Down
2 changes: 1 addition & 1 deletion package.template.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shoutem/platform",
"version": "2.4.0",
"version": "2.4.1",
"scripts": {
"android": "react-native run-android",
"build": "node scripts/build",
Expand Down
22 changes: 11 additions & 11 deletions platform/platform.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"version": "2.4.0",
"mobileAppVersion": "2.4.0",
"releaseNotes": "* For devs: React Native 0.63.2\n* For devs: Introduce peerDependencies to Extensions\n* For devs: Introduce Flipper\n* Bugfixes and improvements",
"version": "2.4.1",
"mobileAppVersion": "2.4.1",
"releaseNotes": "* SendBird Chat extension\n* Advertising extension\n* Bugfixes and stability improvements",
"settings": {
"DEV-appetizeKey": "87802rvr158e8th9n3tffpkhcc",
"QA-appetizeKey": "rzprn6duxft9v4ua0arx5k4fac",
"Production-appetizeKey": "u9hm71h5ayn0w6xjt0e9m1ta5w"
"DEV-appetizeKey": "hqw5pehpfzvwjr3n69mv1942a0",
"QA-appetizeKey": "qku0mhvyew991yjzkyv3g2rpyr",
"Production-appetizeKey": "1bqu3xxrq1k7yazztuahav9aqr"
},
"builds": {
"live": {
Expand All @@ -24,7 +24,7 @@
"shoutem.about": "~2.4.0",
"shoutem.analytics": "~2.4.0",
"shoutem.application": "~2.4.0",
"shoutem.audio": "~2.4.0",
"shoutem.audio": "~2.4.1",
"shoutem.auth": "~2.4.0",
"shoutem.books": "~2.4.0",
"shoutem.camera": "~2.4.0",
Expand All @@ -40,21 +40,21 @@
"shoutem.layouts": "~2.4.0",
"shoutem.loyalty": "~2.4.0",
"shoutem.menu": "~2.4.0",
"shoutem.navigation": "~2.4.0",
"shoutem.navigation": "~2.4.1",
"shoutem.news": "~2.4.0",
"shoutem.notification-center": "~2.4.0",
"shoutem.page": "~2.4.0",
"shoutem.people": "~2.4.0",
"shoutem.persist": "~2.4.0",
"shoutem.photos": "~2.4.0",
"shoutem.places": "~2.4.0",
"shoutem.podcast": "~2.4.0",
"shoutem.preview": "~2.4.0",
"shoutem.podcast": "~2.4.1",
"shoutem.preview": "~2.4.1",
"shoutem.products": "~2.4.0",
"shoutem.push-notifications": "~2.4.0",
"shoutem.radio": "~2.4.0",
"shoutem.redux": "~2.4.0",
"shoutem.rss": "~2.4.0",
"shoutem.rss": "~2.4.1",
"shoutem.rss-news": "~2.4.0",
"shoutem.rss-photos": "~2.4.0",
"shoutem.rss-videos": "~2.4.0",
Expand Down

0 comments on commit 814b936

Please sign in to comment.