Skip to content

Commit a049ffd

Browse files
committed
Release 0.9.0
1 parent 4a1ec90 commit a049ffd

File tree

128 files changed

+2088
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2088
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Added
2+
- Initial release of the DevRev SDK.
3+
- Added the PLuG support chat feature.
4+
- Added user identification.
5+
6+
For installation instructions, consult the [documentation](README.md).

DevRevSDK.xcframework.zip

7.06 MB
Binary file not shown.

LICENSE

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
============================================================
2+
3+
This product includes the 'Swift-JWT' package (https://github.com/Kitura/Swift-JWT) released under the following license:
4+
Apache License, Version 2.0 <https://opensource.org/licenses/Apache-2.0>
5+
6+
============================================================
7+
8+
9+
All other components of this product are provided under the following license:
10+
11+
12+
Apache License
13+
Version 2.0, January 2004
14+
http://www.apache.org/licenses/
15+
16+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
17+
18+
1. Definitions.
19+
20+
"License" shall mean the terms and conditions for use, reproduction,
21+
and distribution as defined by Sections 1 through 9 of this document.
22+
23+
"Licensor" shall mean the copyright owner or entity authorized by
24+
the copyright owner that is granting the License.
25+
26+
"Legal Entity" shall mean the union of the acting entity and all
27+
other entities that control, are controlled by, or are under common
28+
control with that entity. For the purposes of this definition,
29+
"control" means (i) the power, direct or indirect, to cause the
30+
direction or management of such entity, whether by contract or
31+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
32+
outstanding shares, or (iii) beneficial ownership of such entity.
33+
34+
"You" (or "Your") shall mean an individual or Legal Entity
35+
exercising permissions granted by this License.
36+
37+
"Source" form shall mean the preferred form for making modifications,
38+
including but not limited to software source code, documentation
39+
source, and configuration files.
40+
41+
"Object" form shall mean any form resulting from mechanical
42+
transformation or translation of a Source form, including but
43+
not limited to compiled object code, generated documentation,
44+
and conversions to other media types.
45+
46+
"Work" shall mean the work of authorship, whether in Source or
47+
Object form, made available under the License, as indicated by a
48+
copyright notice that is included in or attached to the work
49+
(an example is provided in the Appendix below).
50+
51+
"Derivative Works" shall mean any work, whether in Source or Object
52+
form, that is based on (or derived from) the Work and for which the
53+
editorial revisions, annotations, elaborations, or other modifications
54+
represent, as a whole, an original work of authorship. For the purposes
55+
of this License, Derivative Works shall not include works that remain
56+
separable from, or merely link (or bind by name) to the interfaces of,
57+
the Work and Derivative Works thereof.
58+
59+
"Contribution" shall mean any work of authorship, including
60+
the original version of the Work and any modifications or additions
61+
to that Work or Derivative Works thereof, that is intentionally
62+
submitted to Licensor for inclusion in the Work by the copyright owner
63+
or by an individual or Legal Entity authorized to submit on behalf of
64+
the copyright owner. For the purposes of this definition, "submitted"
65+
means any form of electronic, verbal, or written communication sent
66+
to the Licensor or its representatives, including but not limited to
67+
communication on electronic mailing lists, source code control systems,
68+
and issue tracking systems that are managed by, or on behalf of, the
69+
Licensor for the purpose of discussing and improving the Work, but
70+
excluding communication that is conspicuously marked or otherwise
71+
designated in writing by the copyright owner as "Not a Contribution."
72+
73+
"Contributor" shall mean Licensor and any individual or Legal Entity
74+
on behalf of whom a Contribution has been received by Licensor and
75+
subsequently incorporated within the Work.
76+
77+
2. Grant of Copyright License. Subject to the terms and conditions of
78+
this License, each Contributor hereby grants to You a perpetual,
79+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80+
copyright license to reproduce, prepare Derivative Works of,
81+
publicly display, publicly perform, sublicense, and distribute the
82+
Work and such Derivative Works in Source or Object form.
83+
84+
3. Grant of Patent License. Subject to the terms and conditions of
85+
this License, each Contributor hereby grants to You a perpetual,
86+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
87+
(except as stated in this section) patent license to make, have made,
88+
use, offer to sell, sell, import, and otherwise transfer the Work,
89+
where such license applies only to those patent claims licensable
90+
by such Contributor that are necessarily infringed by their
91+
Contribution(s) alone or by combination of their Contribution(s)
92+
with the Work to which such Contribution(s) was submitted. If You
93+
institute patent litigation against any entity (including a
94+
cross-claim or counterclaim in a lawsuit) alleging that the Work
95+
or a Contribution incorporated within the Work constitutes direct
96+
or contributory patent infringement, then any patent licenses
97+
granted to You under this License for that Work shall terminate
98+
as of the date such litigation is filed.
99+
100+
4. Redistribution. You may reproduce and distribute copies of the
101+
Work or Derivative Works thereof in any medium, with or without
102+
modifications, and in Source or Object form, provided that You
103+
meet the following conditions:
104+
105+
(a) You must give any other recipients of the Work or
106+
Derivative Works a copy of this License; and
107+
108+
(b) You must cause any modified files to carry prominent notices
109+
stating that You changed the files; and
110+
111+
(c) You must retain, in the Source form of any Derivative Works
112+
that You distribute, all copyright, patent, trademark, and
113+
attribution notices from the Source form of the Work,
114+
excluding those notices that do not pertain to any part of
115+
the Derivative Works; and
116+
117+
(d) If the Work includes a "NOTICE" text file as part of its
118+
distribution, then any Derivative Works that You distribute must
119+
include a readable copy of the attribution notices contained
120+
within such NOTICE file, excluding those notices that do not
121+
pertain to any part of the Derivative Works, in at least one
122+
of the following places: within a NOTICE text file distributed
123+
as part of the Derivative Works; within the Source form or
124+
documentation, if provided along with the Derivative Works; or,
125+
within a display generated by the Derivative Works, if and
126+
wherever such third-party notices normally appear. The contents
127+
of the NOTICE file are for informational purposes only and
128+
do not modify the License. You may add Your own attribution
129+
notices within Derivative Works that You distribute, alongside
130+
or as an addendum to the NOTICE text from the Work, provided
131+
that such additional attribution notices cannot be construed
132+
as modifying the License.
133+
134+
You may add Your own copyright statement to Your modifications and
135+
may provide additional or different license terms and conditions
136+
for use, reproduction, or distribution of Your modifications, or
137+
for any such Derivative Works as a whole, provided Your use,
138+
reproduction, and distribution of the Work otherwise complies with
139+
the conditions stated in this License.
140+
141+
5. Submission of Contributions. Unless You explicitly state otherwise,
142+
any Contribution intentionally submitted for inclusion in the Work
143+
by You to the Licensor shall be under the terms and conditions of
144+
this License, without any additional terms or conditions.
145+
Notwithstanding the above, nothing herein shall supersede or modify
146+
the terms of any separate license agreement you may have executed
147+
with Licensor regarding such Contributions.
148+
149+
6. Trademarks. This License does not grant permission to use the trade
150+
names, trademarks, service marks, or product names of the Licensor,
151+
except as required for reasonable and customary use in describing the
152+
origin of the Work and reproducing the content of the NOTICE file.
153+
154+
7. Disclaimer of Warranty. Unless required by applicable law or
155+
agreed to in writing, Licensor provides the Work (and each
156+
Contributor provides its Contributions) on an "AS IS" BASIS,
157+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
158+
implied, including, without limitation, any warranties or conditions
159+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
160+
PARTICULAR PURPOSE. You are solely responsible for determining the
161+
appropriateness of using or redistributing the Work and assume any
162+
risks associated with Your exercise of permissions under this License.
163+
164+
8. Limitation of Liability. In no event and under no legal theory,
165+
whether in tort (including negligence), contract, or otherwise,
166+
unless required by applicable law (such as deliberate and grossly
167+
negligent acts) or agreed to in writing, shall any Contributor be
168+
liable to You for damages, including any direct, indirect, special,
169+
incidental, or consequential damages of any character arising as a
170+
result of this License or out of the use or inability to use the
171+
Work (including but not limited to damages for loss of goodwill,
172+
work stoppage, computer failure or malfunction, or any and all
173+
other commercial damages or losses), even if such Contributor
174+
has been advised of the possibility of such damages.
175+
176+
9. Accepting Warranty or Additional Liability. While redistributing
177+
the Work or Derivative Works thereof, You may choose to offer,
178+
and charge a fee for, acceptance of support, warranty, indemnity,
179+
or other liability obligations and/or rights consistent with this
180+
License. However, in accepting such obligations, You may act only
181+
on Your own behalf and on Your sole responsibility, not on behalf
182+
of any other Contributor, and only if You agree to indemnify,
183+
defend, and hold each Contributor harmless for any liability
184+
incurred by, or claims asserted against, such Contributor by reason
185+
of your accepting any such warranty or additional liability.
186+
187+
END OF TERMS AND CONDITIONS
188+
189+
APPENDIX: How to apply the Apache License to your work.
190+
191+
To apply the Apache License to your work, attach the following
192+
boilerplate notice, with the fields enclosed by brackets "[]"
193+
replaced with your own identifying information. (Don't include
194+
the brackets!) The text should be enclosed in the appropriate
195+
comment syntax for the file format. We also recommend that a
196+
file or class name and description of purpose be included on the
197+
same "printed page" as the copyright notice for easier
198+
identification within third-party archives.
199+
200+
Copyright [yyyy] [name of copyright owner]
201+
202+
Licensed under the Apache License, Version 2.0 (the "License");
203+
you may not use this file except in compliance with the License.
204+
You may obtain a copy of the License at
205+
206+
http://www.apache.org/licenses/LICENSE-2.0
207+
208+
Unless required by applicable law or agreed to in writing, software
209+
distributed under the License is distributed on an "AS IS" BASIS,
210+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
211+
See the License for the specific language governing permissions and
212+
limitations under the License.

Package.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// swift-tools-version:5.7
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "DevRevSDK",
7+
platforms: [
8+
.iOS(.v15)
9+
],
10+
products: [
11+
.library(
12+
name: "DevRevSDK",
13+
targets: [
14+
"DevRevSDK",
15+
]
16+
),
17+
],
18+
targets: [
19+
.binaryTarget(
20+
name: "DevRevSDK",
21+
url: "https://github.com/devrev/devrev-sdk-ios/releases/download/v0.9.0/DevRevSDK.xcframework.zip",
22+
checksum: "45e0a67c85b50d59cf1d84441f2c7d9e0bfc00ee46cd5620747191b027b392e9"
23+
)
24+
]
25+
)

