-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixed issues with user session on android platform
- Loading branch information
Desu Sai Venkat
committed
Nov 22, 2023
1 parent
1d81844
commit 937c931
Showing
6 changed files
with
142 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
..._plugin_android/android/src/main/java/com/rudderstack/sdk/flutter/LifeCycleRunnables.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.rudderstack.sdk.flutter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class LifeCycleRunnables { | ||
|
||
public static final List<RunnableLifeCycleEventsInterface> runnableLifeCycleEvents = new ArrayList<>(); | ||
|
||
interface RunnableLifeCycleEventsInterface { | ||
void run(); | ||
} | ||
|
||
public static class ApplicationOpenedRunnable implements RunnableLifeCycleEventsInterface { | ||
boolean fromBackground; | ||
|
||
public ApplicationOpenedRunnable(boolean fromBackground) { | ||
this.fromBackground = fromBackground; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
RudderSdkFlutterPlugin.getInstance().trackApplicationOpened(fromBackground); | ||
} | ||
} | ||
|
||
public static class ApplicationBackgroundedRunnable implements RunnableLifeCycleEventsInterface { | ||
|
||
@Override | ||
public void run() { | ||
RudderSdkFlutterPlugin.getInstance().trackApplicationBackgrounded(); | ||
} | ||
} | ||
|
||
public static class ScreenViewRunnable implements RunnableLifeCycleEventsInterface { | ||
String activityName; | ||
|
||
public ScreenViewRunnable(String activityName) { | ||
this.activityName = activityName; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
RudderSdkFlutterPlugin.getInstance().trackScreen(activityName); | ||
} | ||
} | ||
|
||
public static void executeRunnableLifeCycleEvent(RunnableLifeCycleEventsInterface lifeCycleEvent) { | ||
if (RudderSdkFlutterPlugin.getInstance() == null || !RudderSdkFlutterPlugin.isInitialized.get()) { | ||
runnableLifeCycleEvents.add(lifeCycleEvent); | ||
} else { | ||
lifeCycleEvent.run(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters