This file contains hidden or 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
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| gemfile(true) do | |
| source "https://rubygems.org" | |
| git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
| gem "rails", "6.1.0" |
This file contains hidden or 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
| eventType:MouseDown code:0x0 name:left flags: misc:PointingButton::LEFT {712,120} 1 | |
| eventType:MouseUp code:0x0 name:left flags: misc:PointingButton::LEFT {712,120} 1 | |
| eventType:MouseDown code:0x0 name:left flags: misc:PointingButton::LEFT {754,129} 1 | |
| eventType:MouseUp code:0x0 name:left flags: misc:PointingButton::LEFT {754,129} 1 | |
| eventType:MouseDown code:0x0 name:left flags: misc:PointingButton::LEFT {754,129} 2 | |
| eventType:MouseUp code:0x0 name:left flags: misc:PointingButton::LEFT {754,129} 2 | |
| eventType:MouseDown code:0x0 name:left flags: misc:PointingButton::LEFT {754,129} 3 | |
| eventType:MouseUp |
This file contains hidden or 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
| # Dodawanie usera jako root | |
| sudo adduser --disabled-password --shell /bin/bash --home /home/USERNAME USERNAME | |
| sudo usermod -aG sudo USERNAME | |
| sudo passwd USERNAME |
This file contains hidden or 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
| object UUIDProvider { | |
| private const val NAME = "${BuildConfig.APPLICATION_ID}.LOCK_ID" | |
| private const val KEY_ID = "${BuildConfig.APPLICATION_ID}.KEY_ID" | |
| private var cacheId: String? = null | |
| fun provide(context: Context): String { | |
| if (cacheId != null) return cacheId!! |
This file contains hidden or 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
| object AppCache { | |
| var lockState: LockState? = null | |
| set(value) { | |
| if (value == null) return | |
| if (field == null || field!!.created_at.before(value.created_at)) { | |
| field = value | |
| } | |
| } |
This file contains hidden or 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 AppMessagingService : FirebaseMessagingService() { | |
| override fun onNewToken(token: String?) { | |
| val registrationId = token ?: return | |
| val userId = UUIDProvider.provide(this) // described later | |
| // request push registration | |
| } | |
| override fun onMessageReceived(remoteMessage: RemoteMessage) { |
This file contains hidden or 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
| <service | |
| android:name=".push.AppMessagingService"> | |
| <intent-filter> | |
| <action android:name="com.google.firebase.MESSAGING_EVENT"/> | |
| </intent-filter> | |
| </service> |
This file contains hidden or 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 ApiClient private constructor(context: Context) { | |
| val apiService = createApiService(context) | |
| private fun createApiService(context: Context): ApiService { | |
| return Retrofit.Builder() | |
| .baseUrl(context.getString(R.string.api_base_url)) | |
| .addConverterFactory(createConverterFactory()) | |
| .client(createHttpClient(context)) | |
| .build() |
This file contains hidden or 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 LockWidgetJobService : JobIntentService() { | |
| companion object { | |
| ... | |
| private val SUPPORTED_ACTIONS = listOf(ACTION_TOGGLE, ACTION_REFRESH) | |
| fun handleAction(context: Context, action: String?) { | |
| if (!canHandle(action)) return |
This file contains hidden or 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 LockWidgetProvider : AppWidgetProvider() { | |
| override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) { | |
| for (id in appWidgetIds) { | |
| appWidgetManager.updateAppWidget(id, createLockRemoteViews(context, AppCache.lockState)) | |
| } | |
| } | |
| override fun onReceive(context: Context, intent: Intent) { | |
| super.onReceive(context, intent) |
NewerOlder