Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
4.27.0

See merge request minds/mobile-native!1851
  • Loading branch information
msantang78 committed Aug 17, 2022
2 parents 9c5d7e1 + 52027a6 commit d0ff52a
Show file tree
Hide file tree
Showing 165 changed files with 5,432 additions and 2,798 deletions.
5 changes: 3 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ build:ios_mr:
stage: build
interruptible: true
script:
- export ENVFILE=".env.review"
- fastlane buildrelease
- export TARGET_NAME=Minds-$CI_COMMIT_REF_SLUG.ipa
- cd ..
Expand Down Expand Up @@ -265,7 +266,7 @@ build:androidproduction-playstore:
.upload_s3: &upload_s3
stage: upload
tags: [minds-ci]
image: minds/ci:latest
image: cimg/aws:2022.06.1
interruptible: true
script:
- echo "Upload $TARGET_NAME"
Expand Down Expand Up @@ -409,7 +410,7 @@ upload:browserstack:mr:

# Release Full Android
release:production:
image: msantang78/ci-mobile:latest
image: cimg/aws:2022.06.1
stage: release
tags: [minds-ci]
dependencies:
Expand Down
7 changes: 1 addition & 6 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { StoresProvider } from './src/common/hooks/use-stores';
import i18n from './src/common/services/i18n.service';

