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
library identifier: 'jenkins-shared@master', retriever: modernSCM( | |
[$class: 'GitSCMSource', | |
remote: 'https://github.com/MobodidTech/jenkins-shared.git', | |
]) |
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
def sendTelegram(message) { | |
def encodedMessage = URLEncoder.encode(message, "UTF-8") | |
withCredentials([string(credentialsId: 'telegramToken', variable: 'TOKEN'), | |
string(credentialsId: 'telegramChatId', variable: 'CHAT_ID')]) { | |
response = httpRequest (consoleLogResponseBody: true, | |
contentType: 'APPLICATION_JSON', | |
httpMode: 'GET', | |
url: "https://api.telegram.org/bot$TOKEN/sendMessage?text=$encodedMessage&chat_id=$CHAT_ID&disable_web_page_preview=true", |
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
FROM ubuntu:latest | |
# Install OS prerequisites | |
RUN apt-get update -qq | |
RUN apt-get install -y openjdk-8-jdk \ | |
wget \ | |
expect \ | |
zip \ | |
unzip |
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
pipeline { | |
agent { | |
docker { | |
image 'android-agent' | |
} | |
} | |
} |
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
open class Event<out T>(private val content: T) { | |
var hasBeenHandled = false | |
private set // Allow external read but not write | |
/** | |
* Returns the content and prevents its use again. | |
*/ | |
fun getContentIfNotHandledOrReturnNull(): T? { | |
return if (hasBeenHandled) { |
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
class MyViewModel() : ViewModel(){ | |
val networkError = MutableLiveData<String>() | |
} | |
//inside activity | |
viewModel.networkError.observe(this, Observer { | |
showToast(it) | |
}) |
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
include ':app' | |
def progressButton = '../../Android-Lib/ProgressButton' | |
if (file(progressButton).exists()) { | |
includeBuild(progressButton) { | |
dependencySubstitution { | |
substitute module('com.alirezaahmadi:progress-button') with project(':app') | |
} | |
} |
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
class LogicHandlingClass { | |
fun doThis(){ | |
//does something amazing! | |
} | |
} | |
class UserClass { | |
val logicHandlingClass = LogicHandlingClass() | |
val myClass = MyClass(logicHandlingClass::doThis) |
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
class MyClass(val doThis: () -> Unit, val doThat: (number: Int) -> Unit = {}) { | |
fun someFunction(){ | |
doThis() | |
doThat(12) | |
} | |
} | |
class UserClass { | |
val myClass = MyClass(::doThis, ::doThat) |
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
class MyClass(val listener: Listener) { | |
interface Listener { | |
fun doThis() | |
fun doThat(number: Int) | |
} | |
fun someFunction(){ | |
listener.doThis() | |
listener.doThat(12) |
NewerOlder