Skip to content

Commit

Permalink
refactor: deprecate also the usage func location
Browse files Browse the repository at this point in the history
  • Loading branch information
arifBurakDemiray committed Nov 21, 2023
1 parent 19bfdbf commit 1a6a2ea
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Fixed a bug where setting organization of the user would not work.

* Deprecated "Countly::backendMode()" call, use "Countly::backendM" instead via "instance()" call.
* Deprecated "Usage::addLocation(double, double)" call, use "Countly::location::setLocation" instead via "instance()" call.
* The following methods are deprecated from the "UserEditor" interface:
* "commit()" instead use "Countly::userProfile::save" via "instance()" call
* "pushUnique(String, Object)" instead use "Countly::userProfile::pushUnique" via "instance()" call
Expand Down
1 change: 1 addition & 0 deletions sdk-java/src/main/java/ly/count/sdk/java/Usage.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public interface Usage {
* @param latitude geographical latitude of the user
* @param longitude geographical longitude of the user
* @return this instance for method chaining.
* @deprecated use {@link Countly#location()} via "instance()" call
*/
Usage addLocation(double latitude, double longitude);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import ly.count.sdk.java.Countly;
import ly.count.sdk.java.Event;
import ly.count.sdk.java.Session;
import ly.count.sdk.java.Usage;
Expand Down Expand Up @@ -354,7 +355,8 @@ public Session addLocation(double latitude, double longitude) {
L.i("[SessionImpl] addLocation: Skipping event - feature is not enabled");
return this;
}
return (Session) addParam("location", latitude + "," + longitude);
Countly.instance().location().setLocation(null, null, latitude + "," + longitude, null);
return this;
}

public View view(String name, boolean start) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ private void addLocation_base(Config config, Object expected) {
SessionImpl session = (SessionImpl) Countly.session();
session.addLocation(1.0, 2.0);

Assert.assertEquals(expected, session.params.get("location"));
Assert.assertEquals(expected, TestUtils.getCurrentRQ()[0].get("location"));
}

/**
Expand Down

0 comments on commit 1a6a2ea

Please sign in to comment.