Skip to content

Commit

Permalink
Merge pull request #233 from yumemi-inc/feature/fix_flavor_issue
Browse files Browse the repository at this point in the history
dart-define系のissueを修正
  • Loading branch information
K9i-0 committed Jun 4, 2024
2 parents fed93db + 0435c19 commit 55899f6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
7 changes: 5 additions & 2 deletions apps/app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ if (project.hasProperty('dart-defines')) {
.split(',')
.collectEntries { entry ->
def pair = new String(entry.decodeBase64(), 'UTF-8').split('=')
[(pair.first()): pair.last()]
// valueがemtpyの時にlastがkeyになるので、lengthが2でなければ空のmapにする
pair.length == 2 ? [(pair.first()): pair.last()] : [:]
}
}

Expand All @@ -54,7 +55,9 @@ android {

defaultConfig {
applicationId = "${dartDefines.appId}"
applicationIdSuffix = "${dartDefines.appIdSuffix}"
if (dartDefines.appIdSuffix != null) {
applicationIdSuffix = "${dartDefines.appIdSuffix}"
}
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion = flutter.minSdkVersion
Expand Down
8 changes: 1 addition & 7 deletions apps/app/lib/app_build_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ final class AppBuildConfig implements BuildConfig {
required this.buildNumber,
required this.buildSignature,
this.installerStore,
}) : flavor = switch (appFlavor) {
'dev' => Flavor.dev,
'stg' => Flavor.stg,
'prod' => Flavor.prd,
// default flavor
_ => Flavor.dev,
};
}) : flavor = Flavor.values.byName(appFlavor);

@override
String appName;
Expand Down
1 change: 1 addition & 0 deletions packages/cores/core/lib/extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'src/extension/enum.dart';
12 changes: 12 additions & 0 deletions packages/cores/core/lib/src/extension/enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extension EnumByName<T extends Enum> on Iterable<T> {
// byNameで取得できなかった場合はnullを返す版
T? byNameOrNull(String name) {
for (final MapEntry(key: key, value: value) in asNameMap().entries) {
if (key == name) {
return value;
}
}

return null;
}
}

0 comments on commit 55899f6

Please sign in to comment.