Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@ google-services.json
/.env
.env.stg
tmp.xcconfig

android/app/google-services-prod.json

android/app/google-services2.json
44 changes: 23 additions & 21 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ import NotificationService from './src/Services/NotificationService';
import {colors} from './src/Theme';
import Toast from './src/Util/Toast';
import ToastView, {DURATION} from './src/Util/ToastView';
import UserService from '~/Services/UserService';
import {AUTH_PROVIDER} from '~/Util/constants/provider';

const Stack = createStackNavigator();
I18nManager.allowRTL(false);
Expand Down Expand Up @@ -105,36 +107,35 @@ const App = () => {
const credentials = await AsyncStorage.getItem(
ASYNC_STORAGE_KEYS.credentials,
);
const parsedCredentials = credentials && JSON.parse(credentials);

if (credentials) {
if (
credentials &&
parsedCredentials?.providerId !== AUTH_PROVIDER.apple
) {
const accessToken = await UserService.getAccessToken();
NotificationService.saveTokenToDatabase();
const parsedCredentials = JSON.parse(credentials);
if (new Date(parsedCredentials.expirationDate) > new Date()) {
routing('CommonWebview', {
credentials: parsedCredentials,
});
} else {
Toast.error(
'Your session has expired. Please log in again to use the app.',
);
}

routing('CommonWebview', {
credentials: {
...parsedCredentials,
secret: accessToken || parsedCredentials.secret,
},
});
}
} catch (err) {
AsyncStorage.setItem(ASYNC_STORAGE_KEYS.credentials, '');
Toast.error(
'Your session has expired. Please log in again to use the app.',
);
}
};

useEffect(() => {
(async () => {
await NotificationService.requestUserPermission();
await NotificationService.registerAppWithFCM();

const token = await messaging().getToken();
// console.log('---token', token);
})();
messaging().onTokenRefresh(() => {
NotificationService.saveTokenToDatabase();
});
}, []);

