Skip to content

Commit

Permalink
fix apple MARSDK crash
Browse files Browse the repository at this point in the history
  • Loading branch information
irov committed Jul 26, 2023
1 parent c9a3b10 commit 93dca8c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/Plugins/AppleMARSDKPlugin/AppleMARSDKAdRewardedDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ - (void) MARAdRewardedDidFailed: (MARAdErrorCode)code withMessage: (NSString *)m

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

provider->onAdRewardedDidFailed();
}

Expand All @@ -40,6 +45,11 @@ - (void) MARAdRewardedDidLoaded :(NSDictionary *)adDict {

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

provider->onAdRewardedDidLoaded();
}

Expand All @@ -50,6 +60,11 @@ - (void) MARAdRewardedDidShow :(NSDictionary *)adDict {

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

provider->onAdRewardedDidShow();
}

Expand All @@ -60,6 +75,11 @@ - (void) MARAdRewardedDidShowFailed :(NSDictionary *)adDict {

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

provider->onAdRewardedDidShowFailed();
}

Expand All @@ -70,6 +90,11 @@ - (void) MARAdRewardedDidClicked :(NSDictionary *)adDict {

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

provider->onAdRewardedDidClicked();
}

Expand All @@ -80,6 +105,11 @@ - (void) MARAdRewardedDidClosed :(NSDictionary *)adDict {

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

provider->onAdRewardedDidClosed();
}

Expand All @@ -90,6 +120,11 @@ - (void) MARAdRewardedDidSkipped :(NSDictionary *)adDict {

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

provider->onAdRewardedDidSkipped();
}

Expand All @@ -100,6 +135,11 @@ - (void) MARAdRewardedDidFinished: (NSString *)itemName itemNum:(int)itemNum adD

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

provider->onAdRewardedDidFinished([itemName UTF8String], itemNum);
}

Expand Down
35 changes: 35 additions & 0 deletions src/Plugins/AppleMARSDKPlugin/AppleMARSDKDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ - (void) OnPlatformInit: (NSDictionary *)params {
);

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

Mengine::MARSDKResultParams result_params;
Mengine::Helper::AppleGetMapNSDictionary( params, &result_params );
Expand All @@ -50,6 +55,11 @@ - (void) OnRealName:(NSDictionary*)params {
);

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

Mengine::MARSDKResultParams result_params;
Mengine::Helper::AppleGetMapNSDictionary( params, &result_params );
Expand All @@ -64,6 +74,11 @@ - (void) OnEventWithCode:(int)code msg: (NSString*)msg {
);

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

const Mengine::Char * msg_str = [msg UTF8String];

Expand All @@ -77,6 +92,11 @@ - (void) OnEventCustom:(NSString*)eventName params:(NSDictionary*)params {
);

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

const Mengine::Char * eventName_str = [eventName UTF8String];

Expand All @@ -93,6 +113,11 @@ - (void) OnUserLogin: (NSDictionary *)params {

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

Mengine::MARSDKResultParams result_params;
Mengine::Helper::AppleGetMapNSDictionary( params, &result_params );

Expand All @@ -106,6 +131,11 @@ - (void) OnUserLogout: (NSDictionary *)params {

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

Mengine::MARSDKResultParams result_params;
Mengine::Helper::AppleGetMapNSDictionary( params, &result_params );

Expand All @@ -119,6 +149,11 @@ - (void) OnPayPaid: (NSDictionary *)params {

const Mengine::AppleMARSDKProviderInterfacePtr & provider = m_service->getProvider();

if( provider == nullptr )
{
return;
}

Mengine::MARSDKResultParams result_params;
Mengine::Helper::AppleGetMapNSDictionary( params, &result_params );

Expand Down

0 comments on commit 93dca8c

Please sign in to comment.