Skip to content

Commit

Permalink
Release 0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bojan committed Oct 3, 2023
1 parent d18fc04 commit 799e214
Show file tree
Hide file tree
Showing 83 changed files with 276 additions and 82 deletions.
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Added
- Initial release of the DevRev SDK.
- Added the PLuG support chat feature.
- Added user identification.
- Added support for tracking analytics events.

# Changed
- Updated the initial configuration method.
- Updated the support widget to version 2.0.

# Deprecated
- Removed the organization slug (`organizationSlug`) parameter from the configuration method.

For installation instructions, consult the [documentation](README.md).
Binary file modified DevRevSDK.xcframework.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ let package = Package(
targets: [
.binaryTarget(
name: "DevRevSDK",
url: "https://github.com/devrev/devrev-sdk-ios/releases/download/v0.9.1/DevRevSDK.xcframework.zip",
checksum: "24f0fdf4f70bcdf90c235b8ecead03aff31da3dbe1ba17391f1d97a1e3dd7c5b"
url: "https://github.com/devrev/devrev-sdk-ios/releases/download/v0.9.2/DevRevSDK.xcframework.zip",
checksum: "3f28597cb0fc2ea725e67a6ae14488ab15c9574dea6fb605e633b0b8982e27cb"
)
]
)
89 changes: 65 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@
- [Setting up the DevRev SDK](#setting-up-the-devrev-sdk)
- [Step 1: Credentials](#step-1-credentials)
- [Step 2: Initialization](#step-2-initialization)
- [Example](#example)
- [UIKit apps](#uikit-apps)
- [SwiftUI apps](#swiftui-apps)
- [Features](#features)
- [Identification](#identification)
- [Example](#example-1)
- [PLuG support chat](#plug-support-chat)
- [UIKit](#uikit)
- [Example](#example-2)
- [SwiftUI](#swiftui)
- [Example](#example)
- [New conversation callback](#new-conversation-callback)
- [Example](#example-3)
- [Analytics](#analytics)
- [Example](#example-4)
- [Screenshots](#screenshots)
- [Sample app](#sample-app)
- [Troubleshooting](#troubleshooting)
- [Cannot import the SDK into my app](#cannot-import-the-sdk-into-my-app)
Expand All @@ -25,7 +32,6 @@
- Minimum deployment target iOS 15.

# Setup

You can integrate the DevRev SDK in your project as a Swift Package Manager (SPM) package.

Open your project in Xcode, go to the `Add Package` screen, add the following URL under `Enter Package URL`:
Expand All @@ -39,49 +45,55 @@ Now you should be able to import and use the DevRev SDK.

# Setting up the DevRev SDK
## Step 1: Credentials
Open the **Support** settings page, then go to **PLuG Setup**.

<img src="docs/screenshots/screenshot-support-settings.png" width="250" />

On the **PLuG Setup** page, you will be able to create your SDK credentials (app ID and secret).

<img src="docs/screenshots/screenshot-creating-credentials.png" width="400" />

1. Open the **Settings** page.
<img src="docs/screenshots/screenshot-settings-home.png" />
1. Under the **Support** section, go to **PLuG Tokens**.
<img src="docs/screenshots/screenshot-support-tokens.png" width="250" />
1. On the **PLuG Tokens** page, you will be able create your credentials under the **App Credentials**. These credentials are referred to as `appID` and `secret` in the code.
- Create new credentials, if none exist:
<img src="docs/screenshots/screenshot-support-tokens-creating-credentials.png" width="400" />
- Or maybe reuse any existing ones:
<img src="docs/screenshots/screenshot-support-tokens-existing-credentials.png" width="400" />
1. Next, you will have to open the **PLuG Settings** page, and copy the value under **Your Unique App ID**.
> This value is referred to as `supportID` in the code.
<img src="docs/screenshots/screenshot-support-settings.png" width="250" />
<img src="docs/screenshots/screenshot-support-settings-id.png" width="400" />

## Step 2: Initialization

Once you have the credentials, you can configure the DevRev SDK in your app. The SDK will be initialized once you have called the configuration method:

```swift
DevRev.configure(appID: appID, secret: secret, organizationSlug: organizationSlug)
DevRev.configure(appID:secret:supportID:)
```

### UIKit apps
#### Example
```swift
DevRev.configure(appID: appID, secret: secret, supportID: supportID)
```

### UIKit apps
Configure the SDK in the `AppDelegate.application(_:didFinishLaunchingWithOptions:)` method.

### SwiftUI apps

Depending on the architecture of your app, you will need to configure the SDK at your entry point or initial view of the app.

# Features

## Identification
Certain features of the SDK **require** a user identification. Make sure that you identify the user using the `DevRev.identify(...)` function.
Certain features of the SDK **require** a user identification. Make sure that you identify the user using the `DevRev.identify(_:)` function.

The function accepts the `DevRev.Identification` structure, with the user ID (`userID`) as the only required property, all other properties are optional.

The call would look something like this:
> Note: The `DevRev.identify(_:)` function is an asynchronous one, make sure that you wrap it in a `Task` when calling it from synchronous contexts.
#### Example
```swift
await DevRev.identify(Identification(userID: "[email protected]"))
```

The identification function should be placed at the appropriate place in your app after you login your user. If you have the user information at app launch, call the function after the `DevRev.configure(...)` method.
The identification function should be placed at the appropriate place in your app after you login your user. If you have the user information at app launch, call the function after the `DevRev.configure(appID:secret:supportID:)` method.

## PLuG support chat

### UIKit

The support chat feature can be shown as a modal screen or pushed to a navigation stack.

The following overloaded method will show the support screen:
Expand All @@ -92,16 +104,46 @@ DevRev.showSupport(from:isAnimated:)
1. If a `UIViewController` is passed as the `from` parameter, then the screen will be shown **modally**.
1. If a `UINavigationController` is passed as the `from` parameter, then the screen will be pushed onto the stack.

### SwiftUI
#### Example
```swift
DevRev.showSupport(from: mainViewController)
```

### SwiftUI
For SwiftUI apps we provide a specific view, you just need to use the public view property:

```swift
DevRev.supportView
```

### Example
### New conversation callback
For convenience, a callback closure has been added, that way the host app will be able to access the conversation ID.

```swift
DevRev.conversationCreatedCompletion
```

#### Example
```swift
DevRev.conversationCreatedCompletion = { conversationID in
print("A new conversation has been created: \(conversationID).")
}
```

## Analytics
The DevRev SDK supports sending custom analytic events using a name and a string dictionary.

You can track them using the following function:
```swift
DevRev.trackEvent(name:properties:)
```

#### Example
```swift
DevRev.trackEvent(name: "open-message-screen", properties: ["id": "foo-bar-1337"])
```

### Screenshots
<img src="docs/screenshots/screenshot-sample-identifying-the-user.png" width="250" />
<br />
<img src="docs/screenshots/screenshot-sample-identified-user.png" width="250" />
Expand All @@ -120,10 +162,9 @@ Before you start using the sample app you will need to configure it to be used w
- Select the appropriate target (2),
- Go to the Signing & Capabilities section (3), and
- Select your development team under Team (4).
<img src="docs/screenshots/screenshot-sample-signing.png" />
<img src="docs/screenshots/screenshot-xcode-signing.png" width="400" />

# Troubleshooting

## Cannot import the SDK into my app
Check the [Setup](#setup) again and make sure that DevRevSDK is properly linked.

Expand Down
6 changes: 3 additions & 3 deletions Samples/SampleSwiftUI/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ struct ContentView: View {
@State private var userID: String = ""

#error("The sample app needs a development team set for code signing.")
#error("Enter your credentials and organization slug here!")
#error("Enter your credentials and support ID here!")
private let appID = "<APPID>"
private let secret = "<SECRET>"
private let organizationSlug = "<SLUG>"
private let supportID = "<SUPPORT_ID>"

init() {
DevRev.configure(appID: appID,
secret: secret,
organizationSlug: organizationSlug)
supportID: supportID)
}

var body: some View {
Expand Down
6 changes: 3 additions & 3 deletions Samples/SampleUIKit/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import DevRevSDK
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
#error("The sample app needs a development team set for code signing.")
#error("Enter your credentials and organization slug here!")
#error("Enter your credentials and support ID here!")
private let appID = "<APPID>"
private let secret = "<SECRET>"
private let organizationSlug = "<SLUG>"
private let supportID = "<SUPPORT_ID>"

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
DevRev.configure(appID: appID,
secret: secret,
organizationSlug: organizationSlug)
supportID: supportID)

return true
}
Expand Down
9 changes: 9 additions & 0 deletions docs/css/chunk-384ef189.7ede1ea3.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions docs/css/documentation-topic.29351f99.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/css/documentation-topic~topic.fccbd76c.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/css/index.d5b499b0.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/css/topic.726a35dc.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/css/tutorials-overview.2a582c39.css

Large diffs are not rendered by default.

Loading

0 comments on commit 799e214

Please sign in to comment.