A Dart wrapper for tdlib. Contains generated schema classes of td_api.tl and a client that interacts with lib through ffi.
Actual version of tdlib: 1.8.4
d489014
- Obtain
api_id
andapi_hash
at https://my.telegram.org - Build tdlib for your operating system following the guide below.
- Open
example/lib/main.dart
and place obtainedapi_id
andapi_hash
to appropriate methodsgetApiId
andgetApiHash
. - Specify phone number and code in
getPhoneNumber
andgetCode
methods. Attention, the phone number must be specified from the test DC. If you don't want to use the test DC and want to authenticate with your account, changeuseTestDc
tofalse
inTdlibParameters
. - cd
<repo folder>/example
flutter run
The official repository contains instructions on how to build tdlib. https://github.com/tdlib/td#building
- git clone
[email protected]:tdlib/td.git
- git checkout
d489014
Instruction: tdlib/td#77 (comment)
- Download libtdjsonandroid.zip tdlib/td#77 (comment)
- Unpack the archive to td/example directory.
- Then download the latest OpenSSL 1.1.1 source code as a .tar.gz archive from OpenSSL 1.1.1 release page and place it in the third_party/crypto subfolder.
- Edit
example/third_party/crypto/build.sh
. Set your ANDROID_NDK path,export ANDROID_NDK=/Users/arseny30/Library/Android/sdk/ndk-bundle
replace by own path to ndk. - chmod +x
build.sh
andbuild-all.sh
inexample/third_party/crypto/
folder. - chmod +x
export.sh
inexample
- Setup ANDROID_NDK path in
example/build.sh
. Replace...=${ANDROID_SDK_ROOT}/ndk-bundle/...
by own path to ndk. - chmod +x
build.sh
andbuild-all.sh
inexample/
folder. - Fix cmake path in
CMakeLists.txt
, replaceset(TD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
byset(TD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
. - Run
example/third_party/crypto/build-all.sh
- Run
example/export.sh
- Copy
.so
files fromexample/libs
toexample/android/app/main/jniLibs
:
└── example
└── android
└── app
└── main
└── jniLibs
└── arm64-v8a
│ └── libtdjsonandroid.so
│ └── libtdjsonandroid.so.debug
└── armeabi-v7a
│ └── libtdjsonandroid.so
│ └── libtdjsonandroid.so.debug
└── x86
│ └── libtdjsonandroid.so
│ └── libtdjsonandroid.so.debug
└── x86_64
└── libtdjsonandroid.so
└── libtdjsonandroid.so.debug
- Open file
example/android/app/build.gradle
replace
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
by
sourceSets {
main {
java.srcDirs += 'src/main/kotlin'
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
Instruction: https://github.com/tdlib/td/tree/master/example/ios
- Remove watchOS and tvOS in
example/ios/build-openssl.sh
andexample/ios/build.sh
: replaceplatforms="macOS iOS watchOS tvOS"
byplatforms="macOS iOS"
. - Build following the guide.
- Copy
example/ios/tdjson/iOS/lib/libtdjson.dylib
toexample/ios
- Copy
example/ios/tdjson/macOS/lib/libtdjson.dylib
toexample/macos
└── example
└── ios
│ └── libtdjson.dylib
└── macos
└── libtdjson.dylib
- Open
Runner.xcworkspace
in Xcode. - Add
.dylib
file to project. - Find
Frameworks, Libraries, and EmbeddedContent
. - Against
libtdjson.dylib
chooseEmbed & Sign
. - Find
Signing & Capabilities
. - In Section
App Sandbox (Debug and Profile)
set trueOutgoing Connections (Client)
.
Instruction: https://tdlib.github.io/td/build.html
- Choose language
C++
- Choose operating system
Windows
- Build following the guide.
- Copy files from
/tdlib/bin
toexample/windows/tdlib
└── example
└── windows
└── tdlib
└── libcrypto-1_1.dll
└── libssl-1_1.dll
└── tdjson.dll
└── zlib1.dll
- Rename
libcrypto-1_1-(x64|x32).dll
tolibcrypto-1_1.dll
andlibssl-1_1-(x64|x32).dll
tolibssl-1_1.dll
- Open
example/windows/CMakeLists.txt
. - Add below line
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
:
# begin td
set(dll_path "${CMAKE_CURRENT_SOURCE_DIR}/tdlib")
set(libcrypto "libcrypto-1_1.dll")
set(libcrypto_path "${dll_path}/${libcrypto}")
install(CODE "file(REMOVE_RECURSE \"${INSTALL_BUNDLE_LIB_DIR}/${libcrypto}\")" COMPONENT Runtime)
install(FILES "${libcrypto_path}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime)
set(libssl "libssl-1_1.dll")
set(libssl_path "${dll_path}/${libssl}")
install(CODE "file(REMOVE_RECURSE \"${INSTALL_BUNDLE_LIB_DIR}/${libssl}\")" COMPONENT Runtime)
install(FILES "${libssl_path}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime)
set(tdjson "tdjson.dll")
set(tdjson_path "${dll_path}/${tdjson}")
install(CODE "file(REMOVE_RECURSE \"${INSTALL_BUNDLE_LIB_DIR}/${tdjson}\")" COMPONENT Runtime)
install(FILES "${tdjson_path}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime)
set(zlib "zlib1.dll")
set(zlib_path "${dll_path}/${zlib}")
install(CODE "file(REMOVE_RECURSE \"${INSTALL_BUNDLE_LIB_DIR}/${zlib}\")" COMPONENT Runtime)
install(FILES "${zlib_path}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime)
# end td
TBD
TBD