forked from nprudnikov/PrFirebase
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dea18f4
commit d597789
Showing
41 changed files
with
3,018 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/Intermediate/ | ||
/Binaries/ | ||
.DS_Store |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Nikolay Prudnikov | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,22 @@ | ||
{ | ||
"FileVersion" : 3, | ||
|
||
"FriendlyName" : "PrFirebase", | ||
"Version" : 1, | ||
"VersionName" : "0.1", | ||
"CreatedBy" : "Prudnikov Nikolay", | ||
"CreatedByURL" : "https://github.com/nprudnikov", | ||
"EngineVersion" : "4.26.0", | ||
"Description" : "", | ||
"Category" : "Analytics", | ||
"MarketplaceURL" : "", | ||
|
||
"Modules" : | ||
[ | ||
{ | ||
"Name" : "PrFirebase", | ||
"Type" : "Runtime", | ||
"LoadingPhase": "PreLoadingScreen" | ||
} | ||
] | ||
} |
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,22 @@ | ||
--- | ||
Language: Cpp | ||
BasedOnStyle: LLVM | ||
IndentWidth: 4 | ||
TabWidth: 4 | ||
UseTab: ForContinuationAndIndentation | ||
Standard: Cpp11 | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: DontAlign | ||
AlignEscapedNewlines: Right | ||
AlignTrailingComments: true | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: InlineOnly | ||
BreakBeforeBraces: Allman | ||
BreakConstructorInitializersBeforeComma: true | ||
ColumnLimit: 0 | ||
PointerAlignment: Left | ||
SpacesInAngles: false | ||
--- | ||
Language: ObjC | ||
DisableFormat: true | ||
... |
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,45 @@ | ||
#pragma once | ||
|
||
#include "PrFirebaseModule.h" | ||
|
||
#include "PrFirebaseDefines.h" | ||
|
||
#include "PrFirebaseAuthModule.generated.h" | ||
|
||
USTRUCT(Blueprintable, BlueprintType) | ||
struct PRFIREBASE_API FPrFirebaseUser | ||
{ | ||
GENERATED_BODY(); | ||
|
||
FPrFirebaseUser(){}; | ||
|
||
UPROPERTY(EditAnywhere, BlueprintReadWrite) | ||
FString UserName; | ||
|
||
UPROPERTY(EditAnywhere, BlueprintReadWrite) | ||
FString Uid; | ||
}; | ||
|
||
DECLARE_DYNAMIC_DELEGATE_OneParam(FPrFirebaseAuthDelegate, bool, bSuccess); | ||
|
||
UCLASS() | ||
class PRFIREBASE_API UPrFirebaseAuthModule : public UPrFirebaseModule | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UFUNCTION(BlueprintCallable, Category = "Firebase|Auth") | ||
virtual void SignInNativePlatform(FPrFirebaseAuthDelegate Delegate) { Firebase_NotImplemented(); } | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Auth") | ||
virtual void GetUserInfo(FPrFirebaseUser& OutUserInfo) const { Firebase_NotImplemented(); } | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Auth") | ||
virtual bool IsAuthenticated() const | ||
{ | ||
Firebase_NotImplemented(); | ||
return false; | ||
} | ||
|
||
virtual bool IsAvailable() const final { return WITH_FIREBASE_CRASHLYTICS; } | ||
}; |
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,45 @@ | ||
#pragma once | ||
|
||
#include "PrFirebaseModule.h" | ||
|
||
#include "PrFirebaseDefines.h" | ||
|
||
#include "PrFirebaseCrashlyticsModule.generated.h" | ||
|
||
class FOutputDevice; | ||
|
||
UCLASS() | ||
class PRFIREBASE_API UPrFirebaseCrashlyticsModule : public UPrFirebaseModule | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UFUNCTION(BlueprintCallable, Category = "Firebase|Crashlytics|Crash") | ||
virtual void Crash() { Firebase_NotImplemented(); } | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Crashlytics|User") | ||
virtual void SetUserIdentifier(const FString& UserIdentifier) { Firebase_NotImplemented(); } | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Crashlytics|Log") | ||
virtual void WriteLog(const FString& Log) { Firebase_NotImplemented(); } | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Crashlytics|Log") | ||
virtual void WriteError(const FString& Log, int32 Code = 0) { Firebase_NotImplemented(); } | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Crashlytics|Value") | ||
virtual void AddAttribute(const FString& Key, const FString& Value) { Firebase_NotImplemented(); } | ||
|
||
virtual bool IsAvailable() const final { return WITH_FIREBASE_CRASHLYTICS; } | ||
|
||
protected: | ||
friend class FCrashlyticsOutputDevice; | ||
friend class FCrashlyticsOutputDeviceError; | ||
|
||
void CatchEngineLogs(); | ||
|
||
FString CrashlyticsLogFormat(const TCHAR* V, ELogVerbosity::Type Verbosity, const class FName& Category); | ||
|
||
void WriteBlueprintCallstack(); | ||
|
||
void Log(bool bCritical, const TCHAR* V, ELogVerbosity::Type Verbosity, const class FName& Category); | ||
}; |
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,9 @@ | ||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
|
||
DEFINE_LOG_CATEGORY_STATIC(LogFirebase, VeryVerbose, All); | ||
DEFINE_LOG_CATEGORY_STATIC(LogCrashlytics, VeryVerbose, All); | ||
DEFINE_LOG_CATEGORY_STATIC(LogPerformance, VeryVerbose, All); | ||
|
||
#define Firebase_NotImplemented() |
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,17 @@ | ||
#pragma once | ||
|
||
#include "Kismet/BlueprintFunctionLibrary.h" | ||
|
||
#include "PrFirebaseProxy.h" | ||
|
||
#include "PrFirebaseLibrary.generated.h" | ||
|
||
UCLASS() | ||
class PRFIREBASE_API UPrFirebaseLibrary : public UBlueprintFunctionLibrary | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UFUNCTION(BlueprintCallable, Category = PrFirebase, BlueprintPure) | ||
static UPrFirebaseProxy* GetFirebaseProxy(); | ||
}; |
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,28 @@ | ||
#pragma once | ||
|
||
#include "PrFirebaseDefines.h" | ||
|
||
#include "CoreMinimal.h" | ||
|
||
#include "PrFirebaseModule.generated.h" | ||
|
||
UCLASS() | ||
class PRFIREBASE_API UPrFirebaseModule : public UObject | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UFUNCTION(BlueprintCallable, Category = "Firebase|Module") | ||
virtual bool IsAvailable() const | ||
{ | ||
Firebase_NotImplemented(); | ||
return false; | ||
} | ||
|
||
protected: | ||
friend class UPrFirebaseProxy; | ||
|
||
virtual void PreInitialize_AnyThread() {} | ||
virtual void Initialize_AnyThread() {} | ||
virtual void PostInitialize_AnyThread() {} | ||
}; |
155 changes: 155 additions & 0 deletions
155
Source/PrFirebase/Classes/PrFirebasePerformanceModule.h
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,155 @@ | ||
#pragma once | ||
|
||
#include "PrFirebaseModule.h" | ||
|
||
#include "PrFirebaseDefines.h" | ||
|
||
#include "Misc/CoreDelegates.h" | ||
|
||
#include "PrFirebasePerformanceModule.generated.h" | ||
|
||
class UPrFirebasePerformanceModule; | ||
|
||
USTRUCT(Blueprintable, BlueprintType) | ||
struct FPrFirebasePerformanceTrace | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
FPrFirebasePerformanceTrace(); | ||
|
||
FPrFirebasePerformanceTrace(TWeakObjectPtr<UPrFirebasePerformanceModule> PerformanceModule, const FString& Identifier); | ||
|
||
FPrFirebasePerformanceTrace(TWeakObjectPtr<UPrFirebasePerformanceModule> PerformanceModule, int32 Index); | ||
|
||
void Stop(); | ||
|
||
void IncrementMetric(const FString& Name, int32 Value); | ||
|
||
void SetMetric(const FString& Name, int32 Value); | ||
|
||
void SetAttribute(const FString& Name, const FString& Value); | ||
|
||
void RemoveAttribute(const FString& Name); | ||
|
||
int32 GetTraceIndex() const; | ||
|
||
private: | ||
UPROPERTY() | ||
TWeakObjectPtr<UPrFirebasePerformanceModule> Module; | ||
|
||
UPROPERTY() | ||
int32 TraceIndex; | ||
}; | ||
|
||
USTRUCT() | ||
struct FPrFirebasePerformanceScopeTimeTrace | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
FPrFirebasePerformanceScopeTimeTrace(); | ||
|
||
FPrFirebasePerformanceScopeTimeTrace(TWeakObjectPtr<UPrFirebasePerformanceModule> PerformanceModule, const FString& Identifier); | ||
|
||
~FPrFirebasePerformanceScopeTimeTrace(); | ||
|
||
private: | ||
TOptional<FPrFirebasePerformanceTrace> Trace; | ||
}; | ||
|
||
UCLASS() | ||
class PRFIREBASE_API UPrFirebasePerformanceModule : public UPrFirebaseModule | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UPrFirebasePerformanceModule(); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Trace") | ||
void SetAttributeForAllTraces(const FString& Name, const FString& Value); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Trace") | ||
void RemoveAttributeForAllTraces(const FString& Name); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Trace") | ||
void SetMetricForAllTraces(const FString& Name, int32 Value); | ||
|
||
int32 StartTraceWithoutWrapper(const FString& Identifier); | ||
|
||
void StopTraceWithoutWrapper(int32 TraceIndex); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Trace") | ||
FPrFirebasePerformanceTrace StartTrace(const FString& Identifier); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Trace") | ||
void StopTrace(const FPrFirebasePerformanceTrace& Trace); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Trace") | ||
void IncrementMetric(const FPrFirebasePerformanceTrace& Trace, const FString& Name, int32 Value); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Trace") | ||
void SetMetric(const FPrFirebasePerformanceTrace& Trace, const FString& Name, int32 Value); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Trace") | ||
void SetAttribute(const FPrFirebasePerformanceTrace& Trace, const FString& Name, const FString& Value); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Trace") | ||
void RemoveAttribute(const FPrFirebasePerformanceTrace& Trace, const FString& Name); | ||
|
||
UFUNCTION(BlueprintCallable, Category = "Firebase|Performance|Utils") | ||
void AppliactionLaunched(); | ||
|
||
virtual bool IsAvailable() const final { return WITH_FIREBASE_PERFORMANCE; } | ||
|
||
protected: | ||
virtual void InternalStartTrace(int32 TraceIndex, const FString& Identifier) { Firebase_NotImplemented(); } | ||
|
||
virtual void InternalStopTrace(int32 TraceIndex) { Firebase_NotImplemented(); } | ||
|
||
virtual void InternalIncrementMetric(int32 TraceIndex, const FString& Name, int32 Value) { Firebase_NotImplemented(); } | ||
|
||
virtual void InternalSetMetric(int32 TraceIndex, const FString& Name, int32 Value) { Firebase_NotImplemented(); } | ||
|
||
virtual void InternalSetAttribute(int32 TraceIndex, const FString& Name, const FString& Value) { Firebase_NotImplemented(); } | ||
|
||
virtual void InternalRemoveAttribute(int32 TraceIndex, const FString& Name) { Firebase_NotImplemented(); } | ||
|
||
void InternalLaunch_AnyThread(); | ||
|
||
void SetTemperature(FCoreDelegates::ETemperatureSeverity Temp); | ||
|
||
void SetPowerMode(bool bLowPowerMode); | ||
|
||
void StartWatch(); | ||
|
||
private: | ||
int32 LastTraceIndex; | ||
|
||
bool bAppliactionLaunched; | ||
|
||
bool bAppliactionFirstFrame; | ||
|
||
TMap<FString, FString> GlobalAttributes; | ||
|
||
TMap<FString, int32> GlobalMetrics; | ||
|
||
TSet<int32> ExistingTraceIndices; | ||
|
||
TOptional<FPrFirebasePerformanceTrace> AppLaunchTrace; | ||
|
||
TOptional<FPrFirebasePerformanceTrace> AvFrameTrace; | ||
|
||
TOptional<FDateTime> AvFrameTime; | ||
|
||
int64 AvFrameCounter; | ||
|
||
void OnAppliactionLaunched(); | ||
|
||
void OnEndFrame(); | ||
}; | ||
|
||
#define PRF_SCOPE_TIME(_Identifier_) \ | ||
FPrFirebasePerformanceScopeTimeTrace _PrFirebasePerformanceScopeTimeTrace_##_TraceName_##__LINE__(GPrFirebasePerformanceModule, #_Identifier_); | ||
|
||
extern PRFIREBASE_API TWeakObjectPtr<UPrFirebasePerformanceModule> GPrFirebasePerformanceModule; |
Oops, something went wrong.