-
Notifications
You must be signed in to change notification settings - Fork 59
feat: add manual start and stop recording #256
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # Disabled rules | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ported from posthog-ios repo |
||
| --disable docComments | ||
| --disable noForceUnwrapInTests | ||
| --disable hoistTry | ||
| --disable redundantAsync | ||
| --disable redundantThrows | ||
| --disable redundantProperty | ||
| --disable redundantReturn | ||
| --disable redundantClosure | ||
| --disable redundantType | ||
| --disable wrapPropertyBodies | ||
| --disable blankLinesBetweenScopes | ||
|
|
||
| --acronyms ID,URL,UUID | ||
| --allman false | ||
| --anonymousforeach convert | ||
| --assetliterals visual-width | ||
| --asynccapturing | ||
| --beforemarks | ||
| --binarygrouping none | ||
| --callsiteparen default | ||
| --categorymark "MARK: %c" | ||
| --classthreshold 0 | ||
| --closingparen balanced | ||
| --closurevoid remove | ||
| --commas always | ||
| --complexattrs preserve | ||
| --computedvarattrs preserve | ||
| --condassignment after-property | ||
| --conflictmarkers reject | ||
| --dateformat system | ||
| --decimalgrouping ignore | ||
| --doccomments before-declarations | ||
| --elseposition same-line | ||
| --emptybraces no-space | ||
| --enumnamespaces always | ||
| --enumthreshold 0 | ||
| --exponentcase lowercase | ||
| --exponentgrouping disabled | ||
| --extensionacl on-extension | ||
| --extensionlength 0 | ||
| --extensionmark "MARK: - %t + %c" | ||
| --fractiongrouping disabled | ||
| --fragment false | ||
| --funcattributes preserve | ||
| --generictypes | ||
| --groupedextension "MARK: %c" | ||
| --guardelse auto | ||
| --header ignore | ||
| --hexgrouping 4,8 | ||
| --hexliteralcase uppercase | ||
| --ifdef indent | ||
| --importgrouping alpha | ||
| --indent 4 | ||
| --indentcase false | ||
| --indentstrings false | ||
| --initcodernil false | ||
| --lifecycle | ||
| --lineaftermarks true | ||
| --linebreaks lf | ||
| --markcategories true | ||
| --markextensions always | ||
| --marktypes always | ||
| --maxwidth none | ||
| --modifierorder | ||
| --nevertrailing | ||
| --nilinit remove | ||
| --noncomplexattrs | ||
| --nospaceoperators | ||
| --nowrapoperators | ||
| --octalgrouping none | ||
| --onelineforeach ignore | ||
| --operatorfunc spaced | ||
| --organizationmode visibility | ||
| --organizetypes actor,class,enum,struct | ||
| --patternlet hoist | ||
| --ranges spaced | ||
| --redundanttype infer-locals-only | ||
| --self remove | ||
| --selfrequired | ||
| --semicolons never | ||
| --shortoptionals except-properties | ||
| --smarttabs enabled | ||
| --someany true | ||
| --storedvarattrs preserve | ||
| --stripunusedargs always | ||
| --structthreshold 0 | ||
| --tabwidth unspecified | ||
| --throwcapturing | ||
| --timezone system | ||
| --trailingclosures | ||
| --trimwhitespace always | ||
| --typeattributes preserve | ||
| --typeblanklines remove | ||
| --typedelimiter space-after | ||
| --typemark "MARK: - %t" | ||
| --voidtype void | ||
| --wraparguments preserve | ||
| --wrapcollections preserve | ||
| --wrapconditions preserve | ||
| --wrapeffects preserve | ||
| --wrapenumcases always | ||
| --wrapparameters default | ||
| --wrapreturntype preserve | ||
| --wrapternary default | ||
| --wraptypealiases preserve | ||
| --xcodeindentation disabled | ||
| --yodaswap always | ||
| --hexgrouping ignore | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -658,4 +658,45 @@ class PosthogFlutterIO extends PosthogFlutterPlatformInterface { | |||||
| printIfDebug('Exception on openUrl: $exception'); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| @override | ||||||
| Future<void> startSessionRecording({bool resumeCurrent = true}) async { | ||||||
| if (!isSupportedPlatform()) { | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
all those methods should bail if its a macOS app since replay isnt supported, theres no need to call method channels if we know its not gonna work |
||||||
| return; | ||||||
| } | ||||||
|
|
||||||
| try { | ||||||
| await _methodChannel.invokeMethod('startSessionRecording', resumeCurrent); | ||||||
| } on PlatformException catch (exception) { | ||||||
| printIfDebug('Exception on startSessionRecording: $exception'); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| @override | ||||||
| Future<void> stopSessionRecording() async { | ||||||
| if (!isSupportedPlatform()) { | ||||||
| return; | ||||||
| } | ||||||
|
|
||||||
| try { | ||||||
| await _methodChannel.invokeMethod('stopSessionRecording'); | ||||||
| } on PlatformException catch (exception) { | ||||||
| printIfDebug('Exception on stopSessionRecording: $exception'); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| @override | ||||||
| Future<bool> isSessionReplayActive() async { | ||||||
| if (!isSupportedPlatform()) { | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| try { | ||||||
| final result = await _methodChannel.invokeMethod('isSessionReplayActive'); | ||||||
| return result as bool? ?? false; | ||||||
| } on PlatformException catch (exception) { | ||||||
| printIfDebug('Exception on isSessionReplayActive: $exception'); | ||||||
| return false; | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do those API work even if config.sessionReplay is disabled or both ways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what we did for the other sdks I believe. So if local config is false, people can start a recording later on manually.
If remote config/flags is false, then no-op
Trying to validate these with some local testing