Skip to content

Commit

Permalink
feat: deprecate view calls (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
arifBurakDemiray authored Jan 10, 2024
1 parent e38c5af commit abdf629
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
10 changes: 10 additions & 0 deletions sdk-java/src/main/java/ly/count/sdk/java/Countly.java
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,22 @@ public Usage addLocation(double latitude, double longitude) {
return ((Session) sdk.session(null)).addLocation(latitude, longitude);
}

/**
* {@inheritDoc}
*
* @deprecated use {@link ModuleViews.Views#startView(String)} instead via {@link Countly#views()} instance() call
*/
@Override
public View view(String name, boolean start) {
L.d("[Countly] view: name = " + name + " start = " + start);
return ((Session) sdk.session(null)).view(name, start);
}

/**
* {@inheritDoc}
*
* @deprecated use {@link ModuleViews.Views#startView(String)} instead via {@link Countly#views()} instance() call
*/
@Override
public View view(String name) {
L.d("[Countly] view: name = " + name);
Expand Down
11 changes: 7 additions & 4 deletions sdk-java/src/main/java/ly/count/sdk/java/Usage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Map;
import ly.count.sdk.java.internal.ModuleDeviceIdCore;
import ly.count.sdk.java.internal.ModuleEvents;
import ly.count.sdk.java.internal.ModuleViews;

/**
* This interface represents session concept, that is one indivisible usage occasion of your application.
Expand All @@ -17,7 +18,7 @@ public interface Usage {

/**
* Create event object, don't record it yet. Creates begin request if this session
* hasn't yet been began.
* hasn't yet been begun.
*
* @param key key for this event, cannot be null or empty
* @return Event instance.
Expand All @@ -28,7 +29,7 @@ public interface Usage {

/**
* Get existing or create new timed event object, don't record it. Creates begin request if this session
* hasn't yet been began.
* hasn't yet been begun.
*
* @param key key for this event, cannot be null or empty
* @return timed Event instance.
Expand Down Expand Up @@ -97,21 +98,23 @@ public interface Usage {
* Start new view.
* In case previous view in this session is not ended yet, it will be ended automatically.
* In case session ends and last view haven't been ended yet, it will be ended automatically.
* Creates begin request if this session hasn't yet been began.
* Creates begin request if this session hasn't yet been begun.
*
* @param name String representing name of this View
* @param start whether this view is first in current application launch
* @return new but already started {@link View}, you're responsible for its ending by calling {@link View#stop(boolean)}
* @deprecated use {@link ModuleViews.Views#startView(String)} instead via {@link Countly#views()}
*/
View view(String name, boolean start);

/**
* Identical to {@link #view(String, boolean)}, but without {@code start} parameter which
* is determined automatically based on whether this view is first in this session.
* Creates begin request if this session hasn't yet been began.
* Creates begin request if this session hasn't yet been begun.
*
* @param name String representing name of this View
* @return new but already started {@link View}, you're responsible for its ending by calling {@link View#stop(boolean)}
* @deprecated use {@link ModuleViews.Views#startView(String)} instead via {@link Countly#views()}
*/
View view(String name);

Expand Down
17 changes: 16 additions & 1 deletion sdk-java/src/main/java/ly/count/sdk/java/View.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
package ly.count.sdk.java;

import ly.count.sdk.java.internal.ModuleViews;

/**
* Contract interface for Views functionality
*/

public interface View {

/**
* Start view
*
* @param firstView true if this is the first view in the session
* @deprecated use {@link ModuleViews.Views#startView(String)} instead via {@link Countly#views()}
*/
void start(boolean firstView);

/**
* Stop view
*
* @param lastView true if this is the last view in the session
* @deprecated use {@link ModuleViews.Views#stopViewWithName(String)} or {@link ModuleViews.Views#stopViewWithID(String)} instead via {@link Countly#views()}
*/
void stop(boolean lastView);
}
}

0 comments on commit abdf629

Please sign in to comment.