Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ride Status not available with ObjC ? #94

Closed
fvisticot opened this issue Aug 26, 2016 · 4 comments
Closed

Ride Status not available with ObjC ? #94

fvisticot opened this issue Aug 26, 2016 · 4 comments
Labels

Comments

@fvisticot
Copy link

fvisticot commented Aug 26, 2016

UBSDKRide does not expose ride Status.
How to get the ride status after a call to fetchRideDetails ?

@interface UBSDKRide : NSObject

/// Contains the information about the destination of the trip, if one has been set.
@property (nonatomic, readonly, strong) UBSDKRideRequestLocation * _Nullable destination;

/// The object that contains driver details. Only non-null during an ongoing trip.
@property (nonatomic, readonly, strong) UBSDKDriver * _Nullable driver;

/// The object that contains the location information of the vehicle and driver.
@property (nonatomic, readonly, strong) UBSDKRideRequestLocation * _Nullable driverLocation;

/// The estimated time of vehicle arrival in minutes.
@property (nonatomic, readonly) NSInteger eta;

/// The object containing the information about the pickup for the trip.
@property (nonatomic, readonly, strong) UBSDKRideRequestLocation * _Nullable pickup;

/// The unique ID of the Request.
@property (nonatomic, readonly, copy) NSString * _Nullable requestID;

/// The surge pricing multiplier used to calculate the increased price of a Request.
@property (nonatomic, readonly) double surgeMultiplier;

/// The object that contains vehicle details. Only non-null during an ongoing trip.
@property (nonatomic, readonly, strong) UBSDKVehicle * _Nullable vehicle;

@end
@jbrophy17
Copy link
Contributor

You are correct, good find. This is because Objective-C does not support an optional Enum (which is how rideStatus is defined). The fix will be not having rideStatus optional and instead giving it a default value.

If you like, since you found this, you can put up a PR and I would be happy to review it

@jbrophy17 jbrophy17 added the bug label Aug 26, 2016
@fvisticot
Copy link
Author

Can you please explain a little bit more where to do the modification ? can we add this status property in the UBSDKRide class ? How this property will be updated by current API ? Tx for helping

@jbrophy17
Copy link
Contributor

The status property exists, it just is not currently being exposed in the Objective-C interface. In order to expose it, it needs to be something that can be represented in Objective-C. So, what I think should work is a slight modification in Ride.swift

Need to change:

    /// The status of the Request indicating state.
    public private(set) var status: RideStatus?

to:

    /// The status of the Request indicating state.
    public private(set) var status: RideStatus = .Unknown

and make adjustments wherever status has been used

@jbrophy17
Copy link
Contributor

Fixed in v0.5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants