Skip to content

Commit 71a210c

Browse files
Merge pull request #65 from p2devs/feat/public-comicbook
feat: Add Apple Sign In and CommunityTab features with enhanced notifications
2 parents 0eb7110 + 1fd2a24 commit 71a210c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+5744
-678
lines changed

App.js

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
import React, {useEffect} from 'react';
2-
import {Provider} from 'react-redux';
3-
import {PersistGate} from 'redux-persist/integration/react';
4-
import {persistor, store} from './src/Redux/Store';
5-
import {GestureHandlerRootView} from 'react-native-gesture-handler';
6-
import {RootNavigation} from './src/Navigation';
1+
import React, { useEffect } from 'react';
2+
import { Provider } from 'react-redux';
3+
import { PersistGate } from 'redux-persist/integration/react';
4+
import { persistor, store } from './src/Redux/Store';
5+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
6+
import { RootNavigation } from './src/Navigation';
77
import Loading from './src/Components/UIComp/Loading';
88
import Toast from 'react-native-toast-message';
9-
import {PaperProvider} from 'react-native-paper';
9+
import { PaperProvider } from 'react-native-paper';
1010
import ForceUpdate from './src/Components/ForceUpdate';
11-
import {ConfigCatProvider} from 'configcat-react';
12-
import {CONFIGCAT_SDK_KEY_TEST, CONFIGCAT_SDK_KEY_PROD} from '@env';
13-
import {BannerProvider} from './src/Components/UIComp/AnimeAdBanner/BannerContext';
11+
import { ConfigCatProvider } from 'configcat-react';
12+
import { CONFIGCAT_SDK_KEY_TEST, CONFIGCAT_SDK_KEY_PROD } from '@env';
13+
import { BannerProvider } from './src/Components/UIComp/AnimeAdBanner/BannerContext';
1414
import crashlytics from '@react-native-firebase/crashlytics';
1515
import analytics from '@react-native-firebase/analytics';
16+
import {
17+
configureGoogleSignIn,
18+
listenToAuthChanges,
19+
} from './src/InkNest-Externals/Community/Logic/CommunityActions';
20+
import NotificationSubscriptionBootstrapper from './src/InkNest-Externals/Notifications/components/NotificationSubscriptionBootstrapper';
1621

