Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ jobs:
NEW_VERSION="${NEW_VERSION#v}"
./scripts/bump_version.sh --version "$NEW_VERSION"

- name: Verify version sync
run: |
PUBSPEC_VERSION=$(grep "^version:" pubspec.yaml | sed 's/version: //')
DART_VERSION=$(grep "packageVersion" lib/src/version.dart | sed "s/.*'\(.*\)'.*/\1/")
if [ "$PUBSPEC_VERSION" != "$DART_VERSION" ]; then
echo "::error::Version mismatch: pubspec.yaml ($PUBSPEC_VERSION) != lib/src/version.dart ($DART_VERSION)"
exit 1
fi
echo "Versions in sync: $PUBSPEC_VERSION"

- name: Install Flutter
uses: subosito/flutter-action@v2
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class AtomicTransactFlutterPlugin: FlutterPlugin, MethodCallHandler, ActivityAwa
if (call.method == "presentTransact") {
val transactPath = call.argument<String>("transactPath") as String? ?: ""
val apiPath = call.argument<String>("apiPath") as String? ?: ""
val pluginVersion = call.argument<String>("pluginVersion") ?: ""
val suffix = if (pluginVersion.isNotEmpty()) "flutter-$pluginVersion" else "flutter"
val debug = call.argument<Boolean>("debug") ?: false
val configuration = call.argument<Map<String, Any>>("configuration")
val publicToken = configuration?.get("publicToken") as String
Expand Down Expand Up @@ -71,6 +73,8 @@ class AtomicTransactFlutterPlugin: FlutterPlugin, MethodCallHandler, ActivityAwa
webContentsDebuggingEnabled = debug
)

config.platform = Config.Platform.suffixed(suffix)

Transact.registerReceiver(activity, object: TransactBroadcastReceiver() {
override fun onClose(data: JSONObject) {
channel.invokeMethod("onCompletion", mapOf("type" to "closed", "response" to mapFromTransactResponseData(data)));
Expand All @@ -93,11 +97,13 @@ class AtomicTransactFlutterPlugin: FlutterPlugin, MethodCallHandler, ActivityAwa
})

Transact.present(activity, config)
}
}
else if (call.method == "presentAction") {
val id = call.argument<String>("id") ?: return
val transactPath = call.argument<String>("transactPath") as String? ?: ""
val apiPath = call.argument<String>("apiPath") as String? ?: ""
val actionPluginVersion = call.argument<String>("pluginVersion") ?: ""
val actionSuffix = if (actionPluginVersion.isNotEmpty()) "flutter-$actionPluginVersion" else "flutter"
val debug = call.argument<Boolean>("debug") ?: false
var theme = call.argument<Map<String, Any>>("theme")
val config = ActionConfig(
Expand All @@ -107,6 +113,7 @@ class AtomicTransactFlutterPlugin: FlutterPlugin, MethodCallHandler, ActivityAwa
theme = configThemeFromMap(theme),
webContentsDebuggingEnabled = debug
)
config.platform = Config.Platform.suffixed(actionSuffix)

Transact.registerReceiver(activity, object: TransactBroadcastReceiver() {
override fun onClose(data: JSONObject) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class AtomicTransactFlutterPlugin: NSObject, FlutterPlugin {
let arguments = call.arguments as! [String: Any]
let transactPath = arguments["transactPath"] as! String
let apiPath = arguments["apiPath"] as! String
let pluginVersion = arguments["pluginVersion"] as? String ?? ""
let debugEnabled = arguments["debug"] as? Bool ?? false
let decoder = JSONDecoder()

Expand All @@ -31,11 +32,8 @@ public class AtomicTransactFlutterPlugin: NSObject, FlutterPlugin {
if let configuration = arguments["configuration"] as? [String: Any] {
do {
var json = configuration

if var platform = AtomicConfig.Platform().encode() as? [String: Any] {
platform["sdkVersion"] = platform["sdkVersion"] as! String + "-flutter"
json["platform"] = platform
}
let suffix = pluginVersion.isEmpty ? "flutter" : "flutter-\(pluginVersion)"
json["platform"] = AtomicConfig.Platform(suffixed: suffix).encode()

guard let data = try? JSONSerialization.data(withJSONObject: json, options: []) else { return }

Expand Down
3 changes: 3 additions & 0 deletions lib/platform_interface/atomic_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/services.dart';

import '../src/config.dart';
import '../src/types.dart';
import '../src/version.dart';
import 'atomic_platform_interface.dart';

class AtomicMethodChannel extends AtomicPlatformInterface {
Expand Down Expand Up @@ -31,6 +32,7 @@ class AtomicMethodChannel extends AtomicPlatformInterface {
'transactPath': environment.transactPath,
'apiPath': environment.apiPath,
'presentationStyleIOS': presentationStyleIOS?.name,
'pluginVersion': packageVersion,
'debug': debug,
},
);
Expand All @@ -52,6 +54,7 @@ class AtomicMethodChannel extends AtomicPlatformInterface {
'apiPath': environment.apiPath,
'theme': theme?.toJson(),
'presentationStyleIOS': presentationStyleIOS?.name,
'pluginVersion': packageVersion,
'debug': debug,
});
}
Expand Down
9 changes: 0 additions & 9 deletions lib/src/config.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ignore_for_file: deprecated_member_use_from_same_package

import 'dart:io' show Platform;

import 'types.dart';

/// Provide colors to customize Transact.
Expand Down Expand Up @@ -424,12 +422,6 @@ class AtomicConfig {
/// Handoff allows views to be handled outside of Transact.
final List<AtomicTransactHandoff>? handoff;

/// The platform being used
final Map<String, String> platform = {
'version': Platform.operatingSystemVersion,
'name': Platform.operatingSystem
};

/// Used to override feature flags
final AtomicExperiments? experiments;

Expand Down Expand Up @@ -467,7 +459,6 @@ class AtomicConfig {
'linkedAccount': linkedAccount,
'theme': theme?.toJson(),
'language': language,
'platform': platform,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being overridden on the native side.

'deeplink': deeplink?.toJson(),
'metadata': metadata,
'search': search?.toJson(),
Expand Down
3 changes: 3 additions & 0 deletions lib/src/version.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// GENERATED — do not edit by hand.
// Updated by scripts/bump_version.sh
const String packageVersion = '3.13.4';
9 changes: 9 additions & 0 deletions scripts/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e

PUBSPEC_FILE="pubspec.yaml"
PODSPEC_FILE="ios/atomic_transact_flutter.podspec"
VERSION_DART_FILE="lib/src/version.dart"
CHANGELOG_FILE="CHANGELOG.md"

NEW_VERSION=""
Expand Down Expand Up @@ -113,11 +114,19 @@ rm "$PUBSPEC_FILE.bak"
sed -i.bak "s/s\.version *= *'[^']*'/s.version = '$new_version'/" "$PODSPEC_FILE"
rm "$PODSPEC_FILE.bak"

# Update version.dart
cat > "$VERSION_DART_FILE" << DART
// GENERATED — do not edit by hand.
// Updated by scripts/bump_version.sh
const String packageVersion = '$new_version';
DART

# Update changelog
update_changelog "$new_version"

echo "✅ Successfully updated version to $new_version in all files"
echo "📝 Updated files:"
echo " - $PUBSPEC_FILE"
echo " - $PODSPEC_FILE"
echo " - $VERSION_DART_FILE"
echo " - $CHANGELOG_FILE"