Skip to content

Commit

Permalink
PR Comments 2
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Nelson <nejrd@amazon.com>
  • Loading branch information
fjnoyp and Jordan-Nelson committed Jan 10, 2023
1 parent d668333 commit 99e6d4d
Show file tree
Hide file tree
Showing 19 changed files with 116 additions and 387 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin
class AmplifyAnalyticsPinpointPlugin: FlutterPlugin, Messages.PigeonLegacyDataProvider {

lateinit var context: Context
lateinit var sharedPrefs: SharedPreferences
var sharedPrefs: SharedPreferences? = null

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

override fun initialize(pinpointAppId: String, result: Messages.Result<Void>){
sharedPrefs = context.getSharedPreferences(
override fun getEndpointId(pinpointAppId: String, result: Messages.Result<String?>){
sharedPrefs = sharedPrefs ?: context.getSharedPreferences(
"${pinpointAppId}$PINPOINT_SHARED_PREFS_SUFFIX",
Context.MODE_PRIVATE
)
result.success(null)
}

override fun getEndpointId(result: Messages.Result<String?>){
result.success(sharedPrefs.getString(UNIQUE_ID_KEY, null))
result.success(sharedPrefs!!.getString(UNIQUE_ID_KEY, null))
}

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

import 'dart:async';

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

import 'dart:async';

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

import 'dart:async';

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

import 'dart:async';

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

import 'package:amplify_analytics_pinpoint/amplify_analytics_pinpoint.dart';

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

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

import 'dart:async';

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

@override
Future<void> initialize(String pinpointAppId) {
return _pigeonDataProvider.initialize(pinpointAppId);
}

@override
Future<String?> getEndpointId() {
return _pigeonDataProvider.getEndpointId();
Future<String?> getEndpointId(String pinpointAppId) {
return _pigeonDataProvider.getEndpointId(pinpointAppId);
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import 'dart:async';

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

@override
Future<void> initialize(String pinpointAppId) async {}

@override
Future<String?> getEndpointId() async {
Future<String?> getEndpointId(String pinpointAppId) async {
final endpointId = await _keyValueStore.read(key: _key);
return endpointId;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import 'dart:async';
import 'dart:io' show Platform;
Expand Down Expand Up @@ -41,13 +30,8 @@ class FlutterLegacyNativeDataProvider implements LegacyNativeDataProvider {
final LegacyNativeDataProvider? _nativeDataProvider;

@override
Future<void> initialize(String pinpointAppId) async {
return _nativeDataProvider?.initialize(pinpointAppId);
}

@override
Future<String?> getEndpointId() async {
Future<String?> getEndpointId(String pinpointAppId) async {
if (_nativeDataProvider == null) return null;
return _nativeDataProvider!.getEndpointId();
return _nativeDataProvider!.getEndpointId(pinpointAppId);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0

0 comments on commit 99e6d4d

Please sign in to comment.