Skip to content

Commit

Permalink
Merge branch 'master' into @LucaColonnello/fix-web-browser-app-state-…
Browse files Browse the repository at this point in the history
…init
  • Loading branch information
LucaColonnello committed Feb 5, 2020
2 parents 4144dcf + b3eaf83 commit 8617d93
Show file tree
Hide file tree
Showing 1,507 changed files with 62,840 additions and 19,240 deletions.
92 changes: 51 additions & 41 deletions .circleci/config.yml
Expand Up @@ -358,10 +358,12 @@ workflows:
- expotools
- client_android
- client_ios
- test_suite_publish
- android_test_suite:
requires:
- test_suite_publish
# Disabled until further notice
# See https://exponent-internal.slack.com/archives/C1QNF5L3C/p1576852692010900
# - test_suite_publish
# - android_test_suite:
# requires:
# - test_suite_publish
- client_android_approve_google_play:
type: approval
requires:
Expand Down Expand Up @@ -718,29 +720,31 @@ jobs:
echo "You can deploy this by updating or creating a new file in https://github.com/expo/turtle/tree/master/shellTarballs/android"
echo "Then follow the deployment instructions: https://github.com/expo/turtle-deploy"
android_test_suite:
executor: android
steps:
- setup
- guard_sdk_tests
- update_submodules
- yarn_install:
working_directory: ~/expo # need jsc-android dependency in expokit-npm-package
- yarn_install:
working_directory: ~/expo/tools-public
- restore_gradle_cache
- run:
name: Build APK, upload to Device Farm, follow device logs
command: |
nix-shell android/shell.nix --pure \
--keep AWS_ACCESS_KEY_ID \
--keep AWS_SECRET_ACCESS_KEY \
--keep SSL_CERT_FILE \
--keep FASTLANE_SKIP_UPDATE_CHECK \
--keep FASTLANE_DISABLE_COLORS \
--keep CI \
--run "fastlane android devicefarm"
- save_gradle_cache
# Disabled until further notice
# See https://exponent-internal.slack.com/archives/C1QNF5L3C/p1576852692010900
# android_test_suite:
# executor: android
# steps:
# - setup
# - guard_sdk_tests
# - update_submodules
# - yarn_install:
# working_directory: ~/expo # need jsc-android dependency in expokit-npm-package
# - yarn_install:
# working_directory: ~/expo/tools-public
# - restore_gradle_cache
# - run:
# name: Build APK, upload to Device Farm, follow device logs
# command: |
# nix-shell android/shell.nix --pure \
# --keep AWS_ACCESS_KEY_ID \
# --keep AWS_SECRET_ACCESS_KEY \
# --keep SSL_CERT_FILE \
# --keep FASTLANE_SKIP_UPDATE_CHECK \
# --keep FASTLANE_DISABLE_COLORS \
# --keep CI \
# --run "fastlane android devicefarm"
# - save_gradle_cache

client_android:
executor: android
Expand Down Expand Up @@ -818,6 +822,10 @@ jobs:
- update_submodules
- yarn_install:
working_directory: docs
- run:
name: Run Danger
working_directory: docs
command: yarn danger ci
- yarn:
command: export
working_directory: docs
Expand Down Expand Up @@ -850,17 +858,19 @@ jobs:
command: ./deploy.sh
working_directory: docs

test_suite_publish:
executor: nix
steps:
- setup
- conditionally_halt:
# Exclude .git/, node_modules,THIRD-PARTY-LICENSES, LICENSE, docs/, guides/, template-files/, templates/, native-component-list/, bare-expo/, and every `.md` file
exclude: '^(.*)(\/(.git\/|LICENSE|THIRD-PARTY-LICENSES|node_modules|docs|guides|scripts|template-files|templates|native-component-list|bare-expo).*|\.md$)'
search_depth: 1
- update_submodules
- decrypt_secrets_if_possible
- run:
name: Publish
working_directory: ~/expo/apps/test-suite
command: ./publish.sh
# Disabled until further notice
# See https://exponent-internal.slack.com/archives/C1QNF5L3C/p1576852692010900
# test_suite_publish:
# executor: nix
# steps:
# - setup
# - conditionally_halt:
# # Exclude .git/, node_modules,THIRD-PARTY-LICENSES, LICENSE, docs/, guides/, template-files/, templates/, native-component-list/, bare-expo/, and every `.md` file
# exclude: '^(.*)(\/(.git\/|LICENSE|THIRD-PARTY-LICENSES|node_modules|docs|guides|scripts|template-files|templates|native-component-list|bare-expo).*|\.md$)'
# search_depth: 1
# - update_submodules
# - decrypt_secrets_if_possible
# - run:
# name: Publish
# working_directory: ~/expo/apps/test-suite
# command: ./publish.sh
34 changes: 3 additions & 31 deletions .github/stale.yml
Expand Up @@ -9,20 +9,11 @@ daysUntilClose: 30

# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels:
- status:needs more info
- 'status: needs more info'

# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels: []

# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false

# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false

# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false

# Label to use when marking as stale
staleLabel: stale

Expand All @@ -32,30 +23,11 @@ markComment: >
can properly address it, we will be closing it in one month. If you've found a fix, please share it! Otherwise, please
provide the info we asked for, especially a reproducible example. Thanks!
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.

# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
closeComment: >
This issue has been automatically closed since there has not been
any recent activity after it was marked as stale. Please open a new issue for any
related bugs.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30

# Limit to only `issues` or `pulls`
only: issues

# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
# pulls:
# daysUntilStale: 30
# markComment: >
# This pull request has been automatically marked as stale because it has not had
# recent activity. It will be closed if no further activity occurs. Thank you
# for your contributions.

# issues:
# exemptLabels:
# - confirmed
only: issues
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -74,6 +74,7 @@ jarjar-rules.txt
/android/expoview/src/main/java/host/exp/exponent/generated/ExponentKeys.java
/android/app/fabric.properties
/apps/bare-expo/android/app/google-services.json
/apps/bare-expo/ios/BareExpo/GoogleService-Info.plist
/ios/Exponent/Generated/EXKeys.h
/ios/ExponentIntegrationTests/EXTestEnvironment.plist
/exponent-view-template/ios/Podfile
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Expand Up @@ -8,6 +8,8 @@ This is the log of notable changes to the Expo client that are developer-facing.

### 🛠 Breaking changes