1722
/**
1823
* The main App component that sets up the root of the application.
@@ -24,6 +29,12 @@ import analytics from '@react-native-firebase/analytics';
2429
*/
2530
const App = () => {
2631
useEffect(() => {
32+
// Configure Google Sign-In
33+
configureGoogleSignIn();
34+
35+
// Listen to auth state changes
36+
const unsubscribeAuth = store.dispatch(listenToAuthChanges());
37+
2738
if (!__DEV__) {
2839
// Initialize Firebase Crashlytics
2940
crashlytics().log('App mounted.');
@@ -43,19 +54,26 @@ const App = () => {
4354
ErrorUtils.setGlobalHandler(errorHandler);
4455

4556
return () => {
46-
// Clean up if needed
57+
// Clean up auth listener
58+
if (unsubscribeAuth) unsubscribeAuth();
4759
};
4860
}
61+
62+
return () => {
63+
// Clean up auth listener
64+
if (unsubscribeAuth) unsubscribeAuth();
65+
};
4966
}, []);
5067

5168
return (
52-
<GestureHandlerRootView style={{flex: 1}}>
69+
<GestureHandlerRootView style={{ flex: 1 }}>
5370
<ConfigCatProvider
5471
sdkKey={__DEV__ ? CONFIGCAT_SDK_KEY_TEST : CONFIGCAT_SDK_KEY_PROD}>
5572
<Provider store={store}>
5673
<PersistGate loading={<Loading />} persistor={persistor}>
5774
<PaperProvider>
5875
<BannerProvider>
76+
<NotificationSubscriptionBootstrapper />
5977
<RootNavigation />
6078
<Toast />
6179
<ForceUpdate />

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ android {
8585
applicationId "com.p2devs.inknest"
8686
minSdkVersion rootProject.ext.minSdkVersion
8787
targetSdkVersion rootProject.ext.targetSdkVersion
88-
versionCode 31
89-
versionName "1.4.2"
88+
versionCode 32
89+
versionName "1.4.3"
9090

9191
// Increase memory allocated to Gradle
9292
dexOptions {

example.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
android_admob_interstitial_unit_id_download=ca-app-pub-xxxxxxxx/xxxxxxxx
22
ios_admob_interstitial_unit_id_download=ca-app-pub-xxxxxxxx/xxxxxxxx
3+
4+
GOOGLE_WEB_CLIENT_ID=your-web-client-id.apps.googleusercontent.com
5+
IOS_GOOGLE_CLIENT_ID=your-ios-client-id.apps.googleusercontent.com

index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,23 @@ import App from './App';
77
import {name as appName} from './app.json';
88
import 'react-native-reanimated';
99
import 'react-native-gesture-handler';
10+
import messaging from '@react-native-firebase/messaging';
11+
import crashlytics from '@react-native-firebase/crashlytics';
12+
import {
13+
appendNotificationToStorage,
14+
buildNotificationPayload,
15+
} from './src/Utils/notificationHelpers';
16+
17+
messaging().setBackgroundMessageHandler(async remoteMessage => {
18+
try {
19+
const payload = buildNotificationPayload(remoteMessage, false);
20+
console.log('Payload:', payload);
21+
if (payload) {
22+
await appendNotificationToStorage(payload);
23+
}
24+
} catch (error) {
25+
crashlytics().recordError(error);
26+
}
27+
});
1028

1129
AppRegistry.registerComponent(appName, () => App);

ios/InkNest.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@
644644
"$(inherited)",
645645
"@executable_path/Frameworks",
646646
);
647-
MARKETING_VERSION = 1.4.2;
647+
MARKETING_VERSION = 1.4.3;
648648
OTHER_LDFLAGS = (
649649
"$(inherited)",
650650
"-ObjC",
@@ -677,7 +677,7 @@
677677
"$(inherited)",
678678
"@executable_path/Frameworks",
679679
);
680-
MARKETING_VERSION = 1.4.2;
680+
MARKETING_VERSION = 1.4.3;
681681
OTHER_LDFLAGS = (
682682
"$(inherited)",
683683
"-ObjC",

ios/InkNest/AppDelegate.mm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#import <React/RCTBundleURLProvider.h>
55
#import <React/RCTLinkingManager.h>
6+
#import <GoogleSignIn/GoogleSignIn.h>
67

78
@implementation AppDelegate
89

@@ -22,11 +23,15 @@ - (BOOL)application:(UIApplication *)application
2223
openURL:(NSURL *)url
2324
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
2425
{
25-
// Handle deep linking if needed
2626
if ([RCTLinkingManager application:application openURL:url options:options]) {
2727
return YES;
2828
}
29-
29+
30+
// Allow Google Sign-In to consume the callback URL if it matches one of its schemes
31+
if ([[GIDSignIn sharedInstance] handleURL:url]) {
32+
return YES;
33+
}
34+
3035
return NO;
3136
}
3237

ios/InkNest/Info.plist

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,25 @@
7474
<string>$(MARKETING_VERSION)</string>
7575
<key>CFBundleSignature</key>
7676
<string>????</string>
77+
<key>CFBundleURLTypes</key>
78+
<array>
79+
<dict>
80+
<key>CFBundleTypeRole</key>
81+
<string>Editor</string>
82+
<key>CFBundleURLName</key>
83+
<string>REVERSED_CLIENT_ID</string>
84+
<key>CFBundleURLSchemes</key>
85+
<array>
86+
<string>com.googleusercontent.apps.1021954829778-d4c6hcqa2iudbospgkhq4ng7dg1e5c1q</string>
87+
</array>
88+
</dict>
89+
</array>
7790
<key>CFBundleVersion</key>
7891
<string>$(CURRENT_PROJECT_VERSION)</string>
7992
<key>GADApplicationIdentifier</key>
8093
<string>ca-app-pub-3157479752055629~8049473571</string>
94+
<key>GIDClientID</key>
95+
<string>1021954829778-d4c6hcqa2iudbospgkhq4ng7dg1e5c1q.apps.googleusercontent.com</string>
8196
<key>ITSAppUsesNonExemptEncryption</key>
8297
<false/>
8398
<key>LSRequiresIPhoneOS</key>
@@ -120,6 +135,7 @@
120135
<key>UIBackgroundModes</key>
121136
<array>
122137
<string>remote-notification</string>
138+
<string>fetch</string>
123139
</array>
124140
<key>UILaunchStoryboardName</key>
125141
<string>LaunchScreen</string>

ios/InkNest/InkNest.entitlements

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
<dict>
55
<key>aps-environment</key>
66
<string>development</string>
7+
<key>com.apple.developer.applesignin</key>
8+
<array>
9+
<string>Default</string>
10+
</array>
711
</dict>
812
</plist>

ios/InkNest/PrivacyInfo.xcprivacy

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
<dict>
55
<key>NSPrivacyAccessedAPITypes</key>
66
<array>
7+
<dict>
8+
<key>NSPrivacyAccessedAPIType</key>
9+
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
10+
<key>NSPrivacyAccessedAPITypeReasons</key>
11+
<array>
12+
<string>C617.1</string>
13+
<string>0A2A.1</string>
14+
</array>
15+
</dict>
716
<dict>
817
<key>NSPrivacyAccessedAPIType</key>
918
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
@@ -31,15 +40,6 @@
3140
<string>85F4.1</string>
3241
</array>
3342
</dict>
34-
<dict>
35-
<key>NSPrivacyAccessedAPIType</key>
36-
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
37-
<key>NSPrivacyAccessedAPITypeReasons</key>
38-
<array>
39-
<string>C617.1</string>
40-
<string>0A2A.1</string>
41-
</array>
42-
</dict>
4343
</array>
4444
<key>NSPrivacyCollectedDataTypes</key>
4545
<array/>

0 commit comments

Comments
 (0)