Skip to content

Instantly share code, notes, and snippets.

View yccheok's full-sized avatar

Yan Cheng Cheok yccheok

View GitHub Profile
class GradientView: UIView {
override class var layerClass: AnyClass { CAGradientLayer.self }
override init(frame: CGRect) {
super.init(frame: frame)
isOpaque = false
if let gradient = self.layer as? CAGradientLayer {
gradient.startPoint = .init(x: 0.5, y: 0)
gradient.endPoint = .init(x: 0.5, y: 1)
//gradient.colors = [UIColor.red.cgColor, UIColor.black.cgColor]
class OnboardingViewControllerTemplate: UIViewController {
@IBOutlet weak var demoImageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidLayoutSubviews() {
class ShareViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Get the all encompasing object that holds whatever was shared. If not, dismiss view.
guard let extensionItem = extensionContext?.inputItems.first as? NSExtensionItem else {
self.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
return
}
(venv) yccheok@Yans-MacBook-Pro functions % export PUBSUB_PROJECT_ID="YYY";
export PUBSUB_EMULATOR_HOST="localhost:8085";
export GOOGLE_APPLICATION_CREDENTIALS="/Users/yccheok/yocto/ZZZ/firebase/functions/YYY.json";
firebase emulators:start
(node:4337) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
i emulators: Starting emulators: auth, functions, firestore, pubsub, storage
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project YYY. This may result in unexpected behavior.
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database, hosting, dataconnect
⚠ functions: Your GOOGLE_APPLICATION_CREDENTIALS environment variable points to /Users/yccheok/yocto/ZZZ/firebase/functions/YYY.json. Non-emulated services will access production using these credentials
static func generateDocId() -> String {
let db = Firestore.firestore()
// Any collection name will do. This function is not supposed to perform any read/write
// operations on Firestore.
return db.collection("sandbox").document().documentID
}
Currently, I have modified three functions to insert Qonversion-related code. Can you help me review whether I have done it correctly?
I have another concern. If, after trying, I am not satisfied with the outcome and decide not to purchase any plan from Qonversion, will the newly added Qonversion-related code affect my app’s performance in production?
Thank you.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
let config = Qonversion.Configuration(projectKey: "XXX", launchMode: .analytics)
import UIKit
class TodoInputAccessoryView: UIView {
@IBOutlet weak var textView: UITextView!
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
public static ScreenDensity getScreenDensity() {
try {
final String screenDensity = MyApplication.instance().getResources().getString(R.string.screen_density);
if ("ldpi".equals(screenDensity)) {
return ScreenDensity.ldpi;
} else if ("hdpi".equals(screenDensity)) {
return ScreenDensity.hdpi;
} else if ("xhdpi".equals(screenDensity)) {
return ScreenDensity.xhdpi;
} else if ("xxhdpi".equals(screenDensity)) {
/*
* Copyright (C) 2015 Paul Burke
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
package io.github.luizgrp.sectionedrecyclerviewadapter;
import static io.github.luizgrp.sectionedrecyclerviewadapter.Section.State;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;