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 refreshAuthLogic = (failedRequest) => { | |
const refreshToken = (response) => { | |
actions.auth.signInAsync.success(response); | |
actions.userSetting.saveUserSettingAsync.request({ | |
session: { uid: response.uid, token: response.token }, | |
}); | |
failedRequest.response.config.headers.Authorization = | |
'Bearer ' + response.token; | |
}; |
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 {AsyncStorage} from 'react-native'; | |
export function setValue(key: string, value: any): Promise<void> { | |
return AsyncStorage.setItem(key, JSON.stringify(value)); | |
} | |
export function getValue<T>(key: string, defaultValue: T = null): Promise<T> { | |
return new Promise((resolve, reject) => { | |
AsyncStorage.getItem(key).then((value) => { | |
if (value !== null) { |
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 UIKit | |
public protocol ReusableView: class { | |
static var defaultReuseIdentifier: String { get } | |
} | |
extension ReusableView where Self: UIView { | |
public static var defaultReuseIdentifier: String { | |
return String(describing: self) | |
} |
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
/* | |
localizable-sheet-script | |
A Google Sheets script that will take a sheet in a specific format and return iOS and Android localization files. | |
https://github.com/cobeisfresh/localizable-sheet-script | |
Created by COBE http://cobeisfresh.com/ Copyright 2017 COBE | |
Customized by Ngoc LE | |
License: MIT | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULA |
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
extension String { | |
func localized(tableName: String = "Localizable") -> String { | |
return NSLocalizedString(self, tableName: tableName, value: "**\(self)**", comment: "") | |
} | |
} | |
protocol Localizable { | |
var tableName: String { get } | |
var localized: String { 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
checkVersion = function () { | |
var agent = window.navigator.userAgent, | |
start = agent.indexOf( ‘OS ‘ ); | |
if( ( agent.indexOf( ‘iPhone’ ) > -1 || agent.indexOf( ‘iPad’ ) > -1 ) && start > -1 ){ | |
return window.Number( agent.substr( start + 3, 3 ).replace( ‘_’, ’.’ ) ); | |
} | |
return 0; | |
} |