[MOB-17072] Adopt changes for Core 2.0 part 1#2
Conversation
| @SuppressWarnings("unused") | ||
| public class Edge { | ||
|
|
||
| private static final String LOG_SOURCE = "Edge"; |
There was a problem hiding this comment.
As the name of this class is the same as the extension, should the source remain as "Edge" or something else like "PublicAPIs"?
There was a problem hiding this comment.
Other core extensions also use the same source name the extension name, I think we can leave it as Edge to make it consistent.
| SharedStateResult assuranceStateResult = sharedStateCallback.getSharedState( | ||
| EdgeConstants.SharedState.ASSURANCE, | ||
| null | ||
| ); | ||
| final String assuranceIntegrationId = EventUtils.getAssuranceIntegrationId(assuranceSharedState); | ||
|
|
||
| if (!Utils.isNullOrEmpty(assuranceIntegrationId)) { | ||
| if (assuranceStateResult == null || assuranceStateResult.getStatus() != SharedStateStatus.SET) { | ||
| return requestHeaders; | ||
| } | ||
|
|
||
| final String assuranceIntegrationId = DataReader.optString( | ||
| assuranceStateResult.getValue(), | ||
| EdgeConstants.SharedState.Assurance.INTEGRATION_ID, | ||
| null | ||
| ); | ||
|
|
||
| if (!StringUtils.isNullOrEmpty(assuranceIntegrationId)) { |
There was a problem hiding this comment.
I've only updated EdgeHitProcessor to fix uses of getSharedState and to use the new DataReader in this getRequestHeader function. The reset of this class will be updated in another PR.
| return httpConnecting[0]; | ||
| } catch (final InterruptedException | IllegalArgumentException e) { | ||
| Log.warning(LOG_TAG, "Connection failure for url (%s), error: (%s)", url, e); | ||
| Log.warning(LOG_TAG, LOG_SOURCE, "Connection failure for url (%s), error: (%s)", url, e); |
There was a problem hiding this comment.
I've only updated the EdgeNetworkService to fix this one instance of Log to get the code to compile. The reset of the class will be updated in another PR.
|
|
||
| package com.adobe.marketing.mobile; | ||
|
|
||
| import com.adobe.marketing.mobile.util.StringUtils; |
There was a problem hiding this comment.
This line was the only needed change. Please review entire class.
| */ | ||
| class NetworkResponseHandler { | ||
|
|
||
| private static final String LOG_SOURCE = "NetworkResponseHandler"; |
There was a problem hiding this comment.
I've only updated NetworkResponseHandler to fix the cases of Log which were failing to compile. The rest of this class will be updated in another PR.
| new EdgeSharedStateCallback() { | ||
| @Override | ||
| public Map<String, Object> getSharedState(final String stateOwner, final Event event) { | ||
| public SharedStateResult getSharedState(final String stateOwner, final Event event) { |
There was a problem hiding this comment.
The changes in EdgeStateTests were done automatically when I made the API changes. The test classes will be updated in another PR.
|
|
||
| static final String EDGE_DATA_STORAGE = "EdgeDataStorage"; | ||
| static final String EXTENSION_VERSION = "1.4.0"; | ||
| static final String EXTENSION_VERSION = "2.0.0"; |
There was a problem hiding this comment.
As this PR is just part 1 of the changes to adopt Core 2.0, I'm not able to remove any unneeded constants, such as the EdgeType and EdgeSource constants.
| @SuppressWarnings("unused") | ||
| public class Edge { | ||
|
|
||
| private static final String LOG_SOURCE = "Edge"; |
There was a problem hiding this comment.
Other core extensions also use the same source name the extension name, I think we can leave it as Edge to make it consistent.
|
|
||
| // Get Hub's shared state needed to check if Identity and Consent are registered | ||
| // If not set, return false and attempt bootup at next event | ||
| final SharedStateResult eventHubStateResult = sharedStateCallback.getSharedState( |
There was a problem hiding this comment.
Does the actual check on whether Consent and Identity are registered happen elsewhere?
There was a problem hiding this comment.
I'm not sure why I said Identity here. The hub's state is needed to build ImplementationDetails using the Core version and wrapper type, and setting the default Consent if Consent is not registered. Both of those a checked in the synchronized block, in ImplementationDetails.fromEventHubState and updateCollectConsentIfNotRegistered.
I'll update the comment to make it more clear.
code/edge/src/main/java/com/adobe/marketing/mobile/EdgeExtension.java
Outdated
Show resolved
Hide resolved
code/edge/src/main/java/com/adobe/marketing/mobile/EdgeExtension.java
Outdated
Show resolved
Hide resolved
code/edge/src/main/java/com/adobe/marketing/mobile/EdgeExtension.java
Outdated
Show resolved
Hide resolved
code/edge/src/main/java/com/adobe/marketing/mobile/EdgeExtension.java
Outdated
Show resolved
Hide resolved
code/edge/src/main/java/com/adobe/marketing/mobile/EdgeExtension.java
Outdated
Show resolved
Hide resolved
emdobrin
left a comment
There was a problem hiding this comment.
Changes look good to me with couple small follow-ups
Description
Part 1 of adoption of changes for Core 2.0
Updates .gradle files to use Core 2.0 from jitpack
Sets extension version to 2.0.0
Updates Edge public APIs for Core 2.0
Use new shared state api in EdgeExtension, EdgeState, EdgeHitProcessor
Implements EdgeExtension.onRegistered and registers listeners. Removes older Listener class
Implements EdgeExtension.readyForEvent which calls EdgeState.bootupIfNeeded and checks shared state dependencies for specific events.
Updates EdgeState and EdgeProperties for Core 2.0 changes.
Switch to new Log class only for the class touched by the changes above.
Set permission for
.githooks/pre-commitfor executionOut of scope for this PR:
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: