Compare commits

...

9 Commits

8 changed files with 147 additions and 16 deletions

View File

@ -16,6 +16,8 @@ runtime of applications.
## How to use
__[Here](https://insanusmokrassar.github.io/KrontabPredictor) you may find the builder for `Krontab` templates creation.__
There are several ways to configure and use this library:
* From some string

View File

@ -7,15 +7,17 @@ As has been said in the [setup](setup.md) section, this library contains next le
| Weight (by order) | LogLevel name | JS | JVM Loggers | Android |
| -: |:-------------:|:-------------:|:-------------:|:-------:|
| 0 | DEBUG | console.log | Level.FINEST | Log.d |
| 1 | VERBOSE | console.info | Level.FINE | Log.v |
| 2 | INFO | console.info | Level.INFO | Log.i |
| 3 | WARNING | console.warn | Level.WARNING | Log.w |
| 4 | ERROR | console.error | Level.SEVERE | Log.e |
| 5 | ASSERT | console.error | Level.SEVERE | Log.wtf |
| 0 | TRACE | console.trace + console.debug | Level.FINEST | Log.d |
| 1 | DEBUG | console.debug | Level.FINER | Log.d |
| 2 | VERBOSE | console.info | Level.FINE | Log.v |
| 3 | INFO | console.info | Level.INFO | Log.i |
| 4 | WARNING | console.warn | Level.WARNING | Log.w |
| 5 | ERROR | console.error | Level.SEVERE | Log.e |
| 6 | ASSERT | console.error | Level.SEVERE | Log.wtf |
Each of these levels have fullname and shortname shortcat extensions:
* `KSLog.trace`/`KSLog.t`/`KSLog.tS`
* `KSLog.debug`/`KSLog.d`/`KSLog.dS`
* `KSLog.verbose`/`KSLog.v`/`KSLog.vS`
* `KSLog.info`/`KSLog.i`/`KSLog.iS`

View File

@ -1,5 +1,5 @@
# Setup
# Setup
## Dependency installation
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/kslog/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/kslog)
@ -48,12 +48,13 @@ KSLog(
Additionally you may use one of several different settings:
* `minLoggingLevel` - minimal logging level for the log which will be logged. The order of log level is next:
* DEBUG
* VERBOSE
* INFO
* WARNING
* ERROR
* ASSERT
* TRACE
* DEBUG
* VERBOSE
* INFO
* WARNING
* ERROR
* ASSERT
* `levels` - and iterable with the levels which should be logged
* `firstLevel`,`secondLevel`,`otherLevels` - as `levels`, but `vararg` :)
@ -150,4 +151,4 @@ KSLog(
"yourTag"
Logger.getLogger("YourJavaLoggerName")
)
```
```

View File

@ -0,0 +1,121 @@
# Getting started (TBD)
[![Maven Central](https://img.shields.io/maven-central/v/dev.inmo/navigation.core?label=navigation&style=flat-square)](https://github.com/InsanusMokrassar/navigation)
Traditionally, you need to add dependency to your project. Currently, there are two types of artifacts:
* `Core` - only necessary tools for your projects
* `MVVM` - Model-View-ViewModel architecture tools + `Core` components
| Artifact | Purpose | Dependency |
|:--------:|-------------------------------------------------------------|-----------------------------------------------------------------|
| `Core` | Only necessary tools for your projects | `implementation "dev.inmo:navigation.core:$navigation_version"` |
| `MVVM` | Model-View-ViewModel architecture tools + `Core` components | `implementation "dev.inmo:navigation.mvvm:$navigation_version"` |
# Get started
After you have added your dependency, you should initialize navigation. There are several important things:
1. `Config` - it is an instance of any class which extending the `NavigationNodeDefaultConfig` in common case
2. `Factory` - usually object which may create a node or some required part for node
For example: lets imagine that we have a node `Main`. Here what should we do to create a node and make it workable in
navigation:
```kotlin
data class MainConfig(
// this id will be used to search an html element by id in JS
// and Fragment by tag in Android
override val id: String = "main"
) : NavigationNodeDefaultConfig
```
Both `JS` and `Android` platforms require `ViewModel` for their `MVVM` node variants, but it can be common as well as
`MainConfig`:
```kotlin
class MainViewModel(
node: NavigationNode<MainConfig, NavigationNodeDefaultConfig>
) : ViewModel(
node
)
```
### JS part
```kotlin
// Core variant without MVVM or Compose
class MainNode(
config: MainConfig,
chain: NavigationChain<NavigationNodeDefaultConfig>,
) : JsNavigationNode<MainConfig, NavigationNodeDefaultConfig>(
chain,
config
) {
// Some code
// In htmlElementStateFlow will be found `HTMLElement` where node should be binded
}
// MVVM Compose variant
class MainNodeView(
config: MainConfig,
chain: NavigationChain<NavigationNodeDefaultConfig>,
) : View<MainConfig, MainViewModel>(
config,
chain
) {
// Some code
// In htmlElementStateFlow will be found `HTMLElement` where node should be binded
@Composable
override onDraw() {
Text("Hello world")
}
}
object MainNodeFactory : NavigationNodeFactory<NavigationNodeDefaultConfig> {
override fun createNode(
navigationChain: NavigationChain<Base>,
config: Base
): NavigationNode<out Base, Base>? = if (config is MainConfig) {
MainNode(config, chain) // Or `MainNodeView(config, chain)` for MVVM
} else {
null
}
}
```
---
Data below is under TBD
### Android
In Android there is one important note: you will not directly work with nodes. In fact it will be required to create
special `NodeFragment`:
```kotlin
// Core variant
class MainFragment : NodeFragment<MainConfig, NavigationNodeDefaultConfig>() {
// Your code
// Here will be available: node with type `AndroidFragmentNode`, config: `MainConfig`
}
// MVVM Variant
class MainViewFragment : ViewFragment<MainViewModel, MainConfig>() {
// Will be available also `viewModel` via koin `lazyInject`
override val viewModelClass
get() = MainViewModel::class
}
```
Initialization is different on the platforms, so, lets take a look at each one.
## JS
In `JavaScript` it looks like:
```kotlin
initNavigation(
)
```

View File

@ -1,5 +1,7 @@
# Navigation
**This library uses koin as preferred DI in MVVM part**
Navigation is a library for simple management for your app views (or some other logics). In this library there are several
important terms:

View File

@ -0,0 +1 @@
# Payments Guide

View File

@ -1,6 +1,6 @@
# TelegramBotAPI
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-6.8-blue)](https://core.telegram.org/bots/api-changelog#august-18-2023)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-6.9-blue)](https://core.telegram.org/bots/api-changelog#september-22-2023)
<!--- [![Telegram Channel](./resources/tg_channel_qr.jpg)](https://t.me/ktgbotapi) --->

View File

@ -33,6 +33,7 @@ nav:
- 'Krontab':
- 'krontab/index.md'
- KDocs: 'https://krontab.inmo.dev/'
- Predictor: 'https://insanusmokrassar.github.io/KrontabPredictor'
- Introduction:
- 'krontab/introduction/including-in-project.md'
- 'krontab/introduction/how-to-use.md'
@ -47,6 +48,7 @@ nav:
- 'kslog/logging.md'
- 'Navigation':
- 'navigation/index.md'
- 'navigation/getting-started.md'
use_directory_urls: false