Skip to content

Commit

Permalink
Merge pull request #22 from rees46/chore/java-to-kotlin-description
Browse files Browse the repository at this point in the history
Chore/java to kotlin description
  • Loading branch information
TorinAsakura authored Jun 12, 2024
2 parents 71e69a1 + 10e3b5c commit 97907b4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 23 deletions.
2 changes: 1 addition & 1 deletion source/includes/_init.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ end
// 4. Specify the git URL for SDK repo: <%= config[:ios_sdk_repo] %>
```

```java
```kotlin
// 1. Add to dependencies:
implementation 'com.<%= config[:android_sdk_package_code] %>:<%= config[:android_sdk_package_code] %>-sdk:+'
implementation 'com.google.firebase:firebase-bom:29.0.3'
Expand Down
29 changes: 21 additions & 8 deletions source/includes/_orders.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,31 @@ Returns a list of user's orders (ascending by date and internal ID). User is ide
//TODO
```

```java
// value in parameters can be String, int, double, boolean
public CustomOrderParameters set(@NonNull String name, @NonNull String value) {
```kotlin
// Example of setting custom order parameters
class CustomOrderParameters {
// Method to set parameters
fun set(name: String, value: Any): CustomOrderParameters {
// implementation here
return this
}
}

// Creating an instance of CustomOrderParameters and setting various types of parameters
val orderParams = CustomOrderParameters()

// for String
.set("tour_class", "lux")
orderParams.set("tour_class", "lux")

// for int
.set("rooms", 5)
orderParams.set("rooms", 5)

// for double
.set("change", 5.5)
orderParams.set("change", 5.5)

// for boolean
.set("booked", true)
}
orderParams.set("booked", true)

```

```jsx
Expand Down
27 changes: 16 additions & 11 deletions source/includes/_profile.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,22 @@ curl -d "shop_id=SHOPID&shop_secret=SHOP_SECRET&email=EMAIL&fieldname=FIELDVALUE
}
```

```java
HashMap<String, String> params = new HashMap<>();
params.put("email", "[email protected]");
<%= config[:android_sdk_package_name]%>.profile(params);
//With callback
<%= config[:android_sdk_package_name]%>.profile(params, new Api.OnApiCallbackListener() {
@Override
public void onSuccess(JSONObject response) {
Log.i(TAG, "Response: " + response.toString());
}
});
```kotlin
// Create a map of parameters
val params = hashMapOf(
"email" to "[email protected]"
)

// Use the SDK to update the profile
sdk.profile(params)

// With callback
sdk.profile(params, object : Api.OnApiCallbackListener {
override fun onSuccess(response: JSONObject) {
Log.i(TAG, "Response: ${response.toString()}")
}
})

```

```jsx
Expand Down
4 changes: 2 additions & 2 deletions source/includes/_utilities.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Methods and helpers for finetune tasks.
sdk->getCurrentSegment()
```

```java
<%= config[:android_sdk_package_name]%>.getSegment()
```kotlin
sdk.getSegment()
```

```jsx
Expand Down
2 changes: 1 addition & 1 deletion source/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ language_tabs:
- shell: cURL
- javascript: JavaScript
- swift: iOS
- java: Android
- kotlin: Android
- jsx: React Native

includes:
Expand Down

0 comments on commit 97907b4

Please sign in to comment.