Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SERDUN committed Aug 28, 2024
2 parents e76c410 + e47348a commit c875eb3
Show file tree
Hide file tree
Showing 35 changed files with 2,243 additions and 63 deletions.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,32 @@ dart pub global activate --source=path <path to this package>

## Usage

**Android Keystore Signing**

```sh
# Keystore-generate command
$ webtrit_phone_tools keystore-generate --bundleId="com.webtrit.app" --appendDirectory ../webtrit_phone_keystores
# Keystore-commit command
$ webtrit_phone_tools keystore-commit --bundleId="com.webtrit.app" --appendDirectory ../webtrit_phone_keystores
# Keystore-verify command
$ webtrit_phone_tools keystore-verify ../webtrit_phone_keystores/com.webtrit.app
```

**Application Resource Configuration:**

```sh
# Configure application resources (using configurator tool)

Check warning on line 39 in README.md

View workflow job for this annotation

GitHub Actions / spell-check / build

Unknown word (configurator)
$ webtrit_phone_tools configure --applicationId=$(id) $(KEYSTORES_PATH) --$(BUILD_FLOW)
# Generate configuration files
$ webtrit_phone_tools configurator-generate

Check warning on line 42 in README.md

View workflow job for this annotation

GitHub Actions / spell-check / build

Unknown word (configurator)

# Create demo classic configuration (using configurator tool)

Check warning on line 44 in README.md

View workflow job for this annotation

GitHub Actions / spell-check / build

Unknown word (configurator)
$ webtrit_phone_tools create-demo-classic

# Create assetlink and apple-app-site-association files

Check warning on line 47 in README.md

View workflow job for this annotation

GitHub Actions / spell-check / build

Unknown word (assetlink)
$ webtrit_phone_tools assetlinks-generate --bundleId=$(bundle_id) --appleTeamID=$(team_id) --androidFingerprints=$(SHA256_key) --output=$(out_path) $(metadata_path)

Check warning on line 48 in README.md

View workflow job for this annotation

GitHub Actions / spell-check / build

Unknown word (assetlinks)

**Additional Commands:**

# Show CLI version
$ webtrit_phone_tools --version
Expand All @@ -37,4 +58,29 @@ $ webtrit_phone_tools --help

---

**Advanced Usage (Configurator Tool):**

Check warning on line 61 in README.md

View workflow job for this annotation

GitHub Actions / spell-check / build

Unknown word (Configurator)

These commands are for developers familiar with the `configurator` tool used internally.

Check warning on line 63 in README.md

View workflow job for this annotation

GitHub Actions / spell-check / build

Unknown word (configurator)

* [`configurator-resources`](./lib/src/commands/configurator_get_resources_command.dart)

Check warning on line 65 in README.md

View workflow job for this annotation

GitHub Actions / spell-check / build

Unknown word (configurator)
* [`configurator-generate`](./lib/src/commands/configurator_generate_command.dart)

---

## Providing Assets for Builds

In the Dart CLI, there isn't a mechanism like in Flutter where you can directly store files in executed builds. Instead, we need to stringify assets before creating the build. This ensures that assets are properly embedded into the Dart code.

To stringify assets, use the `stringify_assets.sh` script. This script converts asset files into Dart code that can be included in your build.

**Example Usage:**

```sh
./stringify_assets.sh assets lib/src/gen/stringify_assets.dart
```

This command takes all files in the `assets` directory and converts them into a Dart file located at `lib/src/gen/stringify_assets.dart`.

Make sure to run this script before creating a build to ensure all assets are properly included.

[very_good_cli_link]: https://github.com/VeryGoodOpenSource/very_good_cli
10 changes: 5 additions & 5 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include: package:very_good_analysis/analysis_options.5.1.0.yaml
linter:
rules:
lines_longer_than_80_chars: false
public_member_api_docs: false
include: package:webtrit_analysis/analysis_options.yaml

analyzer:
exclude:
- lib/src/gen/**
4 changes: 4 additions & 0 deletions assets/app_theme_gradient_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"color": "{{ color }}",
"blend": false
}
55 changes: 55 additions & 0 deletions assets/app_theme_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"seedColor": "{{ seedColor }}",
"lightColorSchemeOverride": {
"primary": "{{ primary }}",
"onPrimary": "{{ onPrimary }}",
"primaryContainer": "{{ primaryContainer }}",
"onPrimaryContainer": "{{ onPrimaryContainer }}",
"primaryFixed": "{{ primaryFixed }}",
"primaryFixedDim": "{{ primaryFixedDim }}",
"onPrimaryFixed": "{{ onPrimaryFixed }}",
"onPrimaryFixedVariant": "{{ onPrimaryFixedVariant }}",
"secondary": "{{ secondary }}",
"onSecondary": "{{ onSecondary }}",
"secondaryContainer": "{{ secondaryContainer }}",
"onSecondaryContainer": "{{ onSecondaryContainer }}",
"secondaryFixed": "{{ secondaryFixed }}",
"secondaryFixedDim": "{{ secondaryFixedDim }}",
"onSecondaryFixed": "{{ onSecondaryFixed }}",
"onSecondaryFixedVariant": "{{ onSecondaryFixedVariant }}",
"tertiary": "{{ tertiary }}",
"onTertiary": "{{ onTertiary }}",
"tertiaryContainer": "{{ tertiaryContainer }}",
"onTertiaryContainer": "{{ onTertiaryContainer }}",
"tertiaryFixed": "{{ tertiaryFixed }}",
"tertiaryFixedDim": "{{ tertiaryFixedDim }}",
"onTertiaryFixed": "{{ onTertiaryFixed }}",
"onTertiaryFixedVariant": "{{ onTertiaryFixedVariant }}",
"error": "{{ error }}",
"onError": "{{ onError }}",
"errorContainer": "{{ errorContainer }}",
"onErrorContainer": "{{ onErrorContainer }}",
"outline": "{{ outline }}",
"outlineVariant": "{{ outlineVariant }}",
"surface": "{{ surface }}",
"onSurface": "{{ onSurface }}",
"surfaceDim": "{{ surfaceDim }}",
"surfaceBright": "{{ surfaceBright }}",
"surfaceContainerLowest": "{{ surfaceContainerLowest }}",
"surfaceContainerLow": "{{ surfaceContainerLow }}",
"surfaceContainer": "{{ surfaceContainer }}",
"surfaceContainerHigh": "{{ surfaceContainerHigh }}",
"surfaceContainerHighest": "{{ surfaceContainerHighest }}",
"onSurfaceVariant": "{{ onSurfaceVariant }}",
"inverseSurface": "{{ inverseSurface }}",
"onInverseSurface": "{{ onInverseSurface }}",
"inversePrimary": "{{ inversePrimary }}",
"shadow": "{{ shadow }}",
"scrim": "{{ scrim }}",
"surfaceTint": "{{ surfaceTint }}"
},
"primaryGradientColors": {{ primaryGradientColors }},
"fontFamily": "{{fontFamily}}",
"primaryOnboardingLogo": "{{primaryOnboardingLogo}}",
"secondaryOnboardingLogo": "{{secondaryOnboardingLogo}}"
}
10 changes: 10 additions & 0 deletions assets/apple_asset_links_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"applinks": {
"details": [
{
"appID": "{{ appID }}",
"paths": [ "*" ]
}
]
}
}
20 changes: 20 additions & 0 deletions assets/dart_define_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"WEBTRIT_APP_DEBUG_LEVEL": "ALL",
"WEBTRIT_APP_DATABASE_LOG_STATEMENTS": false,
"WEBTRIT_APP_PERIODIC_POLLING": true,
"WEBTRIT_APP_ENABLE_ATTENDED_TRANSFER": {{ WEBTRIT_APP_ENABLE_ATTENDED_TRANSFER }},
"WEBTRIT_APP_DEMO_CORE_URL": "{{ WEBTRIT_APP_DEMO_CORE_URL }}",
"WEBTRIT_APP_CORE_URL": "{{ WEBTRIT_APP_CORE_URL }}",
"WEBTRIT_APP_NAME": "{{ WEBTRIT_APP_NAME }}",
"WEBTRIT_APP_GREETING": "{{ WEBTRIT_APP_GREETING }}",
"WEBTRIT_APP_DESCRIPTION": "{{ WEBTRIT_APP_DESCRIPTION }}",
"WEBTRIT_APP_TERMS_AND_CONDITIONS_URL": "{{ WEBTRIT_APP_TERMS_AND_CONDITIONS_URL }}",
"WEBTRIT_APP_SALES_EMAIL": "{{ WEBTRIT_APP_SALES_EMAIL }}",
"WEBTRIT_APP_CREDENTIALS_REQUEST_URL": "{{ WEBTRIT_APP_CREDENTIALS_REQUEST_URL }}",
"WEBTRIT_ANDROID_RELEASE_UPLOAD_KEYSTORE_PATH": "{{ WEBTRIT_ANDROID_RELEASE_UPLOAD_KEYSTORE_PATH }}",
"WEBTRIT_APP_LINK_DOMAIN": "app.webtrit.com",
"WEBTRIT_APP_CHAT_SERVICE_URL": "{{ WEBTRIT_APP_CHAT_SERVICE_URL }}",
"WEBTRIT_APP_SMS_SERVICE_URL": "{{ WEBTRIT_APP_SMS_SERVICE_URL }}",
"WEBTRIT_APP_CHAT_FEATURE_ENABLE": {{ WEBTRIT_APP_CHAT_FEATURE_ENABLE }},
"WEBTRIT_APP_SMS_FEATURE_ENABLE": {{ WEBTRIT_APP_SMS_FEATURE_ENABLE }}
}
14 changes: 14 additions & 0 deletions assets/flutter_launcher_icons_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
flutter_launcher_icons:
android: true
image_path_android: "assets/launcher_icons/android.png"
min_sdk_android: 23
adaptive_icon_background: "{{adaptive_icon_background}}"
adaptive_icon_foreground: "assets/launcher_icons/ic_foreground.png"
ios: true
remove_alpha_ios: true
image_path_ios: "assets/launcher_icons/ios.png"
web:
generate: true
image_path: "assets/launcher_icons/web.png"
background_color: "#FFFFFF"
theme_color: "{{theme_color}}"
6 changes: 6 additions & 0 deletions assets/flutter_native_splash_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
flutter_native_splash:
color: "{{background}}"
color_dark: "{{background}}"
android_12:
color: "{{background}}"
color_dark: "{{background}}"
7 changes: 7 additions & 0 deletions assets/google_asset_links_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"relation": [ "delegate_permission/common.handle_all_urls" ],
"target": {
"package_name": "{{ package_name }}",
"sha256_cert_fingerprints": {{ sha256_cert_fingerprints }}
}
}
9 changes: 9 additions & 0 deletions assets/package_rename_config_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package_rename_config:
android:
app_name: {{ app_name }}
package_name: {{ android_package_name }}
override_old_package: {{override_old_package}}
lang: kotlin
ios:
app_name: {{ app_name }}
package_name: {{ ios_package_name }}
7 changes: 7 additions & 0 deletions assets/upload-store-connect-metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"bundleId": "{{ BUNDLE_ID }}",
"issuer-id": "",
"key_id": "",
"code-signing-identity": "",
"team-id": ""
}
21 changes: 21 additions & 0 deletions lib/src/command_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import 'package:pub_updater/pub_updater.dart';
import 'package:webtrit_phone_tools/src/commands/commands.dart';
import 'package:webtrit_phone_tools/src/version.dart';

import 'commands/constants.dart';
import 'utils/utils.dart';

const executableName = 'webtrit_phone_tools';
const packageName = 'webtrit_phone_tools';
const description = 'WebTrit Phone CLI tools';
Expand All @@ -22,8 +25,12 @@ class WebtritPhoneToolsCommandRunner extends CompletionCommandRunner<int> {
/// {@macro webtrit_phone_tools_command_runner}
WebtritPhoneToolsCommandRunner({
Logger? logger,
HttpClient? httpClient,
KeystoreReadmeUpdater? keystoreReadmeUpdater,
PubUpdater? pubUpdater,
}) : _logger = logger ?? Logger(),
_httpClient = httpClient ?? HttpClient(configuratorApiUrl, Logger()),
_keystoreReadmeUpdater = keystoreReadmeUpdater ?? KeystoreReadmeUpdater(Logger()),
_pubUpdater = pubUpdater ?? PubUpdater(),
super(executableName, description) {
// Add root options and flags
Expand All @@ -40,15 +47,29 @@ class WebtritPhoneToolsCommandRunner extends CompletionCommandRunner<int> {
);

// Add sub commands
addCommand(ConfiguratorGetResourcesCommand(
logger: _logger,
httpClient: _httpClient,
));
addCommand(ConfiguratorGenerateCommand(logger: _logger));
addCommand(KeystoreInitCommand(
logger: _logger,
httpClient: _httpClient,
keystoreReadmeUpdater: _keystoreReadmeUpdater,
));
addCommand(KeystoreGenerateCommand(logger: _logger));
addCommand(KeystoreCommitCommand(logger: _logger));
addCommand(KeystoreVerifyCommand(logger: _logger));
addCommand(AssetlinksGenerateCommand(logger: _logger));
addCommand(UpdateCommand(logger: _logger, pubUpdater: _pubUpdater));
}

@override
void printUsage() => _logger.info(usage);

final Logger _logger;
final HttpClient _httpClient;
final KeystoreReadmeUpdater _keystoreReadmeUpdater;
final PubUpdater _pubUpdater;

@override
Expand Down
Loading

0 comments on commit c875eb3

Please sign in to comment.