Skip to content

Commit 8247610

Browse files
authored
Merge pull request #29 from adjust/v4232
Version 4.23.2
2 parents 2fef96a + daef884 commit 8247610

File tree

13 files changed

+123
-18
lines changed

13 files changed

+123
-18
lines changed

CHANGELOG.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
### Version 4.23.2 (11th November 2020)
2+
#### Added
3+
- Added [Flutter 1.2 or later](https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects) support for Android projects.
4+
5+
#### Native SDKs
6+
- [[email protected]][ios_sdk_v4.23.2]
7+
- [[email protected]][android_sdk_v4.24.1]
8+
9+
---
10+
111
### Version 4.23.1 (31st August 2020)
212
#### Fixed
313
- Removed `iosPrefix` from `pubspec.yaml`.
@@ -18,8 +28,6 @@
1828
- Added sending of value of user's consent to be tracked with each package.
1929
- Added `setUrlStrategy` method to `AdjustConfig` class to allow selection of URL strategy for specific market.
2030

21-
⚠️ **Note**: iOS 14 beta versions prior to 5 appear to have an issue when trying to use iAd framework API like described in [here](https://github.com/adjust/ios_sdk/issues/452). For testing of v4.23.0 version of SDK in iOS, please make sure you're using **iOS 14 beta 5 or later**.
22-
2331
#### Native SDKs
2432
- [[email protected]][ios_sdk_v4.23.0]
2533
- [[email protected]][android_sdk_v4.24.0]
@@ -152,9 +160,11 @@
152160
[ios_sdk_v4.21.0]: https://github.com/adjust/ios_sdk/tree/v4.21.0
153161
[ios_sdk_v4.22.1]: https://github.com/adjust/ios_sdk/tree/v4.22.1
154162
[ios_sdk_v4.23.0]: https://github.com/adjust/ios_sdk/tree/v4.23.0
163+
[ios_sdk_v4.23.2]: https://github.com/adjust/ios_sdk/tree/v4.23.2
155164

156165
[android_sdk_v4.17.0]: https://github.com/adjust/android_sdk/tree/v4.17.0
157166
[android_sdk_v4.18.0]: https://github.com/adjust/android_sdk/tree/v4.18.0
158167
[android_sdk_v4.21.0]: https://github.com/adjust/android_sdk/tree/v4.21.0
159168
[android_sdk_v4.22.0]: https://github.com/adjust/android_sdk/tree/v4.22.0
160-
[android_sdk_v4.24.0]: https://github.com/adjust/android_sdk/tree/v4.24.0
169+
[android_sdk_v4.24.0]: https://github.com/adjust/android_sdk/tree/v4.24.0
170+
[android_sdk_v4.24.1]: https://github.com/adjust/android_sdk/tree/v4.24.1

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ You can add Adjust SDK to your Flutter app by adding following to your `pubspec.
9393

9494
```yaml
9595
dependencies:
96-
adjust_sdk: ^4.23.1
96+
adjust_sdk: ^4.23.2
9797
```
9898
9999
Then navigate to your project in the terminal and run:
@@ -387,13 +387,15 @@ Once everything set up, inside of your native Android activity make a call to `a
387387

388388
```java
389389
import com.adjust.sdk.flutter.AdjustSdk;
390+
import io.flutter.embedding.android.FlutterActivity; // Used for post flutter 1.12 Android projects
391+
//import io.flutter.app.FlutterActivity; // Used for pre flutter 1.12 Android projects
390392

391393
public class MainActivity extends FlutterActivity {
392394
// Either call make the call in onCreate.
393395
@Override
394396
protected void onCreate(Bundle savedInstanceState) {
395397
super.onCreate(savedInstanceState);
396-
GeneratedPluginRegistrant.registerWith(this);
398+
// GeneratedPluginRegistrant.registerWith(this); Used only for pre flutter 1.12 Android projects
397399

398400
Intent intent = getIntent();
399401
Uri data = intent.getData();

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.23.1
1+
4.23.2

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ android {
3636
}
3737

3838
dependencies {
39-
api 'com.adjust.sdk:adjust-android:4.24.0'
39+
api 'com.adjust.sdk:adjust-android:4.24.1'
4040
}

android/src/main/java/com/adjust/sdk/flutter/AdjustSdk.java

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
import java.util.HashMap;
3939
import java.util.Map;
4040

41+
import io.flutter.embedding.engine.plugins.FlutterPlugin;
42+
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
43+
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
4144
import io.flutter.plugin.common.MethodChannel;
4245
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
4346
import io.flutter.plugin.common.MethodChannel.Result;
@@ -46,15 +49,70 @@
4649

4750
import static com.adjust.sdk.flutter.AdjustUtils.*;
4851

49-
public class AdjustSdk implements MethodCallHandler {
52+
public class AdjustSdk implements FlutterPlugin, ActivityAware, MethodCallHandler {
5053
private static String TAG = "AdjustBridge";
5154
private static boolean launchDeferredDeeplink = true;
5255
private MethodChannel channel;
5356
private Context applicationContext;
57+
private boolean v2Plugin;
58+
private boolean v2Attached = false;
5459

5560
AdjustSdk(MethodChannel channel, Context applicationContext) {
5661
this.channel = channel;
5762
this.applicationContext = applicationContext;
63+
64+
v2Plugin = false;
65+
}
66+
67+
public AdjustSdk() {
68+
v2Plugin = true;
69+
}
70+
71+
// FlutterPlugin
72+
@Override
73+
public void onAttachedToEngine(FlutterPluginBinding binding) {
74+
if (!v2Plugin) {
75+
return;
76+
}
77+
if (v2Attached) {
78+
return;
79+
}
80+
81+
v2Attached = true;
82+
applicationContext = binding.getApplicationContext();
83+
channel = new MethodChannel(binding.getBinaryMessenger(), "com.adjust.sdk/api");
84+
channel.setMethodCallHandler(this);
85+
}
86+
87+
@Override
88+
public void onDetachedFromEngine(FlutterPluginBinding binding) {
89+
v2Attached = false;
90+
applicationContext = null;
91+
if (channel != null) {
92+
channel.setMethodCallHandler(null);
93+
}
94+
channel = null;
95+
}
96+
97+
// ActivityAware
98+
@Override
99+
public void onAttachedToActivity(ActivityPluginBinding binding) {
100+
Adjust.onResume();
101+
}
102+
103+
@Override
104+
public void onDetachedFromActivityForConfigChanges() {
105+
}
106+
107+
@Override
108+
public void onReattachedToActivityForConfigChanges(
109+
ActivityPluginBinding binding)
110+
{
111+
}
112+
113+
@Override
114+
public void onDetachedFromActivity() {
115+
Adjust.onPause();
58116
}
59117

60118
// Plugin registration.

example/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
additional functionality it is fine to subclass or reimplement
77
FlutterApplication and put your custom class here. -->
88
<application
9-
android:name="io.flutter.app.FlutterApplication"
109
android:label="example"
1110
android:icon="@mipmap/ic_launcher">
1211
<activity

ios/adjust_sdk.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'adjust_sdk'
3-
s.version = '4.23.1'
3+
s.version = '4.23.2'
44
s.summary = 'Adjust Flutter SDK for iOS platform'
55
s.description = <<-DESC
66
Adjust Flutter SDK for iOS platform.
@@ -14,5 +14,5 @@ Pod::Spec.new do |s|
1414
s.ios.deployment_target = '8.0'
1515

1616
s.dependency 'Flutter'
17-
s.dependency 'Adjust', '4.23.0'
17+
s.dependency 'Adjust', '4.23.2'
1818
end

lib/adjust.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import 'package:adjust_sdk/adjust_app_store_subscription.dart';
1717
import 'package:adjust_sdk/adjust_play_store_subscription.dart';
1818

1919
class Adjust {
20-
static const String _sdkPrefix = 'flutter4.23.1';
20+
static const String _sdkPrefix = 'flutter4.23.2';
2121
static const MethodChannel _channel = const MethodChannel('com.adjust.sdk/api');
2222

2323
static void start(AdjustConfig config) {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: adjust_sdk
22
description: This is the Flutter SDK of Adjust™. You can read more about Adjust™ at adjust.com.
33
homepage: https://github.com/adjust/flutter_sdk
4-
version: 4.23.1
4+
version: 4.23.2
55

66
environment:
77
sdk: ">=2.0.0 <3.0.0"

test/android/src/main/java/com/adjust/test/lib/TestLibPlugin.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import android.os.Looper;
1313
import android.util.Log;
1414

15+
import io.flutter.embedding.engine.plugins.FlutterPlugin;
1516
import io.flutter.plugin.common.MethodCall;
1617
import io.flutter.plugin.common.MethodChannel;
1718
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
@@ -24,15 +25,49 @@
2425
import java.util.HashMap;
2526
import java.util.Map;
2627

27-
public class TestLibPlugin implements MethodCallHandler {
28+
public class TestLibPlugin implements FlutterPlugin, MethodCallHandler {
2829
private static String TAG = "TestLibPlugin";
2930
private TestLibrary testLibrary = null;
3031
private MethodChannel channel;
32+
private boolean v2Plugin;
33+
private boolean v2Attached = false;
3134

3235
private TestLibPlugin(MethodChannel channel) {
3336
this.channel = channel;
37+
38+
v2Plugin = false;
39+
}
40+
41+
public TestLibPlugin() {
42+
v2Plugin = true;
43+
}
44+
45+
// FlutterPlugin
46+
@Override
47+
public void onAttachedToEngine(FlutterPluginBinding binding) {
48+
if (!v2Plugin) {
49+
return;
50+
}
51+
if (v2Attached) {
52+
return;
53+
}
54+
55+
v2Attached = true;
56+
57+
channel = new MethodChannel(binding.getBinaryMessenger(), "com.adjust.test.lib/api");
58+
channel.setMethodCallHandler(this);
59+
}
60+
61+
@Override
62+
public void onDetachedFromEngine(FlutterPluginBinding binding) {
63+
v2Attached = false;
64+
if (channel != null) {
65+
channel.setMethodCallHandler(null);
66+
}
67+
channel = null;
3468
}
3569

70+
// Plugin registration.
3671
public static void registerWith(Registrar registrar) {
3772
final MethodChannel channel = new MethodChannel(registrar.messenger(), "com.adjust.test.lib/api");
3873
channel.setMethodCallHandler(new TestLibPlugin(channel));

0 commit comments

Comments
 (0)