useEffect(() => {
Expand Down Expand Up @@ -308,7 +309,7 @@ const App = () => {
});

if (screenName === ASYNC_STORAGE_KEYS.authCode && entityId === AUTH_CODE) {
AsyncStorage.setItem('authCode', entityId);
AsyncStorage.setItem(ASYNC_STORAGE_KEYS.authCode, entityId);
Toast.success('Your email is confirmed. You can login now.');
}
/* else if (screenName === DYNAMIC_LINKS_TYPES.USER) {
Expand Down Expand Up @@ -386,7 +387,8 @@ const App = () => {
headerStyle: styles.headerStyle,
headerTintColor: colors.black,
headerBackImage: () => <Icon name="left-arrow" size={32} />,
}}>
}}
options={{headerShown: false, gestureEnabled: false}}>
{/* <Stack.Screen
name="Onboarding"
component={Onboarding}
Expand All @@ -395,7 +397,7 @@ const App = () => {
<Stack.Screen
name="UserProfile"
component={UserProfile}
options={{headerShown: false}}
options={{headerShown: false, gestureEnabled: false}}
/>

{/* <Stack.Screen
Expand All @@ -408,7 +410,7 @@ const App = () => {
<Stack.Screen
name="CommonWebview"
component={CommonWebview}
options={{headerShown: false}}
options={{headerShown: false, gestureEnabled: false}}
/>
{/* <Stack.Screen
name="Profile"
Expand Down
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ android {
ndkVersion rootProject.ext.ndkVersion

defaultConfig {
applicationId "com.daostack.common"
applicationId "com.daostack.commondev"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
versionCode 6714
versionName "1.11.0"
multiDexEnabled true

// react-native-config
Expand Down
80 changes: 0 additions & 80 deletions android/app/google-services.json

This file was deleted.

1 change: 1 addition & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
Expand Down
9 changes: 2 additions & 7 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@
android:theme="@style/AppTheme">
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_notification" />

<activity
android:name=".SplashActivity"
android:exported="true"
android:theme="@style/SplashTheme"
android:label="@string/app_name">
</activity>

<activity
android:name=".MainActivity"
android:theme="@style/LaunchTheme"
android:launchMode="singleTop"
android:label="@string/app_name"
android:exported="true"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import androidx.annotation.Nullable;
import android.content.Intent;
import org.devio.rn.splashscreen.SplashScreen;

public class MainActivity extends ReactActivity {

Expand All @@ -21,7 +22,11 @@ protected String getMainComponentName() {

@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
// Use SplashTheme in AndroidManifest.xml for MainActivity, themes loads before layouts inflate
setTheme(R.style.AppTheme); // Now set the theme from Splash to App before setContentView
setContentView(R.drawable.background_splash); // Then inflate the new view
SplashScreen.show(this); // Now show the splash screen. Hide it later in JS
super.onCreate(savedInstanceState);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.daostack.common.BuildConfig;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.orhanobut.hawk.Hawk;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
Expand Down
6 changes: 6 additions & 0 deletions android/app/src/main/res/layout/splash_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

</LinearLayout>
5 changes: 4 additions & 1 deletion android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
<item name="android:windowIsFloating">false</item>
</style>

<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">@color/white</item>
<item name="android:background">@drawable/background_splash</item>
</style> -->
<style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
</style>

</resources>
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = 'common'
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-fast-openpgp'
project(':react-native-fast-openpgp').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-openpgp/android')
include ':react-native-fast-openpgp'
Expand Down
2 changes: 1 addition & 1 deletion ios/common-local-dev-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<string>dev</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.1027354410661-c5kcu3ie4gge7p6vimko5qjgie5poaai</string>
<string>com.googleusercontent.apps.870639147922-k51ofl1nn1nvkurot5scpv8qb9eaplg4</string>
</array>
</dict>
</array>
Expand Down
20 changes: 10 additions & 10 deletions ios/common.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
151C203F2499E3F4006170CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 15E907342417D1BB008A5750 /* LaunchScreen.storyboard */; };
151C20402499E3F4006170CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 15E907322417D1BB008A5750 /* Assets.xcassets */; };
151C20412499E3F4006170CC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 15E9072F2417D1B9008A5750 /* Main.storyboard */; };
151C20622499E99B006170CC /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 151C20612499E99B006170CC /* GoogleService-Info.plist */; };
153D23F924B5BE9A007E8F37 /* NunitoSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 42C6A385306D40069FD183D7 /* NunitoSans-Bold.ttf */; };
153D23FA24B5BE9A007E8F37 /* NunitoSans-Italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F2C9B59F8FFB49DFA4FF15CA /* NunitoSans-Italic.ttf */; };
153D23FB24B5BE9A007E8F37 /* NunitoSans-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8D6FB52253054110853F2376 /* NunitoSans-Light.ttf */; };
Expand Down Expand Up @@ -63,6 +62,7 @@
633AADEFA12A4EEF840ED24D /* NotoSerif-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 267EC9C3E82F4ED9B159DC28 /* NotoSerif-SemiBold.ttf */; };
84096E192A4CCC2E00CA2FFE /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84096E172A4CCC2500CA2FFE /* GoogleService-Info.plist */; };
840F88F127FEDB510011ECD6 /* common-dev-notification-service-ext.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 151C20202499CEA3006170CC /* common-dev-notification-service-ext.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
84106FF62AA1E7AC00E7BA07 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84106FF52AA1E7AC00E7BA07 /* GoogleService-Info.plist */; };
845015EB2A4D50BC0081D208 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84096E172A4CCC2500CA2FFE /* GoogleService-Info.plist */; };
88F102D71F0644038ECC212B /* NunitoSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A40576CB8A1C45D8A51C0FD5 /* NunitoSans-Regular.ttf */; };
9932C9CC0B2948FE94025468 /* NunitoSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 42C6A385306D40069FD183D7 /* NunitoSans-Bold.ttf */; };
Expand Down Expand Up @@ -125,7 +125,6 @@
151C20212499CEA3006170CC /* common-notification-service-ext copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "common-notification-service-ext copy-Info.plist"; sourceTree = SOURCE_ROOT; };
151C20522499E3F4006170CC /* common-stg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "common-stg.app"; sourceTree = BUILT_PRODUCTS_DIR; };
151C205C2499E503006170CC /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
151C20612499E99B006170CC /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
15AD00A124AB2E0F004FDADE /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
15CD0307246E873C00EDADE2 /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
15CD0309246E873C00EDADE2 /* UserNotificationsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotificationsUI.framework; path = System/Library/Frameworks/UserNotificationsUI.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -156,6 +155,7 @@
7518FC7755D4F917296C37EA /* Pods_common_dev.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_common_dev.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7963CF94C9EE55F6D82B8A1D /* Pods_common.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_common.framework; sourceTree = BUILT_PRODUCTS_DIR; };
84096E172A4CCC2500CA2FFE /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
84106FF52AA1E7AC00E7BA07 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
8D6FB52253054110853F2376 /* NunitoSans-Light.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "NunitoSans-Light.ttf"; path = "../src/Assets/fonts/NunitoSans/NunitoSans-Light.ttf"; sourceTree = "<group>"; };
9B6A7FB45B15676235BF5F49 /* Pods-common-stg.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-common-stg.release.xcconfig"; path = "Target Support Files/Pods-common-stg/Pods-common-stg.release.xcconfig"; sourceTree = "<group>"; };
A40576CB8A1C45D8A51C0FD5 /* NunitoSans-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "NunitoSans-Regular.ttf"; path = "../src/Assets/fonts/NunitoSans/NunitoSans-Regular.ttf"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -220,7 +220,7 @@
151C20592499E503006170CC /* production */ = {
isa = PBXGroup;
children = (
151C20612499E99B006170CC /* GoogleService-Info.plist */,
84106FF52AA1E7AC00E7BA07 /* GoogleService-Info.plist */,
);
path = production;
sourceTree = "<group>";
Expand Down Expand Up @@ -590,12 +590,12 @@
15E907362417D1BB008A5750 /* LaunchScreen.storyboard in Resources */,
15E907332417D1BB008A5750 /* Assets.xcassets in Resources */,
15E907312417D1B9008A5750 /* Main.storyboard in Resources */,
151C20622499E99B006170CC /* GoogleService-Info.plist in Resources */,
9932C9CC0B2948FE94025468 /* NunitoSans-Bold.ttf in Resources */,
FCD9335756174A92AE4AC3F6 /* NunitoSans-Italic.ttf in Resources */,
CDD5E5B60C08404981150417 /* NunitoSans-Light.ttf in Resources */,
88F102D71F0644038ECC212B /* NunitoSans-Regular.ttf in Resources */,
CF0B3799DD99422BA7B8AE3C /* NunitoSans-SemiBold.ttf in Resources */,
84106FF62AA1E7AC00E7BA07 /* GoogleService-Info.plist in Resources */,
1F88078D5AE44AD180187B06 /* Nunito-Regular.ttf in Resources */,
633AADEFA12A4EEF840ED24D /* NotoSerif-SemiBold.ttf in Resources */,
);
Expand Down Expand Up @@ -1386,14 +1386,14 @@
CODE_SIGN_ENTITLEMENTS = common/common.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 16;
CURRENT_PROJECT_VERSION = 22;
DEVELOPMENT_TEAM = 66CXPKJ7ZA;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "armv7 arm64";
INFOPLIST_FILE = common/Support/Info.plist;
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
INFOPLIST_PREFIX_HEADER = "";
INFOPLIST_PREPROCESS = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1402,7 +1402,7 @@
"$(SDKROOT)/usr/lib/swift",
"$(inherited)",
);
MARKETING_VERSION = 1.10.8;
MARKETING_VERSION = 1.10.12;
PRODUCT_BUNDLE_IDENTIFIER = com.daostack.common;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1423,14 +1423,14 @@
CODE_SIGN_ENTITLEMENTS = common/common.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 16;
CURRENT_PROJECT_VERSION = 22;
DEVELOPMENT_TEAM = 66CXPKJ7ZA;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "armv7 arm64";
INFOPLIST_FILE = common/Support/Info.plist;
INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional";
INFOPLIST_PREFIX_HEADER = "";
INFOPLIST_PREPROCESS = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1439,7 +1439,7 @@
"$(SDKROOT)/usr/lib/swift",
"$(inherited)",
);
MARKETING_VERSION = 1.10.8;
MARKETING_VERSION = 1.10.12;
PRODUCT_BUNDLE_IDENTIFIER = com.daostack.common;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Loading