Skip to content

Commit

Permalink
Merge branch 'main' into rename-ExpensiTextInput + ExpensiTextInput -…
Browse files Browse the repository at this point in the history
…> TextInput in AddressForm.js and AddDebitCardPage.js
  • Loading branch information
mateusbra committed Jan 4, 2022
2 parents 7c92f1c + 667570c commit 4047edb
Show file tree
Hide file tree
Showing 205 changed files with 2,319 additions and 1,781 deletions.
Binary file modified .github/workflows/OSBotify-private-key.asc.gpg
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/cherryPick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:

- name: Set up git for Botify
run: |
git config user.signingkey DBF63700F60F5530
git config user.signingkey 367811D53E34168C
git config commit.gpgsign true
git config user.name OSBotify
git config user.email infra+osbotify@expensify.com
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/createNewVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
git fetch
git checkout main
git config user.signingkey DBF63700F60F5530
git config user.signingkey 367811D53E34168C
git config commit.gpgsign true
git config user.name OSBotify
git config user.email infra+osbotify@expensify.com
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

- name: Set up git for Botify
run: |
git config user.signingkey DBF63700F60F5530
git config user.signingkey 367811D53E34168C
git config commit.gpgsign true
git config user.name OSBotify
git config user.email infra+osbotify@expensify.com
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:

- name: Set up git for Botify
run: |
git config user.signingkey DBF63700F60F5530
git config user.signingkey 367811D53E34168C
git config commit.gpgsign true
git config user.name OSBotify
git config user.email infra+osbotify@expensify.com
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/updateProtectedBranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

- name: Set up git for Botify
run: |
git config user.signingkey DBF63700F60F5530
git config user.signingkey 367811D53E34168C
git config commit.gpgsign true
git config user.name OSBotify
git config user.email infra+osbotify@expensify.com
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@ fastlane/screenshots

# Storybook build files
storybook-static

# GitHub GPG Keys
.github/workflows/OSBotify-private-key.asc
*.asc
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ outside of Expensify, or if no actual discrimination occurs; and/or
- Celebrating discrimination, whether the discrimination being celebrated is real or theoretical.

While it certainly takes more than the above to create an inclusive environment, this is
our minimum expectation for every contributor. We encourage everyone to be curious while simultaneously being respectful of our differences. Building an inclusive environment requires clear communication, checking for understanding, taking note of non-verbalcommunication and being aware of our own assumptions. The best interactions occur when there is a baseline understanding that everyone is equal and all people are individuals with unique experiences.
our minimum expectation for every contributor. We encourage everyone to be curious while simultaneously being respectful of our differences. Building an inclusive environment requires clear communication, checking for understanding, taking note of non-verbal communication and being aware of our own assumptions. The best interactions occur when there is a baseline understanding that everyone is equal and all people are individuals with unique experiences.

