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
2 changes: 2 additions & 0 deletions .github/workflows/intercom-sdk-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
- name: Run SDK update script
id: sdk
run: dart scripts/check_intercom_sdk_updates.dart
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create pull request
uses: peter-evans/create-pull-request@v6
Expand Down
4 changes: 4 additions & 0 deletions intercom_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 9.5.0

* Swift Package Manager support

## 9.4.27

* Updated README
Expand Down
11 changes: 10 additions & 1 deletion intercom_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,13 @@ class MyApp : Application() {
If you find this package helpful, you can support the development by:

- [Buy Me A Coffee](https://buymeacoffee.com/deepakdroid)
- [PayPal](https://paypal.me/deepakdroid)
- [PayPal](https://paypal.me/deepakdroid)

## Sponsored: Alternative Solutions

### Feeddo
A customer support and communication platform for Flutter mobile apps. Provides AI-powered in-app support that answers users from your uploaded knowledge, along with bug reporting and feature request tracking.
- Website: https://feeddo.dev
- pub.dev: https://pub.dev/packages/feeddo_flutter

_Note: This is a sponsored listing and does not imply endorsement._
7 changes: 6 additions & 1 deletion intercom_flutter/ios/intercom_flutter.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#

# Read Intercom SDK version from Package.swift (single source of truth)
package_swift = File.read(File.join(__dir__, 'intercom_flutter', 'Package.swift'))
intercom_version = package_swift.match(/exact:\s*"([^"]+)"/)[1]

Pod::Spec.new do |s|
s.name = 'intercom_flutter'
s.version = '9.0.0'
Expand All @@ -15,7 +20,7 @@ A new flutter plugin project.
s.source_files = 'intercom_flutter/Sources/intercom_flutter/**/*.{h,m}'
s.public_header_files = 'intercom_flutter/Sources/intercom_flutter/include/**/*.h'
s.dependency 'Flutter'
s.dependency 'Intercom', '19.5.1'
s.dependency 'Intercom', intercom_version
s.static_framework = true
s.ios.deployment_target = '15.0'
end
2 changes: 1 addition & 1 deletion intercom_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: intercom_flutter
description: Flutter plugin for Intercom integration. Provides in-app messaging
and help-center Intercom services
version: 9.4.27
version: 9.5.0
homepage: https://github.com/v3rm0n/intercom_flutter

dependencies:
Expand Down
22 changes: 13 additions & 9 deletions scripts/check_intercom_sdk_updates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Future<String> _fetchLatestVersion(Uri url) async {
final request = await client.getUrl(url);
request.headers.set(HttpHeaders.userAgentHeader, 'intercom-flutter-sdk-check');
request.headers.set(HttpHeaders.acceptHeader, 'application/vnd.github+json');
final token = Platform.environment['GITHUB_TOKEN'];
if (token != null && token.isNotEmpty) {
request.headers.set(HttpHeaders.authorizationHeader, 'Bearer $token');
}
final response = await request.close();
if (response.statusCode != 200) {
final body = await response.transform(utf8.decoder).join();
Expand Down Expand Up @@ -82,9 +86,9 @@ String _updateBuildGradle(String contents, String version) {
return updated;
}

String _updatePodspec(String contents, String version) {
String _updatePackageSwift(String contents, String version) {
return contents.replaceAllMapped(
RegExp(r"(s\.dependency 'Intercom', ')(\d+\.\d+\.\d+)(')"),
RegExp(r'(exact:\s*")(\d+\.\d+\.\d+)(")'),
(match) => '${match.group(1)}$version${match.group(3)}',
);
}
Expand Down Expand Up @@ -153,20 +157,20 @@ Future<void> main(List<String> args) async {
}

final buildGradlePath = _joinPath(repoRoot, 'intercom_flutter/android/build.gradle');
final podspecPath = _joinPath(repoRoot, 'intercom_flutter/ios/intercom_flutter.podspec');
final packageSwiftPath = _joinPath(repoRoot, 'intercom_flutter/ios/intercom_flutter/Package.swift');
final readmePath = _joinPath(repoRoot, 'intercom_flutter/README.md');
final changelogPath = _joinPath(repoRoot, 'intercom_flutter/CHANGELOG.md');
final pubspecPath = _joinPath(repoRoot, 'intercom_flutter/pubspec.yaml');

final buildGradle = _readFile(buildGradlePath);
final podspec = _readFile(podspecPath);
final packageSwift = _readFile(packageSwiftPath);
final readme = _readFile(readmePath);
final changelog = _readFile(changelogPath);
final pubspec = _readFile(pubspecPath);

final androidMatch =
RegExp(r'io\.intercom\.android:intercom-sdk:(\d+\.\d+\.\d+)').firstMatch(buildGradle);
final iosMatch = RegExp(r"s\.dependency 'Intercom', '(\d+\.\d+\.\d+)'").firstMatch(podspec);
final iosMatch = RegExp(r'exact:\s*"(\d+\.\d+\.\d+)"').firstMatch(packageSwift);

if (androidMatch == null || iosMatch == null) {
throw StateError('Unable to detect current Intercom SDK versions.');
Expand Down Expand Up @@ -212,7 +216,7 @@ Future<void> main(List<String> args) async {
}

var updatedBuildGradle = buildGradle;
var updatedPodspec = podspec;
var updatedPackageSwift = packageSwift;
var updatedReadme = readme;
var updatedChangelog = changelog;
var updatedPubspec = pubspec;
Expand All @@ -221,7 +225,7 @@ Future<void> main(List<String> args) async {
updatedBuildGradle = _updateBuildGradle(updatedBuildGradle, latestAndroid);
}
if (shouldUpdateIos) {
updatedPodspec = _updatePodspec(updatedPodspec, latestIos);
updatedPackageSwift = _updatePackageSwift(updatedPackageSwift, latestIos);
}

updatedReadme = _updateReadme(
Expand All @@ -248,8 +252,8 @@ Future<void> main(List<String> args) async {
if (updatedBuildGradle != buildGradle) {
_writeFile(buildGradlePath, updatedBuildGradle);
}
if (updatedPodspec != podspec) {
_writeFile(podspecPath, updatedPodspec);
if (updatedPackageSwift != packageSwift) {
_writeFile(packageSwiftPath, updatedPackageSwift);
}
if (updatedReadme != readme) {
_writeFile(readmePath, updatedReadme);
Expand Down
Loading