Skip to content
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

Update high level components to be accessed via pascal case #1764

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 11 additions & 11 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ The OneSignal SDK has been updated to be more modular in nature. The SDK has be
| Namespace | Module | Kotlin | Java |
| ------------- | ----------------------------- | ------------------------- | ------------------------------ |
| User | com.onesignal:core | `OneSignal.User` | `OneSignal.getUser()` |
| Session | com.onesignal:core | `OneSignal.session` | `OneSignal.getSession()` |
| Notifications | com.onesignal:notifications | `OneSignal.notifications` | `OneSignal.getNotifications()` |
| Location | com.onesignal:location | `OneSignal.location` | `OneSignal.getLocation()` |
| InAppMessages | com.onesignal:in-app-messages | `OneSignal.inAppMessages` | `OneSignal.getInAppMessages()` |
| Debug | com.onesignal:core | `OneSignal.debug` | `OneSignal.getDebug()` |
| Session | com.onesignal:core | `OneSignal.Session` | `OneSignal.getSession()` |
| Notifications | com.onesignal:notifications | `OneSignal.Notifications` | `OneSignal.getNotifications()` |
| Location | com.onesignal:location | `OneSignal.Location` | `OneSignal.getLocation()` |
| InAppMessages | com.onesignal:in-app-messages | `OneSignal.InAppMessages` | `OneSignal.getInAppMessages()` |
| Debug | com.onesignal:core | `OneSignal.Debug` | `OneSignal.getDebug()` |



Expand All @@ -83,7 +83,7 @@ Initialization of the OneSignal SDK, although similar to past versions, has chan
OneSignal.initWithContext(this, ONESIGNAL_APP_ID)
// requestPermission will show the native Android notification permission prompt.
// We recommend removing the following code and instead using an In-App Message to prompt for notification permission.
OneSignal.notifications.requestPermission(true)
OneSignal.Notifications.requestPermission(true)

If your integration is not user-centric, there is no additional startup code required. A user is automatically created as part of the push subscription creation, both of which are only accessible from the current device and the OneSignal dashboard.

Expand Down Expand Up @@ -246,7 +246,7 @@ The user name space is accessible via `OneSignal.User` (in Kotlin) or `OneSignal


**Session Namespace**
The session namespace is accessible via `OneSignal.session` (in Kotlin) or `OneSignal.getSession()` (in Java) and provides access to session-scoped functionality.
The session namespace is accessible via `OneSignal.Session` (in Kotlin) or `OneSignal.getSession()` (in Java) and provides access to session-scoped functionality.

| **Kotlin** | **Java** | **Description** |
| ----------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------------------- |
Expand All @@ -256,7 +256,7 @@ The session namespace is accessible via `OneSignal.session` (in Kotlin) or `OneS


**Notifications Namespace**
The notification namespace is accessible via `OneSignal.notifications` (in Kotlin) or `OneSignal.getNotifications()` (in Java) and provides access to notification-scoped functionality.
The notification namespace is accessible via `OneSignal.Notifications` (in Kotlin) or `OneSignal.getNotifications()` (in Java) and provides access to notification-scoped functionality.