Acting inclusively is of equal importance when we are interacting with colleagues as it is
when we are interacting with others. Diversity of thought is one of our strengths, so let’s all do our part to protect it.
Expand Down
42 changes: 23 additions & 19 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ created to house a collection of items in plural form and using camelCase (eg: p
## File naming/structure
Files should be named after the component/function/constants they export, respecting the casing used for it. ie:

- If you export a constant named `CONST` it's file/directory should be named the `CONST`.
- If you export a component named `Text` the file/directory should be named `Text`.
- If you export a function named `guid` the file/directory should be named `guid`.
- If you export a constant named `CONST`, its file/directory should be named the `CONST`.
- If you export a component named `Text`, the file/directory should be named `Text`.
- If you export a function named `guid`, the file/directory should be named `guid`.
- For files that are utilities that export several functions/classes use the UpperCamelCase version ie: `DateUtils`.
- HOCs should be named in camelCase like withOnyx.
- [Higher-Order Components](https://reactjs.org/docs/higher-order-components.html) (HOCs) should be named in camelCase, like `withOnyx`.
- All React components should be PascalCase (a.k.a. UpperCamelCase 🐫).

## Platform-Specific File Extensions
Expand Down
12 changes: 6 additions & 6 deletions STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,16 @@ render() {
// Bad
const UserInfo = ({name, email}) => (
<View>
<ExpensifyText>Name: {name}</ExpensifyText>
<ExpensifyText>Email: {email}</ExpensifyText>
<Text>Name: {name}</Text>
<Text>Email: {email}</Text>
</View>
);
// Good
const UserInfo = props => (
<View>
<ExpensifyText>Name: {props.name}</ExpensifyText>
<ExpensifyText>Email: {props.email}</ExpensifyText>
<Text>Name: {props.name}</Text>
<Text>Email: {props.email}</Text>
</View>
);
```
Expand Down Expand Up @@ -701,9 +701,9 @@ class BComposedComponent extends React.Component
render() {
return (
<AComponent {...props}>
<ExpensifyText>
<Text>
{this.state.whatever}
</ExpensifyText>
</Text>
</AComponent>
)
}
Expand Down
38 changes: 19 additions & 19 deletions STYLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ If we need some minimal set of styling rules applied to a single-use component t
```jsx
// Bad - Since we only use this style once in this component
const TextWithPadding = props => (
<ExpensifyText style={styles.textWithPadding}>
<Text style={styles.textWithPadding}>
{props.children}
</ExpensifyText>
</Text>
);

// Good
const TextWithPadding = props => (
<ExpensifyText
<Text
style={[
styles.p5,
styles.noWrap,
]}
>
{props.children}
</ExpensifyText>
</Text>
);
```

Expand All @@ -56,24 +56,24 @@ Any array of styles associated with a single type of React element that has at l
```jsx
// Bad - Do not use inline styles
const TextWithPadding = props => (
<ExpensifyText style={{
<Text style={{
padding: 10,
whiteSpace: props.shouldWrap ? 'wrap' : 'nowrap',
}}>
{props.children}
</ExpensifyText>
</Text>
);

// Good
const TextWithPadding = props => (
<ExpensifyText
<Text
style={[
styles.p5,
getTextWrapStyle(props.shouldWrap)
]}
>
{props.children}
</ExpensifyText>
</Text>
);
```

Expand All @@ -85,34 +85,34 @@ There are many styles in the `styles.js` file. It is generally a bad practice to
// Bad - Reuses style without generalizing style name
const SettingsScreen = props => (
<View>
<ExpensifyText style={[styles.settingsScreenText]}>
<Text style={[styles.settingsScreenText]}>
Expensify
</ExpensifyText>
</Text>
</View>
);

const SomeOtherScreen = props => (
<View>
<ExpensifyText style={[styles.settingsScreenText]}>
<Text style={[styles.settingsScreenText]}>
New Expensify
</ExpensifyText>
</Text>
</View>
);

// Good
const SettingsScreen = props => (
<View>
<ExpensifyText style={[styles.defaultScreenText]}>
<Text style={[styles.defaultScreenText]}>
Expensify
</ExpensifyText>
</Text>
</View>
);

const SomeOtherScreen = props => (
<View>
<ExpensifyText style={[styles.defaultScreenText]}>
<Text style={[styles.defaultScreenText]}>
New Expensify
</ExpensifyText>
</Text>
</View>
);
```
Expand Down Expand Up @@ -193,7 +193,7 @@ The only time we should allow a component to have a `style` prop with `PropTypes
```jsx
// Good
const CustomText = props => (
<ExpensifyText style={props.style}>{props.children}</ExpensifyText>
<Text style={props.style}>{props.children}</Text>
);

// Good
Expand All @@ -202,14 +202,14 @@ const CustomText = props => {
? props.style
: [props.style];
}(
<ExpensifyText
<Text
style={[
styles.defaultCustomText,
...propsStyle,
]}
>
{props.children}
</ExpensifyText>
</Text>
);
```

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001012200
versionName "1.1.22-0"
versionCode 1001012500
versionName "1.1.25-0"
}
splits {
abi {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Bitmap.Config;
import android.graphics.PorterDuffXfermode;
import android.graphics.PorterDuff.Mode;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
Expand Down Expand Up @@ -74,6 +80,32 @@ protected NotificationCompat.Builder onExtendBuilder(@NonNull Context context, @
return builder;
}

/**
* Creates a canvas to draw a circle and then draws the bitmap avatar within that circle
* to clip off the area of the bitmap outside the circular path and returns a circular
* bitmap.
*
* @param bitmap The bitmap image to modify.
*/
public Bitmap getCroppedBitmap(Bitmap bitmap) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);

final int defaultBackgroundColor = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());

paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(defaultBackgroundColor);
canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2,
bitmap.getWidth() / 2, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}

/**
* Applies the message style to the notification builder. It also takes advantage of the
* notification cache to build conversations.
Expand Down Expand Up @@ -208,7 +240,7 @@ private IconCompat fetchIcon(String urlString) {

try {
Bitmap bitmap = future.get(MAX_ICON_FETCH_WAIT_TIME_SECONDS, TimeUnit.SECONDS);
return IconCompat.createWithBitmap(bitmap);
return IconCompat.createWithBitmap(getCroppedBitmap(bitmap));
} catch (InterruptedException e) {
Log.e(TAG,"Failed to fetch icon", e);
Thread.currentThread().interrupt();
Expand Down
7 changes: 7 additions & 0 deletions assets/images/bolt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions assets/images/keyboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions assets/images/transfer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions desktop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,30 @@ const quitAndInstallWithUpdate = () => {
autoUpdater.quitAndInstall();
};

/**
* Trigger event to show keyboard shortcuts
* @param {BrowserWindow} browserWindow
*/
const showKeyboardShortcutsModal = (browserWindow) => {
if (!browserWindow.isVisible()) {
return;
}
browserWindow.webContents.send('show-keyboard-shortcuts-modal');
};

// Defines the system-level menu item for manually triggering an update after
const updateAppMenuItem = new MenuItem({
label: 'Update New Expensify',
enabled: false,
click: quitAndInstallWithUpdate,
});

// Defines the system-level menu item for opening keyboard shortcuts modal
const keyboardShortcutsMenu = new MenuItem({
label: 'View Keyboard Shortcuts',
accelerator: 'CmdOrCtrl+?',
});

// Actual auto-update listeners
const electronUpdater = browserWindow => ({
init: () => {
Expand Down Expand Up @@ -138,6 +155,10 @@ const mainWindow = (() => {
browserWindow.setTitle('New Expensify');
}

keyboardShortcutsMenu.click = () => {
showKeyboardShortcutsModal(browserWindow);
};

// List the Expensify Chat instance under the Window menu, even when it's hidden
const systemMenu = Menu.getApplicationMenu();
systemMenu.insert(4, new MenuItem({
Expand All @@ -158,6 +179,8 @@ const mainWindow = (() => {

const appMenu = _.find(systemMenu.items, item => item.role === 'appmenu');
appMenu.submenu.insert(1, updateAppMenuItem);
appMenu.submenu.insert(2, keyboardShortcutsMenu);


// On mac, pressing cmd++ actually sends a cmd+=. cmd++ is generally the zoom in shortcut, but this is
// not properly listened for by electron. Adding in an invisible cmd+= listener fixes this.
Expand Down
Loading

0 comments on commit 4047edb

Please sign in to comment.