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
#!/usr/bin/env bash | |
# NB: local trial script has to be self-contained | |
# See https://sipb.mit.edu/doc/safe-shell/ | |
set -euf -o pipefail | |
if [[ "$OSTYPE" == "linux-gnu" ]]; then | |
export MAYBE_SUDO="sudo" | |
else | |
export MAYBE_SUDO="" |
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
//MARK: - UserDefaults + Codable | |
extension UserDefaults { | |
func storeCodable<T: Codable>(_ object: T, key: String) { | |
do { | |
let data = try JSONEncoder().encode(object) | |
UserDefaults.standard.set(data, forKey: key) | |
} catch let error { | |
print("Error encoding: \(error)") | |
} | |
} |
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
//MARK: - UISwitch Extension | |
@available(iOS 14.0, *) | |
extension UISwitch { | |
func setOnValueChangeListener(onValueChanged :@escaping () -> Void){ | |
self.addAction(UIAction(){ action in | |
onValueChanged() | |
}, for: .valueChanged) | |
} | |
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
//MARK: - UITextField Extension | |
@available(iOS 14.0, *) | |
extension UITextField { | |
func setOnTextChangeListener(onTextChanged :@escaping () -> Void){ | |
self.addAction(UIAction(){ action in | |
onTextChanged() | |
}, for: .editingChanged) | |
} | |
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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.agrawalsuneet.unitysharingclient" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal"> | |
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" /> | |
<application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:isGame="true" android:banner="@drawable/app_banner"> | |
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="fullSensor" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false"> | |
<intent-filter> | |
<action andro |
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
using UnityEngine; | |
using UnityEngine.UI; | |
public class AcceptIncomingTextInUnity : MonoBehaviour | |
{ | |
public Button acceptIncomingTextBtn; | |
void Start() | |
{ | |
acceptIncomingTextBtn.onClick.AddListener(onAcceptImageClicked); | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.agrawalsuneet.unitysharingclient" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal"> | |
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" /> | |
<application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:isGame="true" android:banner="@drawable/app_banner"> | |
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="fullSensor" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false"> | |
<intent-filter> | |
<action andro |
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
using UnityEngine; | |
public class CastToJavaObject : MonoBehaviour | |
{ | |
//C# Code | |
public AndroidJavaObject castToJavaObject(AndroidJavaObject source, string className) | |
{ | |
var clazz = new AndroidJavaClass("java.lang.Class"); | |
var destClass = clazz.CallStatic<AndroidJavaObject>("forName", className); | |
return destClass.Call<AndroidJavaObject>("cast", source); |
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
// | |
// UIView+ClickListener.swift | |
// | |
// Created by Suneet Agrawal on 12/12/20. | |
// | |
import UIKit | |
// MARK: ClickListener | |
class ClickListener: UITapGestureRecognizer { |
NewerOlder