Rocket.Chat.ReactNative/app/lib/methods/userPreferences.ts

60 lines
1.2 KiB
TypeScript
Raw Normal View History

Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
import MMKVStorage, { create } from 'react-native-mmkv-storage';
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
const MMKV = new MMKVStorage.Loader()
// MODES.MULTI_PROCESS = ACCESSIBLE BY APP GROUP (iOS)
.setProcessingMode(MMKVStorage.MODES.MULTI_PROCESS)
.withEncryption()
.initialize();
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
export const useUserPreferences = create(MMKV);
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
class UserPreferences {
private mmkv: MMKVStorage.API;
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
constructor() {
this.mmkv = MMKV;
}
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
getString(key: string): string | null {
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
try {
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
return this.mmkv.getString(key) || null;
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
} catch {
return null;
}
}
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
setString(key: string, value: string): boolean | undefined {
return this.mmkv.setString(key, value);
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
}
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
getBool(key: string): boolean | null {
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
try {
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
return this.mmkv.getBool(key) || null;
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
} catch {
return null;
}
}
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
setBool(key: string, value: boolean): boolean | undefined {
return this.mmkv.setBool(key, value);
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
}
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
getMap(key: string): object | null {
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
try {
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
return this.mmkv.getMap(key) || null;
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
} catch {
return null;
}
}
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
setMap(key: string, value: object): boolean | undefined {
return this.mmkv.setMap(key, value);
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
}
Chore: Update react-native-mmkv-storage to 0.6.12 (#3634) * chore: updating mmkv library * feat: updating android ejson to use the getSecureKey new version * feat: updating IOS files to use the getSecureKey new version * feat: changing all mmkv methods to use sync calls * feat: changing mmkv methods from Screen lock * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from login, ssl certificate and change/add server * feat: changing all mmkv methods from logout * feat: changing all mmkv methods from e2e * fix: small fix at encryption and server drop down * feat: changing all mmkv methods from set theme * feat: changing all mmkv methods from openLink * fix: setting up mmkv to works property on Android * fix: fix an error to set the theme when open the app * refactor: change the react-native branch (temporary) * refactor: removing all `Async` from mmkv functions name * refactor: removing await from unnecessary functions, removing console.log and update cocoapods * refactor: removing unnecessary undefined from methods * feat: creating a custom hook for mmkv * refactor: changing the fetchPasscode to use the useUserPreferences hook * refactor: changing setTheme from app/index * refactor: small fix on setTheme * chore: update mmkv to 0.6.11 * chore: update mmkv to 0.6.11 * chore: minor tweak * chore: update mmkv to 0.6.12 * chore: mock NativeModules * chore: fix test mmkv * chore: removing custom MMKV JSI module, since is no more necessary after 0.6.11 version * feat: removing some async calls from mmkv after update from develop * feat: creating a function to get the initialTheme * feat: removing unnecessary try/catch * fix: fixing the blink white when open the app * feat: changing useMMKVStorage to create from mmkv lib * test: creating a mock for mmkv create function * chore: fix errors on tablet * minor tweak
2022-03-09 19:41:26 +00:00
removeItem(key: string): boolean | undefined {
[NEW] Encrypt user credentials and preferences (#2247) * install react-native-mmkv-storage * wip ios migration * change all js rn-user-defaults -> react-native-mmkv-storage * remove all rn-user-defaults native references (iOS) * android migration from rn-user-defaults to react-native-mmkv-storage * ios app group accessible mmkv * handle get errors * remove access of credentials from legacy native apps * remove data of user defaults * remove no longer necessary import * js mmkv encryption * run migration only once * reply from notification android * fix app group key access at native level ios * encrypt user credentials using a specific key * ios encrypt with random key * use a random key at the first encryption * encrypt migrated data on js land * remove unused function * reply notifications ios should be working * use fix instanceID * android ejson retrieve encrypted data * remove encryption migrated data for a while * encryption working between app and share extension * fix patch react-native-notifications * ssl pinning working using mmkv encrypted data * improve react-native-notifications * run encrypt migration data only once * fix build * fix patches magic string * fix mmkv id * mmkv -> userPreferences * fix instance id on android migration * cast our oldest sharedPreferences string into an object * revert log remove * create currentServer Rocket.Chat key * wrap mmkv api class * change the get logic * move userPreferences to lib * move encrypt migrated data to userPreferences class * check if the new object is new before insert * invalidate ci yarn cache * fix sort migration from android shared preferences * fix splashscreen forever * invalidate yarn cache * invalidate yarn cache * fix patch * Minor change * fix android notifications looking for wrong mmkv instance * Fix some issues on iOS mmkv native access * Remove unnecessary code * Fix notification reply and ssl pinning * WIP NotificationService use MMKV credentials * Add KeychainGroup * Notification idOnly get credentials from mmkv * Some fixes * Invalidate yarn cache * Pods * Use MMKVAppExtension on NotificationService Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-08-19 17:14:22 +00:00
return this.mmkv.removeItem(key);
}
}
const userPreferences = new UserPreferences();
export default userPreferences;