expo-splash-screen 0.12.0 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "/Users/tomasz/Work/expo/packages/expo-splash-screen/tsconfig.json",
2
+ "extends": "/Users/brentvatne/code/expo/packages/expo-splash-screen/tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "module": "esnext",
5
5
  "typeRoots": [
@@ -7,7 +7,7 @@
7
7
  "../node_modules/@types",
8
8
  "../../node_modules/@types",
9
9
  "../../../node_modules/@types",
10
- "/Users/tomasz/Work/expo/packages/expo-module-scripts/ts-declarations"
10
+ "/Users/brentvatne/code/expo/packages/expo-module-scripts/ts-declarations"
11
11
  ]
12
12
  }
13
13
  }
package/CHANGELOG.md CHANGED
@@ -10,6 +10,37 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.13.3 — 2021-10-15
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix `No native splash screen registered for given view controller` error happening when project is using both `expo-dev-client` and `expo-splash-screen` packages. ([#14745](https://github.com/expo/expo/pull/14745) by [@kudo](https://github.com/kudo))
18
+
19
+ ## 0.13.2 — 2021-10-15
20
+
21
+ _This version does not introduce any user-facing changes._
22
+
23
+ ## 0.13.1 — 2021-10-01
24
+
25
+ ### 🐛 Bug fixes
26
+
27
+ - Fix expo-screen-orientation breaking for expo-updates + expo-splash-screen integration. ([#14519](https://github.com/expo/expo/pull/14519) by [@kudo](https://github.com/kudo))
28
+
29
+ ## 0.13.0 — 2021-09-28
30
+
31
+ ### 🛠 Breaking changes
32
+
33
+ - Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
34
+
35
+ ### 🐛 Bug fixes
36
+
37
+ - Fix 'No native splash screen registered' warning from reloading apps. ([#14467](https://github.com/expo/expo/pull/14467) by [@kudo](https://github.com/kudo))
38
+ - Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
39
+
40
+ ### 💡 Others
41
+
42
+ - Updated `@expo/configure-splash-screen`, `@expo/prebuild-config` ([#14443](https://github.com/expo/expo/pull/14443) by [@EvanBacon](https://github.com/EvanBacon))
43
+
13
44
  ## 0.12.0 — 2021-09-09
14
45
 
15
46
  ### 🎉 New features
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.12.0'
6
+ version = '0.13.3'
7
7
 
8
8
  buildscript {
9
9
  // Simple helper that allows the root project to override versions declared by this library.
@@ -57,7 +57,7 @@ android {
57
57
  minSdkVersion safeExtGet('minSdkVersion', 21)
58
58
  targetSdkVersion safeExtGet('targetSdkVersion', 30)
59
59
  versionCode 17
60
- versionName '0.12.0'
60
+ versionName '0.13.3'
61
61
  }
62
62
  lintOptions {
63
63
  abortOnError false
@@ -4,6 +4,11 @@ import android.content.Context
4
4
  import androidx.core.content.ContextCompat
5
5
 
6
6
  // this needs to stay for versioning to work
7
+ /* ktlint-disable no-unused-imports */
8
+ import expo.modules.splashscreen.SplashScreenImageResizeMode
9
+ import expo.modules.splashscreen.SplashScreenViewProvider
10
+ // EXPO_VERSIONING_NEEDS_EXPOVIEW_R
11
+ /* ktlint-enable no-unused-imports */
7
12
 
8
13
  /**
9
14
  * Default implementation that uses native resources.
@@ -8,6 +8,12 @@ import com.facebook.react.ReactRootView
8
8
  import expo.modules.core.interfaces.ReactActivityLifecycleListener
9
9
  import expo.modules.splashscreen.singletons.SplashScreen
10
10
 
11
+ // this needs to stay for versioning to work
12
+ /* ktlint-disable no-unused-imports */
13
+ import expo.modules.splashscreen.SplashScreenImageResizeMode
14
+ // EXPO_VERSIONING_NEEDS_EXPOVIEW_R
15
+ /* ktlint-enable no-unused-imports */
16
+
11
17
  class SplashScreenReactActivityLifecycleListener(activityContext: Context) : ReactActivityLifecycleListener {
12
18
  override fun onCreate(activity: Activity, savedInstanceState: Bundle?) {
13
19
  // To support backward compatible or SplashScreenImageResizeMode customization
@@ -6,6 +6,11 @@ import android.view.ViewGroup
6
6
  import android.widget.ImageView
7
7
  import android.widget.RelativeLayout
8
8
 
9
+ // this needs to stay for versioning to work
10
+ /* ktlint-disable no-unused-imports */
11
+ import expo.modules.splashscreen.SplashScreenImageResizeMode
12
+ /* ktlint-enable no-unused-imports */
13
+
9
14
  @SuppressLint("ViewConstructor")
10
15
  class SplashScreenView(
11
16
  context: Context
@@ -4,12 +4,22 @@
4
4
  #import <EXSplashScreen/EXSplashScreenViewNativeProvider.h>
5
5
  #import <ExpoModulesCore/EXDefines.h>
6
6
 
7
- NSString * const kRootViewController = @"rootViewController";
7
+ static NSString * const kRootViewController = @"rootViewController";
8
+ static NSString * const kView = @"view";
8
9
 
9
10
  @interface EXSplashScreenService ()
10
11
 
11
12
  @property (nonatomic, strong) NSMapTable<UIViewController *, EXSplashScreenViewController *> *splashScreenControllers;
12
- @property (nonatomic, assign) BOOL isObservingRootViewController;
13
+ /**
14
+ * This module holds a reference to rootViewController acting as a flag to indicate KVO is enabled.
15
+ * When KVO is enabled, actually we are observing two targets and re-show splash screen if targets changed:
16
+ * - `keyWindow.rootViewController`: it is for expo-dev-client which replaced it in startup.
17
+ * - `rootViewController.rootView`: it is for expo-updates which replaced it in startup.
18
+ *
19
+ * If `rootViewController` is changed, we also need the old `rootViewController` to unregister rootView KVO.
20
+ * That's why we keep a weak reference here but not a boolean flag.
21
+ */
22
+ @property (nonatomic, weak) UIViewController *observingRootViewController;
13
23
 
14
24
  @end
15
25
 
@@ -21,7 +31,6 @@ EX_REGISTER_SINGLETON_MODULE(SplashScreen);
21
31
  {
22
32
  if (self = [super init]) {
23
33
  _splashScreenControllers = [NSMapTable weakToStrongObjectsMapTable];
24
- _isObservingRootViewController = NO;
25
34
  }
26
35
  return self;
27
36
  }
@@ -92,19 +101,8 @@ EX_REGISTER_SINGLETON_MODULE(SplashScreen);
92
101
  }
93
102
  [self removeRootViewControllerListener];
94
103
 
95
- EXSplashScreenViewController *splashScreenViewController = [self.splashScreenControllers objectForKey:viewController];
96
- EX_WEAKIFY(self);
97
- return [splashScreenViewController
98
- hideWithCallback:^(BOOL hasEffect) {
99
- EX_ENSURE_STRONGIFY(self);
100
- [self.splashScreenControllers removeObjectForKey:viewController];
101
- successCallback(hasEffect);
102
- }
103
- failureCallback:^(NSString *message) {
104
- EX_ENSURE_STRONGIFY(self);
105
- [self.splashScreenControllers removeObjectForKey:viewController];
106
- failureCallback(message);
107
- }];
104
+ return [[self.splashScreenControllers objectForKey:viewController] hideWithCallback:successCallback
105
+ failureCallback:failureCallback];
108
106
  }
109
107
 
110
108
  - (void)onAppContentDidAppear:(UIViewController *)viewController
@@ -152,18 +150,26 @@ EX_REGISTER_SINGLETON_MODULE(SplashScreen);
152
150
  - (void)addRootViewControllerListener
153
151
  {
154
152
  NSAssert([NSThread isMainThread], @"Method must be called on main thread");
155
- if (!_isObservingRootViewController) {
156
- [UIApplication.sharedApplication.keyWindow addObserver:self forKeyPath:kRootViewController options:NSKeyValueObservingOptionNew context:nil];
157
- _isObservingRootViewController = YES;
153
+ if (self.observingRootViewController == nil) {
154
+ UIViewController *rootViewController = UIApplication.sharedApplication.keyWindow.rootViewController;
155
+
156
+ [UIApplication.sharedApplication.keyWindow addObserver:self
157
+ forKeyPath:kRootViewController
158
+ options:NSKeyValueObservingOptionNew
159
+ context:nil];
160
+
161
+ [rootViewController addObserver:self forKeyPath:kView options:NSKeyValueObservingOptionNew context:nil];
162
+ self.observingRootViewController = rootViewController;
158
163
  }
159
164
  }
160
165
 
161
166
  - (void)removeRootViewControllerListener
162
167
  {
163
168
  NSAssert([NSThread isMainThread], @"Method must be called on main thread");
164
- if (_isObservingRootViewController) {
169
+ if (self.observingRootViewController != nil) {
165
170
  [UIApplication.sharedApplication.keyWindow removeObserver:self forKeyPath:kRootViewController context:nil];
166
- _isObservingRootViewController = NO;
171
+ [self.observingRootViewController removeObserver:self forKeyPath:kView context:nil];
172
+ self.observingRootViewController = nil;
167
173
  }
168
174
  }
169
175
 
@@ -172,7 +178,20 @@ EX_REGISTER_SINGLETON_MODULE(SplashScreen);
172
178
  if (object == UIApplication.sharedApplication.keyWindow && [keyPath isEqualToString:kRootViewController]) {
173
179
  UIViewController *newRootViewController = change[@"new"];
174
180
  if (newRootViewController != nil) {
181
+ [self removeRootViewControllerListener];
175
182
  [self showSplashScreenFor:newRootViewController];
183
+ [self addRootViewControllerListener];
184
+ }
185
+ }
186
+ if (object == UIApplication.sharedApplication.keyWindow.rootViewController && [keyPath isEqualToString:kView]) {
187
+ UIView *newView = change[@"new"];
188
+ if (newView != nil && [newView.nextResponder isKindOfClass:[UIViewController class]]) {
189
+ UIViewController *viewController = (UIViewController *)newView.nextResponder;
190
+ // To show splash screen as soon as possible, we do not wait for hiding callback and call showSplashScreen immediately.
191
+ // GCD main queue should keep the calls in sequence.
192
+ [self hideSplashScreenFor:viewController successCallback:^(BOOL hasEffect){} failureCallback:^(NSString *message){}];
193
+ [self.splashScreenControllers removeObjectForKey:viewController];
194
+ [self showSplashScreenFor:viewController];
176
195
  }
177
196
  }
178
197
  }
@@ -10,8 +10,9 @@ Pod::Spec.new do |s|
10
10
  s.license = package['license']
11
11
  s.author = package['author']
12
12
  s.homepage = package['homepage']
13
- s.platform = :ios, '11.0'
13
+ s.platform = :ios, '12.0'
14
14
  s.source = { git: 'https://github.com/expo/expo.git' }
15
+ s.static_framework = true
15
16
 
16
17
  s.dependency 'ExpoModulesCore'
17
18
  s.dependency 'React-Core'
@@ -6,30 +6,30 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_x86_64-simulator</string>
9
+ <string>ios-arm64</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>EXSplashScreen.framework</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
- <string>x86_64</string>
16
15
  </array>
17
16
  <key>SupportedPlatform</key>
18
17
  <string>ios</string>
19
- <key>SupportedPlatformVariant</key>
20
- <string>simulator</string>
21
18
  </dict>
22
19
  <dict>
23
20
  <key>LibraryIdentifier</key>
24
- <string>ios-arm64</string>
21
+ <string>ios-arm64_x86_64-simulator</string>
25
22
  <key>LibraryPath</key>
26
23
  <string>EXSplashScreen.framework</string>
27
24
  <key>SupportedArchitectures</key>
28
25
  <array>
29
26
  <string>arm64</string>
27
+ <string>x86_64</string>
30
28
  </array>
31
29
  <key>SupportedPlatform</key>
32
30
  <string>ios</string>
31
+ <key>SupportedPlatformVariant</key>
32
+ <string>simulator</string>
33
33
  </dict>
34
34
  </array>
35
35
  <key>CFBundlePackageType</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-splash-screen",
3
- "version": "0.12.0",
3
+ "version": "0.13.3",
4
4
  "description": "Provides a module to allow keeping the native Splash Screen visible until you choose to hide it.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -37,12 +37,12 @@
37
37
  "preset": "expo-module-scripts"
38
38
  },
39
39
  "dependencies": {
40
- "@expo/configure-splash-screen": "0.5.0",
41
- "@expo/prebuild-config": "^2.0.0",
42
- "expo-modules-core": "~0.3.1"
40
+ "@expo/configure-splash-screen": "^0.6.0",
41
+ "@expo/prebuild-config": "^3.0.0",
42
+ "expo-modules-core": "~0.4.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "expo-module-scripts": "^2.0.0"
46
46
  },
47
- "gitHead": "fe74edd44933f9f00a023544cafc4713594892fb"
47
+ "gitHead": "e30402e90972d9e1838d7b63a40a71a41398a772"
48
48
  }