Skip to main content

iOS SDK V2 Dashboard

Objective-C

Objective-C games (Egret, Cocos Creator) use showProfileWithCallback: to open the SDK profile/account screen:

[[OEGManager sharedManager] showProfileWithCallback:^(OEGActionType type, id response, BOOL success, NSError *error) {
if (type == OEGActionTypeLogout) {
// User tapped Logout inside the SDK screen.
// Navigate back to your game's login screen here.
}
}];

The SDK presents the profile screen modally. The callback fires when the user performs an action (e.g. logout) or dismisses the screen.


Swift — DashboardView

V2 iOS does not expose a showDashboard(from:) convenience method on OEGManager. The shipped dashboard surface is the SwiftUI DashboardView.

Use DashboardView

import OegSdkV2
import SwiftUI

struct MyGameMenu: View {
var body: some View {
DashboardView(
onLogout: {
OEGAuth.shared.logout()
},
onPayment: {
OEGPayment.shared.purchase(productId: "your_product_id") { result in
print(result)
}
},
onRequestPush: {
OEGPush.shared.requestAuthorization { granted, error in
print("Push granted: \\(granted)")
}
}
)
}
}

Handling logout from the dashboard

When the user taps Logout inside DashboardView:

  1. The onLogout closure you provided is called
  2. Your closure calls OEGAuth.shared.logout()
  3. logout() clears the session and posts the OEGUserDidLogout notification on NotificationCenter

The onLogout closure itself does not navigate the user away from the gameplay screen — your game must observe OEGUserDidLogout and perform the navigation:

// Set this up once at app startup (e.g. in your root coordinator or AppDelegate)
NotificationCenter.default.addObserver(
forName: .OEGUserDidLogout,
object: nil,
queue: .main
) { _ in
// Navigate back to your game's login/main screen
// e.g. dismiss all modals, pop to root, show login view
}

Common bug: Games that only call OEGAuth.shared.logout() inside onLogout but do not observe OEGUserDidLogout will clear the SDK session but stay on the gameplay screen — leaving the user stuck.

What the dashboard provides

  • Account info
  • Profile update
  • Change password
  • Language selection
  • Payment test hook
  • Push permission test hook
  • Logout

When to use it

Use DashboardView if:

  • Your app already uses SwiftUI
  • You want a ready-made SDK account/settings screen

Skip it if:

  • You are building a custom UIKit/SwiftUI account surface on top of OEGAuth