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 OrderCancellationComponent(private val context: Context, | |
| private val api: Api, | |
| private val orderNumber: String) { | |
| interface Callbacks { | |
| fun onOrderCancelledSuccessfully() | |
| fun onOrderCancellationFailed() | |
| } | |
| var callbacks: Callbacks? = null // Callbacks for communication with the parent component |
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
| //Utils - Declaration | |
| object PromptUtils { | |
| fun alertDialog(context: Context, @StyleRes style: Int, dialogBuilder: AlertDialog.Builder.() -> Unit): Dialog { | |
| val builder = AlertDialog.Builder(context, style).also { | |
| it.setCancelable(false) | |
| it.dialogBuilder() | |
| } | |
| return builder.create() | |
| } |
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
| /** | |
| * Authenticator that attempts to refresh the client's access token. | |
| * In the event that a refresh fails and a new token can't be issued an error | |
| * is delivered to the caller. This authenticator blocks all requests while a token | |
| * refresh is being performed. In-flight requests that fail with a 401 are | |
| * automatically retried. | |
| */ | |
| class AccessTokenAuthenticator( | |
| private val tokenProvider: AccessTokenProvider | |
| ) : Authenticator { |
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
| android { | |
| signingConfigs { | |
| getByName("debug") { | |
| keyAlias = "debug" | |
| keyPassword = "my debug key password" | |
| storeFile = file("/home/miles/keystore.jks") | |
| storePassword = "my keystore password" | |
| } | |
| create("release") { | |
| keyAlias = "release" |
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
| import android.app.Activity | |
| import android.content.Intent | |
| import android.content.IntentSender | |
| import android.os.Bundle | |
| import android.widget.Toast | |
| import androidx.appcompat.app.AppCompatActivity | |
| import androidx.core.content.ContextCompat | |
| import com.google.android.material.snackbar.Snackbar | |
| import com.google.android.play.core.appupdate.AppUpdateManager | |
| import com.google.android.play.core.appupdate.AppUpdateManagerFactory |
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
| /* | |
| You need to call the below method once. It register the callback and fire it when there is a change in network state. | |
| Here I used a Global Static Variable, So I can use it to access the network state in anyware of the application. | |
| */ | |
| // You need to pass the context when creating the class | |
| public CheckNetwork(Context context) { | |
| this.context = context; | |
| } |
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
| /** | |
| * Get reference to the connectivity manager | |
| */ | |
| ConnectivityManager connectivityManager = | |
| (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
| /** | |
| * Find out whether device is connected to wifi or cellular at the moment | |
| */ | |
| public NetworkType getNetworkType() { |
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 MyReachability { | |
| private fun hasNetworkAvailable(context: Context): Boolean { | |
| val service = Context.CONNECTIVITY_SERVICE | |
| val manager = context.getSystemService(service) as ConnectivityManager? | |
| val network = manager?.activeNetworkInfo | |
| Log.d(classTag, "hasNetworkAvailable: ${(network != null)}") | |
| return (network?.isConnected) ?: false | |
| } |
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
| [ | |
| { | |
| "program_name": "(ISC)²", | |
| "policy_url": "https://bugcrowd.com/isc2", | |
| "submission_url": "https://bugcrowd.com/isc2/report", | |
| "launch_date": "", | |
| "bug_bounty": false, | |
| "swag": false, | |
| "hall_of_fame": true, | |
| "safe_harbor": "partial" |