Skip to content

Commit 1c6cd64

Browse files
Release/1.1.7 (#161)
* Patches for Github Issues (#159) * Patch for Github Issue #144 * Patch for Github issue #147 * Patch for Github issue #147 * Patch for Github issue #144 * Patch for Github issue #147 * Patch for Github issue #147 * Patch for Github issue #138 * Patch for Github issue #138 * Patch for Github Issue #152 * Patch for Github Issue #152 * Testing patch for Github Issue #157 * Patch for Github Issue #157 * Updating for 1.1.7 release * Removing unnecessary library name --------- Co-authored-by: Neelkanth Kaushik <[email protected]>
1 parent 87f50a5 commit 1c6cd64

File tree

10 files changed

+61
-29
lines changed

10 files changed

+61
-29
lines changed

packages/core/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 1.1.7
2+
3+
- Fix for setFlushPolicies method is overwriting Configuration properties #144
4+
- Fix for Android build error on nullable receiver in sdk 35 #147
5+
- Fix for Context app version wrong on Flutter web #138
6+
- Fix for Integrations field is empty in segment analytics #152
7+
- Fix for AppsFlyer Destination not initializing properly #98
8+
- fix for Crash in Timeline.applyPlugins #157
9+
110
## 1.1.6
211

312
- Fix error loading storage files

packages/core/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626

2727
android {
2828
namespace 'com.segment.analytics'
29-
compileSdkVersion 31
29+
compileSdkVersion 35 //Patch for for Github issue #147
3030

3131
compileOptions {
3232
sourceCompatibility JavaVersion.VERSION_1_8
@@ -44,4 +44,4 @@ android {
4444
defaultConfig {
4545
minSdkVersion 16
4646
}
47-
}
47+
}

packages/core/android/src/main/kotlin/com/segment/analytics/AnalyticsPlugin.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,17 @@ class AnalyticsPlugin : FlutterPlugin, NativeContextApi, EventChannel.StreamHand
143143
NativeContext(
144144
app = NativeContextApp(
145145
build = appBuild,
146-
name = packageInfo.applicationInfo.loadLabel(
147-
packageManager
148-
).toString(),
146+
147+
/* Retrieves the application name from the package info, using the application's label
148+
(i.e., the app name displayed on the device). If the application name cannot be fetched
149+
(e.g., due to a missing label or other issues), the fallback value "Unknown" will be used
150+
to ensure the app doesn't break due to a null value.
151+
152+
Patch for for Github issue #147 - Replaced following line:
153+
name = packageInfo.applicationInfo.loadLabel(packageManager).toString(), with the line below
154+
*/
155+
name = packageInfo.applicationInfo?.loadLabel(packageManager)?.toString() ?: "Unknown",
156+
149157
namespace = packageInfo.packageName,
150158
version = packageInfo.versionName
151159
),

packages/core/lib/analytics.dart

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
library analytics;
2-
31
import 'dart:async';
42

53
import 'package:segment_analytics/client.dart';
@@ -212,26 +210,30 @@ class Analytics with ClientMethods {
212210

213211
@override
214212
Future track(String event, {Map<String, dynamic>? properties}) async {
215-
await _process(TrackEvent(event, properties: properties ?? {}));
213+
await _process(TrackEvent(event, properties: properties ?? {},
214+
integrations: _state.integrations.state)); // Patch for Github Issue #152
216215
}
217216

218217
@override
219218
Future screen(String name, {Map<String, dynamic>? properties}) async {
220-
final event = ScreenEvent(name, properties: properties ?? {});
219+
final event = ScreenEvent(name, properties: properties ?? {},
220+
integrations: _state.integrations.state); // Patch for Github Issue #152
221221

222222
await _process(event);
223223
}
224224

225225
@override
226226
Future identify({String? userId, UserTraits? userTraits}) async {
227-
final event = IdentifyEvent(userId: userId, traits: userTraits);
227+
final event = IdentifyEvent(userId: userId, traits: userTraits,
228+
integrations: _state.integrations.state); // Patch for Github Issue #152
228229

229230
await _process(event);
230231
}
231232

232233
@override
233234
Future group(String groupId, {GroupTraits? groupTraits}) async {
234-
final event = GroupEvent(groupId, traits: groupTraits);
235+
final event = GroupEvent(groupId, traits: groupTraits,
236+
integrations: _state.integrations.state); // Patch for Github Issue #152
235237

236238
await _process(event);
237239
}
@@ -240,7 +242,8 @@ class Analytics with ClientMethods {
240242
Future alias(String newUserId) async {
241243
final userInfo = await state.userInfo.state;
242244
final event =
243-
AliasEvent(userInfo.userId ?? userInfo.anonymousId, userId: newUserId);
245+
AliasEvent(userInfo.userId ?? userInfo.anonymousId, userId: newUserId,
246+
integrations: _state.integrations.state); // Patch for Github Issue #152
244247

245248
await _process(event);
246249
}

packages/core/lib/analytics_web.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AnalyticsPlatformImpl extends AnalyticsPlatform {
1818
NativeContext(
1919
app: NativeContextApp(
2020
name: web.window.navigator.appName,
21-
version: web.window.navigator.appVersion,
21+
version: getAppVersion(), // Patch Github Issue #138
2222
namespace: web.window.navigator.appCodeName,
2323
),
2424
userAgent: web.window.navigator.userAgent,
@@ -28,6 +28,16 @@ class AnalyticsPlatformImpl extends AnalyticsPlatform {
2828
width: web.window.screen.width,
2929
),
3030
);
31+
32+
/*
33+
- Checks for <meta name="app-version" content="1.2.3"> in <root>/web/index.html
34+
and return the value inside 'content'
35+
- Returns the browser version as fallback
36+
*/
37+
String getAppVersion() {
38+
final meta = web.document.querySelector('meta[name="app-version"]');
39+
return meta?.getAttribute('content') ?? web.window.navigator.appVersion;
40+
}
3141
}
3242

3343
class AnalyticsWeb {

packages/core/lib/event.dart

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ abstract class RawEvent with JSONSerialisable {
5555
@JsonKey(name: "_metadata")
5656
DestinationMetadata? metadata;
5757

58-
RawEvent(this.type, {this.anonymousId, this.userId});
58+
RawEvent(this.type, {this.anonymousId, this.userId, this.integrations,}); // Patch for Github Issue #152
5959
}
6060

6161
@JsonSerializable(explicitToJson: true)
@@ -79,7 +79,7 @@ class TrackEvent extends RawEvent {
7979
String event;
8080
Map<String, dynamic>? properties;
8181

82-
TrackEvent(this.event, {this.properties}) : super(EventType.track);
82+
TrackEvent(this.event, {this.properties, Map<String, dynamic>? integrations,}) : super(EventType.track, integrations: integrations,); // Patch for Github Issue #152
8383

8484
factory TrackEvent.fromJson(Map<String, dynamic> json) =>
8585
_$TrackEventFromJson(json);
@@ -90,8 +90,8 @@ class TrackEvent extends RawEvent {
9090
@JsonSerializable(explicitToJson: true)
9191
class IdentifyEvent extends RawEvent {
9292
UserTraits? traits;
93-
IdentifyEvent({this.traits, String? userId})
94-
: super(EventType.identify, userId: userId);
93+
IdentifyEvent({this.traits, String? userId, Map<String, dynamic>? integrations})
94+
: super(EventType.identify, userId: userId, integrations: integrations); // Patch for Github Issue #152
9595

9696
factory IdentifyEvent.fromJson(Map<String, dynamic> json) =>
9797
_$IdentifyEventFromJson(json);
@@ -105,7 +105,7 @@ class GroupEvent extends RawEvent {
105105
String groupId;
106106
GroupTraits? traits;
107107

108-
GroupEvent(this.groupId, {this.traits}) : super(EventType.group);
108+
GroupEvent(this.groupId, {this.traits, Map<String, dynamic>? integrations}) : super(EventType.group, integrations: integrations); // Patch for Github Issue #152
109109

110110
factory GroupEvent.fromJson(Map<String, dynamic> json) =>
111111
_$GroupEventFromJson(json);
@@ -117,8 +117,8 @@ class GroupEvent extends RawEvent {
117117
class AliasEvent extends RawEvent {
118118
String previousId;
119119

120-
AliasEvent(this.previousId, {String? userId})
121-
: super(EventType.alias, userId: userId);
120+
AliasEvent(this.previousId, {String? userId, Map<String, dynamic>? integrations})
121+
: super(EventType.alias, userId: userId, integrations: integrations); // Patch for Github Issue #152
122122

123123
factory AliasEvent.fromJson(Map<String, dynamic> json) =>
124124
_$AliasEventFromJson(json);
@@ -131,7 +131,10 @@ class ScreenEvent extends RawEvent {
131131
String name;
132132
Map<String, dynamic>? properties;
133133

134-
ScreenEvent(this.name, {this.properties}) : super(EventType.screen);
134+
ScreenEvent(
135+
this.name, {
136+
this.properties,
137+
Map<String, dynamic>? integrations}) : super(EventType.screen, integrations: integrations); // Patch for Github Issue #152
135138

136139
factory ScreenEvent.fromJson(Map<String, dynamic> json) =>
137140
_$ScreenEventFromJson(json);

packages/core/lib/state.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,5 +583,6 @@ Configuration setFlushPolicies(
583583
trackApplicationLifecycleEvents: a.trackApplicationLifecycleEvents,
584584
trackDeeplinks: a.trackDeeplinks,
585585
storageJson: a.storageJson,
586-
token: a.token);
586+
token: a.token,
587+
collectDeviceId: a.collectDeviceId); //Patch for for Github issue #144
587588
}

packages/core/lib/timeline.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ class Timeline {
9999
Future<RawEvent?> applyPlugins(PluginType type, RawEvent event) async {
100100
RawEvent? result = event;
101101

102-
final plugins = _plugins[type];
103-
if (plugins != null) {
102+
final plugins = List<Plugin>.from(_plugins[type] ?? []); //Patch for Github issue #157
104103
for (var plugin in plugins) {
105104
if (result != null) {
106105
try {
@@ -122,7 +121,6 @@ class Timeline {
122121
}
123122
}
124123
}
125-
}
126124
return result;
127125
}
128126
}

packages/core/lib/version.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const segmentVersion = "1.1.6";
1+
const segmentVersion = "1.1.7";

packages/core/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: segment_analytics
22
description: The hassle-free way to add Segment analytics to your Flutter app.
3-
version: 1.1.6
3+
version: 1.1.7
44
homepage: https://github.com/segmentio/analytics_flutter#readme
55
repository: https://github.com/segmentio/analytics_flutter/tree/main/packages/core#readme
66
issue_tracker: https://github.com/segmentio/analytics_flutter/issues
@@ -30,9 +30,9 @@ dev_dependencies:
3030
flutter_test:
3131
sdk: flutter
3232
fake_async: ^1.0.0
33-
flutter_lints: ^4.0.0
33+
flutter_lints: ^5.0.0
3434
json_serializable: ^6.8.0
35-
pigeon: ^22.7.2
35+
pigeon: ^25.3.1
3636
mockito: ^5.3.2
3737

3838
flutter:

0 commit comments

Comments
 (0)