This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun keyboardAsState(): State<KeyboardState> { | |
val keyboardState = remember { mutableStateOf(KeyboardState.Closed) } | |
val view = LocalView.current | |
val viewTreeObserver = view.viewTreeObserver | |
DisposableEffect(viewTreeObserver) { | |
val onGlobalListener = ViewTreeObserver.OnGlobalLayoutListener { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Используем кастомный OIDExternalUserAgentIOSSafariViewController вместо OIDExternalUserAgentIOS | |
// | |
// OIDExternalUserAgentIOS использует отдельную сессию ASWebAuthenticationSession, | |
// которая затем не шарит куки с другими SafariViewController | |
// | |
// OIDExternalUserAgentIOSSafariViewController использует общую сессию с SafariViewController, | |
// что позволяет затем открывать страницы в SafariViewController без авторизации | |
// | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//сообщение | |
@SerializedName("id") | |
val id: Int, | |
@SerializedName("text") | |
val text: String, | |
@SerializedName("user") | |
val user: UserModel, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@POST("file.upload/") | |
@Multipart | |
fun uploadMedia(@Part file: MultipartBody.Part): Observable<FileModel> | |
@GET("message.get/") | |
fun getMessages(@Query("chat_id") chatId: Int, | |
@Query("limit") limit: Int, | |
@Query("from") from: Int?, | |
@Query("direction") direction: Int): Observable<MessageWrapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void addTests(ClassLoader loader, TestSuite suite) { | |
try { | |
Class[] classes = getClasses("ru.mail.mailbox.cmd.server", loader); | |
System.out.println("class size " + classes.length); | |
for(Class clazz : classes) { | |
for(Method method : clazz.getDeclaredMethods()) { | |
for(Annotation annotation : method.getAnnotations()) { | |
if(annotation instanceof MockMethod) { | |
// suite.addTest(TestSuite.createTest(clazz, method.getName())); | |
System.out.println("add method " + method.getName() + " for class " + clazz.getName()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//чтобы можно было посылать POST к Django через ajax | |
function setupAjaxDjango(){ | |
// using jQuery | |
function getCookie(name) { | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = jQuery.trim(cookies[i]); | |
// Does this cookie string begin with the name we want? |