Skip to content

Latest commit

 

History

History
232 lines (163 loc) · 6.35 KB

MIGRATION.md

File metadata and controls

232 lines (163 loc) · 6.35 KB

Migration from ACPPlaces to AEPPlaces

This document is a reference comparison of ACPPlaces (2.x) APIs against their equivalent APIs in AEPPlaces (4.x).

If explanation beyond showing API differences is necessary, it will be captured as a "Note" within that API's section.

For example:

Note: This is information that is important to help clarify the API.

Primary class

The class name containing public APIs is different depending on which SDK and language combination being used.

SDK Version Language Class Name Example
ACPPlaces Objective-C ACPPlaces [ACPPlaces clear];
AEPPlaces Objective-C AEPMobilePlaces [AEPMobilePlaces clear];
AEPPlaces Swift Places Places.clear()

Additional public classes and enums

ACPPlaces (Objective-C) AEPPlaces (Objective-C) AEPPlaces (Swift)
ACPPlacesRequestError AEPPlacesQueryResponseCode PlacesQueryResponseCode
ACPPlacesPoi AEPPlacesPoi PointOfInterest
ACPRegionEventType AEPPlacesRegionEvent PlacesRegionEvent

Public APIs (alphabetical)


clear

ACPPlaces (Objective-C)

+ (void) clear;

AEPPlaces (Objective-C)

+ (void) clear;

AEPPlaces (Swift)

static func clear()

extensionVersion

ACPPlaces (Objective-C)

+ (nonnull NSString*) extensionVersion;

AEPPlaces (Objective-C)

+ (nonnull NSString*) extensionVersion;

AEPPlaces (Swift)

static var extensionVersion: String

getCurrentPointsOfInterest

ACPPlaces (Objective-C)

+ (void) getCurrentPointsOfInterest: (nullable void (^) (NSArray<ACPPlacesPoi*>* _Nullable userWithinPoi)) callback;

AEPPlaces (Objective-C)

+ (void) getCurrentPointsOfInterest: ^(NSArray<AEPPlacesPoi*>* _Nonnull pois) closure;

AEPPlaces (Swift)

static func getCurrentPointsOfInterest(_ closure: @escaping ([PointOfInterest]) -> Void)

getLastKnownLocation

ACPPlaces (Objective-C)

Note: If the SDK has no last known location, it will pass a CLLocation object with a value of 999.999 for latitude and longitude to the callback.

+ (void) getLastKnownLocation: (nullable void (^) (CLLocation* _Nullable lastLocation)) callback;

AEPPlaces (Objective-C)

+ (void) getLastKnownLocation: ^(CLLocation* _Nullable lastLocation) closure;

AEPPlaces (Swift)

Note: If the SDK has no last known location, it will pass nil to the closure.

static func getLastKnownLocation(_ closure: @escaping (CLLocation?) -> Void)

getNearbyPointsOfInterest

ACPPlaces (Objective-C)

Note: Two getNearbyPointsOfInterest methods exist. The overloaded version allows the caller to provide an errorCallback parameter in the case of failure.

// without error handling
+ (void) getNearbyPointsOfInterest: (nonnull CLLocation*) currentLocation
                             limit: (NSUInteger) limit
                          callback: (nullable void (^) (NSArray<ACPPlacesPoi*>* _Nullable nearbyPoi)) callback;

// with error handling
+ (void) getNearbyPointsOfInterest: (nonnull CLLocation*) currentLocation
                             limit: (NSUInteger) limit
                          callback: (nullable void (^) (NSArray<ACPPlacesPoi*>* _Nullable nearbyPoi)) callback
                     errorCallback: (nullable void (^) (ACPPlacesRequestError result)) errorCallback;

AEPPlaces (Objective-C)

+ (void) getNearbyPointsOfInterest: (nonnull CLLocation*) currentLocation
                             limit: (NSUInteger) limit
                          callback: ^ (NSArray<AEPPlacesPoi*>* _Nonnull, AEPPlacesQueryResponseCode) closure;

AEPPlaces (Swift)

Note: Rather than providing an overloaded method, a single method supports retrieval of nearby Points of Interest. The provided closure accepts two parameters, representing the resulting nearby Points of Interest (if any) and the response code.

static func getNearbyPointsOfInterest(forLocation location: CLLocation,
                                      withLimit limit: UInt,
                                      closure: @escaping ([PointOfInterest], PlacesQueryResponseCode) -> Void)

processRegionEvent

ACPPlaces (Objective-C)

Note: The order of parameters has the CLRegion that triggered the event first, and the ACPRegionEventType second.

+ (void) processRegionEvent: (nonnull CLRegion*) region
         forRegionEventType: (ACPRegionEventType) eventType;

AEPPlaces (Objective-C)

+ (void) processRegionEvent: (AEPRegionEventType) eventType
                  forRegion: (nonnull CLRegion*) region;

AEPPlaces (Swift)

Note: The order of parameters has the PlacesRegionEvent first, and the CLRegion that triggered the event second. This aligns better with Swift API naming conventions.

static func processRegionEvent(_ regionEvent: PlacesRegionEvent,
                               forRegion region: CLRegion)

registerExtension

ACPPlaces (Objective-C)

+ (void) registerExtension;

AEPPlaces (Objective-C)

Note: Registration occurs by passing AEPMobilePlaces to the [AEPMobileCore registerExtensions:completion:] API.

[AEPMobileCore registerExtensions:@[AEPMobilePlaces.class] completion:nil];

AEPPlaces (Swift)

Note: Registration occurs by passing Places to the MobileCore.registerExtensions API.

MobileCore.registerExtensions([Places.self])

setAuthorizationStatus

ACPPlaces (Objective-C)

+ (void) setAuthorizationStatus: (CLAuthorizationStatus) status;

AEPPlaces (Objective-C)

+ (void) setAuthorizationStatus: (CLAuthorizationStatus) status;

AEPPlaces (Swift)

static func setAuthorizationStatus(_ status: CLAuthorizationStatus)