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
.background { | |
UnevenRoundedRectangle(topLeadingRadius: 12, bottomTrailingRadius: 12) | |
} |
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
const functions = require("firebase-functions"); | |
const admin = require("firebase-admin"); | |
admin.initializeApp(); | |
exports.v2 = functions.https.onRequest(async (req, res) => { | |
// Ensure the request method is POST | |
if (req.method !== "POST") { | |
return res.status(400).send("Only POST requests are accepted"); | |
} |
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
const jwt = require("jsonwebtoken"); | |
const fs = require("fs"); | |
const axios = require("axios"); | |
const privateKey = fs.readFileSync("./AuthKey.p8"); | |
// Production URL : https://api.storekit.itunes.apple.com/inApps/v1/transactions/{transactionId} | |
// Sandbox URL : https://api.storekit-sandbox.itunes.apple.com/inApps/v1/transactions/{transactionId} | |
async function getTransaction(token, ID) { | |
try { |
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
import Foundation | |
import UserMessagingPlatform | |
import UIKit | |
protocol GDPRServiceProtocol { | |
var consentStatus: UMPConsentStatus { get } | |
func loadForm(from root: UIViewController) async throws -> UMPConsentStatus | |
} | |
final class GDPRService: GDPRServiceProtocol { |
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
import Foundation | |
import SwiftUI | |
class DialogPresenter: NSObject, UIViewControllerTransitioningDelegate { | |
private var transitionStyle: PopupDialogTransitionStyle = .zoomIn | |
private var popupContentViewController: UIViewController = UIViewController() | |
private var overlayController: PresentationController? | |
override init() { |
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
Copy code | |
import java.security.SecureRandom | |
import javax.crypto.Cipher | |
import javax.crypto.KeyGenerator | |
import javax.crypto.SecretKey | |
import javax.crypto.spec.IvParameterSpec | |
fun encrypt(plainText: String, key: SecretKey): Pair<ByteArray, ByteArray> { | |
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding") | |
val iv = ByteArray(16) |
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
// Retrofit API interface | |
interface MyApiService { | |
// Example API endpoint that requires an access token | |
@GET("example_endpoint") | |
suspend fun getExampleData(@Header("Authorization") authToken: String): Response<ExampleData> | |
} | |
// Retrofit API client | |
class MyApiClient(private val sharedPreferences: SharedPreferences) { | |
private val apiService = Retrofit.Builder() |
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
const functions = require("firebase-functions"); | |
const admin = require("firebase-admin"); | |
admin.initializeApp(); | |
exports.sendPushMessages = functions.pubsub | |
.schedule("every 1 hours") | |
.onRun(async (context) => { | |
// Retrieve all users from Firestore collection | |
const usersRef = admin.firestore().collection("users"); | |
const usersSnapshot = await usersRef.get(); |
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
// Taken from Apple's App Dev Training: https://developer.apple.com/tutorials/app-dev-training/ | |
/// This color is either black or white, whichever is more accessible when viewed against the scrum color. | |
var accessibleFontColor: Color { | |
var red: CGFloat = 0 | |
var green: CGFloat = 0 | |
var blue: CGFloat = 0 | |
UIColor(self).getRed(&red, green: &green, blue: &blue, alpha: nil) | |
return isLightColor(red: red, green: green, blue: blue) ? .black : .white | |
} |
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
import Foundation | |
import Combine | |
let publisher = [1, 2, 3, 4, 5, 6, 7].publisher | |
publisher | |
.allSatisfy { | |
// evaluate values | |
$0 % 2 == 0 //2, 4, 6 | |
} |
NewerOlder