Skip to content

Commit

Permalink
Updated the sample apps to support 0.1.0 (#8)
Browse files Browse the repository at this point in the history
* Updated the sample apps to support 0.1.0

* set the entitlement token for ci

* updated the README
  • Loading branch information
rahul27 authored Dec 14, 2021
1 parent 6bc53c4 commit 1f4ea43
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 35 deletions.
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
steps:
- checkout

- run:
name: Set the token to download the sdk
command: sed -i 's/ADD_TOKEN_HERE/'"$CS_ANDROID_SDK_ENTITLEMENT_TOKEN"'/g' build.gradle.kts

- android/run-tests:
test-command: ./gradlew lint testDebug --continue

Expand Down
41 changes: 15 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,44 @@ This repository includes sample apps that demonstrate the use of the Moonsense S
## TLDR

- Clone this repository.
- Generate a [personal access token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) on Github with `read:packages` permissions.
- Add your Github `username` and `token` as a gradle property. The easiest way to do this is to add the following lines to `~/.gradle/gradle.properties`
- Replace the following lines in [build.gradle.kts](https://github.com/moonsense/moonsense-android-sdk/blob/main/build.gradle.kts) with the download token provided to you:
```gradle
gpr.user=<username goes here>
gpr.key=<token goes here>
maven {
val token = "ADD_TOKEN_HERE"
url = uri("https://dl.cloudsmith.io/$token/moonsense/sdk/maven/")
}
```
- Create a public token on the [Moonsense Console](https://console.moonsense.cloud/) for your application.
- Add the public token to the `sample-app` under `MainApplication.kt`.
- Run the `sample-app`.

## Version History

The latest release of the SDK is `0.1.0-alpha5`. Details about the current and past releases can be found below:
The latest release of the SDK is `0.1.0`. Details about the current and past releases can be found below:

- [0.1.0](https://github.com/moonsense/moonsense-android-sdk/releases/tag/0.1.0)
- [0.1.0-alpha5](https://github.com/moonsense/moonsense-android-sdk/releases/tag/0.1.0-alpha5)
- [0.1.0-alpha4](https://github.com/moonsense/moonsense-android-sdk/releases/tag/0.1.0-alpha4)
- [0.1.0-alpha3](https://github.com/moonsense/moonsense-android-sdk/releases/tag/0.1.0-alpha3)
- [0.1.0-alpha2](https://github.com/moonsense/moonsense-android-sdk/releases/tag/0.1.0-alpha2)

## Integration

The library has been hosted using [Github Packages](https://github.com/features/packages). If you are reading this you have access to the repo that hosts the SDK library binary. In order to reference the library you need to reference the github maven repository like so:
All that is needed to access the SDK is an entitlement token. This token is either provided to you or can be generated via the [Moonsense Console](https://console.moonsense.cloud/). Once you have the generated token, you can add it to your maven config in gradle like so:

```gradle
repositories {
maven {
url = uri("https://maven.pkg.github.com/moonsense/moonsense-android-sdk")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
}
}
repositories {
maven {
val token = "ADD_TOKEN_HERE"
url = uri("https://dl.cloudsmith.io/$token/moonsense/sdk/maven/")
}
}
```

Since the access to the maven repository is restricted you will need to include your `username` and [personal access token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to reference the SDK library. Details around generating a personal access token can be found [here](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)). Make sure you grant `read:packages` access to reference the library. Once you have the `username` and `token` add it to your gradle properties. The easiest way is to add the following lines to `~/.gradle/gradle.properties`:
With the repository set up, you can add the SDK dependency to your app or module using the following line:

```gradle
gpr.user=<username goes here>
gpr.key=<token goes here>
```

Alternatively you could add the `username` and `password` to your gradle config using [build environment variables](https://docs.gradle.org/current/userguide/build_environment.html).

With the credentials in place your are ready to include the following line to add the SDK dependency to your app or module:


```gradle
implementation("io.moonsense:android-sdk:0.1.0-alpha5")
implementation("io.moonsense:android-sdk:0.1.0")
```

## Usage
Expand Down
9 changes: 2 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ allprojects {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/moonsense/moonsense-android-sdk")
credentials {
username = project.findProperty("gpr.user") as String?
?: System.getenv("CI_GITHUB_USERNAME")
password = project.findProperty("gpr.key") as String?
?: System.getenv("CI_GITHUB_ACCESS_TOKEN")
}
val token = "ADD_TOKEN_HERE"
url = uri("https://dl.cloudsmith.io/$token/moonsense/sdk/maven/")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/AppConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ object AppConfig {
const val minSdkVersion = 16
const val targetSdkVersion = 31
const val versionCode = 1
const val versionName = "0.1.0-alpha5"
const val versionName = "0.1.0"
const val buildToolsVersion = "30.0.3"
const val androidTestInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
const val jvmTarget = "11"
Expand Down
2 changes: 1 addition & 1 deletion sample-payment-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ android {

buildTypes {
getByName("release") {
isMinifyEnabled = false
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand Down

0 comments on commit 1f4ea43

Please sign in to comment.