Skip to content

feat(ios): add session sync callback #1282

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

Merged
merged 59 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
77b8993
feat(android): add SRSyncCallback
kholood-ea Aug 28, 2024
e6b816f
feat: implement and test syncCallback CP side
kholood-ea Aug 28, 2024
bad72d6
feat(example): use SRSyncCallback in example app
kholood-ea Aug 28, 2024
2b01c9d
ci: fix tests
kholood-ea Aug 28, 2024
61d6e52
fix: export session data type
kholood-ea Sep 2, 2024
849648a
fix(example): use session data type
kholood-ea Sep 2, 2024
02c621c
fix(android):remove data modifier
kholood-ea Sep 2, 2024
0d9c7f1
fix(android): add property modifiers
kholood-ea Sep 2, 2024
261aa76
fix(android): update test case
kholood-ea Sep 2, 2024
5056f58
fix: enhance test case
kholood-ea Sep 5, 2024
8d9036e
fix(ios): update network log signature
kholood-ea Sep 8, 2024
1ce3f36
chore(ios): integrate dynamic sampling snapshot
kholood-ea Sep 8, 2024
043f3df
fix:update IOS network log unit test
kholood-ea Sep 8, 2024
8a0c9cc
fix: update session metadata
kholood-ea Sep 9, 2024
65cd192
feat(ios): add setSyncCallback
kholood-ea Sep 9, 2024
36ca2ad
fix: pod.lock file
kholood-ea Sep 9, 2024
2ff447f
fix: update session data type
kholood-ea Sep 9, 2024
131a795
fix: add more session metadata to setSyncCallback
kholood-ea Sep 10, 2024
2b53766
fix: update syncCallback test
kholood-ea Sep 10, 2024
41e6b52
feat: add launchType to session metadata for setSyncCallback
kholood-ea Sep 11, 2024
c6b9173
fix: import type
kholood-ea Sep 12, 2024
5e237a0
fix: enhance test case
kholood-ea Sep 5, 2024
44901df
fix: add more session metadata to setSyncCallback
kholood-ea Sep 10, 2024
4b492dc
fix: update syncCallback test
kholood-ea Sep 10, 2024
c76ef3b
feat: add launchType to session metadata for setSyncCallback
kholood-ea Sep 11, 2024
0c0031c
fix: import type
kholood-ea Sep 12, 2024
5c75de1
feat(ios): add launchType metadata to session syncCallback
kholood-ea Sep 12, 2024
71b5585
fix: add unknown type to launch types
kholood-ea Sep 16, 2024
3b1c37b
fix: assert evaluate sync returns correct value
kholood-ea Sep 16, 2024
446e9e4
fix: import type
kholood-ea Sep 16, 2024
8187f60
fix: cleanup
kholood-ea Sep 16, 2024
d0e972c
chore: update js doc
kholood-ea Sep 16, 2024
c700600
fix: typo
kholood-ea Sep 16, 2024
38bf28f
fix: follow interface naming convention
kholood-ea Sep 16, 2024
8cef372
fix: update type
kholood-ea Sep 16, 2024
40556ec
fix: refactor syncCallback
kholood-ea Sep 16, 2024
bc4f699
fix: default syncing session to true
kholood-ea Sep 16, 2024
6eec19f
fix: convert network logs to readable array
kholood-ea Sep 16, 2024
b3c0a31
chore: add discriptive comment
kholood-ea Sep 16, 2024
e50fbef
chore: use readable map for session metadata
a7medev Sep 16, 2024
d08d84c
fix: setSyncCallback should sync in case of exception
kholood-ea Sep 18, 2024
6ee32a8
fix: move SessionMetadata to models
kholood-ea Sep 18, 2024
6bf9f32
fix: update SessionMetadata type import
kholood-ea Sep 18, 2024
df89665
fix: report bug e2e test
kholood-ea Sep 18, 2024
c60cb78
Merge remote-tracking branch 'origin/feat/session-sync-callback-andro…
kholood-ea Sep 18, 2024
23276be
chore (ios): update snapshot
kholood-ea Sep 18, 2024
3a58433
chore (ios): refactor callback
kholood-ea Sep 18, 2024
479e0de
Merge branch 'feat/session-sync-callback' into feat/session-sync-call…
kholood-ea Sep 18, 2024
fc3337c
fix: return network logs
kholood-ea Sep 19, 2024
bae6d68
chore: update podfile.lock
kholood-ea Sep 19, 2024
8fff79b
chore: fix formatting
kholood-ea Sep 19, 2024
9e69dd8
chore: revert Podfile.lock
kholood-ea Sep 19, 2024
5ea6e35
chore: fix ci
kholood-ea Sep 19, 2024
4729287
fix: launchType typo
kholood-ea Sep 23, 2024
de5c6ce
fix: update class sessionEvaluationCompletion atomicity
kholood-ea Sep 23, 2024
4d9a186
chore: enhance syncCallback formatting
kholood-ea Sep 23, 2024
6677b17
chore: update evaluateSync formatting
kholood-ea Sep 23, 2024
1afe9d3
fix: fix test SetSyncCallback
kholood-ea Sep 26, 2024
250cb94
fix: update getNetworkLogsArray return value
kholood-ea Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add launchType to session metadata for setSyncCallback
  • Loading branch information