import receiveShareService from './src/common/services/receive-share.service';
import AppInitManager from './AppInitManager';
import appInitManager from './AppInitManager';
import { WCContextProvider } from './src/blockchain/v2/walletconnect/WalletConnectContext';
import AppMessageProvider from 'AppMessageProvider';
import ExperimentsProvider from 'ExperimentsProvider';
Expand All @@ -54,7 +54,6 @@ import FriendlyCaptchaProvider, {

YellowBox.ignoreWarnings(['']);

const appInitManager = new AppInitManager();
appInitManager.initializeServices();

if (
Expand Down Expand Up @@ -167,9 +166,6 @@ class App extends Component<Props> {

const stores = getStores();

// Should show auth screens?
const showAuthNav = sessionService.showAuthNav;

return (
<ExperimentsProvider>
<SafeAreaProvider>
Expand All @@ -191,7 +187,6 @@ class App extends Component<Props> {
<WCContextProvider>
<NavigationStack
key={ThemedStyles.theme + i18n.locale}
showAuthNav={showAuthNav}
/>
</WCContextProvider>
</ErrorBoundary>
Expand Down
95 changes: 46 additions & 49 deletions AppErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,69 +22,66 @@ if (process.env.JEST_WORKER_ID === undefined) {
if (!shouldReportToSentry(hint.originalException)) {
return null;
}
if (__DEV__) {
console.log('Exception', hint.originalExceptionnt);
}
}

// for dev only log into the console
if (__DEV__) {
console.log(hint.originalException);
return null;
}

// for dev only log into the console
return event;
},
});
}

// // Log Mobx global errors
// onError(error => {
// console.log(error);
// logService.exception(error);
// });
/**
* react-native-exception-handler global handlers
*/

// react-native-exception-handler global handlers
if (!__DEV__) {
/**
* Globar error handlers
*/
const jsErrorHandler = (e, isFatal) => {
if (isFatal) {
Sentry.captureException(e);
if (e) {
Alert.alert(
'Unexpected error occurred',
`
/**
* Global error handlers
*/
const jsErrorHandler = (e, isFatal) => {
if (isFatal) {
Sentry.captureException(e);
if (e) {
Alert.alert(
'Unexpected error occurred',
`
Error: ${isFatal ? 'Fatal:' : ''} ${e.name} ${e.message}
`,
[
{
text: 'Ok',
},
],
);
}

console.log('Minds Uncaught (fatal)', e);
} else if (e) {
console.log('Minds Uncaught (non-fatal)', e); // So that we can see it in the ADB logs in case of Android if need, eed
[
{
text: 'Ok',
},
],
);
}
};

/**
* Js Errors
*/
setJSExceptionHandler(jsErrorHandler, true);
console.log('Minds Uncaught (fatal)', e.stack);
} else if (e) {
console.log('Minds Uncaught (non-fatal)', e); // So that we can see it in the ADB logs in case of Android if need, eed
}
};

/**
* Native Errors
*/
setNativeExceptionHandler(
exceptionString => {
Sentry.captureException(new Error(exceptionString), {
logger: 'NativeExceptionHandler',
});
console.log(exceptionString);
},
true,
false,
);
}
/**
* Js Errors
*/
setJSExceptionHandler(jsErrorHandler, true);

/**
* Native Errors
*/
setNativeExceptionHandler(
exceptionString => {
Sentry.captureException(new Error(exceptionString), {
logger: 'NativeExceptionHandler',
});
console.log('NativeExceptionHandler', exceptionString);
},
true,
false,
);
57 changes: 40 additions & 17 deletions AppInitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Linking, Alert, Platform } from 'react-native';
import * as Sentry from '@sentry/react-native';
import ShareMenu from 'react-native-share-menu';

import { SettingsStore } from './src/settings/SettingsStore';
import pushService from './src/common/services/push.service';
import receiveShare from './src/common/services/receive-share.service';

Expand All @@ -20,14 +19,14 @@ import badgeService from './src/common/services/badge.service';
import Clipboard from '@react-native-clipboard/clipboard';
import mindsConfigService from './src/common/services/minds-config.service';
import openUrlService from '~/common/services/open-url.service';
import { updateGrowthBookAttributes } from 'ExperimentsProvider';
import { hasVariation, updateGrowthBookAttributes } from 'ExperimentsProvider';

/**
* App initialization manager
*/
export default class AppInitManager {
export class AppInitManager {
initialized = false;
settingsStorePromise?: Promise<SettingsStore>;
navReady: boolean = false;

/**
* Initialize services without waiting for the promises
Expand Down Expand Up @@ -102,7 +101,6 @@ export default class AppInitManager {
*/
onLogout = () => {
// clear app badge
badgeService.setUnreadConversations(0);
badgeService.setUnreadNotifications(0);
translationService.purgeLanguagesCache();
updateGrowthBookAttributes();
Expand Down Expand Up @@ -134,21 +132,39 @@ export default class AppInitManager {
updateService.checkUpdate(!user.canary);
}, 5000);
}

// if the navigator is ready, handle initial navigation (this is needed when the user lands on the welcome screen)
if (this.navReady) {
// when the experiment is enabled, we don't want to navigate to the initial screen because the navigation is done after the email verification.
this.initialNavigationHandling(
hasVariation('minds-3055-email-codes')
? Boolean(user.email_confirmed)
: true,
);
}
};

async initialNavigationHandling() {
navigateToInitialScreen() {
if (sessionService.initialScreen) {
logService.info(
'[App] navigating to initial screen: ' + sessionService.initialScreen,
);
NavigationService.navigate(sessionService.initialScreen, {
initial: true,
...sessionService.initialScreenParams,
});
}

sessionService.setInitialScreen('');
}

async initialNavigationHandling(navigateInitialScreen: boolean = true) {
console.log('[App] initial Navigation Handling');
// load minds settings and boosted content
await boostedContentService.load();
try {
if (sessionService.initialScreen) {
logService.info(
'[App] navigating to initial screen: ' + sessionService.initialScreen,
);
NavigationService.navigate(sessionService.initialScreen, {
initial: true,
});
sessionService.setInitialScreen('');
}
// navigate to initial screen if set
navigateInitialScreen && this.navigateToInitialScreen();

const deepLinkUrl = (await Linking.getInitialURL()) || '';

Expand Down Expand Up @@ -185,7 +201,14 @@ export default class AppInitManager {
* Run the session logic when the navigator is ready
*/
onNavigatorReady = async () => {
console.log('NAV READY');
this.initialNavigationHandling();
this.navReady = true;
// if the user is already logged in, handle initial navigation
if (sessionService.userLoggedIn) {
this.initialNavigationHandling();
}
};
}

const appInitManagerInstace = new AppInitManager();

export default appInitManagerInstace;
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

Minds Mobile

## 4.27.0 - 2022-08-12

### Changed

- New feed implementation with performance improvements
- Fix video sound loop and video frozen on iOS
- Fix video loop on Android
- Refactor of the portrait content viewer
- In feed notices
- Fix notifications unread count logic
- Email code verification & improved initial screen transitions
- Allow media only comments
- Fix push navigation for comments
- Track deep linking navigation
- Fix reset password & navigation issues
- Mutual subscription (I don't recall the new name lol)
- Clean memory cache when switching users
- Fix orientation lock on iOS
- Decimal points for counters
- Portrait content load improvements
- Fix password mask on Android
- Fix top post feed on the discovery screen

## 4.26.0 - 2022-07-12

### Changed
Expand Down
Loading

0 comments on commit d0ff52a

Please sign in to comment.