Skip to content

Commit

Permalink
fix: Fixed a bug that configProperties could not be obtained.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Jun 18, 2023
1 parent d389b5b commit 50a1f9e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
35 changes: 14 additions & 21 deletions packages/katana_cli/lib/action/app/location.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Project imports:
// Dart imports:
import 'dart:io';

// Package imports:
import 'package:html/dom.dart';
import 'package:html/parser.dart';
import 'package:katana_cli/katana_cli.dart';
import 'package:xml/xml.dart';

// Project imports:
import 'package:katana_cli/katana_cli.dart';

/// Add a module to use location information and GoogleMap.
///
/// 位置情報およびGoogleMapを利用するためのモジュールを追加します。
Expand Down Expand Up @@ -90,25 +93,6 @@ class AppLocationCliAction extends CliCommand with CliActionMixin {
),
);
}
if (!manifest.first.children.any((p0) =>
p0 is XmlElement &&
p0.name.toString() == "uses-permission" &&
p0.attributes.any((p1) =>
p1.name.toString() == "android:name" &&
p1.value == "android.permission.FOREGROUND_SERVICE"))) {
manifest.first.children.add(
XmlElement(
XmlName("uses-permission"),
[
XmlAttribute(
XmlName("android:name"),
"android.permission.FOREGROUND_SERVICE",
),
],
[],
),
);
}
if (enableBackground) {
if (!manifest.first.children.any((p0) =>
p0 is XmlElement &&
Expand Down Expand Up @@ -184,6 +168,15 @@ class AppLocationCliAction extends CliCommand with CliActionMixin {
label("Edit build.gradle");
final gradle = AppGradle();
await gradle.load();
if (!gradle.loadProperties.any((e) => e.name == "configProperties")) {
gradle.loadProperties.add(
GradleLoadProperties(
path: "config.properties",
name: "configProperties",
file: "configPropertiesFile",
),
);
}
gradle.android?.defaultConfig.minSdkVersion =
"configProperties[\"flutter.minSdkVersion\"]";
await gradle.save();
Expand Down
9 changes: 9 additions & 0 deletions packages/katana_cli/lib/action/firebase/init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,15 @@ class FirebaseInitCliAction extends CliCommand with CliActionMixin {
].join("\n"));
}
label("Edit build.gradle");
if (!gradle.loadProperties.any((e) => e.name == "configProperties")) {
gradle.loadProperties.add(
GradleLoadProperties(
path: "config.properties",
name: "configProperties",
file: "configPropertiesFile",
),
);
}
gradle.android?.defaultConfig.minSdkVersion =
"configProperties[\"flutter.minSdkVersion\"]";
await gradle.save();
Expand Down

0 comments on commit 50a1f9e

Please sign in to comment.