Skip to content

Commit d5d91c1

Browse files
fjnoypJordan-Nelson
andcommitted
PR Comments 2
Co-authored-by: Jordan Nelson <[email protected]>
1 parent 9e4c46c commit d5d91c1

File tree

19 files changed

+116
-388
lines changed

19 files changed

+116
-388
lines changed

packages/analytics/amplify_analytics_pinpoint/android/src/main/java/com/amazonaws/amplify/amplify_analytics_pinpoint/amplify_analytics_pinpoint/Messages.java

Lines changed: 5 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/analytics/amplify_analytics_pinpoint/android/src/main/kotlin/com/amazonaws/amplify/amplify_analytics_pinpoint/amplify_analytics_pinpoint/AmplifyAnalyticsPinpointPlugin.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin
1111
class AmplifyAnalyticsPinpointPlugin: FlutterPlugin, Messages.PigeonLegacyDataProvider {
1212

1313
lateinit var context: Context
14-
lateinit var sharedPrefs: SharedPreferences
14+
var sharedPrefs: SharedPreferences? = null
1515

1616
companion object {
1717
private const val PINPOINT_SHARED_PREFS_SUFFIX = "515d6767-01b7-49e5-8273-c8d11b0f331d"
@@ -27,16 +27,12 @@ class AmplifyAnalyticsPinpointPlugin: FlutterPlugin, Messages.PigeonLegacyDataPr
2727
Messages.PigeonLegacyDataProvider.setup(binding.binaryMessenger, null)
2828
}
2929

30-
override fun initialize(pinpointAppId: String, result: Messages.Result<Void>){
31-
sharedPrefs = context.getSharedPreferences(
30+
override fun getEndpointId(pinpointAppId: String, result: Messages.Result<String?>){
31+
sharedPrefs = sharedPrefs ?: context.getSharedPreferences(
3232
"${pinpointAppId}$PINPOINT_SHARED_PREFS_SUFFIX",
3333
Context.MODE_PRIVATE
3434
)
35-
result.success(null)
36-
}
37-
38-
override fun getEndpointId(result: Messages.Result<String?>){
39-
result.success(sharedPrefs.getString(UNIQUE_ID_KEY, null))
35+
result.success(sharedPrefs!!.getString(UNIQUE_ID_KEY, null))
4036
}
4137

4238
}

packages/analytics/amplify_analytics_pinpoint/example/integration_test/auto_session_tracking_test.dart

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License").
4-
// You may not use this file except in compliance with the License.
5-
// A copy of the License is located at
6-
//
7-
// http://aws.amazon.com/apache2.0
8-
//
9-
// or in the "license" file accompanying this file. This file is distributed
10-
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11-
// express or implied. See the License for the specific language governing
12-
// permissions and limitations under the License.
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
133

144
import 'dart:async';
155

packages/analytics/amplify_analytics_pinpoint/example/integration_test/enable_disable_test.dart

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License").
4-
// You may not use this file except in compliance with the License.
5-
// A copy of the License is located at
6-
//
7-
// http://aws.amazon.com/apache2.0
8-
//
9-
// or in the "license" file accompanying this file. This file is distributed
10-
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11-
// express or implied. See the License for the specific language governing
12-
// permissions and limitations under the License.
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
133

144
import 'dart:async';
155

packages/analytics/amplify_analytics_pinpoint/example/integration_test/identify_user_test.dart

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License").
4-
// You may not use this file except in compliance with the License.
5-
// A copy of the License is located at
6-
//
7-
// http://aws.amazon.com/apache2.0
8-
//
9-
// or in the "license" file accompanying this file. This file is distributed
10-
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11-
// express or implied. See the License for the specific language governing
12-
// permissions and limitations under the License.
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
133

144
import 'dart:async';
155

packages/analytics/amplify_analytics_pinpoint/example/integration_test/utils/mock_key_value_store.dart

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
143

154
import 'dart:async';
165

packages/analytics/amplify_analytics_pinpoint/example/integration_test/utils/mock_lifecycle_provider.dart

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License").
4-
// You may not use this file except in compliance with the License.
5-
// A copy of the License is located at
6-
//
7-
// http://aws.amazon.com/apache2.0
8-
//
9-
// or in the "license" file accompanying this file. This file is distributed
10-
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11-
// express or implied. See the License for the specific language governing
12-
// permissions and limitations under the License.
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
133

144
import 'package:amplify_analytics_pinpoint/amplify_analytics_pinpoint.dart';
155

packages/analytics/amplify_analytics_pinpoint/example/integration_test/utils/test_event.dart

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
143

154
import 'package:amplify_analytics_pinpoint_dart/src/sdk/pinpoint.dart'
165
show EndpointResponse;
Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
143

154
import 'dart:async';
165

@@ -25,12 +14,7 @@ class DataProviderAndroid implements LegacyNativeDataProvider {
2514
final PigeonLegacyDataProvider _pigeonDataProvider;
2615

2716
@override
28-
Future<void> initialize(String pinpointAppId) {
29-
return _pigeonDataProvider.initialize(pinpointAppId);
30-
}
31-
32-
@override
33-
Future<String?> getEndpointId() {
34-
return _pigeonDataProvider.getEndpointId();
17+
Future<String?> getEndpointId(String pinpointAppId) {
18+
return _pigeonDataProvider.getEndpointId(pinpointAppId);
3519
}
3620
}

packages/analytics/amplify_analytics_pinpoint/lib/src/legacy_native_data_provider/data_provider.ios.dart

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
143

154
import 'dart:async';
165

@@ -31,10 +20,7 @@ class DataProviderIos implements LegacyNativeDataProvider {
3120
final AmplifySecureStorage _keyValueStore;
3221

3322
@override
34-
Future<void> initialize(String pinpointAppId) async {}
35-
36-
@override
37-
Future<String?> getEndpointId() async {
23+
Future<String?> getEndpointId(String pinpointAppId) async {
3824
final endpointId = await _keyValueStore.read(key: _key);
3925
return endpointId;
4026
}

0 commit comments

Comments
 (0)