diff --git a/packages/shorebird_cli/lib/src/code_push_client_wrapper.dart b/packages/shorebird_cli/lib/src/code_push_client_wrapper.dart index cda555862..66865796f 100644 --- a/packages/shorebird_cli/lib/src/code_push_client_wrapper.dart +++ b/packages/shorebird_cli/lib/src/code_push_client_wrapper.dart @@ -134,7 +134,7 @@ This app may not exist or you may not have permission to view it.''', Future ensureReleaseHasNoArtifacts({ required String appId, required Release existingRelease, - required String platform, + required ReleasePlatform platform, }) async { logger.detail('Verifying ability to release'); @@ -228,7 +228,7 @@ Please create a release using "shorebird release" and try again. required String appId, required int releaseId, required Map architectures, - required String platform, + required ReleasePlatform platform, }) async { // TODO(bryanoltman): update this function to only make one call to // getReleaseArtifacts. @@ -265,7 +265,7 @@ Please create a release using "shorebird release" and try again. required String appId, required int releaseId, required String arch, - required String platform, + required ReleasePlatform platform, }) async { final fetchReleaseArtifactProgress = logger.progress( 'Fetching $arch artifact', @@ -295,7 +295,7 @@ Please create a release using "shorebird release" and try again. required String appId, required int releaseId, required String arch, - required String platform, + required ReleasePlatform platform, }) async { final fetchReleaseArtifactProgress = logger.progress( 'Fetching $arch artifact', @@ -327,7 +327,7 @@ Please create a release using "shorebird release" and try again. Future createAndroidReleaseArtifacts({ required String appId, required int releaseId, - required String platform, + required ReleasePlatform platform, required String aabPath, required Map architectures, String? flavor, @@ -400,7 +400,7 @@ aab artifact already exists, continuing...''', Future createAndroidArchiveReleaseArtifacts({ required String appId, required int releaseId, - required String platform, + required ReleasePlatform platform, required String aarPath, required String extractedAarDir, required Map architectures, @@ -479,7 +479,7 @@ aar artifact already exists, continuing...''', releaseId: releaseId, artifactPath: ipaPath, arch: 'ipa', - platform: 'ios', + platform: ReleasePlatform.ios, hash: sha256.convert(await ipaFile.readAsBytes()).toString(), ); } catch (error) { @@ -495,7 +495,7 @@ aar artifact already exists, continuing...''', Future completeRelease({ required String appId, required int releaseId, - required String platform, + required ReleasePlatform platform, }) async { final completeReleaseProgress = logger.progress('Completing release'); try { @@ -535,7 +535,7 @@ aar artifact already exists, continuing...''', Future createPatchArtifacts({ required String appId, required Patch patch, - required String platform, + required ReleasePlatform platform, required Map patchArtifactBundles, }) async { final createArtifactProgress = logger.progress('Uploading artifacts'); @@ -582,7 +582,7 @@ aar artifact already exists, continuing...''', Future publishPatch({ required String appId, required int releaseId, - required String platform, + required ReleasePlatform platform, required String channelName, required Map patchArtifactBundles, }) async { diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_aar_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_aar_command.dart index ce9cfd0f6..b780081f3 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_aar_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_aar_command.dart @@ -144,7 +144,7 @@ of the Android app that is using this module.''', return ExitCode.success.code; } - const platformName = 'android'; + const platform = ReleasePlatform.android; final channelName = results['channel'] as String; final release = await codePushClientWrapper.getRelease( @@ -194,14 +194,14 @@ https://github.com/shorebirdtech/shorebird/issues/472 appId: appId, releaseId: release.id, architectures: architectures, - platform: platformName, + platform: platform, ); final releaseAarArtifact = await codePushClientWrapper.getReleaseArtifact( appId: appId, releaseId: release.id, arch: 'aar', - platform: platformName, + platform: platform, ); final downloadReleaseAarProgress = logger.progress( @@ -280,7 +280,7 @@ https://github.com/shorebirdtech/shorebird/issues/472 if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}', 'đŸ“Ļ Release Version: ${lightCyan.wrap(releaseVersion)}', 'đŸ“ē Channel: ${lightCyan.wrap(channelName)}', - '''🕹ī¸ Platform: ${lightCyan.wrap(platformName)} ${lightCyan.wrap('[${archMetadata.join(', ')}]')}''', + '''🕹ī¸ Platform: ${lightCyan.wrap(platform.name)} ${lightCyan.wrap('[${archMetadata.join(', ')}]')}''', ]; logger.info( @@ -305,7 +305,7 @@ ${summary.join('\n')} await codePushClientWrapper.publishPatch( appId: appId, releaseId: release.id, - platform: platformName, + platform: platform, channelName: channelName, patchArtifactBundles: patchArtifactBundles, ); diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart index 64b155da5..3b6043cbb 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_android_command.dart @@ -16,6 +16,7 @@ import 'package:shorebird_cli/src/shorebird_config_mixin.dart'; import 'package:shorebird_cli/src/shorebird_environment.dart'; import 'package:shorebird_cli/src/shorebird_release_version_mixin.dart'; import 'package:shorebird_cli/src/shorebird_validation_mixin.dart'; +import 'package:shorebird_code_push_client/shorebird_code_push_client.dart'; /// {@template patch_android_command} /// `shorebird patch android` @@ -107,7 +108,7 @@ class PatchAndroidCommand extends ShorebirdCommand await cache.updateAll(); - const platformName = 'android'; + const platform = ReleasePlatform.android; final channelName = results['channel'] as String; final flavor = results['flavor'] as String?; final target = results['target'] as String?; @@ -199,14 +200,14 @@ https://github.com/shorebirdtech/shorebird/issues/472 appId: app.appId, releaseId: release.id, architectures: architectures, - platform: platformName, + platform: platform, ); final releaseAabArtifact = await codePushClientWrapper.getReleaseArtifact( appId: app.appId, releaseId: release.id, arch: 'aab', - platform: platformName, + platform: platform, ); final releaseArtifactPaths = {}; @@ -321,7 +322,7 @@ https://github.com/shorebirdtech/shorebird/issues/472 if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}', 'đŸ“Ļ Release Version: ${lightCyan.wrap(releaseVersion)}', 'đŸ“ē Channel: ${lightCyan.wrap(channelName)}', - '''🕹ī¸ Platform: ${lightCyan.wrap(platformName)} ${lightCyan.wrap('[${archMetadata.join(', ')}]')}''', + '''🕹ī¸ Platform: ${lightCyan.wrap(platform.name)} ${lightCyan.wrap('[${archMetadata.join(', ')}]')}''', ]; logger.info( @@ -346,7 +347,7 @@ ${summary.join('\n')} await codePushClientWrapper.publishPatch( appId: appId, releaseId: release.id, - platform: platformName, + platform: platform, channelName: channelName, patchArtifactBundles: patchArtifactBundles, ); diff --git a/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart b/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart index 19b0eb35c..a03f5359a 100644 --- a/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart +++ b/packages/shorebird_cli/lib/src/commands/patch/patch_ios_command.dart @@ -15,6 +15,7 @@ import 'package:shorebird_cli/src/shorebird_build_mixin.dart'; import 'package:shorebird_cli/src/shorebird_config_mixin.dart'; import 'package:shorebird_cli/src/shorebird_environment.dart'; import 'package:shorebird_cli/src/shorebird_validation_mixin.dart'; +import 'package:shorebird_code_push_client/shorebird_code_push_client.dart'; /// {@template patch_ios_command} /// `shorebird patch ios` command. @@ -87,7 +88,7 @@ class PatchIosCommand extends ShorebirdCommand const arch = 'aarch64'; const channelName = 'stable'; - const platformName = 'ios'; + const platform = ReleasePlatform.ios; final force = results['force'] == true; final dryRun = results['dry-run'] == true; final flavor = results['flavor'] as String?; @@ -204,7 +205,7 @@ https://github.com/shorebirdtech/shorebird/issues/472 if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}', 'đŸ“Ļ Release Version: ${lightCyan.wrap(releaseVersion)}', 'đŸ“ē Channel: ${lightCyan.wrap(channelName)}', - '''🕹ī¸ Platform: ${lightCyan.wrap(platformName)} ${lightCyan.wrap('[$arch (${formatBytes(aotFileSize)})]')}''', + '''🕹ī¸ Platform: ${lightCyan.wrap(platform.name)} ${lightCyan.wrap('[$arch (${formatBytes(aotFileSize)})]')}''', ]; logger.info( @@ -231,7 +232,7 @@ ${summary.join('\n')} await codePushClientWrapper.publishPatch( appId: appId, releaseId: release.id, - platform: platformName, + platform: platform, channelName: channelName, patchArtifactBundles: { Arch.arm64: PatchArtifactBundle( diff --git a/packages/shorebird_cli/lib/src/commands/preview_command.dart b/packages/shorebird_cli/lib/src/commands/preview_command.dart index 5cc39d22a..9b61153e8 100644 --- a/packages/shorebird_cli/lib/src/commands/preview_command.dart +++ b/packages/shorebird_cli/lib/src/commands/preview_command.dart @@ -12,6 +12,7 @@ import 'package:shorebird_cli/src/logger.dart'; import 'package:shorebird_cli/src/shorebird_config_mixin.dart'; import 'package:shorebird_cli/src/shorebird_validation_mixin.dart'; import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart'; +import 'package:shorebird_code_push_client/shorebird_code_push_client.dart'; /// {@template preview_command} /// `shorebird preview` command. @@ -49,7 +50,7 @@ class PreviewCommand extends ShorebirdCommand return error.exitCode.code; } - const platform = 'android'; + const platform = ReleasePlatform.android; final appId = results['app-id'] as String? ?? await promptForApp(); if (appId == null) { diff --git a/packages/shorebird_cli/lib/src/commands/release/release_aar_command.dart b/packages/shorebird_cli/lib/src/commands/release/release_aar_command.dart index 12fc36756..3fa052561 100644 --- a/packages/shorebird_cli/lib/src/commands/release/release_aar_command.dart +++ b/packages/shorebird_cli/lib/src/commands/release/release_aar_command.dart @@ -13,6 +13,7 @@ import 'package:shorebird_cli/src/shorebird_config_mixin.dart'; import 'package:shorebird_cli/src/shorebird_environment.dart'; import 'package:shorebird_cli/src/shorebird_release_version_mixin.dart'; import 'package:shorebird_cli/src/shorebird_validation_mixin.dart'; +import 'package:shorebird_code_push_client/shorebird_code_push_client.dart'; /// {@template release_aar_command} /// `shorebird release aar` @@ -86,7 +87,7 @@ make smaller updates to your app. return ExitCode.config.code; } - const platformName = 'android'; + const platform = ReleasePlatform.android; final flavor = results['flavor'] as String?; final buildNumber = results['build-number'] as String; final releaseVersion = results['release-version'] as String; @@ -104,7 +105,7 @@ make smaller updates to your app. await codePushClientWrapper.ensureReleaseHasNoArtifacts( appId: app.appId, existingRelease: existingRelease, - platform: platformName, + platform: platform, ); } @@ -124,7 +125,7 @@ make smaller updates to your app. '''📱 App: ${lightCyan.wrap(app.displayName)} ${lightCyan.wrap('(${app.appId})')}''', if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}', 'đŸ“Ļ Release Version: ${lightCyan.wrap(releaseVersion)}', - '''🕹ī¸ Platform: ${lightCyan.wrap(platformName)} ${lightCyan.wrap('(${archNames.join(', ')})')}''', + '''🕹ī¸ Platform: ${lightCyan.wrap(platform.name)} ${lightCyan.wrap('(${archNames.join(', ')})')}''', ]; logger.info(''' @@ -175,7 +176,7 @@ ${summary.join('\n')} await codePushClientWrapper.createAndroidArchiveReleaseArtifacts( appId: app.appId, releaseId: release.id, - platform: platformName, + platform: platform, aarPath: aarArtifactPath( packageName: androidPackageName!, buildNumber: buildNumber, @@ -187,7 +188,7 @@ ${summary.join('\n')} await codePushClientWrapper.completeRelease( appId: app.appId, releaseId: release.id, - platform: platformName, + platform: platform, ); logger diff --git a/packages/shorebird_cli/lib/src/commands/release/release_android_command.dart b/packages/shorebird_cli/lib/src/commands/release/release_android_command.dart index d9e716da2..80d3d7876 100644 --- a/packages/shorebird_cli/lib/src/commands/release/release_android_command.dart +++ b/packages/shorebird_cli/lib/src/commands/release/release_android_command.dart @@ -11,6 +11,7 @@ import 'package:shorebird_cli/src/shorebird_config_mixin.dart'; import 'package:shorebird_cli/src/shorebird_environment.dart'; import 'package:shorebird_cli/src/shorebird_release_version_mixin.dart'; import 'package:shorebird_cli/src/shorebird_validation_mixin.dart'; +import 'package:shorebird_code_push_client/shorebird_code_push_client.dart'; /// {@template release_android_command} /// `shorebird release android` @@ -74,7 +75,7 @@ make smaller updates to your app. return e.exitCode.code; } - const platformName = 'android'; + const platform = ReleasePlatform.android; final flavor = results['flavor'] as String?; final target = results['target'] as String?; final generateApk = results['artifact'] as String == 'apk'; @@ -123,7 +124,7 @@ make smaller updates to your app. await codePushClientWrapper.ensureReleaseHasNoArtifacts( appId: app.appId, existingRelease: existingRelease, - platform: platformName, + platform: platform, ); } @@ -132,7 +133,7 @@ make smaller updates to your app. '''📱 App: ${lightCyan.wrap(app.displayName)} ${lightCyan.wrap('(${app.appId})')}''', if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}', 'đŸ“Ļ Release Version: ${lightCyan.wrap(releaseVersion)}', - '''🕹ī¸ Platform: ${lightCyan.wrap(platformName)} ${lightCyan.wrap('(${archNames.join(', ')})')}''', + '''🕹ī¸ Platform: ${lightCyan.wrap(platform.name)} ${lightCyan.wrap('(${archNames.join(', ')})')}''', ]; logger.info(''' @@ -176,7 +177,7 @@ ${summary.join('\n')} appId: app.appId, releaseId: release.id, aabPath: bundlePath, - platform: platformName, + platform: platform, architectures: architectures, flavor: flavor, ); @@ -184,7 +185,7 @@ ${summary.join('\n')} await codePushClientWrapper.completeRelease( appId: app.appId, releaseId: release.id, - platform: platformName, + platform: platform, ); logger diff --git a/packages/shorebird_cli/lib/src/commands/release/release_ios_command.dart b/packages/shorebird_cli/lib/src/commands/release/release_ios_command.dart index 3e7bdeda8..cd9ea03d5 100644 --- a/packages/shorebird_cli/lib/src/commands/release/release_ios_command.dart +++ b/packages/shorebird_cli/lib/src/commands/release/release_ios_command.dart @@ -12,6 +12,7 @@ import 'package:shorebird_cli/src/shorebird_build_mixin.dart'; import 'package:shorebird_cli/src/shorebird_config_mixin.dart'; import 'package:shorebird_cli/src/shorebird_environment.dart'; import 'package:shorebird_cli/src/shorebird_validation_mixin.dart'; +import 'package:shorebird_code_push_client/shorebird_code_push_client.dart'; /// {@template release_ios_command} /// `shorebird release ios-preview` @@ -72,7 +73,7 @@ make smaller updates to your app. '''iOS support is in an experimental state and will not work without Flutter engine changes that have not yet been published.''', ); - const platformName = 'ios'; + const platform = ReleasePlatform.ios; final flavor = results['flavor'] as String?; final shorebirdYaml = ShorebirdEnvironment.getShorebirdYaml()!; final appId = shorebirdYaml.getAppId(flavor: flavor); @@ -121,7 +122,7 @@ make smaller updates to your app. await codePushClientWrapper.ensureReleaseHasNoArtifacts( appId: app.appId, existingRelease: existingRelease, - platform: platformName, + platform: platform, ); } @@ -129,7 +130,7 @@ make smaller updates to your app. '''📱 App: ${lightCyan.wrap(app.displayName)} ${lightCyan.wrap('($appId)')}''', if (flavor != null) '🍧 Flavor: ${lightCyan.wrap(flavor)}', 'đŸ“Ļ Release Version: ${lightCyan.wrap(releaseVersion)}', - '''🕹ī¸ Platform: ${lightCyan.wrap(platformName)}''', + '''🕹ī¸ Platform: ${lightCyan.wrap(platform.name)}''', ]; logger.info(''' @@ -178,7 +179,7 @@ ${summary.join('\n')} await codePushClientWrapper.completeRelease( appId: app.appId, releaseId: release.id, - platform: platformName, + platform: platform, ); logger diff --git a/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart b/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart index 64323602c..aed29f61c 100644 --- a/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart +++ b/packages/shorebird_cli/test/src/code_push_client_wrapper_test.dart @@ -31,6 +31,10 @@ void main() { late http.Client httpClient; late Platform platform; + setUpAll(() { + registerFallbackValue(ReleasePlatform.android); + }); + setUp(() { auth = _MockAuth(); httpClient = _MockHttpClient(); @@ -74,7 +78,7 @@ void main() { const patchId = 1; const patchNumber = 2; const patch = Patch(id: patchId, number: patchNumber); - const platformName = 'ios'; + const releasePlatform = ReleasePlatform.ios; const releaseId = 123; const arch = Arch.arm64; const flutterRevision = '123'; @@ -105,7 +109,7 @@ void main() { id: 1, releaseId: releaseId, arch: 'aarch64', - platform: platformName, + platform: releasePlatform, hash: 'asdf', size: 4, url: 'url', @@ -379,7 +383,7 @@ void main() { () async => codePushClientWrapper.ensureReleaseHasNoArtifacts( appId: appId, existingRelease: release, - platform: platformName, + platform: releasePlatform, ), ), exitsWithCode(ExitCode.software), @@ -388,7 +392,7 @@ void main() { verify( () => logger.err( ''' -It looks like you have an existing $platformName release for version ${lightCyan.wrap(release.version)}. +It looks like you have an existing $releasePlatform release for version ${lightCyan.wrap(release.version)}. Please bump your version number and try again.''', ), ).called(1); @@ -411,7 +415,7 @@ Please bump your version number and try again.''', () => codePushClientWrapper.ensureReleaseHasNoArtifacts( appId: appId, existingRelease: release, - platform: platformName, + platform: releasePlatform, ), ), completes, @@ -673,7 +677,7 @@ Please bump your version number and try again.''', appId: app.appId, releaseId: releaseId, architectures: archMap, - platform: platformName, + platform: releasePlatform, ), ), exitsWithCode(ExitCode.software), @@ -697,7 +701,7 @@ Please bump your version number and try again.''', appId: app.appId, releaseId: releaseId, architectures: archMap, - platform: platformName, + platform: releasePlatform, ), ), exitsWithCode(ExitCode.software), @@ -726,7 +730,7 @@ Please bump your version number and try again.''', appId: app.appId, releaseId: releaseId, architectures: archMap, - platform: platformName, + platform: releasePlatform, ), ); @@ -753,7 +757,7 @@ Please bump your version number and try again.''', appId: app.appId, releaseId: releaseId, arch: arch.name, - platform: platformName, + platform: releasePlatform, ), ), exitsWithCode(ExitCode.software), @@ -778,7 +782,7 @@ Please bump your version number and try again.''', appId: app.appId, releaseId: releaseId, arch: arch.name, - platform: platformName, + platform: releasePlatform, ), ), exitsWithCode(ExitCode.software), @@ -808,7 +812,7 @@ Please bump your version number and try again.''', appId: app.appId, releaseId: releaseId, arch: arch.name, - platform: platformName, + platform: releasePlatform, ), ); @@ -836,7 +840,7 @@ Please bump your version number and try again.''', appId: app.appId, releaseId: releaseId, arch: arch.name, - platform: platformName, + platform: releasePlatform, ), ), exitsWithCode(ExitCode.software), @@ -860,7 +864,7 @@ Please bump your version number and try again.''', appId: app.appId, releaseId: releaseId, arch: arch.name, - platform: platformName, + platform: releasePlatform, ), ); @@ -885,7 +889,7 @@ Please bump your version number and try again.''', appId: app.appId, releaseId: releaseId, arch: arch.name, - platform: platformName, + platform: releasePlatform, ), ); @@ -953,7 +957,7 @@ Please bump your version number and try again.''', () async => codePushClientWrapper.createAndroidReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aabPath: p.join(tempDir.path, aabPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, ), @@ -986,7 +990,7 @@ Please bump your version number and try again.''', () async => codePushClientWrapper.createAndroidReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aabPath: p.join(tempDir.path, aabPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, ), @@ -1019,7 +1023,7 @@ Please bump your version number and try again.''', () async => codePushClientWrapper.createAndroidReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aabPath: p.join(tempDir.path, aabPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, ), @@ -1055,7 +1059,7 @@ Please bump your version number and try again.''', () async => codePushClientWrapper.createAndroidReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aabPath: p.join(tempDir.path, aabPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, ), @@ -1089,7 +1093,7 @@ Please bump your version number and try again.''', () async => codePushClientWrapper.createAndroidReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aabPath: p.join(tempDir.path, aabPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, ), @@ -1120,7 +1124,7 @@ Please bump your version number and try again.''', () async => codePushClientWrapper.createAndroidReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aabPath: p.join(tempDir.path, aabPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, flavor: flavorName, @@ -1138,7 +1142,7 @@ Please bump your version number and try again.''', ), releaseId: releaseId, arch: any(named: 'arch'), - platform: platformName, + platform: releasePlatform, hash: any(named: 'hash'), ), ).called(ShorebirdBuildMixin.allAndroidArchitectures.length); @@ -1215,7 +1219,7 @@ Please bump your version number and try again.''', codePushClientWrapper.createAndroidArchiveReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aarPath: p.join(tempDir.path, aarPath), extractedAarDir: p.join(tempDir.path, extractedAarPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, @@ -1250,7 +1254,7 @@ Please bump your version number and try again.''', codePushClientWrapper.createAndroidArchiveReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aarPath: p.join(tempDir.path, aarPath), extractedAarDir: p.join(tempDir.path, extractedAarPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, @@ -1285,7 +1289,7 @@ Please bump your version number and try again.''', codePushClientWrapper.createAndroidArchiveReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aarPath: p.join(tempDir.path, aarPath), extractedAarDir: p.join(tempDir.path, extractedAarPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, @@ -1323,7 +1327,7 @@ Please bump your version number and try again.''', codePushClientWrapper.createAndroidArchiveReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aarPath: p.join(tempDir.path, aarPath), extractedAarDir: p.join(tempDir.path, extractedAarPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, @@ -1359,7 +1363,7 @@ Please bump your version number and try again.''', codePushClientWrapper.createAndroidArchiveReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aarPath: p.join(tempDir.path, aarPath), extractedAarDir: p.join(tempDir.path, extractedAarPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, @@ -1392,7 +1396,7 @@ Please bump your version number and try again.''', codePushClientWrapper.createAndroidArchiveReleaseArtifacts( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, aarPath: p.join(tempDir.path, aarPath), extractedAarDir: p.join(tempDir.path, extractedAarPath), architectures: ShorebirdBuildMixin.allAndroidArchitectures, @@ -1407,7 +1411,7 @@ Please bump your version number and try again.''', artifactPath: any(named: 'artifactPath'), releaseId: releaseId, arch: any(named: 'arch'), - platform: platformName, + platform: releasePlatform, hash: any(named: 'hash'), ), ).called(ShorebirdBuildMixin.allAndroidArchitectures.length + 1); @@ -1553,7 +1557,7 @@ Please bump your version number and try again.''', () => codePushClientWrapper.completeRelease( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, ), ), exitsWithCode(ExitCode.software), @@ -1575,7 +1579,7 @@ Please bump your version number and try again.''', () => codePushClientWrapper.completeRelease( appId: app.appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, ), ); @@ -1692,7 +1696,7 @@ Please bump your version number and try again.''', () => codePushClientWrapper.createPatchArtifacts( appId: appId, patch: patch, - platform: platformName, + platform: releasePlatform, patchArtifactBundles: patchArtifactBundles, ), ), @@ -1719,7 +1723,7 @@ Please bump your version number and try again.''', () => codePushClientWrapper.createPatchArtifacts( appId: appId, patch: patch, - platform: platformName, + platform: releasePlatform, patchArtifactBundles: patchArtifactBundles, ), ); @@ -1731,7 +1735,7 @@ Please bump your version number and try again.''', artifactPath: partchArtifactBundle.path, patchId: patchId, arch: arch.name, - platform: platformName, + platform: releasePlatform, hash: partchArtifactBundle.hash, ), ).called(1); @@ -1773,7 +1777,7 @@ Please bump your version number and try again.''', () => codePushClientWrapper.publishPatch( appId: appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, channelName: channelName, patchArtifactBundles: patchArtifactBundles, ), @@ -1791,7 +1795,7 @@ Please bump your version number and try again.''', artifactPath: partchArtifactBundle.path, patchId: patchId, arch: arch.name, - platform: platformName, + platform: releasePlatform, hash: partchArtifactBundle.hash, ), ).called(1); @@ -1827,7 +1831,7 @@ Please bump your version number and try again.''', () => codePushClientWrapper.publishPatch( appId: appId, releaseId: releaseId, - platform: platformName, + platform: releasePlatform, channelName: channelName, patchArtifactBundles: patchArtifactBundles, ), @@ -1845,7 +1849,7 @@ Please bump your version number and try again.''', artifactPath: partchArtifactBundle.path, patchId: patchId, arch: arch.name, - platform: platformName, + platform: releasePlatform, hash: partchArtifactBundle.hash, ), ).called(1); diff --git a/packages/shorebird_cli/test/src/commands/patch/patch_aar_command_test.dart b/packages/shorebird_cli/test/src/commands/patch/patch_aar_command_test.dart index 53d779109..ab45ff87c 100644 --- a/packages/shorebird_cli/test/src/commands/patch/patch_aar_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/patch_aar_command_test.dart @@ -60,7 +60,7 @@ void main() { const versionCode = '1'; const version = '$versionName+$versionCode'; const arch = 'aarch64'; - const platformName = 'android'; + const releasePlatform = ReleasePlatform.android; const channelName = 'stable'; const appDisplayName = 'Test App'; const appMetadata = AppMetadata(appId: appId, displayName: appDisplayName); @@ -68,7 +68,7 @@ void main() { id: 0, releaseId: 0, arch: arch, - platform: platformName, + platform: releasePlatform, hash: '#', size: 42, url: 'https://example.com/release.so', @@ -77,7 +77,7 @@ void main() { id: 0, releaseId: 0, arch: arch, - platform: platformName, + platform: releasePlatform, hash: '#', size: 42, url: 'https://example.com/release.aar', @@ -208,6 +208,8 @@ flutter: cache = _MockCache(); shorebirdProcess = _MockShorebirdProcess(); + registerFallbackValue(ReleasePlatform.android); + when(() => platform.environment).thenReturn({}); when(() => platform.script).thenReturn( Uri.file( @@ -307,7 +309,7 @@ flutter: appId: any(named: 'appId'), releaseId: any(named: 'releaseId'), arch: 'aar', - platform: 'android', + platform: ReleasePlatform.android, ), ).thenAnswer((_) async => aarArtifact); when( @@ -705,7 +707,7 @@ https://github.com/shorebirdtech/shorebird/issues/472 () => logger.info( any( that: contains( - '''🕹ī¸ Platform: ${lightCyan.wrap(platformName)} ${lightCyan.wrap('[arm32 (4 B), arm64 (4 B), x86_64 (4 B)]')}''', + '''🕹ī¸ Platform: ${lightCyan.wrap(releasePlatform.name)} ${lightCyan.wrap('[arm32 (4 B), arm64 (4 B), x86_64 (4 B)]')}''', ), ), ), @@ -724,7 +726,7 @@ https://github.com/shorebirdtech/shorebird/issues/472 appId: appId, releaseId: release.id, architectures: ShorebirdBuildMixin.allAndroidArchitectures, - platform: platformName, + platform: releasePlatform, ), ).called(1); verify( @@ -732,14 +734,14 @@ https://github.com/shorebirdtech/shorebird/issues/472 appId: appId, releaseId: release.id, arch: 'aar', - platform: platformName, + platform: releasePlatform, ), ).called(1); verify( () => codePushClientWrapper.publishPatch( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, channelName: channelName, patchArtifactBundles: any(named: 'patchArtifactBundles'), ), @@ -776,7 +778,7 @@ flavors: appId: appId, releaseId: release.id, architectures: ShorebirdBuildMixin.allAndroidArchitectures, - platform: platformName, + platform: releasePlatform, ), ).called(1); verify( @@ -784,14 +786,14 @@ flavors: appId: appId, releaseId: release.id, arch: 'aar', - platform: platformName, + platform: releasePlatform, ), ).called(1); verify( () => codePushClientWrapper.publishPatch( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, channelName: channelName, patchArtifactBundles: any(named: 'patchArtifactBundles'), ), diff --git a/packages/shorebird_cli/test/src/commands/patch/patch_android_command_test.dart b/packages/shorebird_cli/test/src/commands/patch/patch_android_command_test.dart index deb3a17f2..f41c8e93d 100644 --- a/packages/shorebird_cli/test/src/commands/patch/patch_android_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/patch_android_command_test.dart @@ -65,7 +65,7 @@ void main() { const versionCode = '1'; const version = '$versionName+$versionCode'; const arch = 'aarch64'; - const platformName = 'android'; + const releasePlatform = ReleasePlatform.android; const channelName = 'stable'; const appDisplayName = 'Test App'; const app = AppMetadata(appId: appId, displayName: appDisplayName); @@ -73,7 +73,7 @@ void main() { id: 0, releaseId: 0, arch: arch, - platform: platformName, + platform: releasePlatform, hash: '#', size: 42, url: 'https://example.com', @@ -82,7 +82,7 @@ void main() { id: 0, releaseId: 0, arch: arch, - platform: platformName, + platform: releasePlatform, hash: '#', size: 42, url: 'https://example.com/release.aab', @@ -173,6 +173,7 @@ flutter: setUpAll(() { registerFallbackValue(_FakeBaseRequest()); registerFallbackValue(_FakeShorebirdProcess()); + registerFallbackValue(ReleasePlatform.android); }); setUp(() { @@ -299,7 +300,7 @@ flutter: appId: any(named: 'appId'), releaseId: any(named: 'releaseId'), arch: 'aab', - platform: 'android', + platform: ReleasePlatform.android, ), ).thenAnswer((_) async => aabArtifact); when( @@ -787,7 +788,7 @@ https://github.com/shorebirdtech/shorebird/issues/472 () => logger.info( any( that: contains( - '''🕹ī¸ Platform: ${lightCyan.wrap(platformName)} ${lightCyan.wrap('[arm32 (4 B), arm64 (4 B), x86_64 (4 B)]')}''', + '''🕹ī¸ Platform: ${lightCyan.wrap(releasePlatform.name)} ${lightCyan.wrap('[arm32 (4 B), arm64 (4 B), x86_64 (4 B)]')}''', ), ), ), diff --git a/packages/shorebird_cli/test/src/commands/patch/patch_ios_command_test.dart b/packages/shorebird_cli/test/src/commands/patch/patch_ios_command_test.dart index 5175b709d..7e789ee17 100644 --- a/packages/shorebird_cli/test/src/commands/patch/patch_ios_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/patch/patch_ios_command_test.dart @@ -157,6 +157,7 @@ flutter: setUpAll(() { registerFallbackValue(_FakeBaseRequest()); registerFallbackValue(_FakeShorebirdProcess()); + registerFallbackValue(ReleasePlatform.ios); }); setUp(() { diff --git a/packages/shorebird_cli/test/src/commands/preview_command_test.dart b/packages/shorebird_cli/test/src/commands/preview_command_test.dart index 9ef395d9a..03e1ab73f 100644 --- a/packages/shorebird_cli/test/src/commands/preview_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/preview_command_test.dart @@ -52,7 +52,7 @@ void main() { group(PreviewCommand, () { const appId = 'test-app-id'; const appDisplayName = 'Test App'; - const platform = 'android'; + const platform = ReleasePlatform.android; const releaseVersion = '1.2.3'; const releaseId = 42; const releaseArtifactUrl = 'https://example.com/release.aab'; @@ -104,8 +104,9 @@ void main() { ); setUpAll(() { - registerFallbackValue(Uri()); + registerFallbackValue(ReleasePlatform.android); registerFallbackValue(StreamController>()); + registerFallbackValue(Uri()); }); setUp(() { diff --git a/packages/shorebird_cli/test/src/commands/release/release_aar_command_test.dart b/packages/shorebird_cli/test/src/commands/release/release_aar_command_test.dart index 16b5c3da4..f252ce7c7 100644 --- a/packages/shorebird_cli/test/src/commands/release/release_aar_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/release_aar_command_test.dart @@ -62,7 +62,7 @@ void main() { displayName: '1.2.3+1', ); - const platformName = 'android'; + const releasePlatform = ReleasePlatform.android; const buildNumber = '1.0'; const noModulePubspecYamlContent = ''' name: example @@ -159,6 +159,10 @@ flutter: File(aarPath).createSync(recursive: true); } + setUpAll(() { + registerFallbackValue(ReleasePlatform.android); + }); + setUp(() { argResults = _MockArgResults(); httpClient = _MockHttpClient(); @@ -426,7 +430,7 @@ flutter: () => codePushClientWrapper.createAndroidArchiveReleaseArtifacts( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, aarPath: any( named: 'aarPath', that: endsWith( @@ -446,7 +450,7 @@ flutter: () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ).called(1); }); @@ -484,7 +488,7 @@ flavors: () => codePushClientWrapper.createAndroidArchiveReleaseArtifacts( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, aarPath: any( named: 'aarPath', that: endsWith( @@ -504,7 +508,7 @@ flavors: () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ).called(1); }); @@ -537,7 +541,7 @@ flavors: () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ).called(1); }); @@ -595,7 +599,7 @@ flavors: () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ); }); diff --git a/packages/shorebird_cli/test/src/commands/release/release_android_command_test.dart b/packages/shorebird_cli/test/src/commands/release/release_android_command_test.dart index 86622b1e7..d13fcac10 100644 --- a/packages/shorebird_cli/test/src/commands/release/release_android_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/release_android_command_test.dart @@ -57,7 +57,7 @@ void main() { const version = '$versionName+$versionCode'; const appDisplayName = 'Test App'; const arch = 'aarch64'; - const platformName = 'android'; + const releasePlatform = ReleasePlatform.android; const appMetadata = AppMetadata(appId: appId, displayName: appDisplayName); const release = Release( id: 0, @@ -124,6 +124,10 @@ flutter: return tempDir; } + setUpAll(() { + registerFallbackValue(ReleasePlatform.android); + }); + setUp(() { argResults = _MockArgResults(); bundletool = _MockBundleTool(); @@ -171,7 +175,7 @@ flutter: ).thenAnswer((_) async => flutterRevisionProcessResult); when(() => argResults.rest).thenReturn([]); when(() => argResults['arch']).thenReturn(arch); - when(() => argResults['platform']).thenReturn(platformName); + when(() => argResults['platform']).thenReturn(releasePlatform); when(() => argResults['artifact']).thenReturn('aab'); when(() => auth.isAuthenticated).thenReturn(true); when(() => auth.client).thenReturn(httpClient); @@ -399,7 +403,7 @@ flutter: () => codePushClientWrapper.createAndroidReleaseArtifacts( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, aabPath: any(named: 'aabPath'), architectures: any(named: 'architectures'), ), @@ -408,7 +412,7 @@ flutter: () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ).called(1); expect(exitCode, ExitCode.success.code); @@ -428,7 +432,7 @@ flutter: () => codePushClientWrapper.createAndroidReleaseArtifacts( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, aabPath: any(named: 'aabPath'), architectures: any(named: 'architectures'), ), @@ -437,7 +441,7 @@ flutter: () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ).called(1); expect(exitCode, ExitCode.success.code); @@ -468,7 +472,7 @@ flavors: () => codePushClientWrapper.createAndroidReleaseArtifacts( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, aabPath: any(named: 'aabPath'), architectures: any(named: 'architectures'), flavor: flavor, @@ -478,7 +482,7 @@ flavors: () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ).called(1); expect(exitCode, ExitCode.success.code); diff --git a/packages/shorebird_cli/test/src/commands/release/release_ios_command_test.dart b/packages/shorebird_cli/test/src/commands/release/release_ios_command_test.dart index 3c7875713..8e9187018 100644 --- a/packages/shorebird_cli/test/src/commands/release/release_ios_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/release/release_ios_command_test.dart @@ -54,7 +54,7 @@ void main() { const version = '$versionName+$versionCode'; const appDisplayName = 'Test App'; const arch = 'armv7'; - const platformName = 'ios'; + const releasePlatform = ReleasePlatform.ios; const appMetadata = AppMetadata(appId: appId, displayName: appDisplayName); const release = Release( id: 0, @@ -127,6 +127,10 @@ flutter: return tempDir; } + setUpAll(() { + registerFallbackValue(ReleasePlatform.ios); + }); + setUp(() { argResults = _MockArgResults(); codePushClientWrapper = _MockCodePushClientWrapper(); @@ -173,7 +177,7 @@ flutter: ).thenAnswer((_) async => flutterRevisionProcessResult); when(() => argResults.rest).thenReturn([]); when(() => argResults['arch']).thenReturn(arch); - when(() => argResults['platform']).thenReturn(platformName); + when(() => argResults['platform']).thenReturn(releasePlatform); when(() => auth.isAuthenticated).thenReturn(true); when(() => auth.client).thenReturn(httpClient); when(() => ipaReader.read(any())).thenReturn(ipa); @@ -451,7 +455,7 @@ error: exportArchive: No signing certificate "iOS Distribution" found () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ).called(1); }); @@ -488,7 +492,7 @@ error: exportArchive: No signing certificate "iOS Distribution" found () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ).called(1); expect(exitCode, ExitCode.success.code); @@ -571,7 +575,7 @@ flavors: () => codePushClientWrapper.completeRelease( appId: appId, releaseId: release.id, - platform: platformName, + platform: releasePlatform, ), ).called(1); }); diff --git a/packages/shorebird_code_push_client/example/main.dart b/packages/shorebird_code_push_client/example/main.dart index 7c27bd876..dd84ea48c 100644 --- a/packages/shorebird_code_push_client/example/main.dart +++ b/packages/shorebird_code_push_client/example/main.dart @@ -32,8 +32,8 @@ Future main() async { await client.createReleaseArtifact( appId: app.id, releaseId: release.id, + platform: ReleasePlatform.android, artifactPath: '', // e.g. 'libapp.so' - platform: '', // e.g. 'android' arch: '', // e.g. 'aarch64' hash: '', // 'sha256 hash of the artifact' ); @@ -45,8 +45,8 @@ Future main() async { await client.createPatchArtifact( appId: app.id, patchId: patch.id, + platform: ReleasePlatform.android, artifactPath: '', // e.g. 'libapp.so' - platform: '', // e.g. 'android' arch: '', // e.g. 'aarch64' hash: '', // 'sha256 hash of the artifact' ); diff --git a/packages/shorebird_code_push_client/lib/src/code_push_client.dart b/packages/shorebird_code_push_client/lib/src/code_push_client.dart index d48a581dd..73abb8cc8 100644 --- a/packages/shorebird_code_push_client/lib/src/code_push_client.dart +++ b/packages/shorebird_code_push_client/lib/src/code_push_client.dart @@ -138,7 +138,7 @@ class CodePushClient { required String appId, required int patchId, required String arch, - required String platform, + required ReleasePlatform platform, required String hash, }) async { final request = http.MultipartRequest( @@ -148,7 +148,7 @@ class CodePushClient { final file = await http.MultipartFile.fromPath('file', artifactPath); request.fields.addAll({ 'arch': arch, - 'platform': platform, + 'platform': platform.name, 'hash': hash, 'size': '${file.length}', }); @@ -196,7 +196,7 @@ class CodePushClient { required String appId, required int releaseId, required String arch, - required String platform, + required ReleasePlatform platform, required String hash, }) async { final request = http.MultipartRequest( @@ -206,7 +206,7 @@ class CodePushClient { final file = await http.MultipartFile.fromPath('file', artifactPath); request.fields.addAll({ 'arch': arch, - 'platform': platform, + 'platform': platform.name, 'hash': hash, 'size': '${file.length}', }); @@ -310,7 +310,7 @@ class CodePushClient { Future updateReleaseStatus({ required String appId, required int releaseId, - required String platform, + required ReleasePlatform platform, required ReleaseStatus status, }) async { final response = await _httpClient.patch( @@ -460,13 +460,13 @@ class CodePushClient { required String appId, required int releaseId, String? arch, - String? platform, + ReleasePlatform? platform, }) async { final response = await _httpClient.get( Uri.parse('$_v1/apps/$appId/releases/$releaseId/artifacts').replace( queryParameters: { if (arch != null) 'arch': arch, - if (platform != null) 'platform': platform, + if (platform != null) 'platform': platform.name, }, ), ); diff --git a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart index c5b1e8261..da2bdcd50 100644 --- a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart +++ b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart @@ -220,7 +220,7 @@ void main() { group('createPatchArtifact', () { const patchId = 0; const arch = 'aarch64'; - const platform = 'android'; + const platform = ReleasePlatform.android; const hash = 'test-hash'; const size = 42; @@ -494,7 +494,7 @@ void main() { const appId = 'test-app-id'; const releaseId = 0; const arch = 'aarch64'; - const platform = 'android'; + const platform = ReleasePlatform.android; const hash = 'test-hash'; const size = 42; @@ -1161,7 +1161,7 @@ void main() { group('updateReleaseStatus', () { const appId = 'test-app-id'; const releaseId = 42; - const platform = 'android'; + const platform = ReleasePlatform.android; test('makes the correct request', () async { codePushClient @@ -1866,7 +1866,7 @@ void main() { const appId = 'test-app-id'; const releaseId = 0; const arch = 'aarch64'; - const platform = 'android'; + const platform = ReleasePlatform.android; test('makes the correct request', () async { codePushClient @@ -1884,7 +1884,7 @@ void main() { expect( request.url, equals( - v1('apps/$appId/releases/$releaseId/artifacts?arch=$arch&platform=$platform'), + v1('apps/$appId/releases/$releaseId/artifacts?arch=$arch&platform=${platform.name}'), ), ); expect(request.hasStandardHeaders, isTrue); diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/check_for_patches/check_for_patches_request.dart b/packages/shorebird_code_push_protocol/lib/src/messages/check_for_patches/check_for_patches_request.dart index 75cda81b7..1ad468307 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/check_for_patches/check_for_patches_request.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/check_for_patches/check_for_patches_request.dart @@ -1,4 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; part 'check_for_patches_request.g.dart'; @@ -35,7 +36,7 @@ class CheckForPatchesRequest { final String? patchHash; /// The platform of the app. - final String platform; + final ReleasePlatform platform; /// The architecture of the app. final String arch; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/check_for_patches/check_for_patches_request.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/check_for_patches/check_for_patches_request.g.dart index 83ae40060..4b7080000 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/check_for_patches/check_for_patches_request.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/check_for_patches/check_for_patches_request.g.dart @@ -19,7 +19,8 @@ CheckForPatchesRequest _$CheckForPatchesRequestFromJson( $checkedConvert('release_version', (v) => v as String), patchNumber: $checkedConvert('patch_number', (v) => v as int?), patchHash: $checkedConvert('patch_hash', (v) => v as String?), - platform: $checkedConvert('platform', (v) => v as String), + platform: $checkedConvert( + 'platform', (v) => $enumDecode(_$ReleasePlatformEnumMap, v)), arch: $checkedConvert('arch', (v) => v as String), appId: $checkedConvert('app_id', (v) => v as String), channel: $checkedConvert('channel', (v) => v as String), @@ -40,8 +41,13 @@ Map _$CheckForPatchesRequestToJson( 'release_version': instance.releaseVersion, 'patch_number': instance.patchNumber, 'patch_hash': instance.patchHash, - 'platform': instance.platform, + 'platform': _$ReleasePlatformEnumMap[instance.platform]!, 'arch': instance.arch, 'app_id': instance.appId, 'channel': instance.channel, }; + +const _$ReleasePlatformEnumMap = { + ReleasePlatform.android: 'android', + ReleasePlatform.ios: 'ios', +}; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.dart index 69cac94bd..ecbeffe96 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.dart @@ -27,7 +27,7 @@ class CreatePatchArtifactRequest { final String arch; /// The platform of the artifact. - final String platform; + final ReleasePlatform platform; /// The hash of the artifact. final String hash; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.g.dart index 4c2c1b4b0..ad4af47a2 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_request.g.dart @@ -16,7 +16,8 @@ CreatePatchArtifactRequest _$CreatePatchArtifactRequestFromJson( ($checkedConvert) { final val = CreatePatchArtifactRequest( arch: $checkedConvert('arch', (v) => v as String), - platform: $checkedConvert('platform', (v) => v as String), + platform: $checkedConvert( + 'platform', (v) => $enumDecode(_$ReleasePlatformEnumMap, v)), hash: $checkedConvert('hash', (v) => v as String), size: $checkedConvert( 'size', (v) => CreatePatchArtifactRequest._parseStringToInt(v)), @@ -29,7 +30,12 @@ Map _$CreatePatchArtifactRequestToJson( CreatePatchArtifactRequest instance) => { 'arch': instance.arch, - 'platform': instance.platform, + 'platform': _$ReleasePlatformEnumMap[instance.platform]!, 'hash': instance.hash, 'size': CreatePatchArtifactRequest._parseIntToString(instance.size), }; + +const _$ReleasePlatformEnumMap = { + ReleasePlatform.android: 'android', + ReleasePlatform.ios: 'ios', +}; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.dart index de068c705..ccf665aa1 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.dart @@ -36,7 +36,7 @@ class CreatePatchArtifactResponse { final String arch; /// The platform of the artifact. - final String platform; + final ReleasePlatform platform; /// The hash of the artifact. final String hash; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.g.dart index adb385312..58d79ec16 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_patch_artifact/create_patch_artifact_response.g.dart @@ -18,7 +18,8 @@ CreatePatchArtifactResponse _$CreatePatchArtifactResponseFromJson( id: $checkedConvert('id', (v) => v as int), patchId: $checkedConvert('patch_id', (v) => v as int), arch: $checkedConvert('arch', (v) => v as String), - platform: $checkedConvert('platform', (v) => v as String), + platform: $checkedConvert( + 'platform', (v) => $enumDecode(_$ReleasePlatformEnumMap, v)), hash: $checkedConvert('hash', (v) => v as String), size: $checkedConvert('size', (v) => v as int), url: $checkedConvert('url', (v) => v as String), @@ -34,8 +35,13 @@ Map _$CreatePatchArtifactResponseToJson( 'id': instance.id, 'patch_id': instance.patchId, 'arch': instance.arch, - 'platform': instance.platform, + 'platform': _$ReleasePlatformEnumMap[instance.platform]!, 'hash': instance.hash, 'size': instance.size, 'url': instance.url, }; + +const _$ReleasePlatformEnumMap = { + ReleasePlatform.android: 'android', + ReleasePlatform.ios: 'ios', +}; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_request.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_request.dart index 6cef0a84e..4affb2e1e 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_request.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_request.dart @@ -27,7 +27,7 @@ class CreateReleaseArtifactRequest { final String arch; /// The platform of the artifact. - final String platform; + final ReleasePlatform platform; /// The hash of the artifact. final String hash; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_request.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_request.g.dart index 778106310..8a56b8a20 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_request.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_request.g.dart @@ -16,7 +16,8 @@ CreateReleaseArtifactRequest _$CreateReleaseArtifactRequestFromJson( ($checkedConvert) { final val = CreateReleaseArtifactRequest( arch: $checkedConvert('arch', (v) => v as String), - platform: $checkedConvert('platform', (v) => v as String), + platform: $checkedConvert( + 'platform', (v) => $enumDecode(_$ReleasePlatformEnumMap, v)), hash: $checkedConvert('hash', (v) => v as String), size: $checkedConvert( 'size', (v) => CreateReleaseArtifactRequest._parseStringToInt(v)), @@ -29,7 +30,12 @@ Map _$CreateReleaseArtifactRequestToJson( CreateReleaseArtifactRequest instance) => { 'arch': instance.arch, - 'platform': instance.platform, + 'platform': _$ReleasePlatformEnumMap[instance.platform]!, 'hash': instance.hash, 'size': CreateReleaseArtifactRequest._parseIntToString(instance.size), }; + +const _$ReleasePlatformEnumMap = { + ReleasePlatform.android: 'android', + ReleasePlatform.ios: 'ios', +}; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.dart index 441dd92bc..70f2ea89e 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.dart @@ -36,7 +36,7 @@ class CreateReleaseArtifactResponse { final String arch; /// The platform of the artifact. - final String platform; + final ReleasePlatform platform; /// The hash of the artifact. final String hash; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.g.dart index 73abc1d98..be9c1b1f3 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/create_release_artifact/create_release_artifact_response.g.dart @@ -18,7 +18,8 @@ CreateReleaseArtifactResponse _$CreateReleaseArtifactResponseFromJson( id: $checkedConvert('id', (v) => v as int), releaseId: $checkedConvert('release_id', (v) => v as int), arch: $checkedConvert('arch', (v) => v as String), - platform: $checkedConvert('platform', (v) => v as String), + platform: $checkedConvert( + 'platform', (v) => $enumDecode(_$ReleasePlatformEnumMap, v)), hash: $checkedConvert('hash', (v) => v as String), size: $checkedConvert('size', (v) => v as int), url: $checkedConvert('url', (v) => v as String), @@ -34,8 +35,13 @@ Map _$CreateReleaseArtifactResponseToJson( 'id': instance.id, 'release_id': instance.releaseId, 'arch': instance.arch, - 'platform': instance.platform, + 'platform': _$ReleasePlatformEnumMap[instance.platform]!, 'hash': instance.hash, 'size': instance.size, 'url': instance.url, }; + +const _$ReleasePlatformEnumMap = { + ReleasePlatform.android: 'android', + ReleasePlatform.ios: 'ios', +}; diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/update_release/update_release_request.dart b/packages/shorebird_code_push_protocol/lib/src/messages/update_release/update_release_request.dart index c92384c86..334baf8e0 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/update_release/update_release_request.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/update_release/update_release_request.dart @@ -25,5 +25,5 @@ class UpdateReleaseRequest { final ReleaseStatus status; /// The platform of the release. - final String platform; + final ReleasePlatform platform; } diff --git a/packages/shorebird_code_push_protocol/lib/src/messages/update_release/update_release_request.g.dart b/packages/shorebird_code_push_protocol/lib/src/messages/update_release/update_release_request.g.dart index 125949bf4..220a0ec31 100644 --- a/packages/shorebird_code_push_protocol/lib/src/messages/update_release/update_release_request.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/messages/update_release/update_release_request.g.dart @@ -17,7 +17,8 @@ UpdateReleaseRequest _$UpdateReleaseRequestFromJson( final val = UpdateReleaseRequest( status: $checkedConvert( 'status', (v) => $enumDecode(_$ReleaseStatusEnumMap, v)), - platform: $checkedConvert('platform', (v) => v as String), + platform: $checkedConvert( + 'platform', (v) => $enumDecode(_$ReleasePlatformEnumMap, v)), ); return val; }, @@ -27,10 +28,15 @@ Map _$UpdateReleaseRequestToJson( UpdateReleaseRequest instance) => { 'status': _$ReleaseStatusEnumMap[instance.status]!, - 'platform': instance.platform, + 'platform': _$ReleasePlatformEnumMap[instance.platform]!, }; const _$ReleaseStatusEnumMap = { ReleaseStatus.draft: 'draft', ReleaseStatus.active: 'active', }; + +const _$ReleasePlatformEnumMap = { + ReleasePlatform.android: 'android', + ReleasePlatform.ios: 'ios', +}; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/models.dart b/packages/shorebird_code_push_protocol/lib/src/models/models.dart index 1b78e2d68..2fdf4fed3 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/models.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/models.dart @@ -7,6 +7,7 @@ export 'patch.dart'; export 'patch_artifact.dart'; export 'release.dart'; export 'release_artifact.dart'; +export 'release_platform.dart'; export 'release_status.dart'; export 'shorebird_plan.dart'; export 'subscription.dart'; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/patch_artifact.dart b/packages/shorebird_code_push_protocol/lib/src/models/patch_artifact.dart index c8d642bab..f65d9bfaf 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/patch_artifact.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/patch_artifact.dart @@ -1,4 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; part 'patch_artifact.g.dart'; @@ -36,7 +37,7 @@ class PatchArtifact { final String arch; /// The platform of the artifact. - final String platform; + final ReleasePlatform platform; /// The hash of the artifact. final String hash; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/patch_artifact.g.dart b/packages/shorebird_code_push_protocol/lib/src/models/patch_artifact.g.dart index 576e351ff..4480f1ece 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/patch_artifact.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/patch_artifact.g.dart @@ -17,7 +17,8 @@ PatchArtifact _$PatchArtifactFromJson(Map json) => id: $checkedConvert('id', (v) => v as int), patchId: $checkedConvert('patch_id', (v) => v as int), arch: $checkedConvert('arch', (v) => v as String), - platform: $checkedConvert('platform', (v) => v as String), + platform: $checkedConvert( + 'platform', (v) => $enumDecode(_$ReleasePlatformEnumMap, v)), hash: $checkedConvert('hash', (v) => v as String), size: $checkedConvert('size', (v) => v as int), url: $checkedConvert('url', (v) => v as String), @@ -32,8 +33,13 @@ Map _$PatchArtifactToJson(PatchArtifact instance) => 'id': instance.id, 'patch_id': instance.patchId, 'arch': instance.arch, - 'platform': instance.platform, + 'platform': _$ReleasePlatformEnumMap[instance.platform]!, 'hash': instance.hash, 'size': instance.size, 'url': instance.url, }; + +const _$ReleasePlatformEnumMap = { + ReleasePlatform.android: 'android', + ReleasePlatform.ios: 'ios', +}; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/release_artifact.dart b/packages/shorebird_code_push_protocol/lib/src/models/release_artifact.dart index 04cf3846d..59e279385 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/release_artifact.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/release_artifact.dart @@ -1,4 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; part 'release_artifact.g.dart'; @@ -36,7 +37,7 @@ class ReleaseArtifact { final String arch; /// The platform of the artifact. - final String platform; + final ReleasePlatform platform; /// The hash of the artifact. final String hash; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/release_artifact.g.dart b/packages/shorebird_code_push_protocol/lib/src/models/release_artifact.g.dart index 7e1123269..d06b3e84a 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/release_artifact.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/release_artifact.g.dart @@ -17,7 +17,8 @@ ReleaseArtifact _$ReleaseArtifactFromJson(Map json) => id: $checkedConvert('id', (v) => v as int), releaseId: $checkedConvert('release_id', (v) => v as int), arch: $checkedConvert('arch', (v) => v as String), - platform: $checkedConvert('platform', (v) => v as String), + platform: $checkedConvert( + 'platform', (v) => $enumDecode(_$ReleasePlatformEnumMap, v)), hash: $checkedConvert('hash', (v) => v as String), size: $checkedConvert('size', (v) => v as int), url: $checkedConvert('url', (v) => v as String), @@ -32,8 +33,13 @@ Map _$ReleaseArtifactToJson(ReleaseArtifact instance) => 'id': instance.id, 'release_id': instance.releaseId, 'arch': instance.arch, - 'platform': instance.platform, + 'platform': _$ReleasePlatformEnumMap[instance.platform]!, 'hash': instance.hash, 'size': instance.size, 'url': instance.url, }; + +const _$ReleasePlatformEnumMap = { + ReleasePlatform.android: 'android', + ReleasePlatform.ios: 'ios', +}; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/release_platform.dart b/packages/shorebird_code_push_protocol/lib/src/models/release_platform.dart new file mode 100644 index 000000000..dbbb4d402 --- /dev/null +++ b/packages/shorebird_code_push_protocol/lib/src/models/release_platform.dart @@ -0,0 +1,7 @@ +/// A platform to which a Shorebird release can be deployed. +enum ReleasePlatform { + // ignore: public_member_api_docs + android, + // ignore: public_member_api_docs + ios; +} diff --git a/packages/shorebird_code_push_protocol/lib/src/models/release_status.dart b/packages/shorebird_code_push_protocol/lib/src/models/release_status.dart index 2478a8b3d..c3223f7c1 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/release_status.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/release_status.dart @@ -5,9 +5,5 @@ enum ReleaseStatus { draft, /// Indicates that all platform artifacts have been uploaded for this release. - active; - - /// Returns the [ReleaseStatus] with the given [name]. - factory ReleaseStatus.named(String name) => - ReleaseStatus.values.firstWhere((status) => status.name == name); + active, } diff --git a/packages/shorebird_code_push_protocol/test/src/messages/check_for_patches/check_for_patches_request_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/check_for_patches/check_for_patches_request_test.dart index 512d1672e..c01db0ed7 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/check_for_patches/check_for_patches_request_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/check_for_patches/check_for_patches_request_test.dart @@ -8,7 +8,7 @@ void main() { releaseVersion: '1', patchNumber: 2, patchHash: '3', - platform: 'android', + platform: ReleasePlatform.android, arch: 'arm64', appId: 'app_123', channel: 'channel_123', diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_request_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_request_test.dart index cf075e845..d10bb6f10 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_request_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_request_test.dart @@ -6,7 +6,7 @@ void main() { test('can be (de)serialized', () { const request = CreatePatchArtifactRequest( arch: 'arm64', - platform: 'android', + platform: ReleasePlatform.android, hash: '1234', size: 9876, ); diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_response_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_response_test.dart index 754c544cf..999d478f7 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_response_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_patch_artifact/create_patch_artifact_response_test.dart @@ -8,7 +8,7 @@ void main() { id: 42, patchId: 1, arch: 'arm64', - platform: 'android', + platform: ReleasePlatform.android, hash: '1234', size: 9876, url: 'https://example.com', diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_request_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_request_test.dart index 003f2583d..28d4e94ba 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_request_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_request_test.dart @@ -6,7 +6,7 @@ void main() { test('can be (de)serialized', () { const request = CreateReleaseArtifactRequest( arch: 'arm64', - platform: 'android', + platform: ReleasePlatform.android, hash: '1234', size: 9876, ); diff --git a/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_response_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_response_test.dart index 59774e076..6b4c5d247 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_response_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/create_release_artifact/create_release_artifact_response_test.dart @@ -8,7 +8,7 @@ void main() { id: 42, releaseId: 1, arch: 'arm64', - platform: 'android', + platform: ReleasePlatform.android, hash: '1234', size: 9876, url: 'https://example.com', diff --git a/packages/shorebird_code_push_protocol/test/src/messages/get_release_artifacts/get_release_artifacts_response_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/get_release_artifacts/get_release_artifacts_response_test.dart index df7db0a5d..f4023ecda 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/get_release_artifacts/get_release_artifacts_response_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/get_release_artifacts/get_release_artifacts_response_test.dart @@ -10,7 +10,7 @@ void main() { id: 42, releaseId: 1, arch: 'aarch64', - platform: 'android', + platform: ReleasePlatform.android, hash: '#', size: 1337, url: 'https://example.com', diff --git a/packages/shorebird_code_push_protocol/test/src/messages/update_release/update_release_request_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/update_release/update_release_request_test.dart index f173b7847..11b210da3 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/update_release/update_release_request_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/update_release/update_release_request_test.dart @@ -5,7 +5,7 @@ void main() { group(UpdateReleaseRequest, () { test('can be (de)serialized', () { const request = UpdateReleaseRequest( - platform: 'android', + platform: ReleasePlatform.android, status: ReleaseStatus.active, ); expect( diff --git a/packages/shorebird_code_push_protocol/test/src/models/patch_artifact_test.dart b/packages/shorebird_code_push_protocol/test/src/models/patch_artifact_test.dart index f357a9bac..e3b8c5232 100644 --- a/packages/shorebird_code_push_protocol/test/src/models/patch_artifact_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/models/patch_artifact_test.dart @@ -8,7 +8,7 @@ void main() { id: 1, patchId: 1, arch: 'aarch64', - platform: 'android', + platform: ReleasePlatform.android, url: 'https://example.com', size: 42, hash: 'sha256:1234567890', diff --git a/packages/shorebird_code_push_protocol/test/src/models/release_artifact_test.dart b/packages/shorebird_code_push_protocol/test/src/models/release_artifact_test.dart index c3f4ca005..963814fe5 100644 --- a/packages/shorebird_code_push_protocol/test/src/models/release_artifact_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/models/release_artifact_test.dart @@ -8,7 +8,7 @@ void main() { id: 1, releaseId: 1, arch: 'aarch64', - platform: 'android', + platform: ReleasePlatform.android, url: 'https://example.com', size: 42, hash: 'sha256:1234567890', @@ -24,7 +24,7 @@ void main() { id: 1, releaseId: 1, arch: 'aarch64', - platform: 'android', + platform: ReleasePlatform.android, url: 'https://example.com', size: 42, hash: 'sha256:1234567890', diff --git a/packages/shorebird_code_push_protocol/test/src/models/release_status_test.dart b/packages/shorebird_code_push_protocol/test/src/models/release_status_test.dart deleted file mode 100644 index 128d6f58a..000000000 --- a/packages/shorebird_code_push_protocol/test/src/models/release_status_test.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart'; -import 'package:test/test.dart'; - -void main() { - group(ReleaseStatus, () { - test('named allows lookup based on name', () { - expect(ReleaseStatus.named('draft'), equals(ReleaseStatus.draft)); - expect(ReleaseStatus.named('active'), equals(ReleaseStatus.active)); - }); - }); -}