kholood-ea committed Sep 12, 2024
commit c76ef3bca0ee5d07888d32da5195a0b8b2f3941c
2 changes: 1 addition & 1 deletion android/native.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project.ext.instabug = [
version: '13.3.0'
version: '13.3.0.6212131-SNAPSHOT',
]

dependencies {
Expand Down
16 changes: 16 additions & 0 deletions android/src/main/java/com/instabug/reactlibrary/ArgsRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.instabug.library.invocation.InstabugInvocationEvent;
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition;
import com.instabug.library.sessionreplay.model.SessionMetadata;
import com.instabug.library.ui.onboarding.WelcomeMessage;

import java.util.ArrayList;
Expand Down Expand Up @@ -58,6 +59,7 @@ static Map<String, Object> getAll() {
putAll(nonFatalExceptionLevel);
putAll(locales);
putAll(placeholders);
putAll(launchType);
}};
}

Expand Down Expand Up @@ -238,4 +240,18 @@ static Map<String, Object> getAll() {
put("team", Key.CHATS_TEAM_STRING_NAME);
put("insufficientContentMessage", Key.COMMENT_FIELD_INSUFFICIENT_CONTENT);
}};

public static ArgsMap<String> launchType = new ArgsMap<String>() {{
put("cold", SessionMetadata.LaunchType.COLD);
put("hot",SessionMetadata.LaunchType.HOT );
put("warm",SessionMetadata.LaunchType.WARM );
}};

// Temporary workaround to be removed in future release
public static HashMap<String,String> launchTypeReversed = new HashMap<String,String>() {{
put(SessionMetadata.LaunchType.COLD,"cold");
put(SessionMetadata.LaunchType.HOT,"hot" );
put(SessionMetadata.LaunchType.WARM,"warm" );
}};

}
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ public boolean onSessionReadyToSync(@NonNull SessionMetadata sessionMetadata) {
params.putString("device",sessionMetadata.getDevice());
params.putDouble("sessionDurationInSeconds",(double)sessionMetadata.getSessionDurationInSeconds());
params.putBoolean("hasLinkToAppReview",sessionMetadata.getLinkedToReview());
params.putDouble("launchType", sessionMetadata.getLaunchType());
params.putString("launchType",ArgsRegistry.launchTypeReversed.get(sessionMetadata.getLaunchType()) );
params.putDouble("launchDuration", sessionMetadata.getLaunchDuration());
params.putArray("networkLogs",getNetworkLogsArray(sessionMetadata.getNetworkLogs()));

// TODO:Add rest of sessionMetadata
// params.putDouble("bugsCount", ??);
// params.putDouble("fatalCrashCount",??);
Expand Down
4 changes: 4 additions & 0 deletions examples/default/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Instabug, {
LogLevel,
ReproStepsMode,
SessionReplay,
LaunchType,
} from 'instabug-reactnative';
import type { sessionData } from 'instabug-reactnative';
import { NativeBaseProvider } from 'native-base';
Expand All @@ -23,6 +24,9 @@ const queryClient = new QueryClient();

export const App: React.FC = () => {
const shouldSyncSession = (data: sessionData) => {
if (data.launchType === LaunchType.cold) {
return true;
}
if (data.sessionDurationInSeconds > 20) {
return true;
}
Expand Down
18 changes: 11 additions & 7 deletions src/modules/SessionReplay.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { NativeSessionReplay, NativeEvents, emitter } from '../native/NativeSessionReplay';

import type { NetworkData } from '../modules/NetworkLogger';
import { LaunchType } from '../utils/Enums';
export interface networkLog {
url: string;
duration: number;
statusCode: number;
}

export interface sessionData {
appVersion: string;
OS: string;
device: string;
sessionDurationInSeconds: number;
bugsCount: number;
fatalCrashCount: number;
oomCrashCount: number;
networkLogs: Array<NetworkData>;
launchType: string;
networkLogs: Array<networkLog>;
launchType: LaunchType;
hasLinkToAppReview: boolean;
launchDuration: number;
bugsCount?: number;
fatalCrashCount?: number;
oomCrashCount?: number;
}
/**
* Enables or disables Session Replay for your Instabug integration.
Expand Down
9 changes: 8 additions & 1 deletion src/native/NativeConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export type NativeConstants = NativeSdkDebugLogsLevel &
NativeReproStepsMode &
NativeLocale &
NativeNonFatalErrorLevel &
NativeStringKey;
NativeStringKey &
NativeLaunchType;

interface NativeSdkDebugLogsLevel {
sdkDebugLogsLevelVerbose: any;
Expand Down Expand Up @@ -188,3 +189,9 @@ interface NativeStringKey {
welcomeMessageLiveWelcomeStepContent: any;
welcomeMessageLiveWelcomeStepTitle: any;
}

interface NativeLaunchType {
hot: any;
cold: any;
warm: any;
}
9 changes: 9 additions & 0 deletions src/utils/Enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,12 @@ export enum StringKey {
welcomeMessageLiveWelcomeStepContent = constants.welcomeMessageLiveWelcomeStepContent,
welcomeMessageLiveWelcomeStepTitle = constants.welcomeMessageLiveWelcomeStepTitle,
}

export enum LaunchType {
hot = constants.hot,
cold = constants.cold,
/**
* android only
*/
warm = constants.warm,
}