text stringlengths 9 39.2M | dir stringlengths 25 226 | lang stringclasses 163
values | created_date timestamp[s] | updated_date timestamp[s] | repo_name stringclasses 751
values | repo_full_name stringclasses 752
values | star int64 1.01k 183k | len_tokens int64 1 18.5M |
|---|---|---|---|---|---|---|---|---|
```javascript
/* @flow strict-local */
import type { ServerEmojiData } from '../../api/modelTypes';
import { displayCharacterForUnicodeEmojiCode, availableUnicodeEmojiCodes } from '../../emoji/data';
const codeToCss = (code, serverEmojiData): string =>
`.emoji-${code}:before { content: '${displayCharacterForUnicode... | /content/code_sandbox/src/webview/css/cssEmojis.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 167 |
```javascript
/* @flow strict-local */
import { Platform } from 'react-native';
import type { Auth } from '../../types';
import smoothScroll from './smoothScroll.min';
import matchesPolyfill from './matchesPolyfill';
import compiledWebviewJs from './generatedEs3';
/**
* An HTML fragment for the main `script` element... | /content/code_sandbox/src/webview/js/script.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 267 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import { ensureUnreachable } from '../../generics';
import type { EditSequence } from '../generateInboundEventEditSequence';
// TODO: Put more of the WebView's event-handling code in here.
/**
* PRIVATE - don't use until we have more test cov... | /content/code_sandbox/src/webview/js/handleInboundEvents.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 441 |
```javascript
/* @flow strict-local */
/**
* This entire code has been copied near verbatim from the WebApp's `pygments.scss` file.
* path_to_url
* The main change is in the logic of the `isDarkMode` flag. The reason why we have to do
* that is because the WebApp uses SCSS, which can detect this natively, while we... | /content/code_sandbox/src/webview/css/cssPygments.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,052 |
```javascript
/* @flow strict-local */
// Official MDN polyfill for Element.matches
// Source: path_to_url
export default `
if (!Element.prototype.matches) {
Element.prototype.matches =
Element.prototype.matchesSelector ||
Element.prototype.mozMatchesSelector ||
Element.prototype.msMatchesSelector ||
... | /content/code_sandbox/src/webview/js/matchesPolyfill.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 128 |
```javascript
/* @flow strict-local */
import type {
WebViewInboundEvent,
WebViewInboundEventContent,
WebViewInboundEventFetching,
WebViewInboundEventTyping,
WebViewInboundEventReady,
WebViewInboundEventSetRead,
} from '../generateInboundEvents';
import type { JSONable } from '../../utils/jsonable';
import ... | /content/code_sandbox/src/webview/js/InboundEventLogger.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,200 |
```javascript
/* @flow strict-local */
/**
* Collapse an open spoiler block with animation.
*
* Does what `collapse_spoiler` in static/js/spoilers.js in the web
* does, only departing as appropriate to adapt to mobile.
*/
const collapseSpoiler = (spoiler: HTMLElement) => {
// Translation of zulip/zulip@f3011d3b... | /content/code_sandbox/src/webview/js/spoilers.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 942 |
```javascript
/* @flow strict-local */
import type { Auth } from '../../types';
import { isUrlOnRealm } from '../../utils/url';
/** List of routes which accept the API key appended as a GET parameter. */
const inlineApiRoutes: $ReadOnlyArray<RegExp> = [
'^/user_uploads/',
'^/thumbnail$',
'^/avatar/',
].map(r =... | /content/code_sandbox/src/webview/js/rewriteHtml.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,262 |
```javascript
/**
* Main entry point for our code running inside the message-list WebView.
*
* This file, together with the code it imports, does not run in the normal
* React Native environment. Instead, it runs in a browser environment
* (Chrome when on Android, Safari when on iOS), inside a WebView, where we
... | /content/code_sandbox/src/webview/js/js.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 8,097 |
```javascript
/* @flow strict-local */
export default `
!function(){"use strict";function o(o){var t=["MSIE ","Trident/","Edge/"];return new RegExp(t.join("|")).test(o)}function t(){function t(o,t){this.scrollLeft=o,this.scrollTop=t}function r(o){return.5*(1-Math.cos(Math.PI*o))}function i(o){if(null===o||"object"!=typ... | /content/code_sandbox/src/webview/js/smoothScroll.min.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,247 |
```javascript
/* @flow strict-local */
import type { WebViewOutboundEvent } from '../handleOutboundEvents';
export default (msg: WebViewOutboundEvent) => {
window.ReactNativeWebView.postMessage(JSON.stringify(msg));
};
``` | /content/code_sandbox/src/webview/js/sendMessage.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 45 |
```javascript
/*
* This is a GENERATED file -- do not edit.
* To make changes:
* 1. Edit `js.js` or the files it imports, which together make up
* the source for this file.
* 2. Run `tools/generate-webview-js`.
*
* @generated
* @flow strict
*/
export default `
'use strict';
var compiledWebviewJs = (... | /content/code_sandbox/src/webview/js/generatedEs3.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 6,765 |
```javascript
/** @jest-environment jsdom-global */
// @flow strict-local
import rewriteHtml from '../rewriteHtml';
import type { Auth } from '../../../types';
describe('rewriteHtml', () => {
const realm = new URL('path_to_url
global.jsdom.reconfigure({
// This should really be a file:// URL. In particular, i... | /content/code_sandbox/src/webview/js/__tests__/rewriteHtml-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 992 |
```css
/*
Top level.
*/
html {
-webkit-user-select: none; /* Safari 3.1+ */
-moz-user-select: none; /* Firefox 2+ */
-ms-user-select: none; /* IE 10+ */
user-select: none; /* Standard syntax */
-khtml-user-select: none;
-webkit-touch-callout: none;
font: -apple-system-body;
}
body {
font-family: sans... | /content/code_sandbox/src/webview/static/base.css | css | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 5,566 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import generateInboundEvents from '../generateInboundEvents';
import { flagsStateToStringList } from '../html/message';
import { HOME_NARROW } from '../../utils/narrow';
import * as eg from '../../__tests__/lib/exampleData';
import type { Pro... | /content/code_sandbox/src/webview/__tests__/generateInboundEvents-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,420 |
```javascript
/**
* @jest-environment jsdom
* @flow strict-local
*/
import Immutable from 'immutable';
import invariant from 'invariant';
import * as eg from '../../__tests__/lib/exampleData';
import {
HOME_NARROW,
streamNarrow,
topicNarrow,
pmNarrowFromUsersUnsafe,
keyFromNarrow,
ALL_PRIVATE_NARROW,
} ... | /content/code_sandbox/src/webview/__tests__/generateInboundEventEditSequence-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 9,529 |
```unknown
// Jest Snapshot v1, path_to_url
exports[`getEditSequence correct for interesting changes DM recipient headers enableGuestUserIndicator turns on, affecting a recipient user 1`] = `3`;
exports[`getEditSequence correct for interesting changes DM recipient headers recipient user became guest 1`] = `1`;
expor... | /content/code_sandbox/src/webview/__tests__/__snapshots__/generateInboundEventEditSequence-test.js.snap.ios | unknown | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 39,602 |
```javascript
// @flow strict-local
/**
* Heartbeat: Perform callbacks at regular intervals.
*
* While active, calls `callback` every `milliseconds` milliseconds.
* While inactive, does nothing.
*
* On becoming active, the first call to `callback` comes immediately,
* or one full period after the last call made... | /content/code_sandbox/src/presence/heartbeat.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 594 |
```javascript
// @flow strict-local
import * as React from 'react';
import { AppState } from 'react-native';
import { useGlobalSelector, useSelector, useDispatch } from '../react-redux';
import { getHasAuth } from '../account/accountsSelectors';
import { reportPresence } from '../actions';
import Heartbeat from './hea... | /content/code_sandbox/src/presence/PresenceHeartbeat.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 349 |
```javascript
/* @flow strict-local */
import Immutable from 'immutable';
import differenceInSeconds from 'date-fns/differenceInSeconds';
import differenceInDays from 'date-fns/differenceInDays';
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
import type {
ClientPresence,
UserPresence,
PresenceS... | /content/code_sandbox/src/presence/presenceModel.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,884 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import Immutable from 'immutable';
import * as eg from '../../__tests__/lib/exampleData';
import { PRESENCE_RESPONSE, EVENT_PRESENCE } from '../../actionConstants';
import {
reducer as presenceReducer,
getAggregatedPresence,
getUserLas... | /content/code_sandbox/src/presence/__tests__/presenceModel-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,799 |
```javascript
// @flow strict-local
import Heartbeat from '../heartbeat';
// (hopefully) restrictive type alias for Jest's mock callback functions
type CallbackType = JestMockFn<$ReadOnlyArray<void>, void>;
describe('Heartbeat', () => {
// ===================================================================
// Con... | /content/code_sandbox/src/presence/__tests__/heartbeat-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,689 |
```javascript
// @flow strict-local
import type { User, UserPresence } from '../../api/modelTypes';
import { type PresenceState } from '../../reduxTypes';
import { reducer } from '../presenceModel';
import * as eg from '../../__tests__/lib/exampleData';
import { objectFromEntries } from '../../jsBackport';
export func... | /content/code_sandbox/src/presence/__tests__/presence-testlib.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 197 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import type { PerAccountApplicableAction, PerAccountState } from '../types';
import type { UnreadPmsState } from './unreadModelTypes';
import {
REGISTER_COMPLETE,
EVENT_NEW_MESSAGE,
EVENT_MESSAGE_DELETE,
EVENT_UPDATE_MESSAGE_FLAGS,
RES... | /content/code_sandbox/src/unread/unreadPmsReducer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 801 |
```javascript
/* @flow strict-local */
import Immutable from 'immutable';
import invariant from 'invariant';
import type { Narrow, UserId } from '../types';
import { userIdsOfPmNarrow } from '../utils/narrow';
import { pmUnreadsKeyFromPmKeyIds } from '../utils/recipient';
import type { PerAccountApplicableAction } fro... | /content/code_sandbox/src/unread/unreadModel.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,207 |
```unknown
// Jest Snapshot v1, path_to_url
exports[`getEditSequence correct for interesting changes DM recipient headers enableGuestUserIndicator turns on, affecting a recipient user 1`] = `3`;
exports[`getEditSequence correct for interesting changes DM recipient headers recipient user became guest 1`] = `1`;
expor... | /content/code_sandbox/src/webview/__tests__/__snapshots__/generateInboundEventEditSequence-test.js.snap.android | unknown | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 39,602 |
```javascript
/* @flow strict-local */
import type { HuddlesUnreadItem, PmsUnreadItem, UserId } from '../types';
import { addItemsToArray, removeItemsFromArray, filterArray } from '../utils/immutability';
type SomeUnreadItem = $ReadOnly<{ unread_message_ids: $ReadOnlyArray<number>, ... }>;
export function removeItems... | /content/code_sandbox/src/unread/unreadHelpers.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 599 |
```javascript
/* @flow strict-local */
import type Immutable from 'immutable';
import type { HuddlesUnreadItem, PmsUnreadItem } from '../api/apiTypes';
/**
* A summary of (almost) all unread stream messages.
*
* This is a map from stream IDs, to maps from topics, to lists of
* message IDs. Each list is sorted. ... | /content/code_sandbox/src/unread/unreadModelTypes.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 671 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import type { PerAccountApplicableAction } from '../types';
import type { UnreadMentionsState } from './unreadModelTypes';
import {
REGISTER_COMPLETE,
EVENT_NEW_MESSAGE,
EVENT_MESSAGE_DELETE,
EVENT_UPDATE_MESSAGE_FLAGS,
RESET_ACCOUNT_D... | /content/code_sandbox/src/unread/unreadMentionsReducer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 502 |
```javascript
/* @flow strict-local */
import { createSelector } from 'reselect';
import type { Narrow, Selector } from '../types';
import type { UnreadStreamItem } from './UnreadCards';
import { caseInsensitiveCompareFunc } from '../utils/misc';
import { getMute, isTopicVisibleInStream, isTopicVisible } from '../mute... | /content/code_sandbox/src/unread/unreadSelectors.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,258 |
```javascript
/* @flow strict-local */
import React, { useState } from 'react';
import type { Node } from 'react';
import { SectionList } from 'react-native';
import Immutable from 'immutable';
import { useDispatch, useSelector } from '../react-redux';
import SearchEmptyState from '../common/SearchEmptyState';
import... | /content/code_sandbox/src/unread/UnreadCards.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 888 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import type { PerAccountApplicableAction } from '../types';
import type { UnreadHuddlesState } from './unreadModelTypes';
import {
REGISTER_COMPLETE,
EVENT_NEW_MESSAGE,
EVENT_MESSAGE_DELETE,
EVENT_UPDATE_MESSAGE_FLAGS,
RESET_ACCOUNT_DA... | /content/code_sandbox/src/unread/unreadHuddlesReducer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 778 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import Immutable from 'immutable';
import unreadMentionsReducer from '../unreadMentionsReducer';
import { EVENT_UPDATE_MESSAGE_FLAGS } from '../../actionConstants';
import { NULL_ARRAY } from '../../nullObjects';
import * as eg from '../../__... | /content/code_sandbox/src/unread/__tests__/unreadMentionsReducer-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,315 |
```javascript
/* @flow strict-local */
import { reducer } from '../unreadModel';
import type { UnreadState } from '../unreadModelTypes';
import type { Message, Stream } from '../../api/apiTypes';
import type { PerAccountState } from '../../reduxTypes';
import * as eg from '../../__tests__/lib/exampleData';
import { ra... | /content/code_sandbox/src/unread/__tests__/unread-testlib.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 802 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import unreadPmsReducer from '../unreadPmsReducer';
import { EVENT_UPDATE_MESSAGE_FLAGS } from '../../actionConstants';
import { NULL_ARRAY } from '../../nullObjects';
import * as eg from '../../__tests__/lib/exampleData';
import { makeUserId... | /content/code_sandbox/src/unread/__tests__/unreadPmsReducer-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,523 |
```javascript
/* @flow strict-local */
import {
getUnreadByStream,
getUnreadStreamTotal,
getUnreadByPms,
getUnreadPmsTotal,
getUnreadByHuddles,
getUnreadHuddlesTotal,
getUnreadMentionsTotal,
getUnreadTotal,
getUnreadStreamsAndTopics,
} from '../unreadSelectors';
import * as eg from '../../__tests__/... | /content/code_sandbox/src/unread/__tests__/unreadSelectors-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,068 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import unreadHuddlesReducer from '../unreadHuddlesReducer';
import { RESET_ACCOUNT_DATA, EVENT_UPDATE_MESSAGE_FLAGS } from '../../actionConstants';
import { NULL_ARRAY } from '../../nullObjects';
import * as eg from '../../__tests__/lib/examp... | /content/code_sandbox/src/unread/__tests__/unreadHuddlesReducer-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,741 |
```javascript
// @flow strict-local
import * as React from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { useColorScheme } from 'react-native';
import { BRAND_COLOR } from '../styles';
import { useGlobalSelector } from '../react-redux';
import { getGlobalSettings, getIsHydrated } ... | /content/code_sandbox/src/boot/ZulipSafeAreaProvider.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 447 |
```javascript
/* @flow strict-local */
import React, { PureComponent } from 'react';
import type { Node } from 'react';
import * as api from '../api';
import CompatibilityScreen from '../start/CompatibilityScreen';
type Props = $ReadOnly<{|
children: Node,
|}>;
type State = {|
compatibilityCheckFail: boolean,
|}... | /content/code_sandbox/src/boot/CompatibilityChecker.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 176 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { useColorScheme } from 'react-native';
import { useGlobalSelector } from '../react-redux';
import { getGlobalSettings } from '../directSelectors';
import { themeData, ThemeContext } from '../styles/theme';
imp... | /content/code_sandbox/src/boot/ThemeProvider.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 205 |
```javascript
/* @flow strict-local */
import Immutable from 'immutable';
import { EVENT_UPDATE_MESSAGE_FLAGS } from '../../actionConstants';
import { reducer } from '../unreadModel';
import { setUnion } from '../../immutableUtils';
import { type UnreadState } from '../unreadModelTypes';
import * as eg from '../../__t... | /content/code_sandbox/src/unread/__tests__/unreadModel-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,646 |
```javascript
/* @flow strict-local */
/**
* The feature level at which we want to say "channel" instead of "stream".
*
* Outside a per-account context, check the feature level of the active
* account, if there is one and it has server data. If there isn't an active
* account or it doesn't have server data, just ... | /content/code_sandbox/src/boot/streamChannelRenamesMap.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,157 |
```javascript
/* @flow strict-local */
import { applyMiddleware, compose, createStore } from 'redux';
import type { Store } from 'redux';
// $FlowFixMe[untyped-import]
import thunkMiddleware from 'redux-thunk';
// $FlowFixMe[untyped-import]
import { createLogger } from 'redux-logger';
// $FlowFixMe[untyped-import]
impo... | /content/code_sandbox/src/boot/store.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,633 |
```javascript
/* @flow strict-local */
import React, { useEffect } from 'react';
import type { Node } from 'react';
import type { Dispatch } from '../reduxTypes';
import { observeStore } from '../redux';
import { Provider } from '../react-redux';
import * as logging from '../utils/logging';
import { getHasAuth, getAcc... | /content/code_sandbox/src/boot/StoreProvider.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 493 |
```javascript
/* @flow strict-local */
import type { Action, PerAccountApplicableAction, GlobalState, MigrationsState } from '../types';
import { dubPerAccountState } from '../reduxTypes';
import { isPerAccountApplicableAction } from '../actionTypes';
import accounts from '../account/accountsReducer';
import alertWord... | /content/code_sandbox/src/boot/reducers.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,895 |
```javascript
// @flow strict-local
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
import type { Node } from 'react';
import { AccessibilityInfo, View, LayoutAnimation, Platform, useColorScheme } from 'react-native';
import NetInfo from '@react-native-community/netinfo';
i... | /content/code_sandbox/src/boot/OfflineNoticeProvider.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,998 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { useGlobalSelector } from '../react-redux';
import { getIsHydrated } from '../selectors';
import FullScreenLoading from '../common/FullScreenLoading';
type Props = $ReadOnly<{|
children: Node,
|}>;
/**
* W... | /content/code_sandbox/src/boot/StoreHydratedGate.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 138 |
```javascript
/* @flow strict-local */
import * as React from 'react';
import { Text } from 'react-native';
import { IntlProvider, IntlContext } from 'react-intl';
import type { IntlShape } from 'react-intl';
import type { GetText } from '../types';
import { useGlobalSelector } from '../react-redux';
import { getGloba... | /content/code_sandbox/src/boot/TranslationProvider.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 965 |
```javascript
/* @flow strict-local */
import reducers from '../reducers';
import { discardKeys, storeKeys, cacheKeys } from '../store';
import * as eg from '../../__tests__/lib/exampleData';
describe('reducers', () => {
test('reducers return the default states on unknown action', () => {
// $FlowFixMe[incompati... | /content/code_sandbox/src/boot/__tests__/reducers-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 165 |
```javascript
/* @flow strict-local */
import React, { PureComponent } from 'react';
import type { Node, ComponentType } from 'react';
import { AppState, View } from 'react-native';
import * as ScreenOrientation from 'expo-screen-orientation';
import type { GlobalDispatch, Orientation as OrientationT } from '../types... | /content/code_sandbox/src/boot/AppEventHandlers.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 612 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import type { RouteProp } from '../react-navigation';
import type { MainTabsNavigationProp } from './MainTabsScreen';... | /content/code_sandbox/src/main/HomeScreen.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 569 |
```javascript
/* @flow strict-local */
import React, { PureComponent } from 'react';
import type { Node } from 'react';
import { Animated, Easing } from 'react-native';
import type AnimatedValue from 'react-native/Libraries/Animated/nodes/AnimatedValue';
import type { Style } from '../types';
type Props = $ReadOnly<{... | /content/code_sandbox/src/animation/AnimatedRotateComponent.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 256 |
```javascript
/* @flow strict-local */
import React, { useContext } from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import {
createBottomTabNavigator,
type BottomTabNavigationProp,
} from '@react-navigation/bottom-tabs';
import type { RouteProp, RouteParamsOf } from '../react-n... | /content/code_sandbox/src/main/MainTabsScreen.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 776 |
```javascript
/* @flow strict-local */
import React, { PureComponent } from 'react';
import type { Node } from 'react';
import { Animated, Easing } from 'react-native';
import type AnimatedValue from 'react-native/Libraries/Animated/nodes/AnimatedValue';
import type { Style } from '../types';
type Props = $ReadOnly<{... | /content/code_sandbox/src/animation/AnimatedScaleComponent.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 322 |
```javascript
/* @flow strict-local */
import React, { useContext, useMemo } from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import type { EditingEvent } from 'react-native/Libraries/Components/TextInput/TextInput';
im... | /content/code_sandbox/src/nav/ModalSearchNavBar.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 459 |
```javascript
/* @flow strict-local */
import {
type StackActionType,
StackActions,
CommonActions,
type NavigationAction,
} from '@react-navigation/native';
import * as NavigationService from './NavigationService';
import type { Narrow } from '../types';
import type { SharedData } from '../sharing/types';
// ... | /content/code_sandbox/src/nav/navActions.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 392 |
```javascript
/* @flow strict-local */
import type { Account } from '../types';
export default (args: {|
hasAuth: boolean,
accounts: $ReadOnlyArray<Account>,
|}): {| initialRouteName: string, initialRouteParams?: { ... } |} => {
const { hasAuth, accounts } = args;
// If the active account is not logged in, b... | /content/code_sandbox/src/nav/getInitialRouteInfo.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 308 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { BRAND_COLOR, createStyleSheet, NAVBAR_SIZE } from '../styles';
import { Icon } from '../common/Icons';
import type { IconNames } from '../common/Icons';
import Touchable from '../common/Touchable';
const comp... | /content/code_sandbox/src/nav/TopTabButton.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 352 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { Platform } from 'react-native';
import { navigateBack } from '../actions';
import NavButton from './NavButton';
import { useNavigation } from '../react-navigation';
/**
* The button for the start of the app ... | /content/code_sandbox/src/nav/NavBarBackButton.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 284 |
```javascript
/* @flow strict-local */
import React, { useContext, useMemo } from 'react';
import type { Node } from 'react';
import { SafeAreaView } from 'react-native-safe-area-context';
import type { LocalizableReactText } from '../types';
import globalStyles, { ThemeContext, NAVBAR_SIZE } from '../styles';
import ... | /content/code_sandbox/src/nav/ModalNavBar.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 621 |
```javascript
/* @flow strict-local */
import React, { useCallback, useContext } from 'react';
import type { Node, ComponentType } from 'react';
import { View } from 'react-native';
// $FlowFixMe[untyped-import]
import Color from 'color';
import { SafeAreaView } from 'react-native-safe-area-context';
import type { Nar... | /content/code_sandbox/src/nav/ChatNavBar.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,488 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { Platform } from 'react-native';
import {
createStackNavigator,
type StackNavigationProp,
TransitionPresets,
} from '@react-navigation/stack';
import type { StackActionHelpers } from '@react-navigation/nat... | /content/code_sandbox/src/nav/AppNavigator.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,250 |
```javascript
/* @flow strict-local */
import type { AppNavigatorParamList } from './AppNavigator';
import type { SharingNavigatorParamList } from '../sharing/SharingScreen';
import type { MainTabsNavigatorParamList } from '../main/MainTabsScreen';
export type GlobalParamList = {|
...AppNavigatorParamList,
...Sha... | /content/code_sandbox/src/nav/globalTypes.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 83 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import { useSelector } from '../react-redux';
import { getUnreadMentionsTotal } from '../selectors';
import { IconMention } from '../common/Icons';
import CountOverlay from '../com... | /content/code_sandbox/src/nav/IconUnreadMentions.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 172 |
```javascript
/* @flow strict-local */
import React, { useContext, useEffect } from 'react';
import type { Node } from 'react';
import { useColorScheme } from 'react-native';
import { NavigationContainer, DefaultTheme, DarkTheme } from '@react-navigation/native';
import { useGlobalSelector } from '../react-redux';
imp... | /content/code_sandbox/src/nav/ZulipNavigationContainer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 448 |
```javascript
/* @flow strict-local */
import React from 'react';
import {
type NavigationAction,
type NavigationState,
typeof NavigationContainer,
} from '@react-navigation/native';
export const isReadyRef: {| current: null | boolean |} = React.createRef();
export const navigationContainerRef: {|
current: nul... | /content/code_sandbox/src/nav/NavigationService.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 201 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { BRAND_COLOR, createStyleSheet } from '../styles';
import { Icon } from '../common/Icons';
import type { IconNames } from '../common/Icons';
import Touchable from '../common/Touchable';
const componentStyles =... | /content/code_sandbox/src/nav/NavButton.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 385 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import { navigateBack } from '../navActions';
import * as NavigationService from '../NavigationService';
describe('navigateBack', () => {
test('if no routes the count of same routes is 0', () => {
// $FlowFixMe[cannot-write] Make Flow ... | /content/code_sandbox/src/nav/__tests__/navActions-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 405 |
```javascript
/* @flow strict-local */
// import { Vibration } from 'react-native';
import { CommonActions } from '@react-navigation/native';
import type { Narrow, ThunkAction } from '../types';
import type { EventAction } from '../actionTypes';
import { EVENT_TYPING_START, EVENT_UPDATE_MESSAGE } from '../actionConsta... | /content/code_sandbox/src/events/doEventActionSideEffects.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 792 |
```javascript
/* @flow strict-local */
import { EventTypes, type EventType, type RealmUserUpdateEventRaw } from '../api/eventTypes';
import * as logging from '../utils/logging';
import type { PerAccountState, EventAction, MessageEdit } from '../types';
import {
EVENT_ALERT_WORDS,
EVENT_NEW_MESSAGE,
EVENT_PRESENCE... | /content/code_sandbox/src/events/eventToAction.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,018 |
```javascript
/* @flow strict-local */
import { addBreadcrumb } from '@sentry/react-native';
// $FlowFixMe[untyped-import]
import isEqual from 'lodash.isequal';
import * as NavigationService from '../nav/NavigationService';
import { resetToAccountPicker } from '../nav/navActions';
import { ensureUnreachable } from '..... | /content/code_sandbox/src/events/eventActions.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 3,686 |
```javascript
/* @flow strict-local */
import type { LocalizableText } from '../types';
/**
* A LocalizableText that always resolves to the given string.
*
* Useful for wrapping user data, like the name of a user or a stream,
* in a context where we sometimes also show a string that needs translation.
*/
export f... | /content/code_sandbox/src/i18n/i18n.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 94 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import * as logging from '../../utils/logging';
import * as eg from '../../__tests__/lib/exampleData';
import eventToAction from '../eventToAction';
import { EVENT_NEW_MESSAGE } from '../../actionConstants';
import { AvatarURL } from '../../util... | /content/code_sandbox/src/events/__tests__/eventToAction-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 970 |
```javascript
/* @flow strict-local */
/* eslint-disable global-require */
/**
* Message data for all languages we have message data for.
*
* Keys here are IETF BCP 47 language tags.
*
* The languages we offer in the UI are a subset of these; see
* `src/settings/languages.js`.
*/
// Note that the filenames refl... | /content/code_sandbox/src/i18n/messagesByLanguage.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 922 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import Immutable from 'immutable';
import { ZulipVersion } from '../utils/zulipVersion';
import { GravatarURL, UploadedAvatarURL, FallbackAvatarURL } from '../utils/avatar';
/**
* PRIVATE: Exported only for tests.
*
* A special identifier fo... | /content/code_sandbox/src/storage/replaceRevive.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,862 |
```javascript
/* @flow strict-local */
import LegacyAsyncStorage from '@react-native-async-storage/async-storage';
import invariant from 'invariant';
import { SQLDatabase } from './sqlite';
import * as logging from '../utils/logging';
// A better name for this class might be simply AsyncStorage.
// But for now we res... | /content/code_sandbox/src/storage/AsyncStorage.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,938 |
```javascript
// @flow strict-local
import {
openDatabase,
type SQLResultSet,
type WebSQLDatabase,
type SQLTransaction as WebSQLTransaction,
} from 'expo-sqlite';
import invariant from 'invariant';
/* eslint-disable no-use-before-define */
/* eslint-disable no-underscore-dangle */
/* eslint-disable no-void */
... | /content/code_sandbox/src/storage/sqlite.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,583 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import { NativeModules } from 'react-native';
import { AsyncStorage } from './AsyncStorage';
import * as logging from '../utils/logging';
const NODE_ENV = process.env.NODE_ENV;
/** Assert the given string is plausibly the JSON encoding of some... | /content/code_sandbox/src/storage/CompressedAsyncStorage.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,074 |
```javascript
// @flow strict-local
import type { ReadWrite, SubsetProperties } from '../generics';
import { ZulipVersion } from '../utils/zulipVersion';
import type { GlobalState } from '../types';
import { objectFromEntries } from '../jsBackport';
// Like GlobalState, but making all properties optional.
type Partial... | /content/code_sandbox/src/storage/migrations.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 4,997 |
```javascript
// @flow strict-local
import type { GlobalState } from '../../types';
import { historicalStoreKeys, migrations } from '../migrations';
import { storeKeys } from '../../boot/store';
import { createMigrationFunction } from '../../redux-persist-migrate';
import { ZulipVersion } from '../../utils/zulipVersio... | /content/code_sandbox/src/storage/__tests__/migrations-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,824 |
```javascript
/* @flow strict-local */
import invariant from 'invariant';
import * as eg from '../../__tests__/lib/exampleData';
import { objectEntries } from '../../flowPonyfill';
import type { GlobalState } from '../../types';
import CompressedAsyncStorage from '../CompressedAsyncStorage';
import { stringify, parse ... | /content/code_sandbox/src/storage/__tests__/storage-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 911 |
```javascript
// @flow strict-local
// $FlowFixMe[missing-export] -- present in test version of module
import { deleteDatabase } from 'expo-sqlite';
import LegacyAsyncStorage from '@react-native-async-storage/async-storage';
import { AsyncStorage } from '../AsyncStorage';
import { SQLDatabase } from '../sqlite';
des... | /content/code_sandbox/src/storage/__tests__/AsyncStorage-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 858 |
```javascript
/* @flow strict-local */
import { Platform, NativeModules } from 'react-native';
import { AsyncStorage } from '../AsyncStorage';
import CompressedAsyncStorage from '../CompressedAsyncStorage';
import * as logging from '../../utils/logging';
import { randString } from '../../utils/misc';
test('smoke-test... | /content/code_sandbox/src/storage/__tests__/CompressedAsyncStorage-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,825 |
```javascript
// @flow strict-local
import sqlite3 from 'sqlite3';
// $FlowFixMe[missing-export] -- present in test version of module
import { openDatabase, deleteDatabase, type SQLResultSet } from 'expo-sqlite';
/* eslint-disable import/no-extraneous-dependencies */
// $FlowFixMe[untyped-import]: actually comes from ... | /content/code_sandbox/src/storage/__tests__/sqlite-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 4,502 |
```javascript
/* @flow strict-local */
import Immutable from 'immutable';
import { FallbackAvatarURL, GravatarURL, UploadedAvatarURL } from '../../utils/avatar';
import { ZulipVersion } from '../../utils/zulipVersion';
import { stringify, parse, SERIALIZED_TYPE_FIELD_NAME } from '../replaceRevive';
import * as eg fro... | /content/code_sandbox/src/storage/__tests__/replaceRevive-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,278 |
```javascript
/* @flow strict-local */
import React, { useEffect } from 'react';
import type { Node } from 'react';
import {
createMaterialTopTabNavigator,
type MaterialTopTabNavigationProp,
} from '@react-navigation/material-top-tabs';
import type { RouteParamsOf, RouteProp } from '../react-navigation';
import ty... | /content/code_sandbox/src/sharing/SharingScreen.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 726 |
```javascript
/* @flow strict-local */
import React, { useState, useCallback } from 'react';
import type { Node } from 'react';
import type { UserId, UserOrBot } from '../types';
import Screen from '../common/Screen';
import UserPickerCard from '../user-picker/UserPickerCard';
type Props = $ReadOnly<{|
onComplete: (... | /content/code_sandbox/src/sharing/ChooseRecipientsScreen.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 205 |
```javascript
/* @flow strict-local */
import { NativeModules, DeviceEventEmitter, Platform } from 'react-native';
import * as NavigationService from '../nav/NavigationService';
import type { SharedData } from './types';
import { navigateToSharing } from '../actions';
const Sharing = NativeModules.Sharing ?? {
read... | /content/code_sandbox/src/sharing/index.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 351 |
```javascript
/* @flow strict-local */
export type SharedFile = {|
name: string,
mimeType: string,
url: string,
|};
/**
* The data we get when the user "shares" to Zulip from another app.
*
* On Android, these objects are sent to JS from our platform-native code,
* constructed there by `getParamsFromIntent`... | /content/code_sandbox/src/sharing/types.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 174 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { ComponentType } from 'react';
import type { ValidationError } from './ShareWrapper';
import type { SharingNavigationProp } from './SharingScreen';
import type { RouteProp } from '../react-navigation';
import type { Dispatch, Auth, Stream }... | /content/code_sandbox/src/sharing/ShareToStream.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 1,431 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { View, Modal } from 'react-native';
import type { ValidationError } from './ShareWrapper';
import type { RouteProp } from '../react-navigation';
import type { SharingNavigationProp } from './SharingScreen';
imp... | /content/code_sandbox/src/sharing/ShareToPm.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 760 |
```javascript
/* @flow strict-local */
import type { DraftsState, PerAccountApplicableAction } from '../types';
import { DRAFT_UPDATE, RESET_ACCOUNT_DATA } from '../actionConstants';
import { NULL_OBJECT } from '../nullObjects';
import { keyFromNarrow } from '../utils/narrow';
const initialState = NULL_OBJECT;
const ... | /content/code_sandbox/src/drafts/draftsReducer.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 254 |
```javascript
/* @flow strict-local */
import type { Narrow, PerAccountState } from '../types';
import { keyFromNarrow } from '../utils/narrow';
export const getDraftForNarrow = (state: PerAccountState, narrow: Narrow): string =>
state.drafts[keyFromNarrow(narrow)] || '';
``` | /content/code_sandbox/src/drafts/draftsSelectors.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 68 |
```javascript
/* @flow strict-local */
import type { Narrow, PerAccountAction } from '../types';
import { DRAFT_UPDATE } from '../actionConstants';
export const draftUpdate = (narrow: Narrow, content: string): PerAccountAction => ({
type: DRAFT_UPDATE,
narrow,
content,
});
``` | /content/code_sandbox/src/drafts/draftsActions.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 65 |
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node, ComponentType } from 'react';
import { FlatList, ImageBackground, ScrollView, View, Text } from 'react-native';
import * as apiConstants from '../api/constants';
import type { Auth, Dispatch, GetText, UserId } from '../types';
import... | /content/code_sandbox/src/sharing/ShareWrapper.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 2,334 |
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import { NULL_OBJECT } from '../../nullObjects';
import draftsReducer from '../draftsReducer';
import { DRAFT_UPDATE } from '../../actionConstants';
import { topicNarrow, keyFromNarrow } from '../../utils/narrow';
import * as eg from '../../_... | /content/code_sandbox/src/drafts/__tests__/draftsReducer-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 564 |
```javascript
/* @flow strict-local */
import { getDraftForNarrow } from '../draftsSelectors';
import { topicNarrow, keyFromNarrow } from '../../utils/narrow';
import * as eg from '../../__tests__/lib/exampleData';
describe('getDraftForNarrow', () => {
test('return content of draft if exists', () => {
const nar... | /content/code_sandbox/src/drafts/__tests__/draftsSelectors-test.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 238 |
```javascript
/* @flow strict-local */
// $FlowFixMe[untyped-import]
import Color from 'color';
import type { ColorValue } from 'react-native/Libraries/StyleSheet/StyleSheet';
export const foregroundColorFromBackground = (color: ColorValue): 'black' | 'white' =>
Color(color).luminosity() > 0.4 ? 'black' : 'white';
... | /content/code_sandbox/src/utils/color.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 163 |
```javascript
/* @flow strict-local */
export const removeItemsFromArray = (
input: $ReadOnlyArray<number>,
itemsToRemove: $ReadOnlyArray<number>,
): $ReadOnlyArray<number> => {
const output = input.filter((item: number) => !itemsToRemove.includes(item));
return input.length === output.length ? input : output;... | /content/code_sandbox/src/utils/immutability.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 304 |
```javascript
/* @flow strict */
/* eslint-disable ft-flow/type-id-match */
/**
* Type of a round-trip-capable JSONable object.
*
* Note that this is not the same as the type of objects which `JSON.stringify`
* will accept, nor even the type of objects which `JSON.stringify` will accept
* without returning `undef... | /content/code_sandbox/src/utils/jsonable.js | javascript | 2016-05-08T05:41:48 | 2024-08-15T07:25:47 | zulip-mobile | zulip/zulip-mobile | 1,274 | 732 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.