Skip to content

Commit

Permalink
Add agent QSP for analytic (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-quiltt authored Mar 16, 2024
1 parent 00c97b6 commit edf522d
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Version 2.0.1

- Expose institution in Flutter SDK
- Add agent QSP for analytic

## Version 2.0.0

- Support Plaid
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.0"
version: "2.0.1"
sky_engine:
dependency: transitive
description: flutter
Expand Down
67 changes: 52 additions & 15 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,82 @@ require 'semantic'

REPO_NAME = 'quiltt/quiltt-flutter'
GITHUB_TOKEN = ENV['GITHUB_TOKEN']
PUBSPEC_YAML_FILE_PATH = '../pubspec.yaml'
SDK_VERSION_FILE_PATH = '../lib/quiltt_sdk_version.dart'

def release(level)
client = ::Octokit::Client.new(access_token: GITHUB_TOKEN)
latest_release = client.latest_release(REPO_NAME)

current_version = Semantic::Version.new(latest_release.tag_name.gsub('v', ''))
new_version = current_version.increment!(level).to_s

# Update version in pubspec.yaml
yaml = YAML.load_file('../pubspec.yaml')
yaml['version'] = new_version
File.open('../pubspec.yaml', 'w') { |f| f.write yaml.to_yaml }
def release(new_version)
new_branch = "release/#{new_version}"
push_to_git_remote(new_branch)

set_github_release(
repository_name: REPO_NAME,
api_token: GITHUB_TOKEN,
name: new_version.to_s,
tag_name: new_version.to_s,
is_generate_release_notes: true,
commitish: 'main'
commitish: new_branch
)

create_pull_request(
repo: REPO_NAME,
api_token: GITHUB_TOKEN,
title: "Release #{new_version}",
head: new_branch,
base: 'main'
)
end

def bump_version_file(level)
client = ::Octokit::Client.new(access_token: GITHUB_TOKEN)
latest_release = client.latest_release(REPO_NAME)

current_version = Semantic::Version.new(latest_release.tag_name.gsub('v', ''))
new_version = current_version.increment!(level).to_s

# Increment version in pubspec.yaml
genereate_new_pubspec_yaml(new_version)
# Increment version in quiltt_sdk_version.dart
generate_release_version_file(new_version)
new_version
end

def genereate_new_pubspec_yaml(new_version)
yaml = YAML.load_file(PUBSPEC_YAML_FILE_PATH)
yaml['version'] = new_version
File.open(PUBSPEC_YAML_FILE_PATH, 'w') { |f| f.write yaml.to_yaml }
end

def generate_release_version_file(version)
sh("echo \"var quilttSdkVersion = \\\"#{version}\\\";\" > #{SDK_VERSION_FILE_PATH}")
end

def push_to_git_remote(branch)
sh("git checkout -b #{branch}")
sh("git add #{PUBSPEC_YAML_FILE_PATH}")
sh("git add #{SDK_VERSION_FILE_PATH}")
sh('git commit -m "Bump version"')
sh("git push origin #{branch}")
end

lane :release_patch do
new_version = bump_version_file(:patch)
check_publish
build_example_app
release(:patch)
release(new_version)
end

lane :release_minor do
new_version = bump_version_file(:patch)
check_publish
build_example_app
release(:minor)
release(new_version)
end

lane :release_major do
new_version = bump_version_file(:patch)
check_publish
build_example_app
release(:major)
release(new_version)
end

lane :check_publish do
Expand Down
3 changes: 2 additions & 1 deletion lib/quiltt_connector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:webview_flutter/webview_flutter.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:quiltt_connector/configuration.dart';
import 'package:quiltt_connector/event.dart';
import 'package:quiltt_connector/quiltt_sdk_version.dart';

/// This class is the entry point for the Quiltt Connector SDK.
class QuilttConnector {
Expand Down Expand Up @@ -191,7 +192,7 @@ class _WebViewPage {
Widget build(BuildContext context, {String? token, String? connectionId}) {
var oauthRedirectUrl = Uri.encodeComponent(config.oauthRedirectUrl);
var connectorUrl =
'https://${config.connectorId}.quiltt.app/?mode=webview&oauth_redirect_url=$oauthRedirectUrl&sdk=flutter';
'https://${config.connectorId}.quiltt.app/?mode=webview&oauth_redirect_url=$oauthRedirectUrl&agent=flutter-$quilttSdkVersion';
debugPrint(connectorUrl);
var initInjectedJavaScript = '''
const options = {
Expand Down
1 change: 1 addition & 0 deletions lib/quiltt_sdk_version.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var quilttSdkVersion = "2.0.1";

0 comments on commit edf522d

Please sign in to comment.