expo-updates 0.10.0 → 0.10.4

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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,30 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.10.4 — 2021-10-15
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix auto setup `EXUpdatesAppDelegate` breaking reanimated installation. ([#14755](https://github.com/expo/expo/pull/14755) by [@kudo](https://github.com/kudo))
18
+
19
+ ## 0.10.3 — 2021-10-12
20
+
21
+ ### 🐛 Bug fixes
22
+
23
+ - Fix `Updates.reloadAsync` behavior in bare apps when a new update is available (downloaded). ([#14706](https://github.com/expo/expo/pull/14706) by [@esamelson](https://github.com/esamelson))
24
+
25
+ ## 0.10.2 — 2021-10-01
26
+
27
+ ### 🐛 Bug fixes
28
+
29
+ - 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))
30
+
31
+ ## 0.10.1 — 2021-09-28
32
+
33
+ ### 🎉 New features
34
+
35
+ - [android] Make asset "type" key nullable ([#14499](https://github.com/expo/expo/pull/14499) by [@jkhales](https://github.com/jkhales))
36
+
13
37
  ## 0.10.0 — 2021-09-28
14
38
 
15
39
  ### 🐛 Bug fixes
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.10.0'
6
+ version = '0.10.4'
7
7
 
8
8
  apply from: "../scripts/create-manifest-android.gradle"
9
9
 
@@ -59,7 +59,7 @@ android {
59
59
  minSdkVersion safeExtGet("minSdkVersion", 21)
60
60
  targetSdkVersion safeExtGet("targetSdkVersion", 30)
61
61
  versionCode 31
62
- versionName '0.10.0'
62
+ versionName '0.10.4'
63
63
  consumerProguardFiles("proguard-rules.pro")
64
64
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
65
65
  // uncomment below to export the database schema when making changes
@@ -22,7 +22,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase;
22
22
 
23
23
  import java.util.Date;
24
24
 
25
- @Database(entities = {UpdateEntity.class, UpdateAssetEntity.class, AssetEntity.class, JSONDataEntity.class}, exportSchema = false, version = 6)
25
+ @Database(entities = {UpdateEntity.class, UpdateAssetEntity.class, AssetEntity.class, JSONDataEntity.class}, exportSchema = false, version = 7)
26
26
  @TypeConverters({Converters.class})
27
27
  public abstract class UpdatesDatabase extends RoomDatabase {
28
28
 
@@ -39,6 +39,8 @@ public abstract class UpdatesDatabase extends RoomDatabase {
39
39
  if (sInstance == null) {
40
40
  sInstance = Room.databaseBuilder(context, UpdatesDatabase.class, DB_NAME)
41
41
  .addMigrations(MIGRATION_4_5)
42
+ .addMigrations(MIGRATION_5_6)
43
+ .addMigrations(MIGRATION_6_7)
42
44
  .fallbackToDestructiveMigration()
43
45
  .allowMainThreadQueries()
44
46
  .build();
@@ -96,4 +98,32 @@ public abstract class UpdatesDatabase extends RoomDatabase {
96
98
  }
97
99
  }
98
100
  };
101
+
102
+ /**
103
+ * Make the `assets` table `type` column nullable
104
+ */
105
+ static final Migration MIGRATION_6_7 = new Migration(6, 7) {
106
+ @Override
107
+ public void migrate(@NonNull SupportSQLiteDatabase database) {
108
+ // https://www.sqlite.org/lang_altertable.html#otheralter
109
+ database.execSQL("PRAGMA foreign_keys=OFF");
110
+ database.beginTransaction();
111
+ try {
112
+ try {
113
+ database.execSQL("CREATE TABLE IF NOT EXISTS `new_assets` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `url` TEXT, `key` TEXT, `headers` TEXT, `type` TEXT, `metadata` TEXT, `download_time` INTEGER, `relative_path` TEXT, `hash` BLOB, `hash_type` INTEGER NOT NULL, `marked_for_deletion` INTEGER NOT NULL)");
114
+ database.execSQL("INSERT INTO `new_assets` (`id`, `url`, `key`, `headers`, `type`, `metadata`, `download_time`, `relative_path`, `hash`, `hash_type`, `marked_for_deletion`)" +
115
+ " SELECT `id`, `url`, `key`, `headers`, `type`, `metadata`, `download_time`, `relative_path`, `hash`, `hash_type`, `marked_for_deletion` FROM `assets`");
116
+ database.execSQL("DROP TABLE `assets`");
117
+ database.execSQL("ALTER TABLE `new_assets` RENAME TO `assets`");
118
+ database.execSQL("CREATE UNIQUE INDEX `index_assets_key` ON `assets` (`key`)");
119
+
120
+ database.setTransactionSuccessful();
121
+ } finally {
122
+ database.endTransaction();
123
+ }
124
+ } finally {
125
+ database.execSQL("PRAGMA foreign_keys=ON");
126
+ }
127
+ }
128
+ };
99
129
  }
@@ -29,7 +29,6 @@ public class AssetEntity {
29
29
 
30
30
  public JSONObject headers = null;
31
31
 
32
- @NonNull
33
32
  public String type;
34
33
 
35
34
  public JSONObject metadata = null;
@@ -30,6 +30,15 @@ static NSString * const EXUpdatesEmbeddedAppLoaderErrorDomain = @"EXUpdatesEmbed
30
30
  NSBundle *bundle = [NSBundle bundleWithURL:bundleUrl];
31
31
  NSString *path = [bundle pathForResource:EXUpdatesEmbeddedManifestName ofType:EXUpdatesEmbeddedManifestType];
32
32
  NSData *manifestData = [NSData dataWithContentsOfFile:path];
33
+
34
+ // Fallback to main bundle if the embedded manifest is not found in EXUpdates.bundle. This is a special case
35
+ // to support the existing structure of Expo "shell apps"
36
+ if (!manifestData) {
37
+ path = [[NSBundle mainBundle] pathForResource:EXUpdatesEmbeddedManifestName ofType:EXUpdatesEmbeddedManifestType];
38
+ manifestData = [NSData dataWithContentsOfFile:path];
39
+ }
40
+
41
+ // Not found in EXUpdates.bundle or main bundle
33
42
  if (!manifestData) {
34
43
  @throw [NSException exceptionWithName:NSInternalInconsistencyException
35
44
  reason:@"The embedded manifest is invalid or could not be read. Make sure you have configured expo-updates correctly in your Xcode Build Phases."
@@ -146,27 +146,27 @@ static NSString * const EXUpdatesErrorEventName = @"error";
146
146
 
147
147
  - (void)startAndShowLaunchScreen:(UIWindow *)window
148
148
  {
149
+ UIView *view = nil;
149
150
  NSBundle *mainBundle = [NSBundle mainBundle];
150
- UIViewController *rootViewController = [UIViewController new];
151
151
  NSString *launchScreen = (NSString *)[mainBundle objectForInfoDictionaryKey:@"UILaunchStoryboardName"] ?: @"LaunchScreen";
152
152
 
153
153
  if ([mainBundle pathForResource:launchScreen ofType:@"nib"] != nil) {
154
154
  NSArray *views = [mainBundle loadNibNamed:launchScreen owner:self options:nil];
155
- rootViewController.view = views.firstObject;
156
- rootViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
155
+ view = views.firstObject;
156
+ view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
157
157
  } else if ([mainBundle pathForResource:launchScreen ofType:@"storyboard"] != nil ||
158
158
  [mainBundle pathForResource:launchScreen ofType:@"storyboardc"] != nil) {
159
159
  UIStoryboard *launchScreenStoryboard = [UIStoryboard storyboardWithName:launchScreen bundle:nil];
160
- rootViewController = [launchScreenStoryboard instantiateInitialViewController];
160
+ UIViewController *viewController = [launchScreenStoryboard instantiateInitialViewController];
161
+ view = viewController.view;
162
+ viewController.view = nil;
161
163
  } else {
162
164
  NSLog(@"Launch screen could not be loaded from a .xib or .storyboard. Unexpected loading behavior may occur.");
163
- UIView *view = [UIView new];
165
+ view = [UIView new];
164
166
  view.backgroundColor = [UIColor whiteColor];
165
- rootViewController.view = view;
166
167
  }
167
168
 
168
- window.rootViewController = rootViewController;
169
- [window makeKeyAndVisible];
169
+ window.rootViewController.view = view;
170
170
 
171
171
  [self start];
172
172
  }
@@ -21,6 +21,7 @@
21
21
  @interface EXUpdatesAppDelegate() <EXUpdatesAppControllerDelegate>
22
22
 
23
23
  @property (nonatomic, strong) NSDictionary *launchOptions;
24
+ @property (nonatomic, strong) EXUpdatesBridgeDelegateInterceptor *bridgeDelegate;
24
25
 
25
26
  @end
26
27
 
@@ -95,10 +96,10 @@ EX_REGISTER_SINGLETON_MODULE(EXUpdatesAppDelegate)
95
96
  if (![UIApplication.sharedApplication.delegate conformsToProtocol:@protocol(RCTBridgeDelegate)]) {
96
97
  [NSException raise:NSInvalidArgumentException format:@"AppDelegate does not conforms to RCTBridgeDelegate"];
97
98
  }
98
- EXUpdatesBridgeDelegateInterceptor* bridgeDelegate = [[EXUpdatesBridgeDelegateInterceptor alloc]
99
- initWithBridgeDelegate:(id<RCTBridgeDelegate>)UIApplication.sharedApplication.delegate];
99
+ self.bridgeDelegate = [[EXUpdatesBridgeDelegateInterceptor alloc]
100
+ initWithBridgeDelegate:(id<RCTBridgeDelegate>)UIApplication.sharedApplication.delegate];
100
101
 
101
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:bridgeDelegate launchOptions:self.launchOptions];
102
+ RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self.bridgeDelegate launchOptions:self.launchOptions];
102
103
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
103
104
  id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
104
105
  if (rootViewBackgroundColor != nil) {
@@ -107,11 +108,8 @@ EX_REGISTER_SINGLETON_MODULE(EXUpdatesAppDelegate)
107
108
  rootView.backgroundColor = [UIColor whiteColor];
108
109
  }
109
110
 
110
- UIViewController *rootViewController = [UIViewController new];
111
- rootViewController.view = rootView;
112
111
  UIWindow *window = UIApplication.sharedApplication.delegate.window;
113
- window.rootViewController = rootViewController;
114
- [window makeKeyAndVisible];
112
+ window.rootViewController.view = rootView;
115
113
 
116
114
  return bridge;
117
115
  }
@@ -128,6 +126,11 @@ EX_REGISTER_SINGLETON_MODULE(EXUpdatesAppDelegate)
128
126
  return self;
129
127
  }
130
128
 
129
+ - (BOOL)conformsToProtocol:(Protocol *)protocol
130
+ {
131
+ return [self.bridgeDelegate conformsToProtocol:protocol];
132
+ }
133
+
131
134
  - (id)forwardingTargetForSelector:(SEL)selector {
132
135
  if ([self isInterceptedSelector:selector]) {
133
136
  return self;
@@ -39,6 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
39
39
  NSMutableArray<EXUpdatesAsset *> *processedAssets = [NSMutableArray new];
40
40
 
41
41
  NSString *bundleKey = launchAsset[@"key"];
42
+ // TODO-JJ save launch assets with no file extension to match android
42
43
  EXUpdatesAsset *jsBundleAsset = [[EXUpdatesAsset alloc] initWithKey:bundleKey type:EXUpdatesEmbeddedBundleFileType];
43
44
  jsBundleAsset.url = bundleUrl;
44
45
  jsBundleAsset.isLaunchAsset = YES;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-updates",
3
- "version": "0.10.0",
3
+ "version": "0.10.4",
4
4
  "description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -37,8 +37,8 @@
37
37
  "@expo/config": "^5.0.9",
38
38
  "@expo/config-plugins": "^3.1.0",
39
39
  "@expo/metro-config": "~0.1.84",
40
- "expo-manifests": "~0.2.0",
41
- "expo-modules-core": "~0.4.0",
40
+ "expo-manifests": "~0.2.2",
41
+ "expo-modules-core": "~0.4.3",
42
42
  "expo-structured-headers": "~2.0.0",
43
43
  "expo-updates-interface": "~0.4.0",
44
44
  "fbemitter": "^2.1.1",
@@ -50,5 +50,5 @@
50
50
  "fs-extra": "^9.1.0",
51
51
  "memfs": "^3.2.0"
52
52
  },
53
- "gitHead": "1fffde73411ee7a642b98f1506a8de921805d52b"
53
+ "gitHead": "d23e1ac491da96b51c25eb2533efcd56499ee287"
54
54
  }