- `expo-constants` `Constants.deviceName` now only returns the possible Browser name and doesn't fallback to engine or OS name. ([#6809](https://github.com/expo/expo/pull/6809) [@evanbacon](https://github.com/evanbacon))
- `expo-constants` `Constants.platform.web` now only returns the `ua` (user agent string). ([#6809](https://github.com/expo/expo/pull/6809) [@evanbacon](https://github.com/evanbacon))
- Enriched `androidStatusBar` configuration in `app.json`. ([#6506](https://github.com/expo/expo/pull/6506) [@bbarthec](https://github.com/bbarthec))

### 🎉 New features
Expand All @@ -23,6 +25,7 @@ This is the log of notable changes to the Expo client that are developer-facing.
- Fixed fullscreen events on iOS for native controls. ([#6504](https://github.com/expo/expo/pull/6504) by [@mczernek](https://github.com/mczernek))
- Fixed `Camera.takePictureAsync()` not saving metadata on iOS. ([#6428](https://github.com/expo/expo/pull/6428) by [@lukmccall](https://github.com/lukmccall))
- Fixed `KeyboardAvoidingView` in standalone Android builds. ([#6506](https://github.com/expo/expo/pull/6506) [@bbarthec](https://github.com/bbarthec))
- Fixed `FileSystem.downloadAsync()` throwing `NullPointerException` in rare failures on Android. ([#6819](https://github.com/expo/expo/pull/6819) by [@jsamr](https://github.com/jsamr/))

## 36.0.0

Expand All @@ -46,7 +49,8 @@ This is the log of notable changes to the Expo client that are developer-facing.
- **`jest-expo`**: Removed `mockPlatformIOS()`, `mockPlatformAndroid()`, `mockPlatformWeb()`, `describeCrossPlatform()` in favor of platform specific presets like `jest-expo/universal`. ([#5645](https://github.com/expo/expo/pull/5645) by [@EvanBacon](https://github.com/EvanBacon))
- **`expo`**: Removed Branch export from `expo/Branch`. ([#6190](https://github.com/expo/expo/pull/6190) by [@sjchmiela](https://github.com/sjchmiela))
- **`expo`**: Removed `ErrorRecovery` from the `expo` package and extracted into `expo-error-recovery` unimodule. ([#5357](https://github.com/expo/expo/pull/5357) by [@lukmccall](https://github.com/lukmccall))
- **`expo`**: Updated `Linking.parse` to better handle non-expo URLs. ([#5179](https://github.com/expo/expo/pull/5179) by [@koenpunt](https://github.com/koenpunt))
- **`expo`**: Updated `Linking.parse` to better handle non-expo URLs. URLs like `myapp://hello/world` are now parsed so that `hello` is the hostname and `world` is the path, according to the URI specification; [more info here](https://github.com/expo/expo/issues/6497#issuecomment-574882448). ([#5179](https://github.com/expo/expo/pull/5179) by [@koenpunt](https://github.com/koenpunt))
- **`expo`**: Updated `Linking.makeUrl` to create URLs that follow the [URI specification](https://tools.ietf.org/html/rfc3986#section-3). Making a hostless URL will result in the format `myapp:///path/into/app` ([#6781](https://github.com/expo/expo/pull/6781) by [@cruzach](https://github.com/cruzach))
- **`expo-analytics-segment`**: Fixed `enabled` behavior inverted on iOS. ([#6242](https://github.com/expo/expo/pull/6242) by [@sjchmiela](https://github.com/sjchmiela))
- **`expo-facebook`**: Disabled autoinitialization of the Facebook SDK and added an `initializeAsync` method and `autoinit` app.json setting. ([#5924] by [@sjchmiela](https://github.com/sjchmiela))
- **`expo-keep-awake`**: Removed deprecated methods and components. ([#6006](https://github.com/expo/expo/pull/6006) by [@EvanBacon](https://github.com/EvanBacon))
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
@@ -1,7 +1,7 @@
# Contributing to the Expo SDK

- [📦 Download and Setup](#-download-and-setup)
- [✍️ Editing SDK Packages](#-editing-sdk-packages)
- [✍️ Editing SDK Packages](#%EF%B8%8F-editing-sdk-packages)
- [Style](#style)
- [Extra Credit](#extra-credit)
- [⏱ Testing Your Changes](#-testing-your-changes)
Expand All @@ -24,7 +24,7 @@ Manual smoke tests are included in `apps/native-component-list`, this is a good

> 💡 How does `bare-expo` relate to `test-suite`?
>
> `bare-expo` is a bare workflow app that links all of the Expo SDK dependencies in the `packages/` directory in order to be able to run projects in the `apps/` directory in the bare workflow rather than the Expo client. It currently only runs `test-suite`. `test-suite` is is a regular managed workflow Expo app with some custom code to turn it into a test runner. If you run `expo start` in the `test-suite` directory you can load the project in Expo client. `bare-expo` imports the `test-suite` app root component and uses it as its own root component.
> `bare-expo` is a bare workflow app that links all of the Expo SDK dependencies in the `packages/` directory in order to be able to run projects in the `apps/` directory in the bare workflow rather than the Expo client. It currently only runs `test-suite`. `test-suite` is a regular managed workflow Expo app with some custom code to turn it into a test runner. If you run `expo start` in the `test-suite` directory you can load the project in Expo client. `bare-expo` imports the `test-suite` app root component and uses it as its own root component.
## 📦 Download and Setup

Expand Down
1 change: 1 addition & 0 deletions android/app/build.gradle
Expand Up @@ -236,6 +236,7 @@ dependencies {
'expo-module-template',
'expo-bluetooth',
'expo-in-app-purchases',
'expo-notifications',
'expo-payments-stripe',
'expo-updates'
]
Expand Down
1 change: 1 addition & 0 deletions android/expoview/build.gradle
Expand Up @@ -170,6 +170,7 @@ dependencies {
exclude : [
'expo-module-template',
'expo-bluetooth',
'expo-notifications',
'expo-in-app-purchases',
'expo-updates',
]
Expand Down
Expand Up @@ -10,8 +10,6 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
Expand All @@ -36,6 +34,8 @@
import javax.annotation.Nullable;
import javax.inject.Inject;

import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import de.greenrobot.event.EventBus;
import host.exp.exponent.AppLoader;
import host.exp.exponent.Constants;
Expand Down Expand Up @@ -99,6 +99,7 @@ public ExponentPackageDelegate getExponentPackageDelegate() {
private boolean mIsShellApp;
private String mIntentUri;
private boolean mIsReadyForBundle;
private boolean mWillBeReloaded = false;

private RemoteViews mNotificationRemoteViews;
private Handler mNotificationAnimationHandler;
Expand Down Expand Up @@ -396,7 +397,7 @@ public void setManifest(String manifestUrl, final JSONObject manifest, final Str
Analytics.logEventWithManifestUrlSdkVersion(Analytics.LOAD_EXPERIENCE, mManifestUrl, mSDKVersion);

ExperienceActivityUtils.updateOrientation(mManifest, this);
ExperienceActivityUtils.overrideUserInterfaceStyle(mManifest, this);
mWillBeReloaded = ExperienceActivityUtils.overrideUserInterfaceStyle(mManifest, this);
addNotification(kernelOptions);

ExponentNotification notificationObject = null;
Expand Down Expand Up @@ -472,7 +473,10 @@ public void setBundle(final String localBundlePath) {
// by this point, setManifest should have also been called, so prevent
// setLoadingScreenManifest from showing a rogue loading screen
mShouldShowLoadingScreenWithOptimisticManifest = false;
if (!isDebugModeEnabled()) {

// To prevents starting application twice, we start react instance only if we know that the current activity won't be restarted.
// Restart of the activity could be triggered by dark mode change.
if (!isDebugModeEnabled() && !mWillBeReloaded) {
final boolean finalIsReadyForBundle = mIsReadyForBundle;
AsyncCondition.wait(READY_FOR_BUNDLE, new AsyncCondition.AsyncConditionListener() {
@Override
Expand Down
Expand Up @@ -317,9 +317,12 @@ private RNObject startReactInstance(final Exponent.StartReactInstanceDelegate de
}

RNObject reactInstanceManager = builder.callRecursive("build");
RNObject devSettings = reactInstanceManager.callRecursive("getDevSupportManager").callRecursive("getDevSettings");
if (devSettings != null) {
devSettings.setField("exponentActivityId", mActivityId);
RNObject devSupportManager = mReactInstanceManager.callRecursive("getDevSupportManager");
if (devSupportManager != null) {
RNObject devSettings = devSupportManager.callRecursive("getDevSettings");
if (devSettings != null) {
devSettings.setField("exponentActivityId", mActivityId);
}
}

reactInstanceManager.call("createReactContextInBackground");
Expand Down
Expand Up @@ -5,6 +5,7 @@
import android.app.Activity;
import android.app.ActivityManager;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Build;
Expand All @@ -21,6 +22,7 @@

import host.exp.exponent.ExponentManifest;
import host.exp.exponent.analytics.EXL;
import host.exp.expoview.R;

import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -56,10 +58,22 @@ public static void updateOrientation(JSONObject manifest, Activity activity) {

// region user interface style - light/dark/automatic mode

public static void overrideUserInterfaceStyle(JSONObject manifest, AppCompatActivity activity) {
/**
* Returns true if activity will be reloaded after night mode change.
* Otherwise returns false.
**/
public static boolean overrideUserInterfaceStyle(JSONObject manifest, AppCompatActivity activity) {
String userInterfaceStyle = readUserInterfaceStyleFromManifest(manifest);
int mode = nightModeFromString(userInterfaceStyle);
boolean isNightModeCurrentlyOn = activity.getResources().getBoolean(R.bool.dark_mode);
boolean willBeReloaded = false;
if (mode != AppCompatDelegate.MODE_NIGHT_AUTO) {
willBeReloaded = isNightModeCurrentlyOn && mode == AppCompatDelegate.MODE_NIGHT_NO
|| !isNightModeCurrentlyOn && mode == AppCompatDelegate.MODE_NIGHT_YES;
}

activity.getDelegate().setLocalNightMode(mode);
return willBeReloaded;
}

private static int nightModeFromString(@Nullable String userInterfaceStyle) {
Expand Down
Expand Up @@ -9,6 +9,7 @@
import com.facebook.react.modules.core.PermissionListener;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -68,9 +69,15 @@ public void requestPermissions(ReactNativeActivity currentActivity, final String

if (!mPermissionsToRequestPerExperience.isEmpty()) {
requestExperienceAndGlobalPermissions(mPermissionsToRequestPerExperience.get(mPermissionsAskedCount - 1));
} else if (!mPermissionsToRequestGlobally.isEmpty() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
currentActivity.requestPermissions(mPermissionsToRequestGlobally.toArray(new String[0]),
} else if (!mPermissionsToRequestGlobally.isEmpty()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
currentActivity.requestPermissions(mPermissionsToRequestGlobally.toArray(new String[0]),
EXPONENT_PERMISSIONS_REQUEST);
} else {
int[] result = new int[mPermissionsToRequestGlobally.size()];
Arrays.fill(result, PackageManager.PERMISSION_DENIED);
onRequestPermissionsResult(mPermissionsToRequestGlobally.toArray(new String[0]), result);
}
}
}

Expand Down
Expand Up @@ -22,6 +22,8 @@
import expo.modules.camera.CameraPackage;
import expo.modules.cellular.CellularPackage;
import expo.modules.errorrecovery.ErrorRecoveryPackage;
import expo.modules.screenorientation.ScreenOrientationPackage;
import expo.modules.imageloader.ImageLoaderPackage;
import expo.modules.sharing.SharingPackage;
import expo.modules.constants.ConstantsPackage;
import expo.modules.contacts.ContactsPackage;
Expand Down Expand Up @@ -87,6 +89,7 @@ public class ExperiencePackagePicker {
new GLPackage(),
new GoogleSignInPackage(),
new HapticsPackage(),
new ImageLoaderPackage(),
new ImageManipulatorPackage(),
new ImagePickerPackage(),
new IntentLauncherPackage(),
Expand All @@ -103,6 +106,7 @@ public class ExperiencePackagePicker {
new RandomPackage(),
new SMSPackage(),
new SQLitePackage(),
new ScreenOrientationPackage(),
new SecureStorePackage(),
new SegmentPackage(),
new SensorsPackage(),
Expand Down

0 comments on commit 8617d93

Please sign in to comment.