| **Kotlin** | **Java** | **Description** |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -272,7 +272,7 @@ The notification namespace is accessible via `OneSignal.notifications` (in Kotli


**Location Namespace**
The location namespace is accessible via `OneSignal.location` (in Kotlin) or `OneSignal.getLocation()` (in Java) and provide access to location-scoped functionality.
The location namespace is accessible via `OneSignal.Location` (in Kotlin) or `OneSignal.getLocation()` (in Java) and provide access to location-scoped functionality.

| **Kotlin** | **Java** | **Description** |
| -------------------------------------------| -------------------------------------------------------------------| -------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -281,7 +281,7 @@ The location namespace is accessible via `OneSignal.location` (in Kotlin) or `On


**InAppMessages Namespace**
The In App Messages namespace is accessible via `OneSignal.inAppMessages` (in Kotlin) or `OneSignal.getInAppMessages()` (in Java) and provide access to in app messages-scoped functionality.
The In App Messages namespace is accessible via `OneSignal.InAppMessages` (in Kotlin) or `OneSignal.getInAppMessages()` (in Java) and provide access to in app messages-scoped functionality.

| **Kotlin** | **Java** | **Description** |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -296,7 +296,7 @@ The In App Messages namespace is accessible via `OneSignal.inAppMessages` (in Ko


**Debug Namespace**
The debug namespace is accessible via `OneSignal.debug` (in Kotlin) or `OneSignal.getDebug()` (in Java) and provide access to debug-scoped functionality.
The debug namespace is accessible via `OneSignal.Debug` (in Kotlin) or `OneSignal.getDebug()` (in Java) and provide access to debug-scoped functionality.

| **Kotlin** | **Java** | **Description** |
| -------------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,33 @@ interface IOneSignal {
/**
* The session manager for accessing session-scoped management.
*/
val session: ISessionManager
val Session: ISessionManager

/**
* The notification manager for accessing device-scoped
* notification management.
*/
val notifications: INotificationsManager
val Notifications: INotificationsManager

/**
* The location manager for accessing device-scoped
* location management.
*/
val location: ILocationManager
val Location: ILocationManager

/**
* The In App Messaging manager for accessing device-scoped
* IAP management.
*/
val inAppMessages: IInAppMessagesManager
val InAppMessages: IInAppMessagesManager

/**
* Access to debug the SDK in the event additional information is required to diagnose any
* SDK-related issues.
*
* WARNING: This should not be used in a production setting.
*/
val debug: IDebugManager
val Debug: IDebugManager

/**
* Determines whether a user must consent to privacy prior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,32 @@ object OneSignal {
* has been called.
*/
@JvmStatic
val session: ISessionManager
get() = oneSignal.session
val Session: ISessionManager
get() = oneSignal.Session

/**
* The notification manager for accessing device-scoped notification management. Initialized
* only after [initWithContext] has been called.
*/
@JvmStatic
val notifications: INotificationsManager
get() = oneSignal.notifications
val Notifications: INotificationsManager
get() = oneSignal.Notifications

/**
* The location manager for accessing device-scoped location management. Initialized
* only after [initWithContext] has been called.
*/
@JvmStatic
val location: ILocationManager
get() = oneSignal.location
val Location: ILocationManager
get() = oneSignal.Location

/**
* The In App Messaging manager for accessing device-scoped IAP management. Initialized
* only after [initWithContext] has been called.
*/
@JvmStatic
val inAppMessages: IInAppMessagesManager
get() = oneSignal.inAppMessages
val InAppMessages: IInAppMessagesManager
get() = oneSignal.InAppMessages

/**
* Access to debug the SDK in the additional information is required to diagnose any
Expand All @@ -84,8 +84,8 @@ object OneSignal {
* WARNING: This should not be used in a production setting.
*/
@JvmStatic
val debug: IDebugManager
get() = oneSignal.debug
val Debug: IDebugManager
get() = oneSignal.Debug

/**
* Determines whether a user must consent to privacy prior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
}

// we hardcode the DebugManager implementation so it can be used prior to calling `initWithContext`
override val debug: IDebugManager = DebugManager()
override val session: ISessionManager get() = if (isInitialized) _session!! else throw Exception("Must call 'initWithContext' before use")
override val notifications: INotificationsManager get() = if (isInitialized) _notifications!! else throw Exception("Must call 'initWithContext' before use")
override val location: ILocationManager get() = if (isInitialized) _location!! else throw Exception("Must call 'initWithContext' before use")
override val inAppMessages: IInAppMessagesManager get() = if (isInitialized) _iam!! else throw Exception("Must call 'initWithContext' before use")
override val Debug: IDebugManager = DebugManager()
override val Session: ISessionManager get() = if (isInitialized) _session!! else throw Exception("Must call 'initWithContext' before use")
override val Notifications: INotificationsManager get() = if (isInitialized) _notifications!! else throw Exception("Must call 'initWithContext' before use")
override val Location: ILocationManager get() = if (isInitialized) _location!! else throw Exception("Must call 'initWithContext' before use")
override val InAppMessages: IInAppMessagesManager get() = if (isInitialized) _iam!! else throw Exception("Must call 'initWithContext' before use")
override val User: IUserManager get() = if (isInitialized) _user!! else throw Exception("Must call 'initWithContext' before use")

// Services required by this class
Expand Down