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: 1 addition & 1 deletion .github/actions/setup-flutter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
flutter-version:
description: "Flutter SDK version to install from the stable channel"
required: false
default: "3.29.2"
default: "3.38.0"
sha256:
description: "Expected SHA-256 of the Linux SDK archive. Empty skips verification."
required: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
env:
ARTIFACTORY_URL: ${{ vars.ARTIFACTORY_URL }}
FLUTTER_SUPPRESS_ANALYTICS: "true"
FLUTTER_VERSION: "3.29.2"
FLUTTER_VERSION: "3.38.0"

jobs:
test:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
uses: ./.github/actions/setup-flutter
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
sha256: 6096f21370773093ec19240e133664c1c12eb8b5a85605a92d16ce462a18eac4
sha256: c9cc746283f02dbad5da2785b4837b62f7956e3135fa9af87c7dde2d2bd6c5a6

- name: Authenticate with Artifactory
if: ${{ !github.event.pull_request.head.repo.fork }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:
env:
ARTIFACTORY_URL: ${{ vars.ARTIFACTORY_URL }}
FLUTTER_SUPPRESS_ANALYTICS: "true"
FLUTTER_VERSION: "3.29.2"
FLUTTER_VERSION: "3.38.0"

jobs:
test:
Expand All @@ -36,7 +36,7 @@ jobs:
uses: ./.github/actions/setup-flutter
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
sha256: 6096f21370773093ec19240e133664c1c12eb8b5a85605a92d16ce462a18eac4
sha256: c9cc746283f02dbad5da2785b4837b62f7956e3135fa9af87c7dde2d2bd6c5a6

- name: Authenticate with Artifactory
uses: ./.github/actions/artifactory-oidc
Expand All @@ -62,7 +62,7 @@ jobs:
uses: ./.github/actions/setup-flutter
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
sha256: 6096f21370773093ec19240e133664c1c12eb8b5a85605a92d16ce462a18eac4
sha256: c9cc746283f02dbad5da2785b4837b62f7956e3135fa9af87c7dde2d2bd6c5a6

- name: Publish to pub.dev (Trusted Publishing)
run: dart pub publish --force
Expand Down
4 changes: 4 additions & 0 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B5C067C318D8DD07D23BA94 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98E2D8A73DE7B28F12DCB802 /* Pods_Runner.framework */; };
A1B2C3D41F00000100000001 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D41F00000100000002 /* SceneDelegate.swift */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
Expand All @@ -36,6 +37,7 @@
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
5D511AE6D5667D367382F8FB /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
A1B2C3D41F00000100000002 /* SceneDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -115,6 +117,7 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
A1B2C3D41F00000100000002 /* SceneDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
Expand Down Expand Up @@ -280,6 +283,7 @@
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
A1B2C3D41F00000100000001 /* SceneDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
9 changes: 6 additions & 3 deletions example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
@main
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
}
}
32 changes: 32 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,37 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>segment.analytics.example</string>
<key>CFBundleURLSchemes</key>
<array>
<string>segmentexample</string>
</array>
</dict>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
5 changes: 5 additions & 0 deletions example/ios/Runner/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Flutter
import UIKit

class SceneDelegate: FlutterSceneDelegate {
}
5 changes: 5 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.2.0

- Added iOS UIScene life cycle support (deep links are now received via `scene(_:openURLContexts:)`)
- **Breaking:** requires Flutter 3.38 or newer. Apps on an older Flutter version should stay on `segment_analytics: 1.1.13`

## 1.1.13

- Fixed Swift Package Manager support for iOS and macOS: the package now uses the layout Flutter 3.44+ expects (#213)
Expand Down
2 changes: 2 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Run:

`flutter pub add segment_analytics`

> **Flutter version compatibility:** `segment_analytics` 1.2.0 and newer require Flutter 3.38+ (iOS UIScene life cycle support). If you are on an older Flutter version, pin `segment_analytics: 1.1.13`.

```dart
import 'package:segment_analytics/client.dart';
```
Expand Down
6 changes: 6 additions & 0 deletions packages/core/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

analyzer:
exclude:
# Generated by mockito; references Flutter-internal members that trigger
# invalid_use_of_internal_member on newer Flutter versions.
- test/mocks/mocks.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Flutter
import UIKit
import Foundation

public class AnalyticsPlugin: NSObject, FlutterPlugin, NativeContextApi, FlutterStreamHandler, FlutterApplicationLifeCycleDelegate {
public class AnalyticsPlugin: NSObject, FlutterPlugin, NativeContextApi, FlutterStreamHandler, FlutterApplicationLifeCycleDelegate, FlutterSceneLifeCycleDelegate {
private var pendingDeeplinkEventsQueue:[[String:String?]] = []
public func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
_eventSink = events
Expand All @@ -16,15 +16,26 @@ public class AnalyticsPlugin: NSObject, FlutterPlugin, NativeContextApi, Flutter
}

var _eventSink:FlutterEventSink?;
public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool{
let sourceApplication = options[.sourceApplication] as? String;
private func handleDeeplink(url: URL, sourceApplication: String?) {
let event: [String:String?] = ["url": url.absoluteString, "referring_application": sourceApplication]
if (_eventSink != nil) {
_eventSink?(["url": url.absoluteString, "referring_application": sourceApplication])
}else{
pendingDeeplinkEventsQueue.append(["url": url.absoluteString, "referring_application": sourceApplication]);
_eventSink?(event)
} else {
pendingDeeplinkEventsQueue.append(event)
}
}

// UIApplicationDelegate path (apps that have not adopted the UIScene life cycle).
public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool{
handleDeeplink(url: url, sourceApplication: options[.sourceApplication] as? String)
return false
}

// UIScene path: Flutter forwards both warm URLs and the cold-start launch URL here.
public func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) -> Bool {
for context in URLContexts {
handleDeeplink(url: context.url, sourceApplication: context.options.sourceApplication)
}
return false
}

Expand Down Expand Up @@ -105,5 +116,6 @@ public class AnalyticsPlugin: NSObject, FlutterPlugin, NativeContextApi, Flutter
let channel:FlutterEventChannel = FlutterEventChannel(name: "analytics/deep_link_events", binaryMessenger: registrar.messenger())
channel.setStreamHandler(api)
registrar.addApplicationDelegate(plugin)
registrar.addSceneDelegate(plugin)
}
}
2 changes: 1 addition & 1 deletion packages/core/lib/version.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const segmentVersion = "1.1.13";
const segmentVersion = "1.2.0";
4 changes: 2 additions & 2 deletions packages/core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: segment_analytics
description: The hassle-free way to add Segment analytics to your Flutter app.
version: 1.1.13
version: 1.2.0
homepage: https://github.com/segmentio/analytics_flutter#readme
repository: https://github.com/segmentio/analytics_flutter/tree/main/packages/core#readme
issue_tracker: https://github.com/segmentio/analytics_flutter/issues

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: ">=3.16.0"
flutter: ">=3.38.0"

dependencies:
flutter:
Expand Down
Loading
Loading