Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/up9cloud/flutter_libtdjson

A flutter plugin for TDLib JSON interface, ffi binding.
https://github.com/up9cloud/flutter_libtdjson

android ffi flutter flutter-plugin ios libtdjson macos tdjson tdlib telegram telegram-api

Last synced: about 9 hours ago
JSON representation

A flutter plugin for TDLib JSON interface, ffi binding.

Awesome Lists containing this project

README

        

# flutter_libtdjson

![Build Status](https://github.com/up9cloud/flutter_libtdjson/actions/workflows/main.yml/badge.svg)
[![Pub Version](https://img.shields.io/pub/v/libtdjson)](https://pub.dev/packages/libtdjson)
[![Pub Likes](https://img.shields.io/pub/likes/libtdjson)](https://pub.dev/packages/libtdjson/score)
[![Pub Points](https://img.shields.io/pub/points/libtdjson)](https://pub.dev/packages/libtdjson/score)
[![popularity](https://img.shields.io/pub/popularity/libtdjson)](https://pub.dev/packages/libtdjson/score)

A flutter plugin for [TDLib JSON interface](https://github.com/tdlib/td#using-from-other-programming-languages), ffi binding.

## Lib versions

| package | td version |
| ------- | ------------------------------------- |
| 0.2.1 | 1.8.31 (Android, iOS, macOS) |
| 0.2.0 | 1.8.30 (Android, iOS, macOS) |
| 0.1.4 | 1.8.1 (Android, iOS, macOS) |
| 0.1.3 | 1.7.9 (Android, iOS, macOS) |
| 0.1.2 | 1.7.0 (Android), latest (iOS, macOS) |

## Supported architectures

Make sure you are using supported one

| Platform | Architecture | |
| ---------------- | ------------ | --- |
| Android | armeabi-v7a | ✅ |
| | arm64-v8a | ✅ |
| Android emulator | x86 | ✅ |
| | x86_64 | ✅ |
| iOS | armv7 | ❌ |
| | armv7s | ❌ |
| | arm64 | ⛔ |
| iOS simulator | i386 | ❌ |
| | x86_64 | ⛔ |
| | arm64 (M1) | ⛔ |
| macOS | i386 | ❌ |
| | x86_64 | ✅ |
| | arm64 (M1) | ✅ |

## Installation

- Update `pubspec.yaml`:

```yml
dependencies:
libtdjson: ^0.2.1
```

- If you want to build android, you have to add envs for github maven, see `./android/build.gradle`

```bash
export GITHUB_ACTOR=
export GITHUB_TOKEN=
```

- If you want to set `tdlibParameters.database_directory` outside work dir, make sure you request the storage permission, e.q. `android/app/src/main/AndroidManifest.xml`

```xml




```

- If you want to build macos, have to set network permission in `./macos/Runner/*.entitlements` files

```xml

com.apple.security.network.client


```

## Dev memo

### Bump TDLib version

- Bump the td version of [android-libtdjson](https://github.com/up9cloud/android-libtdjson)
- Bump the android dependency version in `./android/build.gradle`
- Run `./example` for android

```bash
cd ./example
flutter run -d emulator-5554
```

- Bump the td version of [ios-libtdjson](https://github.com/up9cloud/ios-libtdjson)
- Bump the macos dependency version in `./macos/libtdjson.podspec` (s.dependency)
- Run `./example` for macos

```bash
cd ./example/macos
pod update flutter_libtdjson
cd ..
flutter run -d macos
```

- Bump the ios dependency version in `./ios/libtdjson.podspec`
- Run `./example` for ios simulator

```bash
cd ./example/ios
pod update flutter_libtdjson
cd ..
flutter run --debug
# link .dylib to search path, e.q:
# ln -s $(pwd)/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/flutter_libtdjson/libtdjson.dylib ~/Library/Developer/CoreSimulator/Devices/FD63D560-544B-4B18-8F2F-03B093156DE2/data/Containers/Bundle/Application/004B7B3D-4665-4217-A9C7-2D2193107E80/Runner.app/Frameworks/libtdjson.dylib
# Reload with `R`
```

- Bump the package version in `./pubspec.yaml`
- Add changelog for new version in `./CHANGELOG.md`
- Bump version info in `./README.md`
- Git commit (message example: `bump td to vx.x.x`)
- Git add tag (`git tag v?.?.?`, the tag version should be same as the version in pubspec.yaml)
- Push with tags (`git push && git push --tags`)
- Wait for CI task

### Manually publish

- https://dart.dev/tools/pub/publishing

```bash
dart pub publish

# credentials file on macos
cat ~/Library/Application\ Support/dart/pub-credentials.json
```

## TODO

- [ ] ⛔ is about `iOS with dylib`. There are .dylib files in build/ios/Debug-iphonesimulator/XCFrameworkIntermediates, but still...