README.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Table of contents
2+
- [Table of contents](#table-of-contents)
3+
- [Requirements](#requirements)
4+
- [Setup](#setup)
5+
- [Setting up the DevRev SDK](#setting-up-the-devrev-sdk)
6+
- [Step 1: Credentials](#step-1-credentials)
7+
- [Step 2: Initialization](#step-2-initialization)
8+
- [UIKit apps](#uikit-apps)
9+
- [SwiftUI apps](#swiftui-apps)
10+
- [Features](#features)
11+
- [Identification](#identification)
12+
- [PLuG support chat](#plug-support-chat)
13+
- [UIKit](#uikit)
14+
- [SwiftUI](#swiftui)
15+
- [Example](#example)
16+
- [Sample app](#sample-app)
17+
- [Troubleshooting](#troubleshooting)
18+
- [Cannot import the SDK into my app](#cannot-import-the-sdk-into-my-app)
19+
- [How does the DevRev SDK handle errors?](#how-does-the-devrev-sdk-handle-errors)
20+
- [Why won't the support chat show?](#why-wont-the-support-chat-show)
21+
22+
# Requirements
23+
- Latest stable Xcode from the [App Store](https://apps.apple.com/us/app/xcode/id497799835?mt=12), 14.0 or later.
24+
- Swift 5.7 or later.
25+
- Minimum deployment target iOS 15.
26+
27+
# Setup
28+
29+
You can integrate the DevRev SDK in your project as a Swift Package Manager (SPM) package.
30+
31+
Open your project in Xcode, go to the `Add Package` screen, add the following URL under `Enter Package URL`:
32+
```
33+
https://github.com/devrev/devrev-sdk-ios
34+
```
35+
36+
Make sure you link the framework under the **Build Phases** screen of your app target. Find the **Link Binary With Libraries** phase and make sure that **DevRevSDK** is linked there.
37+
38+
Now you should be able to import and use the DevRev SDK.
39+
40+
# Setting up the DevRev SDK
41+
## Step 1: Credentials
42+
Open the **Support** settings page, then go to **PLuG Setup**.
43+
44+
<img src="docs/screenshots/screenshot-support-settings.png" width="250" />
45+
46+
On the **PLuG Setup** page, you will be able to create your SDK credentials (app ID and secret).
47+
48+
<img src="docs/screenshots/screenshot-creating-credentials.png" width="400" />
49+
50+
51+
## Step 2: Initialization
52+
53+
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:
54+
55+
```swift
56+
DevRev.configure(appID: appID, secret: secret, organizationSlug: organizationSlug)
57+
```
58+
59+
### UIKit apps
60+
61+
Configure the SDK in the `AppDelegate.application(_:didFinishLaunchingWithOptions:)` method.
62+
63+
### SwiftUI apps
64+
65+
Depending on the architecture of your app, you will need to configure the SDK at your entry point or initial view of the app.
66+
67+
# Features
68+
69+
## Identification
70+
Certain features of the SDK **require** a user identification. Make sure that you identify the user using the `DevRev.identify(...)` function.
71+
72+
The function accepts the `DevRev.Identification` structure, with the user ID (`userID`) as the only required property, all other properties are optional.
73+
74+
The call would look something like this:
75+
```swift
76+
await DevRev.identify(Identification(userID: "[email protected]"))
77+
```
78+
79+
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.
80+
81+
## PLuG support chat
82+
83+
### UIKit
84+
85+
The support chat feature can be shown as a modal screen or pushed to a navigation stack.
86+
87+
The following overloaded method will show the support screen:
88+
```swift
89+
DevRev.showSupport(from:isAnimated:)
90+
```
91+
92+
1. If a `UIViewController` is passed as the `from` parameter, then the screen will be shown **modally**.
93+
1. If a `UINavigationController` is passed as the `from` parameter, then the screen will be pushed onto the stack.
94+
95+
### SwiftUI
96+
97+
For SwiftUI apps we provide a specific view, you just need to use the public view property:
98+
99+
```swift
100+
DevRev.supportView
101+
```
102+
103+
### Example
104+
105+
<img src="docs/screenshots/screenshot-sample-identifying-the-user.png" width="250" />
106+
<br />
107+
<img src="docs/screenshots/screenshot-sample-identified-user.png" width="250" />
108+
<br />
109+
<img src="docs/screenshots/screenshot-sample-support-view.png" width="250" />
110+
111+
# Sample app
112+
A sample app with use cases for both UIKit and SwiftUI has been provided as part of this repository.
113+
114+
Before you start using the sample app you will need to configure it to be used with your Apple Developer team and your DevRev credentials. For your convenience the code has been marked with compiler error directives (`#error`) at the places that need attention.
115+
116+
1. Add your credentials to `ContentView.swift` (SwiftUI) or `AppDelegate.swift` (UIKit).
117+
- After you have added the credentials, delete or comment out the compiler error lines in the respective files.
118+
1. Configure the code signing for the sample target:
119+
- Open the project settings (1),
120+
- Select the appropriate target (2),
121+
- Go to the Signing & Capabilities section (3), and
122+
- Select your development team under Team (4).
123+
<img src="docs/screenshots/screenshot-sample-signing.png" />
124+
125+
# Troubleshooting
126+
127+
## Cannot import the SDK into my app
128+
Check the [Setup](#setup) again and make sure that DevRevSDK is properly linked.
129+
130+
## How does the DevRev SDK handle errors?
131+
The DevRev SDK outputs all errors in the console using Apple's Unified Logging System under the subsystem `ai.devrev.sdk`.
132+
133+
## Why won't the support chat show?
134+
Make sure you have called the identification method (`DevRev.identify(...)`) properly.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
41.2 KB
Loading

0 commit comments

Comments
 (0)