├── android ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── values-night │ │ │ │ │ └── colors.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-hdpi │ │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable │ │ │ │ │ ├── splashscreen.xml │ │ │ │ │ └── rn_edit_text_material.xml │ │ │ │ ├── values │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ └── styles.xml │ │ │ │ └── mipmap-anydpi-v26 │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── jni │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── MainApplicationModuleProvider.h │ │ │ │ ├── OnLoad.cpp │ │ │ │ ├── MainComponentsRegistry.h │ │ │ │ ├── MainApplicationModuleProvider.cpp │ │ │ │ ├── MainApplicationTurboModuleManagerDelegate.h │ │ │ │ ├── MainApplicationTurboModuleManagerDelegate.cpp │ │ │ │ └── MainComponentsRegistry.cpp │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── diegoramosgomes │ │ │ │ │ └── tabnewsapp │ │ │ │ │ ├── newarchitecture │ │ │ │ │ ├── components │ │ │ │ │ │ └── MainComponentsRegistry.java │ │ │ │ │ ├── modules │ │ │ │ │ │ └── MainApplicationTurboModuleManagerDelegate.java │ │ │ │ │ └── MainApplicationReactNativeHost.java │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainApplication.java │ │ │ └── AndroidManifest.xml │ │ └── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ └── com │ │ │ └── diegoramosgomes │ │ │ └── tabnewsapp │ │ │ └── ReactNativeFlipper.java │ ├── debug.keystore │ ├── proguard-rules.pro │ ├── build_defs.bzl │ ├── BUCK │ └── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle ├── gradle.properties ├── build.gradle ├── gradlew.bat └── gradlew ├── ios ├── Podfile.properties.json ├── tabnewsapp │ ├── Images.xcassets │ │ ├── Contents.json │ │ ├── SplashScreen.imageset │ │ │ ├── image.png │ │ │ └── Contents.json │ │ ├── AppIcon.appiconset │ │ │ ├── ItunesArtwork@2x.png │ │ │ ├── App-Icon-20x20@1x.png │ │ │ ├── App-Icon-20x20@2x.png │ │ │ ├── App-Icon-20x20@3x.png │ │ │ ├── App-Icon-29x29@1x.png │ │ │ ├── App-Icon-29x29@2x.png │ │ │ ├── App-Icon-29x29@3x.png │ │ │ ├── App-Icon-40x40@1x.png │ │ │ ├── App-Icon-40x40@2x.png │ │ │ ├── App-Icon-40x40@3x.png │ │ │ ├── App-Icon-60x60@2x.png │ │ │ ├── App-Icon-60x60@3x.png │ │ │ ├── App-Icon-76x76@1x.png │ │ │ ├── App-Icon-76x76@2x.png │ │ │ ├── App-Icon-83.5x83.5@2x.png │ │ │ └── Contents.json │ │ └── SplashScreenBackground.imageset │ │ │ ├── image.png │ │ │ └── Contents.json │ ├── noop-file.swift │ ├── AppDelegate.h │ ├── main.m │ ├── tabnewsapp.entitlements │ ├── Supporting │ │ └── Expo.plist │ ├── Info.plist │ ├── SplashScreen.storyboard │ └── AppDelegate.mm ├── .gitignore ├── .xcode.env ├── Podfile └── tabnewsapp.xcodeproj │ ├── xcshareddata │ └── xcschemes │ │ └── tabnewsapp.xcscheme │ └── project.pbxproj ├── assets ├── icon.png ├── splash.png ├── favicon.png └── adaptive-icon.png ├── tsconfig.json ├── src ├── Models │ ├── FavoriteModel.ts │ ├── UserModel.ts │ ├── PostCommentItemModel.ts │ └── PostModel.ts ├── Services │ └── api.ts ├── Components │ ├── PostComments │ │ ├── styles.ts │ │ └── index.tsx │ ├── FullscreenLoading │ │ └── index.tsx │ ├── HomeListItem │ │ ├── styles.ts │ │ └── index.tsx │ ├── CoinsInfo │ │ ├── styles.ts │ │ └── index.tsx │ ├── PostCommentItem │ │ ├── styles.ts │ │ └── index.tsx │ ├── FloatActionButton │ │ └── index.tsx │ └── Markdown │ │ └── index.tsx ├── Pages │ ├── FavoritePage │ │ ├── styles.ts │ │ └── index.tsx │ ├── PostPage │ │ ├── styles.ts │ │ └── index.tsx │ ├── CommentPage │ │ ├── styles.ts │ │ └── index.tsx │ ├── AccountPage │ │ ├── styles.ts │ │ └── index.tsx │ ├── LoginPage │ │ ├── styles.ts │ │ └── index.tsx │ ├── SplashScreenPage │ │ └── index.tsx │ ├── HomePage │ │ └── index.tsx │ ├── CreateAccountPage │ │ └── index.tsx │ └── ProfilePage │ │ └── index.tsx ├── Hooks │ ├── useComments.ts │ ├── useProfile.ts │ ├── useFavorites.ts │ ├── useContents.ts │ └── useAuth.ts ├── Routes │ ├── AuthRoutes │ │ └── index.tsx │ ├── AuccountRoutes │ │ └── index.tsx │ ├── RecentRoutes │ │ └── index.tsx │ ├── FavoriteRoutes │ │ └── index.tsx │ ├── HomeRoutes │ │ └── index.tsx │ └── index.tsx └── Contexts │ ├── FavoriteContext.tsx │ └── AuthContext.tsx ├── babel.config.js ├── metro.config.js ├── index.js ├── App.tsx ├── README.md ├── app.json ├── .gitignore └── package.json /android/app/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ios/Podfile.properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo.jsEngine": "jsc" 3 | } 4 | -------------------------------------------------------------------------------- /assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/assets/icon.png -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": {}, 3 | "extends": "expo/tsconfig.base" 4 | } 5 | -------------------------------------------------------------------------------- /assets/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/assets/splash.png -------------------------------------------------------------------------------- /assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/assets/favicon.png -------------------------------------------------------------------------------- /assets/adaptive-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/assets/adaptive-icon.png -------------------------------------------------------------------------------- /android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/debug.keystore -------------------------------------------------------------------------------- /src/Models/FavoriteModel.ts: -------------------------------------------------------------------------------- 1 | export type FavoriteModel = { 2 | id: string 3 | title: string 4 | owner_username: string 5 | } -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "expo" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/Models/UserModel.ts: -------------------------------------------------------------------------------- 1 | export type UserModel = { 2 | id: string 3 | username: string 4 | tabcoins: number 5 | tabcash: number 6 | } -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | api.cache(true); 3 | return { 4 | presets: ['babel-preset-expo'], 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /ios/tabnewsapp/noop-file.swift: -------------------------------------------------------------------------------- 1 | // 2 | // @generated 3 | // A blank Swift file must be created for native modules with Swift files to work correctly. 4 | // 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/splashscreen_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/drawable-hdpi/splashscreen_image.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/splashscreen_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/drawable-mdpi/splashscreen_image.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/splashscreen_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/SplashScreen.imageset/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/SplashScreen.imageset/image.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /src/Services/api.ts: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | 3 | const api = axios.create({ 4 | baseURL: "https://www.tabnews.com.br/api/v1", 5 | timeout: 30000 6 | }) 7 | 8 | export default api -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /metro.config.js: -------------------------------------------------------------------------------- 1 | // Learn more https://docs.expo.io/guides/customizing-metro 2 | const { getDefaultConfig } = require('expo/metro-config'); 3 | 4 | module.exports = getDefaultConfig(__dirname); 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/splashscreen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/ItunesArtwork@2x.png -------------------------------------------------------------------------------- /src/Models/PostCommentItemModel.ts: -------------------------------------------------------------------------------- 1 | export type PostCommentItemModel = { 2 | id: string 3 | body: string 4 | slug: string 5 | owner_username: string 6 | children: PostCommentItemModel[] 7 | } -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@1x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@2x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-20x20@3x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@1x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@2x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-29x29@3x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@1x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@2x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-40x40@3x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@2x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-60x60@3x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@1x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-76x76@2x.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/SplashScreenBackground.imageset/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/SplashScreenBackground.imageset/image.png -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DiegoRamosGomes/tabnews-app/HEAD/ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/App-Icon-83.5x83.5@2x.png -------------------------------------------------------------------------------- /src/Models/PostModel.ts: -------------------------------------------------------------------------------- 1 | export type PostModel = { 2 | id: string 3 | title: string 4 | tabcoins: number 5 | children_deep_count: number 6 | owner_username: string 7 | slug?: string 8 | parent_id?: string 9 | body?: string 10 | } -------------------------------------------------------------------------------- /ios/tabnewsapp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | #import 6 | 7 | @interface AppDelegate : EXAppDelegateWrapper 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /src/Components/PostComments/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | 3 | export const styles = StyleSheet.create({ 4 | container: { 5 | marginTop: 24, 6 | marginBottom: 40, 7 | flex: 0, 8 | height: '100%' 9 | }, 10 | }) -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /ios/tabnewsapp/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | #ffffff 3 | #FFFFFF 4 | #023c69 5 | #ffffff 6 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Android/IntelliJ 6 | # 7 | build/ 8 | .idea 9 | .gradle 10 | local.properties 11 | *.iml 12 | *.hprof 13 | 14 | # BUCK 15 | buck-out/ 16 | \.buckd/ 17 | *.keystore 18 | !debug.keystore 19 | 20 | # Bundle artifacts 21 | *.jsbundle 22 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | tab-news-app 3 | contain 4 | false 5 | -------------------------------------------------------------------------------- /ios/tabnewsapp/tabnewsapp.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | aps-environment 6 | development 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/jni/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | # Define the library name here. 4 | project(tabnewsapp_appmodules) 5 | 6 | # This file includes all the necessary to let you build your application with the New Architecture. 7 | include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake) 8 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { registerRootComponent } from 'expo'; 2 | 3 | import App from './App'; 4 | 5 | // registerRootComponent calls AppRegistry.registerComponent('main', () => App); 6 | // It also ensures that whether you load the app in Expo Go or in a native build, 7 | // the environment is set up appropriately 8 | registerRootComponent(App); 9 | -------------------------------------------------------------------------------- /src/Pages/FavoritePage/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | 3 | export const styles = StyleSheet.create({ 4 | container: { 5 | padding: 16 6 | }, 7 | emptyContainer: { 8 | alignItems: 'center', 9 | marginHorizontal: '20%' 10 | }, 11 | emptyText: { 12 | textAlign: 'center' 13 | } 14 | }) -------------------------------------------------------------------------------- /src/Pages/PostPage/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | 3 | export const styles = StyleSheet.create({ 4 | container: { 5 | paddingTop: 16, 6 | paddingHorizontal: 16, 7 | backgroundColor: 'white', 8 | }, 9 | title: { 10 | fontSize: 20, 11 | fontWeight: 'bold', 12 | marginBottom: 8, 13 | } 14 | }) -------------------------------------------------------------------------------- /src/Hooks/useComments.ts: -------------------------------------------------------------------------------- 1 | import api from "../Services/api"; 2 | 3 | export const useComments = () => { 4 | const getCommentsByPost = async (username: string, slug: string) => { 5 | const { data } = await api.get(`/contents/${username}/${slug}/children`) 6 | 7 | return data 8 | } 9 | 10 | return { 11 | getCommentsByPost 12 | } 13 | } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Pages/CommentPage/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | 3 | export const styles = StyleSheet.create({ 4 | container: { 5 | flex: 1, 6 | backgroundColor: 'white', 7 | paddingHorizontal: 16, 8 | }, 9 | replyTo: { 10 | marginVertical: 8, 11 | color: '#383838' 12 | }, 13 | repliesText: { 14 | fontSize: 15, 15 | fontWeight: 'bold', 16 | marginBottom: 16 17 | } 18 | }) -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/SplashScreen.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "filename": "image.png", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "scale": "3x" 15 | } 16 | ], 17 | "info": { 18 | "version": 1, 19 | "author": "expo" 20 | } 21 | } -------------------------------------------------------------------------------- /android/app/src/main/jni/MainApplicationModuleProvider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace facebook { 9 | namespace react { 10 | 11 | std::shared_ptr MainApplicationModuleProvider( 12 | const std::string &moduleName, 13 | const JavaTurboModule::InitParams ¶ms); 14 | 15 | } // namespace react 16 | } // namespace facebook 17 | -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/SplashScreenBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "filename": "image.png", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "scale": "3x" 15 | } 16 | ], 17 | "info": { 18 | "version": 1, 19 | "author": "expo" 20 | } 21 | } -------------------------------------------------------------------------------- /android/app/src/main/jni/OnLoad.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "MainApplicationTurboModuleManagerDelegate.h" 3 | #include "MainComponentsRegistry.h" 4 | 5 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { 6 | return facebook::jni::initialize(vm, [] { 7 | facebook::react::MainApplicationTurboModuleManagerDelegate:: 8 | registerNatives(); 9 | facebook::react::MainComponentsRegistry::registerNatives(); 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | .xcode.env.local 25 | 26 | # Bundle artifacts 27 | *.jsbundle 28 | 29 | # CocoaPods 30 | /Pods/ 31 | -------------------------------------------------------------------------------- /src/Pages/AccountPage/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | 3 | export const styles = StyleSheet.create({ 4 | container: { 5 | padding: 16 6 | }, 7 | item: { 8 | flexDirection: 'row', 9 | alignItems: 'center', 10 | backgroundColor: 'white', 11 | padding: 8, 12 | borderRadius: 5, 13 | borderWidth: 1, 14 | borderColor: '#c4c4c4', 15 | marginBottom: 16, 16 | }, 17 | itemText: { 18 | flex: 1 19 | }, 20 | }) -------------------------------------------------------------------------------- /src/Hooks/useProfile.ts: -------------------------------------------------------------------------------- 1 | import api from "../Services/api"; 2 | 3 | export const useProfile = () => { 4 | const getUserContents = async (username: string, page?: number, per_page?: number) => { 5 | if (!per_page) { 6 | per_page = 10 7 | } 8 | 9 | if (!page) { 10 | page = 1 11 | } 12 | 13 | const { data } = await api.get(`/contents/${username}?per_page=${per_page}&page=${page}`) 14 | return data 15 | } 16 | 17 | return { 18 | getUserContents 19 | } 20 | } -------------------------------------------------------------------------------- /App.tsx: -------------------------------------------------------------------------------- 1 | import { LogBox } from "react-native"; 2 | import { AuthProvider } from "./src/Contexts/AuthContext"; 3 | import { SplashScreenPage } from "./src/Pages/SplashScreenPage"; 4 | 5 | export default function App() { 6 | LogBox.ignoreLogs([ 7 | 'fontFamily "Courier" is not a system font and has not been loaded through Font.loadAsync.', 8 | 'Input data should be a String' 9 | ]) 10 | 11 | return ( 12 | 13 | 14 | 15 | ); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /src/Components/FullscreenLoading/index.tsx: -------------------------------------------------------------------------------- 1 | import { ActivityIndicator, Dimensions, View } from "react-native"; 2 | 3 | export const FullscreenLoading = () => { 4 | return ( 5 | 14 | 15 | 16 | ) 17 | } -------------------------------------------------------------------------------- /ios/tabnewsapp/Supporting/Expo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | EXUpdatesCheckOnLaunch 6 | ALWAYS 7 | EXUpdatesEnabled 8 | 9 | EXUpdatesLaunchWaitMs 10 | 0 11 | EXUpdatesSDKVersion 12 | 47.0.0 13 | EXUpdatesURL 14 | https://exp.host/@diegoramosgomes/tab-news-app 15 | 16 | -------------------------------------------------------------------------------- /src/Components/HomeListItem/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | 3 | export const styles = StyleSheet.create({ 4 | container: { 5 | padding: 8, 6 | borderWidth: 1, 7 | borderColor: '#c4c4c4', 8 | borderRadius: 5, 9 | backgroundColor: 'white', 10 | flexDirection: 'row', 11 | alignItems: 'center' 12 | }, 13 | bodyContainer: { 14 | flex: 1 15 | }, 16 | leftIcon: { 17 | marginRight: 8, 18 | }, 19 | postInfoContainer: { 20 | flexDirection: 'row', 21 | justifyContent: 'space-between', 22 | }, 23 | postInfo: { 24 | fontSize: 12 25 | } 26 | }) -------------------------------------------------------------------------------- /src/Components/CoinsInfo/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | 3 | export const styles = StyleSheet.create({ 4 | container: { 5 | flexDirection: 'row', 6 | alignItems: 'center' 7 | }, 8 | coinItemContainer: { 9 | flexDirection: 'row', 10 | marginLeft: 4, 11 | }, 12 | coinBox: { 13 | width: 13, 14 | height: 13, 15 | borderRadius: 5, 16 | marginRight: 2, 17 | }, 18 | tabCoin: { 19 | backgroundColor: 'green', 20 | }, 21 | tabCash: { 22 | backgroundColor: 'blue', 23 | }, 24 | coinText: { 25 | lineHeight: 14, 26 | fontSize: 13, 27 | } 28 | }) -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # react-native-reanimated 11 | -keep class com.swmansion.reanimated.** { *; } 12 | -keep class com.facebook.react.turbomodule.** { *; } 13 | 14 | # Add any project specific keep options here: 15 | -------------------------------------------------------------------------------- /src/Hooks/useFavorites.ts: -------------------------------------------------------------------------------- 1 | import { FavoriteModel } from "../Models/FavoriteModel"; 2 | import AsyncStorage from "@react-native-async-storage/async-storage"; 3 | 4 | const FAVORITES_KEY = '@tabnews-app:FAVORITES' 5 | 6 | export const useFavorites = () => { 7 | 8 | const saveFavorites = async (favorites: FavoriteModel[]) => { 9 | await AsyncStorage.setItem(FAVORITES_KEY, JSON.stringify(favorites)) 10 | } 11 | 12 | const getFavorites = async (): Promise => { 13 | const data = await AsyncStorage.getItem(FAVORITES_KEY) 14 | 15 | return JSON.parse(data ?? '[]') 16 | } 17 | 18 | return { 19 | saveFavorites, 20 | getFavorites 21 | } 22 | } -------------------------------------------------------------------------------- /android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Aplicativo mobile do tabnews 2 | 3 | Este aplicativo não é oficial, apenas um projeto hobby para brincar com a api do https://tabnews.com.br 4 | 5 | --- 6 | 7 | ### Passos para iniciar o projeto 8 | 9 | Clone o projeto 10 | 11 | ```bash 12 | git clone https://github.com/DiegoRamosGomes/tabnews-app 13 | ``` 14 | 15 | Entre no diretório do projeto 16 | 17 | ```bash 18 | cd tabnews-app 19 | ``` 20 | 21 | Instale as dependências 22 | 23 | ```bash 24 | yarn install 25 | ``` 26 | 27 | Inicie o servidor 28 | 29 | ```bash 30 | npx expo start 31 | ``` 32 | 33 | Abrir no celular 34 | ``` 35 | Escaneie o qrcode gerado com o app do Expo Go 36 | (Caso for iOS pode escanear direto pela camera do celular) 37 | ``` -------------------------------------------------------------------------------- /src/Routes/AuthRoutes/index.tsx: -------------------------------------------------------------------------------- 1 | import { createNativeStackNavigator } from "@react-navigation/native-stack"; 2 | import { LoginPage } from "../../Pages/LoginPage"; 3 | import { CreateAccountPage } from "../../Pages/CreateAccountPage"; 4 | 5 | export type AuthStackRoutes = { 6 | LoginPage: undefined 7 | RegisterPage: undefined 8 | } 9 | 10 | const AuthStack = createNativeStackNavigator() 11 | 12 | export const AuthRoutes = () => { 13 | return ( 14 | 15 | 16 | 17 | 18 | ) 19 | } -------------------------------------------------------------------------------- /src/Components/CoinsInfo/index.tsx: -------------------------------------------------------------------------------- 1 | import { Text, View } from "react-native"; 2 | import { useContext } from "react"; 3 | import AuthContext from "../../Contexts/AuthContext"; 4 | import { styles } from "./styles"; 5 | 6 | export const CoinsInfo = () => { 7 | const { user } = useContext(AuthContext) 8 | 9 | return ( 10 | 11 | 12 | 13 | 14 | {user?.tabcoins} 15 | 16 | 17 | 18 | 19 | {user?.tabcash} 20 | 21 | 22 | 23 | ) 24 | } -------------------------------------------------------------------------------- /src/Components/PostCommentItem/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | 3 | export const styles = StyleSheet.create({ 4 | commentContainer: { 5 | backgroundColor: '#f1f1f1', 6 | marginBottom: 16, 7 | padding: 8, 8 | borderRadius: 5, 9 | }, 10 | owner: { 11 | alignSelf: 'flex-start', 12 | paddingHorizontal: 6, 13 | paddingVertical: 2, 14 | color: '#0969da', 15 | backgroundColor: '#ddf4ff', 16 | fontSize: 10, 17 | }, 18 | body: { 19 | marginLeft: 8, 20 | position: 'relative', 21 | flex: 1 22 | }, 23 | quantityContainer: { 24 | flexDirection: 'row', 25 | alignItems: 'center', 26 | marginBottom: 8, 27 | paddingRight: 8 28 | }, 29 | viewCommentText: { 30 | flex: 1, 31 | alignSelf: 'flex-start' 32 | } 33 | }) -------------------------------------------------------------------------------- /src/Pages/LoginPage/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from "react-native"; 2 | 3 | export const styles = StyleSheet.create({ 4 | container: {}, 5 | title: { 6 | fontSize: 25, 7 | fontWeight: 'bold', 8 | marginBottom: 24 9 | }, 10 | input: { 11 | width: '100%', 12 | height: 40, 13 | borderWidth: 1, 14 | borderRadius: 5, 15 | paddingHorizontal: 8, 16 | marginVertical: 8 17 | }, 18 | forgotPassword: { 19 | fontSize: 12, 20 | alignSelf: 'flex-end' 21 | }, 22 | loginButtonContainer: { 23 | borderRadius: 5, 24 | paddingVertical: 8, 25 | width: '100%', 26 | backgroundColor: '#2c974b', 27 | marginVertical: 16 28 | }, 29 | loginButton: { 30 | textAlign: 'center', 31 | fontWeight: 'bold', 32 | color: 'white' 33 | }, 34 | signUp: { 35 | marginTop: 80, 36 | fontSize: 12 37 | } 38 | }) -------------------------------------------------------------------------------- /src/Components/FloatActionButton/index.tsx: -------------------------------------------------------------------------------- 1 | import { FloatingAction } from "react-native-floating-action"; 2 | import { List } from "phosphor-react-native"; 3 | import { View } from "react-native"; 4 | 5 | type FloatActionButtonItem = { 6 | text: string 7 | icon: JSX.Element 8 | name: string 9 | } 10 | 11 | interface FloatActionButtonProps { 12 | actions: FloatActionButtonItem[] 13 | onPressItem(name: string): void 14 | } 15 | 16 | export const FloatActionButton = ({actions, onPressItem}: FloatActionButtonProps) => { 17 | return ( 18 | 24 | } 27 | actions={actions} 28 | onPressItem={onPressItem} 29 | /> 30 | 31 | ) 32 | } -------------------------------------------------------------------------------- /src/Components/PostComments/index.tsx: -------------------------------------------------------------------------------- 1 | import { View } from "react-native"; 2 | import { useEffect, useState } from "react"; 3 | import { useComments } from "../../Hooks/useComments"; 4 | import { PostModel } from "../../Models/PostModel"; 5 | import { styles } from "./styles"; 6 | import { PostCommentItem } from "../PostCommentItem"; 7 | 8 | interface PostCommentsProps { 9 | post: PostModel 10 | } 11 | 12 | export const PostComments = ({ post }: PostCommentsProps) => { 13 | const { getCommentsByPost } = useComments() 14 | 15 | const [comments, setComments] = useState([]) 16 | 17 | useEffect(() => { 18 | getCommentsByPost(post.owner_username, post.slug).then(data => { 19 | setComments(data) 20 | }) 21 | }, []) 22 | 23 | return ( 24 | 25 | {comments.map((item) => )} 26 | 27 | ) 28 | } -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "tab-news-app", 4 | "slug": "tab-news-app", 5 | "version": "1.0.0", 6 | "orientation": "portrait", 7 | "icon": "./assets/icon.png", 8 | "userInterfaceStyle": "light", 9 | "splash": { 10 | "image": "./assets/splash.png", 11 | "resizeMode": "contain", 12 | "backgroundColor": "#ffffff" 13 | }, 14 | "updates": { 15 | "fallbackToCacheTimeout": 0 16 | }, 17 | "assetBundlePatterns": [ 18 | "**/*" 19 | ], 20 | "ios": { 21 | "supportsTablet": true, 22 | "bundleIdentifier": "com.diegoramosgomes.tabnewsapp" 23 | }, 24 | "android": { 25 | "adaptiveIcon": { 26 | "foregroundImage": "./assets/adaptive-icon.png", 27 | "backgroundColor": "#FFFFFF" 28 | }, 29 | "package": "com.diegoramosgomes.tabnewsapp" 30 | }, 31 | "web": { 32 | "favicon": "./assets/favicon.png" 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 14 | 17 | -------------------------------------------------------------------------------- /src/Pages/FavoritePage/index.tsx: -------------------------------------------------------------------------------- 1 | import { FlatList, Text, View } from "react-native"; 2 | import { useContext } from "react"; 3 | import { HomeListItem } from "../../Components/HomeListItem"; 4 | import FavoriteContext from "../../Contexts/FavoriteContext"; 5 | import { styles } from "./styles"; 6 | import { HeartBreak } from "phosphor-react-native"; 7 | 8 | export const FavoritePage = () => { 9 | 10 | const { favorites } = useContext(FavoriteContext) 11 | 12 | return ( 13 | 14 | } 17 | ItemSeparatorComponent={() => } 18 | keyExtractor={(item) => item.id} 19 | ListEmptyComponent={() => 20 | 21 | Vocẽ ainda não possui nenhum tópico como favorito 22 | } 23 | /> 24 | 25 | ) 26 | } -------------------------------------------------------------------------------- /src/Pages/SplashScreenPage/index.tsx: -------------------------------------------------------------------------------- 1 | import AuthContext from "../../Contexts/AuthContext"; 2 | import { FavoriteProvider } from "../../Contexts/FavoriteContext"; 3 | import { Routes } from "../../Routes"; 4 | import { StatusBar } from "expo-status-bar"; 5 | import { NavigationContainer } from "@react-navigation/native"; 6 | import { useAuth } from "../../Hooks/useAuth"; 7 | import { useContext, useEffect } from "react"; 8 | 9 | export const SplashScreenPage = () => { 10 | 11 | const { getToken } = useAuth() 12 | const { logInUser, isLogged } = useContext(AuthContext) 13 | 14 | useEffect(() => { 15 | (async () => { 16 | if (!isLogged) { 17 | const token = await getToken() 18 | 19 | if (token) { 20 | await logInUser() 21 | } 22 | } 23 | })() 24 | }, []) 25 | 26 | return ( 27 | 28 | 29 | 30 | 31 | 32 | 33 | ) 34 | } -------------------------------------------------------------------------------- /src/Hooks/useContents.ts: -------------------------------------------------------------------------------- 1 | import api from "../Services/api"; 2 | 3 | export const useContents = () => { 4 | const getLatestContents = async (page?: number, limit?: number, strategy?: 'new' | 'old' | 'relevant') => { 5 | if (!limit) { 6 | limit = 10 7 | } 8 | 9 | if (!page) { 10 | page = 1 11 | } 12 | 13 | if (!strategy) { 14 | strategy = 'relevant' 15 | } 16 | 17 | const { data } = await api.get(`/contents?per_page=${limit}&page=${page}&strategy=${strategy}`) 18 | 19 | return data 20 | } 21 | 22 | const getContent = async (username: string, postSlug: string) => { 23 | const { data } = await api.get(`/contents/${username}/${postSlug}`) 24 | 25 | return data 26 | } 27 | 28 | const giveVote = async (username: string, postSlug: string, type: string) => { 29 | await api.post(`/contents/${username}/${postSlug}/tabcoins`, { 30 | transaction_type: type 31 | }) 32 | } 33 | 34 | return { 35 | getLatestContents, 36 | getContent, 37 | giveVote 38 | } 39 | } -------------------------------------------------------------------------------- /android/app/src/main/jni/MainComponentsRegistry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace facebook { 9 | namespace react { 10 | 11 | class MainComponentsRegistry 12 | : public facebook::jni::HybridClass { 13 | public: 14 | // Adapt it to the package you used for your Java class. 15 | constexpr static auto kJavaDescriptor = 16 | "Lcom/diegoramosgomes/tabnewsapp/newarchitecture/components/MainComponentsRegistry;"; 17 | 18 | static void registerNatives(); 19 | 20 | MainComponentsRegistry(ComponentFactory *delegate); 21 | 22 | private: 23 | static std::shared_ptr 24 | sharedProviderRegistry(); 25 | 26 | static jni::local_ref initHybrid( 27 | jni::alias_ref, 28 | ComponentFactory *delegate); 29 | }; 30 | 31 | } // namespace react 32 | } // namespace facebook 33 | -------------------------------------------------------------------------------- /android/app/src/main/jni/MainApplicationModuleProvider.cpp: -------------------------------------------------------------------------------- 1 | #include "MainApplicationModuleProvider.h" 2 | 3 | #include 4 | #include 5 | 6 | namespace facebook { 7 | namespace react { 8 | 9 | std::shared_ptr MainApplicationModuleProvider( 10 | const std::string &moduleName, 11 | const JavaTurboModule::InitParams ¶ms) { 12 | // Here you can provide your own module provider for TurboModules coming from 13 | // either your application or from external libraries. The approach to follow 14 | // is similar to the following (for a library called `samplelibrary`: 15 | // 16 | // auto module = samplelibrary_ModuleProvider(moduleName, params); 17 | // if (module != nullptr) { 18 | // return module; 19 | // } 20 | // return rncore_ModuleProvider(moduleName, params); 21 | 22 | // Module providers autolinked by RN CLI 23 | auto rncli_module = rncli_ModuleProvider(moduleName, params); 24 | if (rncli_module != nullptr) { 25 | return rncli_module; 26 | } 27 | 28 | return rncore_ModuleProvider(moduleName, params); 29 | } 30 | 31 | } // namespace react 32 | } // namespace facebook 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .expo/ 3 | dist/ 4 | npm-debug.* 5 | *.jks 6 | *.p8 7 | *.p12 8 | *.key 9 | *.mobileprovision 10 | *.orig.* 11 | web-build/ 12 | .idea/ 13 | 14 | # macOS 15 | .DS_Store 16 | 17 | # @generated expo-cli sync-b25d41054229aa64f1468014f243adfae8268af2 18 | # The following patterns were generated by expo-cli 19 | 20 | # OSX 21 | # 22 | .DS_Store 23 | 24 | # Xcode 25 | # 26 | build/ 27 | *.pbxuser 28 | !default.pbxuser 29 | *.mode1v3 30 | !default.mode1v3 31 | *.mode2v3 32 | !default.mode2v3 33 | *.perspectivev3 34 | !default.perspectivev3 35 | xcuserdata 36 | *.xccheckout 37 | *.moved-aside 38 | DerivedData 39 | *.hmap 40 | *.ipa 41 | *.xcuserstate 42 | project.xcworkspace 43 | 44 | # Android/IntelliJ 45 | # 46 | build/ 47 | .idea 48 | .gradle 49 | local.properties 50 | *.iml 51 | *.hprof 52 | .cxx/ 53 | 54 | # node.js 55 | # 56 | node_modules/ 57 | npm-debug.log 58 | yarn-error.log 59 | 60 | # BUCK 61 | buck-out/ 62 | \.buckd/ 63 | *.keystore 64 | !debug.keystore 65 | 66 | # Bundle artifacts 67 | *.jsbundle 68 | 69 | # CocoaPods 70 | /ios/Pods/ 71 | 72 | # Expo 73 | .expo/ 74 | web-build/ 75 | dist/ 76 | 77 | # @end expo-cli -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'tab-news-app' 2 | 3 | apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle"); 4 | useExpoModules() 5 | 6 | apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle"); 7 | applyNativeModulesSettingsGradle(settings) 8 | 9 | include ':app' 10 | includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile()) 11 | 12 | if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") { 13 | include(":ReactAndroid") 14 | project(":ReactAndroid").projectDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../ReactAndroid"); 15 | include(":ReactAndroid:hermes-engine") 16 | project(":ReactAndroid:hermes-engine").projectDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../ReactAndroid/hermes-engine"); 17 | } 18 | -------------------------------------------------------------------------------- /src/Hooks/useAuth.ts: -------------------------------------------------------------------------------- 1 | import AsyncStorage from "@react-native-async-storage/async-storage"; 2 | import { UserModel } from "../Models/UserModel"; 3 | 4 | const AUTH_TOKEN_KEY = '@tabnews-app:AUTH_TOKEN_KEY' 5 | const AUTH_USER_KEY = '@tabnews-app:AUTH_USER_KEY' 6 | 7 | export const useAuth = () => { 8 | const saveToken = async (token: string) => { 9 | await AsyncStorage.setItem(AUTH_TOKEN_KEY, token) 10 | } 11 | 12 | const deleteToken = async () => { 13 | await AsyncStorage.removeItem(AUTH_TOKEN_KEY) 14 | } 15 | 16 | const getToken = async () => { 17 | return await AsyncStorage.getItem(AUTH_TOKEN_KEY) 18 | } 19 | 20 | const saveUser = async (user: UserModel) => { 21 | const userString = JSON.stringify(user) 22 | await AsyncStorage.setItem(AUTH_USER_KEY, userString) 23 | } 24 | 25 | const getUser = async () => { 26 | const userString = await AsyncStorage.getItem(AUTH_USER_KEY) 27 | 28 | return JSON.parse(userString) 29 | } 30 | 31 | const deleteUser = async () => { 32 | await AsyncStorage.removeItem(AUTH_USER_KEY) 33 | } 34 | 35 | return { 36 | deleteToken, 37 | getToken, 38 | saveToken, 39 | saveUser, 40 | getUser, 41 | deleteUser 42 | } 43 | } -------------------------------------------------------------------------------- /src/Routes/AuccountRoutes/index.tsx: -------------------------------------------------------------------------------- 1 | import { createNativeStackNavigator } from "@react-navigation/native-stack"; 2 | import { AccountPage } from "../../Pages/AccountPage"; 3 | import { useContext } from "react"; 4 | import AuthContext from "../../Contexts/AuthContext"; 5 | import { CoinsInfo } from "../../Components/CoinsInfo"; 6 | import { ProfilePage } from "../../Pages/ProfilePage"; 7 | import { PostPage } from "../../Pages/PostPage"; 8 | 9 | export type AccountStackRoutes = { 10 | AccountPage: undefined 11 | ProfilePage: { 12 | username?: string 13 | } 14 | } 15 | 16 | const AccountStack = createNativeStackNavigator() 17 | 18 | export const AccountRoutes = () => { 19 | const { isLogged } = useContext(AuthContext) 20 | 21 | return ( 22 | isLogged ? : null 25 | }}> 26 | 27 | 28 | 32 | 33 | ) 34 | } -------------------------------------------------------------------------------- /src/Routes/RecentRoutes/index.tsx: -------------------------------------------------------------------------------- 1 | import { createNativeStackNavigator } from "@react-navigation/native-stack"; 2 | import { HomePage } from "../../Pages/HomePage"; 3 | import { PostPage } from "../../Pages/PostPage"; 4 | import { PostModel } from "../../Models/PostModel"; 5 | import { CommentPage } from "../../Pages/CommentPage"; 6 | import { CoinsInfo } from "../../Components/CoinsInfo"; 7 | import { useContext } from "react"; 8 | import AuthContext from "../../Contexts/AuthContext"; 9 | 10 | export type RecentStackRoutes = { 11 | HomePage: undefined 12 | PostPage: { 13 | post: PostModel 14 | } 15 | } 16 | 17 | const HomeStack = createNativeStackNavigator(); 18 | 19 | export const RecentRoutes = () => { 20 | const { isLogged } = useContext(AuthContext) 21 | 22 | return ( 23 | isLogged ? : null 26 | }}> 27 | 28 | 32 | 33 | 34 | ) 35 | } -------------------------------------------------------------------------------- /src/Pages/AccountPage/index.tsx: -------------------------------------------------------------------------------- 1 | import { Text, TouchableOpacity, View } from "react-native"; 2 | import { ArrowRight } from "phosphor-react-native"; 3 | import { styles } from "./styles"; 4 | import { useContext } from "react"; 5 | import AuthContext from "../../Contexts/AuthContext"; 6 | import { useNavigation } from "@react-navigation/native"; 7 | import { NativeStackNavigationProp } from "@react-navigation/native-stack"; 8 | import { AccountStackRoutes } from "../../Routes/AuccountRoutes"; 9 | 10 | export const AccountPage = () => { 11 | 12 | const { signOut, user } = useContext(AuthContext) 13 | const navigation = useNavigation>() 14 | 15 | const handleSingOut = async () => { 16 | await signOut() 17 | } 18 | 19 | const handleOpenProfile = () => { 20 | navigation.navigate('ProfilePage') 21 | } 22 | 23 | return ( 24 | 25 | 26 | Perfil 27 | 28 | 29 | 30 | Sair 31 | 32 | 33 | 34 | ) 35 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tab-news-app", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "start": "expo start --dev-client", 6 | "android": "expo run:android", 7 | "ios": "expo run:ios", 8 | "web": "expo start --web" 9 | }, 10 | "dependencies": { 11 | "@react-native-async-storage/async-storage": "~1.17.3", 12 | "@react-navigation/bottom-tabs": "^6.4.1", 13 | "@react-navigation/native": "^6.0.14", 14 | "@react-navigation/native-stack": "^6.7.0", 15 | "@types/react": "~18.0.24", 16 | "@types/react-native": "~0.70.6", 17 | "axios": "^1.2.0", 18 | "expo": "~47.0.8", 19 | "expo-linking": "~3.2.3", 20 | "expo-splash-screen": "~0.17.5", 21 | "expo-status-bar": "~1.4.2", 22 | "phosphor-react-native": "^1.1.2", 23 | "punycode": "^2.1.1", 24 | "react": "18.1.0", 25 | "react-native": "0.70.5", 26 | "react-native-floating-action": "^1.22.0", 27 | "react-native-github-markdown": "^4.1.0", 28 | "react-native-markdown-display": "^7.0.0-alpha.2", 29 | "react-native-safe-area-context": "4.4.1", 30 | "react-native-screens": "~3.18.0", 31 | "react-native-svg": "13.4.0", 32 | "react-native-webview": "11.23.1", 33 | "typescript": "^4.6.3" 34 | }, 35 | "devDependencies": { 36 | "@babel/core": "^7.12.9" 37 | }, 38 | "private": true 39 | } 40 | -------------------------------------------------------------------------------- /android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | namespace facebook { 8 | namespace react { 9 | 10 | class MainApplicationTurboModuleManagerDelegate 11 | : public jni::HybridClass< 12 | MainApplicationTurboModuleManagerDelegate, 13 | TurboModuleManagerDelegate> { 14 | public: 15 | // Adapt it to the package you used for your Java class. 16 | static constexpr auto kJavaDescriptor = 17 | "Lcom/diegoramosgomes/tabnewsapp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;"; 18 | 19 | static jni::local_ref initHybrid(jni::alias_ref); 20 | 21 | static void registerNatives(); 22 | 23 | std::shared_ptr getTurboModule( 24 | const std::string &name, 25 | const std::shared_ptr &jsInvoker) override; 26 | std::shared_ptr getTurboModule( 27 | const std::string &name, 28 | const JavaTurboModule::InitParams ¶ms) override; 29 | 30 | /** 31 | * Test-only method. Allows user to verify whether a TurboModule can be 32 | * created by instances of this class. 33 | */ 34 | bool canCreateTurboModule(const std::string &name); 35 | }; 36 | 37 | } // namespace react 38 | } // namespace facebook 39 | -------------------------------------------------------------------------------- /src/Routes/FavoriteRoutes/index.tsx: -------------------------------------------------------------------------------- 1 | import { createNativeStackNavigator } from "@react-navigation/native-stack"; 2 | import { PostPage } from "../../Pages/PostPage"; 3 | import { PostModel } from "../../Models/PostModel"; 4 | import { CommentPage } from "../../Pages/CommentPage"; 5 | import { FavoritePage } from "../../Pages/FavoritePage"; 6 | import { CoinsInfo } from "../../Components/CoinsInfo"; 7 | import { useContext } from "react"; 8 | import AuthContext from "../../Contexts/AuthContext"; 9 | 10 | export type FavoriteStackRoutes = { 11 | FavoritePage: undefined 12 | PostPage: { 13 | post: PostModel 14 | } 15 | CommentPage: { 16 | post: PostModel 17 | } 18 | } 19 | 20 | const FavoriteStack = createNativeStackNavigator(); 21 | 22 | export const FavoriteRoutes = () => { 23 | const { isLogged } = useContext(AuthContext) 24 | 25 | return ( 26 | isLogged ? : null 29 | }}> 30 | 31 | 35 | 36 | 37 | ) 38 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/diegoramosgomes/tabnewsapp/newarchitecture/components/MainComponentsRegistry.java: -------------------------------------------------------------------------------- 1 | package com.diegoramosgomes.tabnewsapp.newarchitecture.components; 2 | 3 | import com.facebook.jni.HybridData; 4 | import com.facebook.proguard.annotations.DoNotStrip; 5 | import com.facebook.react.fabric.ComponentFactory; 6 | import com.facebook.soloader.SoLoader; 7 | 8 | /** 9 | * Class responsible to load the custom Fabric Components. This class has native methods and needs a 10 | * corresponding C++ implementation/header file to work correctly (already placed inside the jni/ 11 | * folder for you). 12 | * 13 | *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the 14 | * `newArchEnabled` property). Is ignored otherwise. 15 | */ 16 | @DoNotStrip 17 | public class MainComponentsRegistry { 18 | static { 19 | SoLoader.loadLibrary("fabricjni"); 20 | } 21 | 22 | @DoNotStrip private final HybridData mHybridData; 23 | 24 | @DoNotStrip 25 | private native HybridData initHybrid(ComponentFactory componentFactory); 26 | 27 | @DoNotStrip 28 | private MainComponentsRegistry(ComponentFactory componentFactory) { 29 | mHybridData = initHybrid(componentFactory); 30 | } 31 | 32 | @DoNotStrip 33 | public static MainComponentsRegistry register(ComponentFactory componentFactory) { 34 | return new MainComponentsRegistry(componentFactory); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.diegoramosgomes.tabnewsapp", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.diegoramosgomes.tabnewsapp", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /src/Routes/HomeRoutes/index.tsx: -------------------------------------------------------------------------------- 1 | import { createNativeStackNavigator } from "@react-navigation/native-stack"; 2 | import { HomePage } from "../../Pages/HomePage"; 3 | import { PostPage } from "../../Pages/PostPage"; 4 | import { PostModel } from "../../Models/PostModel"; 5 | import { PostCommentItemModel } from "../../Models/PostCommentItemModel"; 6 | import { CommentPage } from "../../Pages/CommentPage"; 7 | import { useContext } from "react"; 8 | import AuthContext from "../../Contexts/AuthContext"; 9 | import { CoinsInfo } from "../../Components/CoinsInfo"; 10 | import { ProfilePage } from "../../Pages/ProfilePage"; 11 | 12 | export type HomeStackRoutes = { 13 | HomePage: undefined 14 | PostPage: { 15 | post: PostModel 16 | } 17 | CommentPage: { 18 | comment: PostCommentItemModel 19 | } 20 | ProfilePage: { 21 | username?: string 22 | } 23 | } 24 | 25 | const HomeStack = createNativeStackNavigator(); 26 | 27 | export const HomeRoutes = () => { 28 | const { isLogged } = useContext(AuthContext) 29 | 30 | return ( 31 | isLogged ? : null 34 | }}> 35 | 36 | 40 | 41 | 42 | 43 | ) 44 | } -------------------------------------------------------------------------------- /src/Contexts/FavoriteContext.tsx: -------------------------------------------------------------------------------- 1 | import { createContext, useEffect, useState } from "react"; 2 | import { FavoriteModel } from "../Models/FavoriteModel"; 3 | import { useFavorites } from "../Hooks/useFavorites"; 4 | import { PostModel } from "../Models/PostModel"; 5 | 6 | interface FavoriteContextProps { 7 | favorites: FavoriteModel[] 8 | 9 | isFavorite(post: PostModel): boolean 10 | 11 | toggleFavorite(post: PostModel): void 12 | } 13 | 14 | const FavoriteContext = createContext({} as FavoriteContextProps) 15 | 16 | export const FavoriteProvider = ({ children }) => { 17 | const { getFavorites, saveFavorites } = useFavorites() 18 | 19 | const [favorites, setFavorites] = useState([]) 20 | 21 | useEffect(() => { 22 | getFavorites() 23 | .then(data => setFavorites(data)) 24 | }, []) 25 | 26 | useEffect(() => { 27 | saveFavorites(favorites).then() 28 | }, [favorites]) 29 | 30 | const isFavorite = (post: PostModel) => { 31 | const exist = favorites.find(item => item.id === post.id) 32 | 33 | return !!exist 34 | } 35 | 36 | const toggleFavorite = (post: PostModel) => { 37 | if (!isFavorite(post)) { 38 | setFavorites(prevState => [...prevState, post]) 39 | } else { 40 | const newList = favorites.filter(value => value.id != post.id) 41 | setFavorites([...newList]) 42 | } 43 | } 44 | 45 | return ( 46 | 51 | {children} 52 | 53 | ) 54 | } 55 | 56 | export default FavoriteContext -------------------------------------------------------------------------------- /android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp: -------------------------------------------------------------------------------- 1 | #include "MainApplicationTurboModuleManagerDelegate.h" 2 | #include "MainApplicationModuleProvider.h" 3 | 4 | namespace facebook { 5 | namespace react { 6 | 7 | jni::local_ref 8 | MainApplicationTurboModuleManagerDelegate::initHybrid( 9 | jni::alias_ref) { 10 | return makeCxxInstance(); 11 | } 12 | 13 | void MainApplicationTurboModuleManagerDelegate::registerNatives() { 14 | registerHybrid({ 15 | makeNativeMethod( 16 | "initHybrid", MainApplicationTurboModuleManagerDelegate::initHybrid), 17 | makeNativeMethod( 18 | "canCreateTurboModule", 19 | MainApplicationTurboModuleManagerDelegate::canCreateTurboModule), 20 | }); 21 | } 22 | 23 | std::shared_ptr 24 | MainApplicationTurboModuleManagerDelegate::getTurboModule( 25 | const std::string &name, 26 | const std::shared_ptr &jsInvoker) { 27 | // Not implemented yet: provide pure-C++ NativeModules here. 28 | return nullptr; 29 | } 30 | 31 | std::shared_ptr 32 | MainApplicationTurboModuleManagerDelegate::getTurboModule( 33 | const std::string &name, 34 | const JavaTurboModule::InitParams ¶ms) { 35 | return MainApplicationModuleProvider(name, params); 36 | } 37 | 38 | bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule( 39 | const std::string &name) { 40 | return getTurboModule(name, nullptr) != nullptr || 41 | getTurboModule(name, {.moduleName = name}) != nullptr; 42 | } 43 | 44 | } // namespace react 45 | } // namespace facebook 46 | -------------------------------------------------------------------------------- /src/Routes/index.tsx: -------------------------------------------------------------------------------- 1 | import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; 2 | import { Clock, Heart, House, User } from 'phosphor-react-native'; 3 | import { HomeRoutes } from './HomeRoutes'; 4 | import { RecentRoutes } from "./RecentRoutes"; 5 | import { FavoriteRoutes } from "./FavoriteRoutes"; 6 | import { AuthRoutes } from "./AuthRoutes"; 7 | import { useContext } from "react"; 8 | import AuthContext from "../Contexts/AuthContext"; 9 | import { AccountRoutes } from "./AuccountRoutes"; 10 | 11 | export type AppRoutesStackParams = { 12 | HomeRoutes: undefined 13 | RecentRoutes: undefined 14 | FavoritePage: undefined 15 | } 16 | 17 | const Tab = createBottomTabNavigator(); 18 | 19 | export const Routes = () => { 20 | 21 | const { isLogged, user } = useContext(AuthContext) 22 | 23 | return ( 24 | 25 | , 30 | tabBarLabel: 'Relevantes', 31 | }} 32 | /> 33 | , 38 | tabBarLabel: 'Recentes', 39 | }} 40 | /> 41 | , 46 | tabBarLabel: 'Favoritos' 47 | }} 48 | /> 49 | , 54 | tabBarLabel: isLogged ? user.username : 'Login' 55 | }} 56 | /> 57 | 58 | ); 59 | }; 60 | -------------------------------------------------------------------------------- /src/Components/Markdown/index.tsx: -------------------------------------------------------------------------------- 1 | import MarkdownWebView from "react-native-github-markdown"; 2 | import { useState } from "react"; 3 | import { WebViewMessageEvent } from "react-native-webview"; 4 | import { Linking } from "react-native"; 5 | 6 | interface MarkdownProps { 7 | body: string 8 | } 9 | 10 | const injectedScript = ` 11 | function waitForBridge() { 12 | if (!window.ReactNativeWebView.postMessage) { 13 | setTimeout(waitForBridge, 200); 14 | } else { 15 | window.document.querySelector("body").style.backgroundColor = "transparent" 16 | setTimeout(postMessage, 500); 17 | } 18 | } 19 | 20 | function postMessage() { 21 | window.ReactNativeWebView.postMessage( 22 | Math.max( 23 | document.documentElement.scrollHeight, 24 | document.body.scrollHeight, 25 | ) 26 | ); 27 | } 28 | waitForBridge(); 29 | true; 30 | `; 31 | export const Markdown = ({body}: MarkdownProps) => { 32 | const [height, setHeight] = useState(0); 33 | 34 | const onMessage = (e: WebViewMessageEvent) => { 35 | setHeight(parseInt(e.nativeEvent.data, 10)); 36 | }; 37 | 38 | return ( 39 | { 48 | if (request.url !== 'about:blank') { 49 | const canOpen = Linking.canOpenURL(request.url) 50 | if (canOpen) { 51 | Linking.openURL(request.url) 52 | } 53 | 54 | return false 55 | } 56 | return true 57 | }} 58 | nestedScrollEnabled={false} 59 | style={{ 60 | flex: 0, 61 | height: height, 62 | backgroundColor: 'transparent', 63 | padding: 0, 64 | marginTop: -30, 65 | marginHorizontal: -35, 66 | marginBottom: -30 67 | }} 68 | /> 69 | ) 70 | } -------------------------------------------------------------------------------- /src/Contexts/AuthContext.tsx: -------------------------------------------------------------------------------- 1 | import { createContext, useState } from "react"; 2 | import { UserModel } from "../Models/UserModel"; 3 | import api from "../Services/api"; 4 | import { useAuth } from "../Hooks/useAuth"; 5 | 6 | interface AuthContextProps { 7 | user: UserModel 8 | isLogged: boolean 9 | 10 | signIn(email: string, password: string): Promise 11 | 12 | signOut(): void 13 | 14 | signUp(username: string, email: string, password: string): Promise 15 | 16 | logInUser(): void 17 | } 18 | 19 | const AuthContext = createContext({} as AuthContextProps) 20 | 21 | export const AuthProvider = ({ children }) => { 22 | const { saveToken, deleteToken, saveUser, deleteUser } = useAuth() 23 | 24 | const [user, setUser] = useState(null) 25 | 26 | const signIn = async (email: string, password: string) => { 27 | try { 28 | const res = await api.post('/sessions', { email, password }) 29 | 30 | if (res.status !== 201) { 31 | return false 32 | } 33 | 34 | const userData = await api.get(`/user`) 35 | 36 | await saveToken(res.data.token) 37 | await saveUser(userData.data) 38 | setUser(userData.data) 39 | return true 40 | } catch (e) { 41 | return false 42 | } 43 | } 44 | 45 | const signOut = async () => { 46 | await api.delete('/sessions') 47 | await deleteToken() 48 | await deleteUser() 49 | setUser(null) 50 | } 51 | 52 | const signUp = async (username: string, email: string, password: string) => { 53 | await api.post('/users', { username, email, password }) 54 | } 55 | 56 | const logInUser = async () => { 57 | const userData = await api.get(`/user`) 58 | setUser(userData.data) 59 | } 60 | 61 | return ( 62 | 70 | {children} 71 | 72 | ) 73 | } 74 | 75 | export default AuthContext -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 23 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/diegoramosgomes/tabnewsapp/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java: -------------------------------------------------------------------------------- 1 | package com.diegoramosgomes.tabnewsapp.newarchitecture.modules; 2 | 3 | import com.facebook.jni.HybridData; 4 | import com.facebook.react.ReactPackage; 5 | import com.facebook.react.ReactPackageTurboModuleManagerDelegate; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.soloader.SoLoader; 8 | import java.util.List; 9 | 10 | /** 11 | * Class responsible to load the TurboModules. This class has native methods and needs a 12 | * corresponding C++ implementation/header file to work correctly (already placed inside the jni/ 13 | * folder for you). 14 | * 15 | *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the 16 | * `newArchEnabled` property). Is ignored otherwise. 17 | */ 18 | public class MainApplicationTurboModuleManagerDelegate 19 | extends ReactPackageTurboModuleManagerDelegate { 20 | 21 | private static volatile boolean sIsSoLibraryLoaded; 22 | 23 | protected MainApplicationTurboModuleManagerDelegate( 24 | ReactApplicationContext reactApplicationContext, List packages) { 25 | super(reactApplicationContext, packages); 26 | } 27 | 28 | protected native HybridData initHybrid(); 29 | 30 | native boolean canCreateTurboModule(String moduleName); 31 | 32 | public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder { 33 | protected MainApplicationTurboModuleManagerDelegate build( 34 | ReactApplicationContext context, List packages) { 35 | return new MainApplicationTurboModuleManagerDelegate(context, packages); 36 | } 37 | } 38 | 39 | @Override 40 | protected synchronized void maybeLoadOtherSoLibraries() { 41 | if (!sIsSoLibraryLoaded) { 42 | // If you change the name of your application .so file in the Android.mk file, 43 | // make sure you update the name here as well. 44 | SoLoader.loadLibrary("tabnewsapp_appmodules"); 45 | sIsSoLibraryLoaded = true; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Components/HomeListItem/index.tsx: -------------------------------------------------------------------------------- 1 | import { Text, TouchableOpacity, View } from "react-native"; 2 | import { styles } from "./styles"; 3 | import { PostModel } from "../../Models/PostModel"; 4 | import type { NativeStackNavigationProp } from '@react-navigation/native-stack'; 5 | import { HomeStackRoutes } from "../../Routes/HomeRoutes"; 6 | import { useNavigation } from "@react-navigation/native"; 7 | import { ArrowBendUpLeft, Article } from "phosphor-react-native"; 8 | 9 | interface HomeListItemProps { 10 | post: PostModel 11 | withLeftIcon?: boolean 12 | } 13 | 14 | type ScreenProps = NativeStackNavigationProp 15 | 16 | export const HomeListItem = ({ post, withLeftIcon }: HomeListItemProps) => { 17 | 18 | const navigation = useNavigation() 19 | 20 | const handleOpenPost = () => { 21 | navigation.push('PostPage', { post }) 22 | } 23 | 24 | const handleOpenProfile = () => { 25 | navigation.navigate('ProfilePage', { username: post.owner_username }) 26 | } 27 | 28 | return ( 29 | 30 | 31 | { 32 | withLeftIcon ? 33 | post.parent_id ? 34 | 35 | :

36 | : null 37 | } 38 | 39 | {post.parent_id ? post.body : post.title} 40 | 41 | 42 | {post.tabcoins} 43 | Tabcoins 44 | 45 | 46 | {post.children_deep_count} 47 | Comentarios 48 | 49 | 50 | {post.owner_username} 51 | 52 | 53 | 54 | 55 | 56 | ) 57 | } -------------------------------------------------------------------------------- /src/Components/PostCommentItem/index.tsx: -------------------------------------------------------------------------------- 1 | import { styles } from "./styles"; 2 | import { Text, TouchableWithoutFeedback, View } from "react-native"; 3 | import { PostCommentItemModel } from "../../Models/PostCommentItemModel"; 4 | import { ArrowRight, ChatText } from "phosphor-react-native"; 5 | import { useNavigation } from "@react-navigation/native"; 6 | import { NativeStackNavigationProp } from "@react-navigation/native-stack"; 7 | import { HomeStackRoutes } from "../../Routes/HomeRoutes"; 8 | import { Markdown } from "../Markdown"; 9 | 10 | interface PostCommentItemProps { 11 | comment: PostCommentItemModel, 12 | canNavigate?: boolean 13 | } 14 | 15 | export const PostCommentItem = ({ comment, canNavigate }: PostCommentItemProps) => { 16 | 17 | const navigation = useNavigation>() 18 | if (canNavigate === undefined || canNavigate === null) { 19 | canNavigate = true 20 | } 21 | 22 | const handleOpenComment = () => { 23 | if (canNavigate) { 24 | navigation.push('CommentPage', { comment }) 25 | } 26 | } 27 | 28 | return ( 29 | 30 | 31 | {comment.owner_username} 32 | 33 | 34 | { 35 | comment.children?.length > 0 && canNavigate ? 36 | <> 37 | 42 | 43 | 44 | {comment.children.length} Comentario{comment.children?.length > 1 ? 's' : ''} 45 | 46 | 47 | 48 | : null 49 | } 50 | 51 | 52 | 53 | ) 54 | } -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | 25 | # Automatically convert third-party libraries to use AndroidX 26 | android.enableJetifier=true 27 | 28 | # Version of flipper SDK to use with React Native 29 | FLIPPER_VERSION=0.125.0 30 | 31 | # Use this property to specify which architecture you want to build. 32 | # You can also override it from the CLI using 33 | # ./gradlew -PreactNativeArchitectures=x86_64 34 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 35 | 36 | # Use this property to enable support to the new architecture. 37 | # This will allow you to use TurboModules and the Fabric render in 38 | # your application. You should enable this flag either if you want 39 | # to write custom TurboModules/Fabric components OR use libraries that 40 | # are providing them. 41 | newArchEnabled=false 42 | 43 | # The hosted JavaScript engine 44 | # Supported values: expo.jsEngine = "hermes" | "jsc" 45 | expo.jsEngine=jsc 46 | 47 | # Enable GIF support in React Native images (~200 B increase) 48 | expo.gif.enabled=true 49 | # Enable webp support in React Native images (~85 KB increase) 50 | expo.webp.enabled=true 51 | # Enable animated webp support (~3.4 MB increase) 52 | # Disabled by default because iOS doesn't support animated webp 53 | expo.webp.animated=false 54 | -------------------------------------------------------------------------------- /src/Pages/HomePage/index.tsx: -------------------------------------------------------------------------------- 1 | import { useContents } from "../../Hooks/useContents"; 2 | import { useCallback, useEffect, useState } from "react"; 3 | import { ActivityIndicator, FlatList, RefreshControl, View } from "react-native"; 4 | import { HomeListItem } from "../../Components/HomeListItem"; 5 | import { AppRoutesStackParams } from "../../Routes"; 6 | import { NativeStackNavigationProp } from "@react-navigation/native-stack"; 7 | 8 | type ScreenOptions = NativeStackNavigationProp 9 | 10 | export const HomePage = ({ route }: ScreenOptions) => { 11 | const { getLatestContents } = useContents() 12 | 13 | const strategyToConsult = route.name === 'HomePage' ? 'relevant' : 'new' 14 | 15 | const [contents, setContents] = useState([]) 16 | const [isLoading, setIsLoading] = useState(false) 17 | const [refreshing, setRefreshing] = useState(false) 18 | 19 | const perPage = 10 20 | 21 | useEffect(() => { 22 | loadPosts().then() 23 | }, []) 24 | 25 | const loadPosts = async () => { 26 | setIsLoading(true) 27 | const page = contents.length === 0 ? 1 : ((contents.length / perPage) + 1) 28 | const data = await getLatestContents(page, perPage, strategyToConsult) 29 | setContents([...contents, ...data]) 30 | setIsLoading(false) 31 | } 32 | 33 | const onRefresh = useCallback(() => { 34 | setRefreshing(true) 35 | setContents([]) 36 | loadPosts().then(() => { 37 | setRefreshing(false) 38 | }) 39 | }, []); 40 | 41 | return ( 42 | 43 | 44 | 50 | } 51 | contentContainerStyle={{ 52 | marginHorizontal: 16 53 | }} 54 | data={contents} 55 | keyExtractor={(item) => item.id} 56 | renderItem={({ item }) => } 57 | ItemSeparatorComponent={() => } 58 | onEndReached={loadPosts} 59 | onEndReachedThreshold={0.2} 60 | ListFooterComponent={() => { 61 | return ( 62 | <> 63 | {isLoading && !refreshing ? : null} 64 | 65 | ) 66 | }} 67 | /> 68 | 69 | ) 70 | } -------------------------------------------------------------------------------- /android/app/src/main/jni/MainComponentsRegistry.cpp: -------------------------------------------------------------------------------- 1 | #include "MainComponentsRegistry.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace facebook { 10 | namespace react { 11 | 12 | MainComponentsRegistry::MainComponentsRegistry(ComponentFactory *delegate) {} 13 | 14 | std::shared_ptr 15 | MainComponentsRegistry::sharedProviderRegistry() { 16 | auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry(); 17 | 18 | // Autolinked providers registered by RN CLI 19 | rncli_registerProviders(providerRegistry); 20 | 21 | // Custom Fabric Components go here. You can register custom 22 | // components coming from your App or from 3rd party libraries here. 23 | // 24 | // providerRegistry->add(concreteComponentDescriptorProvider< 25 | // AocViewerComponentDescriptor>()); 26 | return providerRegistry; 27 | } 28 | 29 | jni::local_ref 30 | MainComponentsRegistry::initHybrid( 31 | jni::alias_ref, 32 | ComponentFactory *delegate) { 33 | auto instance = makeCxxInstance(delegate); 34 | 35 | auto buildRegistryFunction = 36 | [](EventDispatcher::Weak const &eventDispatcher, 37 | ContextContainer::Shared const &contextContainer) 38 | -> ComponentDescriptorRegistry::Shared { 39 | auto registry = MainComponentsRegistry::sharedProviderRegistry() 40 | ->createComponentDescriptorRegistry( 41 | {eventDispatcher, contextContainer}); 42 | 43 | auto mutableRegistry = 44 | std::const_pointer_cast(registry); 45 | 46 | mutableRegistry->setFallbackComponentDescriptor( 47 | std::make_shared( 48 | ComponentDescriptorParameters{ 49 | eventDispatcher, contextContainer, nullptr})); 50 | 51 | return registry; 52 | }; 53 | 54 | delegate->buildRegistryFunction = buildRegistryFunction; 55 | return instance; 56 | } 57 | 58 | void MainComponentsRegistry::registerNatives() { 59 | registerHybrid({ 60 | makeNativeMethod("initHybrid", MainComponentsRegistry::initHybrid), 61 | }); 62 | } 63 | 64 | } // namespace react 65 | } // namespace facebook 66 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") 2 | require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") 3 | require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules") 4 | 5 | require 'json' 6 | podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} 7 | 8 | platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0' 9 | install! 'cocoapods', 10 | :deterministic_uuids => false 11 | 12 | target 'tabnewsapp' do 13 | use_expo_modules! 14 | config = use_native_modules! 15 | 16 | use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] 17 | 18 | # Flags change depending on the env values. 19 | flags = get_default_flags() 20 | 21 | use_react_native!( 22 | :path => config[:reactNativePath], 23 | :hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes', 24 | :fabric_enabled => flags[:fabric_enabled], 25 | # An absolute path to your application root. 26 | :app_path => "#{Pod::Config.instance.installation_root}/..", 27 | # 28 | # Uncomment to opt-in to using Flipper 29 | # Note that if you have use_frameworks! enabled, Flipper will not work 30 | # :flipper_configuration => !ENV['CI'] ? FlipperConfiguration.enabled : FlipperConfiguration.disabled, 31 | ) 32 | 33 | post_install do |installer| 34 | react_native_post_install( 35 | installer, 36 | # Set `mac_catalyst_enabled` to `true` in order to apply patches 37 | # necessary for Mac Catalyst builds 38 | :mac_catalyst_enabled => false 39 | ) 40 | __apply_Xcode_12_5_M1_post_install_workaround(installer) 41 | 42 | # This is necessary for Xcode 14, because it signs resource bundles by default 43 | # when building for devices. 44 | installer.target_installation_results.pod_target_installation_results 45 | .each do |pod_name, target_installation_result| 46 | target_installation_result.resource_bundle_targets.each do |resource_bundle_target| 47 | resource_bundle_target.build_configurations.each do |config| 48 | config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' 49 | end 50 | end 51 | end 52 | end 53 | 54 | post_integrate do |installer| 55 | begin 56 | expo_patch_react_imports!(installer) 57 | rescue => e 58 | Pod::UI.warn e 59 | end 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /src/Pages/CommentPage/index.tsx: -------------------------------------------------------------------------------- 1 | import { ScrollView, Text, View } from "react-native"; 2 | import { PostCommentItemModel } from "../../Models/PostCommentItemModel"; 3 | import { NativeStackNavigationProp } from "@react-navigation/native-stack"; 4 | import { HomeStackRoutes } from "../../Routes/HomeRoutes"; 5 | import { PostCommentItem } from "../../Components/PostCommentItem"; 6 | import { styles } from "./styles"; 7 | import { FloatActionButton } from "../../Components/FloatActionButton"; 8 | import { ThumbsDown, ThumbsUp } from "phosphor-react-native"; 9 | import { useContents } from "../../Hooks/useContents"; 10 | import { useContext } from "react"; 11 | import AuthContext from "../../Contexts/AuthContext"; 12 | 13 | type ScreenProps = NativeStackNavigationProp 14 | 15 | export const CommentPage = ({ route }: ScreenProps) => { 16 | 17 | const comment: PostCommentItemModel = route.params.comment 18 | 19 | const { giveVote } = useContents() 20 | const { logInUser } = useContext(AuthContext) 21 | 22 | const handleClickFloatItem = (name: string) => { 23 | switch (name) { 24 | case 'tabcoin_up': 25 | giveVote(comment.owner_username, comment.slug, 'credit') 26 | .then(() => { 27 | logInUser() 28 | }) 29 | .catch(reason => console.log(reason)) 30 | break 31 | case 'tabcoin_down': 32 | giveVote(comment.owner_username, comment.slug, 'debit') 33 | .then(() => { 34 | logInUser() 35 | }) 36 | .catch(reason => console.log(reason)) 37 | 38 | break 39 | } 40 | } 41 | 42 | return ( 43 | <> 44 | , 49 | name: "tabcoin_up", 50 | }, 51 | { 52 | text: "Desaprovar", 53 | icon: , 54 | name: "tabcoin_down", 55 | }, 56 | ]} 57 | onPressItem={handleClickFloatItem} 58 | /> 59 | 60 | Em resposta á: {comment.owner_username} 61 | 62 | 63 | Respostas 64 | 65 | {comment.children.map(item => { 66 | return 67 | })} 68 | 69 | 70 | 71 | ) 72 | } -------------------------------------------------------------------------------- /ios/tabnewsapp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | tab-news-app 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleURLTypes 24 | 25 | 26 | CFBundleURLSchemes 27 | 28 | com.diegoramosgomes.tabnewsapp 29 | 30 | 31 | 32 | CFBundleVersion 33 | 1 34 | LSRequiresIPhoneOS 35 | 36 | NSAppTransportSecurity 37 | 38 | NSAllowsArbitraryLoads 39 | 40 | NSExceptionDomains 41 | 42 | localhost 43 | 44 | NSExceptionAllowsInsecureHTTPLoads 45 | 46 | 47 | 48 | 49 | UILaunchStoryboardName 50 | SplashScreen 51 | UIRequiredDeviceCapabilities 52 | 53 | armv7 54 | 55 | UIRequiresFullScreen 56 | 57 | UIStatusBarStyle 58 | UIStatusBarStyleDefault 59 | UISupportedInterfaceOrientations 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationPortraitUpsideDown 63 | 64 | UISupportedInterfaceOrientations~ipad 65 | 66 | UIInterfaceOrientationPortrait 67 | UIInterfaceOrientationPortraitUpsideDown 68 | UIInterfaceOrientationLandscapeLeft 69 | UIInterfaceOrientationLandscapeRight 70 | 71 | UIUserInterfaceStyle 72 | Light 73 | UIViewControllerBasedStatusBarAppearance 74 | 75 | 76 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = findProperty('android.buildToolsVersion') ?: '31.0.0' 6 | minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '21') 7 | compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '31') 8 | targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '31') 9 | if (findProperty('android.kotlinVersion')) { 10 | kotlinVersion = findProperty('android.kotlinVersion') 11 | } 12 | frescoVersion = findProperty('expo.frescoVersion') ?: '2.5.0' 13 | 14 | if (System.properties['os.arch'] == 'aarch64') { 15 | // For M1 Users we need to use the NDK 24 which added support for aarch64 16 | ndkVersion = '24.0.8215888' 17 | } else { 18 | // Otherwise we default to the side-by-side NDK version from AGP. 19 | ndkVersion = '21.4.7075529' 20 | } 21 | } 22 | repositories { 23 | google() 24 | mavenCentral() 25 | } 26 | dependencies { 27 | classpath('com.android.tools.build:gradle:7.2.1') 28 | classpath('com.facebook.react:react-native-gradle-plugin') 29 | classpath('de.undercouch:gradle-download-task:5.0.1') 30 | // NOTE: Do not place your application dependencies here; they belong 31 | // in the individual module build.gradle files 32 | } 33 | } 34 | 35 | def REACT_NATIVE_VERSION = new File(['node', '--print', "JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim()) 36 | 37 | allprojects { 38 | configurations.all { 39 | resolutionStrategy { 40 | force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION 41 | } 42 | } 43 | 44 | repositories { 45 | mavenLocal() 46 | maven { 47 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 48 | url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android')) 49 | } 50 | maven { 51 | // Android JSC is installed from npm 52 | url(new File(['node', '--print', "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), '../dist')) 53 | } 54 | 55 | google() 56 | mavenCentral { 57 | // We don't want to fetch react-native from Maven Central as there are 58 | // older versions over there. 59 | content { 60 | excludeGroup 'com.facebook.react' 61 | } 62 | } 63 | maven { url 'https://www.jitpack.io' } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Pages/CreateAccountPage/index.tsx: -------------------------------------------------------------------------------- 1 | import { Text, TextInput, TouchableOpacity, View } from "react-native"; 2 | import { useContext, useState } from "react"; 3 | import { styles } from "../LoginPage/styles"; 4 | import AuthContext from "../../Contexts/AuthContext"; 5 | import { FullscreenLoading } from "../../Components/FullscreenLoading"; 6 | import { NativeStackNavigationProp } from "@react-navigation/native-stack"; 7 | import { AuthStackRoutes } from "../../Routes/AuthRoutes"; 8 | 9 | const mailFormatValidator = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/; 10 | 11 | type ScreenProps = NativeStackNavigationProp 12 | 13 | export const CreateAccountPage = ({ navigation }: ScreenProps) => { 14 | 15 | const { signUp } = useContext(AuthContext) 16 | 17 | const [username, setUsername] = useState('') 18 | const [email, setEmail] = useState('') 19 | const [password, setPassword] = useState('') 20 | const [isLoading, setIsLoading] = useState(false) 21 | 22 | const handleSignUp = async () => { 23 | if (!email.match(mailFormatValidator)) { 24 | alert('preencha todos os campos') 25 | return 26 | } 27 | 28 | if (!username.length) { 29 | alert('Nome de usuario obrigatório') 30 | return 31 | } 32 | 33 | if (!password.length) { 34 | alert('Senha obrigatória') 35 | return 36 | } 37 | 38 | setIsLoading(true) 39 | signUp(username, email, password) 40 | .then(() => { 41 | setIsLoading(false) 42 | navigation.navigate('LoginPage') 43 | }) 44 | .catch(() => { 45 | alert('Verifique os dados informados e tente novamente') 46 | setIsLoading(false) 47 | }) 48 | } 49 | 50 | return ( 51 | <> 52 | {isLoading && } 53 | 54 | Cadastro 55 | 56 | 64 | 73 | 80 | 84 | Criar Cadastro 85 | 86 | 87 | 88 | ) 89 | } -------------------------------------------------------------------------------- /src/Pages/PostPage/index.tsx: -------------------------------------------------------------------------------- 1 | import { ScrollView, Text, View } from "react-native"; 2 | import { NativeStackScreenProps } from '@react-navigation/native-stack'; 3 | import { HomeStackRoutes } from "../../Routes/HomeRoutes"; 4 | import { styles } from "./styles"; 5 | import { useContents } from "../../Hooks/useContents"; 6 | import { useContext, useEffect, useState } from "react"; 7 | import { PostComments } from "../../Components/PostComments"; 8 | import { Heart, ThumbsDown, ThumbsUp } from "phosphor-react-native"; 9 | import FavoriteContext from "../../Contexts/FavoriteContext"; 10 | import AuthContext from "../../Contexts/AuthContext"; 11 | import { FloatActionButton } from "../../Components/FloatActionButton"; 12 | import { Markdown } from "../../Components/Markdown"; 13 | 14 | type ScreenProps = NativeStackScreenProps; 15 | 16 | export const PostPage = ({ route }: ScreenProps) => { 17 | const post = route.params.post 18 | 19 | const { getContent, giveVote } = useContents() 20 | const { isFavorite, toggleFavorite } = useContext(FavoriteContext) 21 | const { logInUser } = useContext(AuthContext) 22 | 23 | const [postContent, setPostContent] = useState() 24 | 25 | useEffect(() => { 26 | (async () => { 27 | if (!postContent) { 28 | const data = await getContent(post.owner_username, post.slug) 29 | setPostContent(data) 30 | } 31 | })() 32 | }, []) 33 | 34 | const handleClickFloatItem = (name: string) => { 35 | switch (name) { 36 | case 'is_favorite': 37 | toggleFavorite(post) 38 | break 39 | case 'tabcoin_up': 40 | giveVote(post.owner_username, post.slug, 'credit') 41 | .then(() => { 42 | logInUser() 43 | }) 44 | break 45 | case 'tabcoin_down': 46 | giveVote(post.owner_username, post.slug, 'debit') 47 | .then(() => { 48 | logInUser() 49 | }) 50 | break 51 | } 52 | } 53 | 54 | return ( 55 | <> 56 | , 61 | name: "tabcoin_up", 62 | }, 63 | { 64 | text: isFavorite(post) ? "Desfavoritar" : "Favoritar", 65 | icon: , 66 | name: "is_favorite", 67 | }, 68 | { 69 | text: "Desaprovar", 70 | icon: , 71 | name: "tabcoin_down", 72 | }, 73 | ]} 74 | onPressItem={handleClickFloatItem} 75 | /> 76 | 80 | {post.title} 81 | 84 | 85 | 86 | 87 | 88 | 89 | ) 90 | } -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if %ERRORLEVEL% equ 0 goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if %ERRORLEVEL% equ 0 goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | set EXIT_CODE=%ERRORLEVEL% 84 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 85 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 86 | exit /b %EXIT_CODE% 87 | 88 | :mainEnd 89 | if "%OS%"=="Windows_NT" endlocal 90 | 91 | :omega 92 | -------------------------------------------------------------------------------- /ios/tabnewsapp/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "iphone", 5 | "size": "20x20", 6 | "scale": "2x", 7 | "filename": "App-Icon-20x20@2x.png" 8 | }, 9 | { 10 | "idiom": "iphone", 11 | "size": "20x20", 12 | "scale": "3x", 13 | "filename": "App-Icon-20x20@3x.png" 14 | }, 15 | { 16 | "idiom": "iphone", 17 | "size": "29x29", 18 | "scale": "1x", 19 | "filename": "App-Icon-29x29@1x.png" 20 | }, 21 | { 22 | "idiom": "iphone", 23 | "size": "29x29", 24 | "scale": "2x", 25 | "filename": "App-Icon-29x29@2x.png" 26 | }, 27 | { 28 | "idiom": "iphone", 29 | "size": "29x29", 30 | "scale": "3x", 31 | "filename": "App-Icon-29x29@3x.png" 32 | }, 33 | { 34 | "idiom": "iphone", 35 | "size": "40x40", 36 | "scale": "2x", 37 | "filename": "App-Icon-40x40@2x.png" 38 | }, 39 | { 40 | "idiom": "iphone", 41 | "size": "40x40", 42 | "scale": "3x", 43 | "filename": "App-Icon-40x40@3x.png" 44 | }, 45 | { 46 | "idiom": "iphone", 47 | "size": "60x60", 48 | "scale": "2x", 49 | "filename": "App-Icon-60x60@2x.png" 50 | }, 51 | { 52 | "idiom": "iphone", 53 | "size": "60x60", 54 | "scale": "3x", 55 | "filename": "App-Icon-60x60@3x.png" 56 | }, 57 | { 58 | "idiom": "ipad", 59 | "size": "20x20", 60 | "scale": "1x", 61 | "filename": "App-Icon-20x20@1x.png" 62 | }, 63 | { 64 | "idiom": "ipad", 65 | "size": "20x20", 66 | "scale": "2x", 67 | "filename": "App-Icon-20x20@2x.png" 68 | }, 69 | { 70 | "idiom": "ipad", 71 | "size": "29x29", 72 | "scale": "1x", 73 | "filename": "App-Icon-29x29@1x.png" 74 | }, 75 | { 76 | "idiom": "ipad", 77 | "size": "29x29", 78 | "scale": "2x", 79 | "filename": "App-Icon-29x29@2x.png" 80 | }, 81 | { 82 | "idiom": "ipad", 83 | "size": "40x40", 84 | "scale": "1x", 85 | "filename": "App-Icon-40x40@1x.png" 86 | }, 87 | { 88 | "idiom": "ipad", 89 | "size": "40x40", 90 | "scale": "2x", 91 | "filename": "App-Icon-40x40@2x.png" 92 | }, 93 | { 94 | "idiom": "ipad", 95 | "size": "76x76", 96 | "scale": "1x", 97 | "filename": "App-Icon-76x76@1x.png" 98 | }, 99 | { 100 | "idiom": "ipad", 101 | "size": "76x76", 102 | "scale": "2x", 103 | "filename": "App-Icon-76x76@2x.png" 104 | }, 105 | { 106 | "idiom": "ipad", 107 | "size": "83.5x83.5", 108 | "scale": "2x", 109 | "filename": "App-Icon-83.5x83.5@2x.png" 110 | }, 111 | { 112 | "idiom": "ios-marketing", 113 | "size": "1024x1024", 114 | "scale": "1x", 115 | "filename": "ItunesArtwork@2x.png" 116 | } 117 | ], 118 | "info": { 119 | "version": 1, 120 | "author": "expo" 121 | } 122 | } -------------------------------------------------------------------------------- /src/Pages/LoginPage/index.tsx: -------------------------------------------------------------------------------- 1 | import { Linking, Text, TextInput, TouchableOpacity, TouchableWithoutFeedback, View } from "react-native"; 2 | import { useContext, useState } from "react"; 3 | import { styles } from "./styles"; 4 | import AuthContext from "../../Contexts/AuthContext"; 5 | import { FullscreenLoading } from "../../Components/FullscreenLoading"; 6 | import { NativeStackNavigationProp } from "@react-navigation/native-stack"; 7 | import { AuthStackRoutes } from "../../Routes/AuthRoutes"; 8 | 9 | const mailFormatValidator = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/; 10 | 11 | type ScreenProps = NativeStackNavigationProp 12 | 13 | export const LoginPage = ({ navigation }: ScreenProps) => { 14 | 15 | const { signIn } = useContext(AuthContext) 16 | 17 | const [email, setEmail] = useState('') 18 | const [password, setPassword] = useState('') 19 | const [isLoading, setIsLoading] = useState(false) 20 | 21 | const handleSignIn = () => { 22 | setIsLoading(true) 23 | 24 | if (!email.match(mailFormatValidator)) { 25 | alert('preencha todos os campos') 26 | setIsLoading(false) 27 | return 28 | } 29 | 30 | signIn(email, password).then(value => { 31 | if (!value) { 32 | alert('dados incorretos') 33 | } 34 | 35 | setIsLoading(false) 36 | }) 37 | } 38 | 39 | const handleSignUp = async () => { 40 | navigation.navigate('RegisterPage') 41 | } 42 | 43 | const handleForgotPassword = async () => { 44 | setIsLoading(true) 45 | 46 | const url = 'https://www.tabnews.com.br/cadastro/recuperar' 47 | const canOpen = Linking.canOpenURL(url) 48 | if (canOpen) { 49 | await Linking.openURL(url) 50 | } 51 | 52 | setIsLoading(false) 53 | } 54 | 55 | return ( 56 | <> 57 | {isLoading && } 58 | 59 | Login 60 | 61 | 70 | 77 | 78 | Esqueci minha senha 79 | 80 | 81 | 85 | Login 86 | 87 | 88 | ou 89 | 90 | 91 | Novo no TabNews? Crie sua conta aqui. 92 | 93 | 94 | 95 | ) 96 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/diegoramosgomes/tabnewsapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.diegoramosgomes.tabnewsapp; 2 | 3 | import android.os.Build; 4 | import android.os.Bundle; 5 | 6 | import com.facebook.react.ReactActivity; 7 | import com.facebook.react.ReactActivityDelegate; 8 | import com.facebook.react.ReactRootView; 9 | 10 | import expo.modules.ReactActivityDelegateWrapper; 11 | 12 | public class MainActivity extends ReactActivity { 13 | @Override 14 | protected void onCreate(Bundle savedInstanceState) { 15 | // Set the theme to AppTheme BEFORE onCreate to support 16 | // coloring the background, status bar, and navigation bar. 17 | // This is required for expo-splash-screen. 18 | setTheme(R.style.AppTheme); 19 | super.onCreate(null); 20 | } 21 | 22 | /** 23 | * Returns the name of the main component registered from JavaScript. 24 | * This is used to schedule rendering of the component. 25 | */ 26 | @Override 27 | protected String getMainComponentName() { 28 | return "main"; 29 | } 30 | 31 | /** 32 | * Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and 33 | * you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer 34 | * (Paper). 35 | */ 36 | @Override 37 | protected ReactActivityDelegate createReactActivityDelegate() { 38 | return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, 39 | new MainActivityDelegate(this, getMainComponentName()) 40 | ); 41 | } 42 | 43 | /** 44 | * Align the back button behavior with Android S 45 | * where moving root activities to background instead of finishing activities. 46 | * @see onBackPressed 47 | */ 48 | @Override 49 | public void invokeDefaultOnBackPressed() { 50 | if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) { 51 | if (!moveTaskToBack(false)) { 52 | // For non-root activities, use the default implementation to finish them. 53 | super.invokeDefaultOnBackPressed(); 54 | } 55 | return; 56 | } 57 | 58 | // Use the default back button implementation on Android S 59 | // because it's doing more than {@link Activity#moveTaskToBack} in fact. 60 | super.invokeDefaultOnBackPressed(); 61 | } 62 | 63 | public static class MainActivityDelegate extends ReactActivityDelegate { 64 | public MainActivityDelegate(ReactActivity activity, String mainComponentName) { 65 | super(activity, mainComponentName); 66 | } 67 | 68 | @Override 69 | protected ReactRootView createRootView() { 70 | ReactRootView reactRootView = new ReactRootView(getContext()); 71 | // If you opted-in for the New Architecture, we enable the Fabric Renderer. 72 | reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED); 73 | return reactRootView; 74 | } 75 | 76 | @Override 77 | protected boolean isConcurrentRootEnabled() { 78 | // If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18). 79 | // More on this on https://reactjs.org/blog/2022/03/29/react-v18.html 80 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /android/app/src/debug/java/com/diegoramosgomes/tabnewsapp/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.diegoramosgomes.tabnewsapp; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 32 | client.addPlugin(new ReactFlipperPlugin()); 33 | client.addPlugin(new DatabasesFlipperPlugin(context)); 34 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 35 | client.addPlugin(CrashReporterPlugin.getInstance()); 36 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 37 | NetworkingModule.setCustomClientBuilder( 38 | new NetworkingModule.CustomClientBuilder() { 39 | @Override 40 | public void apply(OkHttpClient.Builder builder) { 41 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 42 | } 43 | }); 44 | client.addPlugin(networkFlipperPlugin); 45 | client.start(); 46 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 47 | // Hence we run if after all native modules have been initialized 48 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 49 | if (reactContext == null) { 50 | reactInstanceManager.addReactInstanceEventListener( 51 | new ReactInstanceManager.ReactInstanceEventListener() { 52 | @Override 53 | public void onReactContextInitialized(ReactContext reactContext) { 54 | reactInstanceManager.removeReactInstanceEventListener(this); 55 | reactContext.runOnNativeModulesQueueThread( 56 | new Runnable() { 57 | @Override 58 | public void run() { 59 | client.addPlugin(new FrescoFlipperPlugin()); 60 | } 61 | }); 62 | } 63 | }); 64 | } else { 65 | client.addPlugin(new FrescoFlipperPlugin()); 66 | } 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /ios/tabnewsapp.xcodeproj/xcshareddata/xcschemes/tabnewsapp.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/Pages/ProfilePage/index.tsx: -------------------------------------------------------------------------------- 1 | import { NativeStackNavigationProp } from "@react-navigation/native-stack"; 2 | import { AccountStackRoutes } from "../../Routes/AuccountRoutes"; 3 | import { useCallback, useContext, useEffect, useState } from "react"; 4 | import AuthContext from "../../Contexts/AuthContext"; 5 | import { useProfile } from "../../Hooks/useProfile"; 6 | import { ActivityIndicator, FlatList, RefreshControl, TextInput, View } from "react-native"; 7 | import { HomeListItem } from "../../Components/HomeListItem"; 8 | import { MagnifyingGlass } from "phosphor-react-native"; 9 | 10 | 11 | export const ProfilePage = ({ route }: NativeStackNavigationProp) => { 12 | const { user } = useContext(AuthContext) 13 | const { getUserContents } = useProfile() 14 | 15 | const [page, setPage] = useState(1) 16 | const [contents, setContents] = useState([]) 17 | const [isLoading, setIsLoading] = useState(false) 18 | const [searchText, setSearchText] = useState('') 19 | const [refreshing, setRefreshing] = useState(false) 20 | const [hasMoreData, setHasMoreData] = useState(true) 21 | 22 | const username = route.params?.username ?? user.username 23 | const perPage = 5 24 | 25 | const filteredContents = contents?.filter((item) => { 26 | return item?.body?.toLowerCase().includes(searchText.toLowerCase()) || 27 | item?.title?.toLowerCase().includes(searchText.toLowerCase()) 28 | }) 29 | 30 | useEffect(() => { 31 | loadContents().then() 32 | }, []) 33 | 34 | const onRefresh = useCallback(() => { 35 | setHasMoreData(true) 36 | setRefreshing(true) 37 | setPage(1) 38 | setContents([]) 39 | loadContents().then(() => { 40 | setRefreshing(false) 41 | }) 42 | }, []); 43 | 44 | const loadContents = async () => { 45 | setIsLoading(true) 46 | 47 | const data = await getUserContents(username, page, perPage) 48 | if (data.length === 0) { 49 | setHasMoreData(false) 50 | setIsLoading(false) 51 | return 52 | } 53 | 54 | setContents([...contents, ...data]) 55 | setPage(prevState => prevState + 1) 56 | setIsLoading(false) 57 | } 58 | 59 | return ( 60 | <> 61 | 69 | 75 | 76 | 77 | 87 | 88 | 94 | } 95 | contentContainerStyle={{ 96 | margin: 16, 97 | paddingBottom: 24 98 | }} 99 | data={searchText != '' ? filteredContents : contents} 100 | keyExtractor={(item) => item.id} 101 | renderItem={({ item }) => } 102 | ItemSeparatorComponent={() => } 103 | onEndReached={hasMoreData ? loadContents : null} 104 | onEndReachedThreshold={0.2} 105 | ListFooterComponent={() => { 106 | return ( 107 | <> 108 | {isLoading && !refreshing ? : null} 109 | 110 | ) 111 | }} 112 | /> 113 | 114 | ) 115 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/diegoramosgomes/tabnewsapp/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.diegoramosgomes.tabnewsapp; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.content.res.Configuration; 6 | import androidx.annotation.NonNull; 7 | 8 | import com.facebook.react.PackageList; 9 | import com.facebook.react.ReactApplication; 10 | import com.facebook.react.ReactInstanceManager; 11 | import com.facebook.react.ReactNativeHost; 12 | import com.facebook.react.ReactPackage; 13 | import com.facebook.react.config.ReactFeatureFlags; 14 | import com.facebook.soloader.SoLoader; 15 | import com.diegoramosgomes.tabnewsapp.newarchitecture.MainApplicationReactNativeHost; 16 | 17 | import expo.modules.ApplicationLifecycleDispatcher; 18 | import expo.modules.ReactNativeHostWrapper; 19 | 20 | import java.lang.reflect.InvocationTargetException; 21 | import java.util.List; 22 | 23 | public class MainApplication extends Application implements ReactApplication { 24 | private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper( 25 | this, 26 | new ReactNativeHost(this) { 27 | @Override 28 | public boolean getUseDeveloperSupport() { 29 | return BuildConfig.DEBUG; 30 | } 31 | 32 | @Override 33 | protected List getPackages() { 34 | @SuppressWarnings("UnnecessaryLocalVariable") 35 | List packages = new PackageList(this).getPackages(); 36 | // Packages that cannot be autolinked yet can be added manually here, for example: 37 | // packages.add(new MyReactNativePackage()); 38 | return packages; 39 | } 40 | 41 | @Override 42 | protected String getJSMainModuleName() { 43 | return "index"; 44 | } 45 | }); 46 | 47 | private final ReactNativeHost mNewArchitectureNativeHost = 48 | new ReactNativeHostWrapper(this, new MainApplicationReactNativeHost(this)); 49 | 50 | @Override 51 | public ReactNativeHost getReactNativeHost() { 52 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 53 | return mNewArchitectureNativeHost; 54 | } else { 55 | return mReactNativeHost; 56 | } 57 | } 58 | 59 | @Override 60 | public void onCreate() { 61 | super.onCreate(); 62 | // If you opted-in for the New Architecture, we enable the TurboModule system 63 | ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; 64 | SoLoader.init(this, /* native exopackage */ false); 65 | 66 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 67 | ApplicationLifecycleDispatcher.onApplicationCreate(this); 68 | } 69 | 70 | @Override 71 | public void onConfigurationChanged(@NonNull Configuration newConfig) { 72 | super.onConfigurationChanged(newConfig); 73 | ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig); 74 | } 75 | 76 | /** 77 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 78 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 79 | * 80 | * @param context 81 | * @param reactInstanceManager 82 | */ 83 | private static void initializeFlipper( 84 | Context context, ReactInstanceManager reactInstanceManager) { 85 | if (BuildConfig.DEBUG) { 86 | try { 87 | /* 88 | We use reflection here to pick up the class that initializes Flipper, 89 | since Flipper library is not available in release mode 90 | */ 91 | Class aClass = Class.forName("com.diegoramosgomes.tabnewsapp.ReactNativeFlipper"); 92 | aClass 93 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 94 | .invoke(null, context, reactInstanceManager); 95 | } catch (ClassNotFoundException e) { 96 | e.printStackTrace(); 97 | } catch (NoSuchMethodException e) { 98 | e.printStackTrace(); 99 | } catch (IllegalAccessException e) { 100 | e.printStackTrace(); 101 | } catch (InvocationTargetException e) { 102 | e.printStackTrace(); 103 | } 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /ios/tabnewsapp/SplashScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/diegoramosgomes/tabnewsapp/newarchitecture/MainApplicationReactNativeHost.java: -------------------------------------------------------------------------------- 1 | package com.diegoramosgomes.tabnewsapp.newarchitecture; 2 | 3 | import android.app.Application; 4 | import androidx.annotation.NonNull; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactInstanceManager; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.ReactPackageTurboModuleManagerDelegate; 10 | import com.facebook.react.bridge.JSIModulePackage; 11 | import com.facebook.react.bridge.JSIModuleProvider; 12 | import com.facebook.react.bridge.JSIModuleSpec; 13 | import com.facebook.react.bridge.JSIModuleType; 14 | import com.facebook.react.bridge.JavaScriptContextHolder; 15 | import com.facebook.react.bridge.ReactApplicationContext; 16 | import com.facebook.react.bridge.UIManager; 17 | import com.facebook.react.fabric.ComponentFactory; 18 | import com.facebook.react.fabric.CoreComponentsRegistry; 19 | import com.facebook.react.fabric.EmptyReactNativeConfig; 20 | import com.facebook.react.fabric.FabricJSIModuleProvider; 21 | import com.facebook.react.fabric.ReactNativeConfig; 22 | import com.facebook.react.uimanager.ViewManagerRegistry; 23 | import com.diegoramosgomes.tabnewsapp.BuildConfig; 24 | import com.diegoramosgomes.tabnewsapp.newarchitecture.components.MainComponentsRegistry; 25 | import com.diegoramosgomes.tabnewsapp.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate; 26 | import java.util.ArrayList; 27 | import java.util.List; 28 | 29 | /** 30 | * A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both 31 | * TurboModule delegates and the Fabric Renderer. 32 | * 33 | *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the 34 | * `newArchEnabled` property). Is ignored otherwise. 35 | */ 36 | public class MainApplicationReactNativeHost extends ReactNativeHost { 37 | public MainApplicationReactNativeHost(Application application) { 38 | super(application); 39 | } 40 | 41 | @Override 42 | public boolean getUseDeveloperSupport() { 43 | return BuildConfig.DEBUG; 44 | } 45 | 46 | @Override 47 | protected List getPackages() { 48 | List packages = new PackageList(this).getPackages(); 49 | // Packages that cannot be autolinked yet can be added manually here, for example: 50 | // packages.add(new MyReactNativePackage()); 51 | // TurboModules must also be loaded here providing a valid TurboReactPackage implementation: 52 | // packages.add(new TurboReactPackage() { ... }); 53 | // If you have custom Fabric Components, their ViewManagers should also be loaded here 54 | // inside a ReactPackage. 55 | return packages; 56 | } 57 | 58 | @Override 59 | protected String getJSMainModuleName() { 60 | return "index"; 61 | } 62 | 63 | @NonNull 64 | @Override 65 | protected ReactPackageTurboModuleManagerDelegate.Builder 66 | getReactPackageTurboModuleManagerDelegateBuilder() { 67 | // Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary 68 | // for the new architecture and to use TurboModules correctly. 69 | return new MainApplicationTurboModuleManagerDelegate.Builder(); 70 | } 71 | 72 | @Override 73 | protected JSIModulePackage getJSIModulePackage() { 74 | return new JSIModulePackage() { 75 | @Override 76 | public List getJSIModules( 77 | final ReactApplicationContext reactApplicationContext, 78 | final JavaScriptContextHolder jsContext) { 79 | final List specs = new ArrayList<>(); 80 | 81 | // Here we provide a new JSIModuleSpec that will be responsible of providing the 82 | // custom Fabric Components. 83 | specs.add( 84 | new JSIModuleSpec() { 85 | @Override 86 | public JSIModuleType getJSIModuleType() { 87 | return JSIModuleType.UIManager; 88 | } 89 | 90 | @Override 91 | public JSIModuleProvider getJSIModuleProvider() { 92 | final ComponentFactory componentFactory = new ComponentFactory(); 93 | CoreComponentsRegistry.register(componentFactory); 94 | 95 | // Here we register a Components Registry. 96 | // The one that is generated with the template contains no components 97 | // and just provides you the one from React Native core. 98 | MainComponentsRegistry.register(componentFactory); 99 | 100 | final ReactInstanceManager reactInstanceManager = getReactInstanceManager(); 101 | 102 | ViewManagerRegistry viewManagerRegistry = 103 | new ViewManagerRegistry( 104 | reactInstanceManager.getOrCreateViewManagers(reactApplicationContext)); 105 | 106 | return new FabricJSIModuleProvider( 107 | reactApplicationContext, 108 | componentFactory, 109 | ReactNativeConfig.DEFAULT_CONFIG, 110 | viewManagerRegistry); 111 | } 112 | }); 113 | return specs; 114 | } 115 | }; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /ios/tabnewsapp/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | #import 7 | #import 8 | 9 | #import 10 | 11 | #if RCT_NEW_ARCH_ENABLED 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | 19 | #import 20 | 21 | static NSString *const kRNConcurrentRoot = @"concurrentRoot"; 22 | 23 | @interface AppDelegate () { 24 | RCTTurboModuleManager *_turboModuleManager; 25 | RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; 26 | std::shared_ptr _reactNativeConfig; 27 | facebook::react::ContextContainer::Shared _contextContainer; 28 | } 29 | @end 30 | #endif 31 | 32 | @implementation AppDelegate 33 | 34 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 35 | { 36 | RCTAppSetupPrepareApp(application); 37 | 38 | RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions]; 39 | 40 | #if RCT_NEW_ARCH_ENABLED 41 | _contextContainer = std::make_shared(); 42 | _reactNativeConfig = std::make_shared(); 43 | _contextContainer->insert("ReactNativeConfig", _reactNativeConfig); 44 | _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer]; 45 | bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; 46 | #endif 47 | 48 | NSDictionary *initProps = [self prepareInitialProps]; 49 | UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:initProps]; 50 | 51 | rootView.backgroundColor = [UIColor whiteColor]; 52 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 53 | UIViewController *rootViewController = [self.reactDelegate createRootViewController]; 54 | rootViewController.view = rootView; 55 | self.window.rootViewController = rootViewController; 56 | [self.window makeKeyAndVisible]; 57 | 58 | [super application:application didFinishLaunchingWithOptions:launchOptions]; 59 | 60 | return YES; 61 | } 62 | 63 | - (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge 64 | { 65 | // If you'd like to export some custom RCTBridgeModules, add them here! 66 | return @[]; 67 | } 68 | 69 | /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. 70 | /// 71 | /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html 72 | /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). 73 | /// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`. 74 | - (BOOL)concurrentRootEnabled 75 | { 76 | // Switch this bool to turn on and off the concurrent root 77 | return true; 78 | } 79 | 80 | - (NSDictionary *)prepareInitialProps 81 | { 82 | NSMutableDictionary *initProps = [NSMutableDictionary new]; 83 | #if RCT_NEW_ARCH_ENABLED 84 | initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]); 85 | #endif 86 | return initProps; 87 | } 88 | 89 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 90 | { 91 | #if DEBUG 92 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 93 | #else 94 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 95 | #endif 96 | } 97 | 98 | // Linking API 99 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { 100 | return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options]; 101 | } 102 | 103 | // Universal Links 104 | - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { 105 | BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; 106 | return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result; 107 | } 108 | 109 | // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries 110 | - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken 111 | { 112 | return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; 113 | } 114 | 115 | // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries 116 | - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error 117 | { 118 | return [super application:application didFailToRegisterForRemoteNotificationsWithError:error]; 119 | } 120 | 121 | // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries 122 | - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler 123 | { 124 | return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; 125 | } 126 | 127 | #if RCT_NEW_ARCH_ENABLED 128 | 129 | #pragma mark - RCTCxxBridgeDelegate 130 | 131 | - (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge 132 | { 133 | _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge 134 | delegate:self 135 | jsInvoker:bridge.jsCallInvoker]; 136 | return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager); 137 | } 138 | 139 | #pragma mark RCTTurboModuleManagerDelegate 140 | 141 | - (Class)getModuleClassFromName:(const char *)name 142 | { 143 | return RCTCoreModulesClassProvider(name); 144 | } 145 | 146 | - (std::shared_ptr)getTurboModule:(const std::string &)name 147 | jsInvoker:(std::shared_ptr)jsInvoker 148 | { 149 | return nullptr; 150 | } 151 | 152 | - (std::shared_ptr)getTurboModule:(const std::string &)name 153 | initParams: 154 | (const facebook::react::ObjCTurboModule::InitParams &)params 155 | { 156 | return nullptr; 157 | } 158 | 159 | - (id)getModuleInstanceFromClass:(Class)moduleClass 160 | { 161 | return RCTAppSetupDefaultModuleFromClass(moduleClass); 162 | } 163 | 164 | #endif 165 | 166 | @end 167 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Stop when "xargs" is not available. 209 | if ! command -v xargs >/dev/null 2>&1 210 | then 211 | die "xargs is not available" 212 | fi 213 | 214 | # Use "xargs" to parse quoted args. 215 | # 216 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 217 | # 218 | # In Bash we could simply go: 219 | # 220 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 221 | # set -- "${ARGS[@]}" "$@" 222 | # 223 | # but POSIX shell has neither arrays nor command substitution, so instead we 224 | # post-process each arg (as a line of input to sed) to backslash-escape any 225 | # character that might be a shell metacharacter, then use eval to reverse 226 | # that process (while maintaining the separation between arguments), and wrap 227 | # the whole thing up as a single "set" statement. 228 | # 229 | # This will of course break if any of these variables contains a newline or 230 | # an unmatched quote. 231 | # 232 | 233 | eval "set -- $( 234 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 235 | xargs -n1 | 236 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 237 | tr '\n' ' ' 238 | )" '"$@"' 239 | 240 | exec "$JAVACMD" "$@" 241 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation. If none specified and 19 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is 20 | * // default. Can be overridden with ENTRY_FILE environment variable. 21 | * entryFile: "index.android.js", 22 | * 23 | * // https://reactnative.dev/docs/performance#enable-the-ram-format 24 | * bundleCommand: "ram-bundle", 25 | * 26 | * // whether to bundle JS and assets in debug mode 27 | * bundleInDebug: false, 28 | * 29 | * // whether to bundle JS and assets in release mode 30 | * bundleInRelease: true, 31 | * 32 | * // whether to bundle JS and assets in another build variant (if configured). 33 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 34 | * // The configuration property can be in the following formats 35 | * // 'bundleIn${productFlavor}${buildType}' 36 | * // 'bundleIn${buildType}' 37 | * // bundleInFreeDebug: true, 38 | * // bundleInPaidRelease: true, 39 | * // bundleInBeta: true, 40 | * 41 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 42 | * // for example: to disable dev mode in the staging build type (if configured) 43 | * devDisabledInStaging: true, 44 | * // The configuration property can be in the following formats 45 | * // 'devDisabledIn${productFlavor}${buildType}' 46 | * // 'devDisabledIn${buildType}' 47 | * 48 | * // the root of your project, i.e. where "package.json" lives 49 | * root: "../../", 50 | * 51 | * // where to put the JS bundle asset in debug mode 52 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 53 | * 54 | * // where to put the JS bundle asset in release mode 55 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 56 | * 57 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 58 | * // require('./image.png')), in debug mode 59 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 60 | * 61 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 62 | * // require('./image.png')), in release mode 63 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 64 | * 65 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 66 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 67 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 68 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 69 | * // for example, you might want to remove it from here. 70 | * inputExcludes: ["android/**", "ios/**"], 71 | * 72 | * // override which node gets called and with what additional arguments 73 | * nodeExecutableAndArgs: ["node"], 74 | * 75 | * // supply additional arguments to the packager 76 | * extraPackagerArgs: [] 77 | * ] 78 | */ 79 | 80 | def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath() 81 | 82 | def reactNativeRoot = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() 83 | 84 | project.ext.react = [ 85 | entryFile: ["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android"].execute(null, rootDir).text.trim(), 86 | enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes", 87 | hermesCommand: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc", 88 | cliPath: "${reactNativeRoot}/cli.js", 89 | composeSourceMapsPath: "${reactNativeRoot}/scripts/compose-source-maps.js", 90 | ] 91 | 92 | apply from: new File(reactNativeRoot, "react.gradle") 93 | 94 | /** 95 | * Set this to true to create two separate APKs instead of one: 96 | * - An APK that only works on ARM devices 97 | * - An APK that only works on x86 devices 98 | * The advantage is the size of the APK is reduced by about 4MB. 99 | * Upload all the APKs to the Play Store and people will download 100 | * the correct one based on the CPU architecture of their device. 101 | */ 102 | def enableSeparateBuildPerCPUArchitecture = false 103 | 104 | /** 105 | * Run Proguard to shrink the Java bytecode in release builds. 106 | */ 107 | def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean() 108 | 109 | /** 110 | * The preferred build flavor of JavaScriptCore. 111 | * 112 | * For example, to use the international variant, you can use: 113 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 114 | * 115 | * The international variant includes ICU i18n library and necessary data 116 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 117 | * give correct results when using with locales other than en-US. Note that 118 | * this variant is about 6MiB larger per architecture than default. 119 | */ 120 | def jscFlavor = 'org.webkit:android-jsc:+' 121 | 122 | /** 123 | * Whether to enable the Hermes VM. 124 | * 125 | * This should be set on project.ext.react and that value will be read here. If it is not set 126 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 127 | * and the benefits of using Hermes will therefore be sharply reduced. 128 | */ 129 | def enableHermes = project.ext.react.get("enableHermes", false); 130 | 131 | /** 132 | * Architectures to build native code for. 133 | */ 134 | def reactNativeArchitectures() { 135 | def value = project.getProperties().get("reactNativeArchitectures") 136 | return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] 137 | } 138 | 139 | android { 140 | ndkVersion rootProject.ext.ndkVersion 141 | 142 | compileSdkVersion rootProject.ext.compileSdkVersion 143 | 144 | defaultConfig { 145 | applicationId 'com.diegoramosgomes.tabnewsapp' 146 | minSdkVersion rootProject.ext.minSdkVersion 147 | targetSdkVersion rootProject.ext.targetSdkVersion 148 | versionCode 1 149 | versionName "1.0.0" 150 | buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() 151 | 152 | if (isNewArchitectureEnabled()) { 153 | // We configure the CMake build only if you decide to opt-in for the New Architecture. 154 | externalNativeBuild { 155 | cmake { 156 | arguments "-DPROJECT_BUILD_DIR=$buildDir", 157 | "-DREACT_ANDROID_DIR=${reactNativeRoot}/ReactAndroid", 158 | "-DREACT_ANDROID_BUILD_DIR=${reactNativeRoot}/ReactAndroid/build", 159 | "-DNODE_MODULES_DIR=$rootDir/../node_modules", 160 | "-DANDROID_STL=c++_shared" 161 | } 162 | } 163 | if (!enableSeparateBuildPerCPUArchitecture) { 164 | ndk { 165 | abiFilters (*reactNativeArchitectures()) 166 | } 167 | } 168 | } 169 | } 170 | 171 | if (isNewArchitectureEnabled()) { 172 | // We configure the CMake build only if you decide to opt-in for the New Architecture. 173 | externalNativeBuild { 174 | cmake { 175 | path "$projectDir/src/main/jni/CMakeLists.txt" 176 | } 177 | } 178 | def reactAndroidProjectDir = project(':ReactAndroid').projectDir 179 | def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) { 180 | dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck") 181 | from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") 182 | into("$buildDir/react-ndk/exported") 183 | } 184 | def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) { 185 | dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck") 186 | from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") 187 | into("$buildDir/react-ndk/exported") 188 | } 189 | afterEvaluate { 190 | // If you wish to add a custom TurboModule or component locally, 191 | // you should uncomment this line. 192 | // preBuild.dependsOn("generateCodegenArtifactsFromSchema") 193 | preDebugBuild.dependsOn(packageReactNdkDebugLibs) 194 | preReleaseBuild.dependsOn(packageReactNdkReleaseLibs) 195 | 196 | // Due to a bug inside AGP, we have to explicitly set a dependency 197 | // between configureCMakeDebug* tasks and the preBuild tasks. 198 | // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732 199 | configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild) 200 | configureCMakeDebug.dependsOn(preDebugBuild) 201 | reactNativeArchitectures().each { architecture -> 202 | tasks.findByName("configureCMakeDebug[${architecture}]")?.configure { 203 | dependsOn("preDebugBuild") 204 | } 205 | tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure { 206 | dependsOn("preReleaseBuild") 207 | } 208 | } 209 | } 210 | } 211 | 212 | splits { 213 | abi { 214 | reset() 215 | enable enableSeparateBuildPerCPUArchitecture 216 | universalApk false // If true, also generate a universal APK 217 | include (*reactNativeArchitectures()) 218 | } 219 | } 220 | signingConfigs { 221 | debug { 222 | storeFile file('debug.keystore') 223 | storePassword 'android' 224 | keyAlias 'androiddebugkey' 225 | keyPassword 'android' 226 | } 227 | } 228 | buildTypes { 229 | debug { 230 | signingConfig signingConfigs.debug 231 | } 232 | release { 233 | // Caution! In production, you need to generate your own keystore file. 234 | // see https://reactnative.dev/docs/signed-apk-android. 235 | signingConfig signingConfigs.debug 236 | minifyEnabled enableProguardInReleaseBuilds 237 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 238 | } 239 | } 240 | 241 | // applicationVariants are e.g. debug, release 242 | applicationVariants.all { variant -> 243 | variant.outputs.each { output -> 244 | // For each separate APK per architecture, set a unique version code as described here: 245 | // https://developer.android.com/studio/build/configure-apk-splits.html 246 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 247 | def abi = output.getFilter(OutputFile.ABI) 248 | if (abi != null) { // null for the universal-debug, universal-release variants 249 | output.versionCodeOverride = 250 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 251 | } 252 | 253 | } 254 | } 255 | } 256 | 257 | // Apply static values from `gradle.properties` to the `android.packagingOptions` 258 | // Accepts values in comma delimited lists, example: 259 | // android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini 260 | ["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop -> 261 | // Split option: 'foo,bar' -> ['foo', 'bar'] 262 | def options = (findProperty("android.packagingOptions.$prop") ?: "").split(","); 263 | // Trim all elements in place. 264 | for (i in 0.. 0) { 269 | println "android.packagingOptions.$prop += $options ($options.length)" 270 | // Ex: android.packagingOptions.pickFirsts += '**/SCCS/**' 271 | options.each { 272 | android.packagingOptions[prop] += it 273 | } 274 | } 275 | } 276 | 277 | dependencies { 278 | implementation fileTree(dir: "libs", include: ["*.jar"]) 279 | 280 | //noinspection GradleDynamicVersion 281 | implementation "com.facebook.react:react-native:+" // From node_modules 282 | 283 | def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true"; 284 | def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true"; 285 | def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true"; 286 | def frescoVersion = rootProject.ext.frescoVersion 287 | 288 | // If your app supports Android versions before Ice Cream Sandwich (API level 14) 289 | if (isGifEnabled || isWebpEnabled) { 290 | implementation "com.facebook.fresco:fresco:${frescoVersion}" 291 | implementation "com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}" 292 | } 293 | 294 | if (isGifEnabled) { 295 | // For animated gif support 296 | implementation "com.facebook.fresco:animated-gif:${frescoVersion}" 297 | } 298 | 299 | if (isWebpEnabled) { 300 | // For webp support 301 | implementation "com.facebook.fresco:webpsupport:${frescoVersion}" 302 | if (isWebpAnimatedEnabled) { 303 | // Animated webp support 304 | implementation "com.facebook.fresco:animated-webp:${frescoVersion}" 305 | } 306 | } 307 | 308 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 309 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 310 | exclude group:'com.facebook.fbjni' 311 | } 312 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 313 | exclude group:'com.facebook.flipper' 314 | exclude group:'com.squareup.okhttp3', module:'okhttp' 315 | } 316 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 317 | exclude group:'com.facebook.flipper' 318 | } 319 | 320 | if (enableHermes) { 321 | //noinspection GradleDynamicVersion 322 | implementation("com.facebook.react:hermes-engine:+") { // From node_modules 323 | exclude group:'com.facebook.fbjni' 324 | } 325 | } else { 326 | implementation jscFlavor 327 | } 328 | } 329 | 330 | if (isNewArchitectureEnabled()) { 331 | // If new architecture is enabled, we let you build RN from source 332 | // Otherwise we fallback to a prebuilt .aar bundled in the NPM package. 333 | // This will be applied to all the imported transtitive dependency. 334 | configurations.all { 335 | resolutionStrategy.dependencySubstitution { 336 | substitute(module("com.facebook.react:react-native")) 337 | .using(project(":ReactAndroid")) 338 | .because("On New Architecture we're building React Native from source") 339 | substitute(module("com.facebook.react:hermes-engine")) 340 | .using(project(":ReactAndroid:hermes-engine")) 341 | .because("On New Architecture we're building Hermes from source") 342 | } 343 | } 344 | } 345 | 346 | // Run this once to be able to run the application with BUCK 347 | // puts all compile dependencies into folder libs for BUCK to use 348 | task copyDownloadableDepsToLibs(type: Copy) { 349 | from configurations.implementation 350 | into 'libs' 351 | } 352 | 353 | apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle"); 354 | applyNativeModulesAppBuildGradle(project) 355 | 356 | def isNewArchitectureEnabled() { 357 | // To opt-in for the New Architecture, you can either: 358 | // - Set `newArchEnabled` to true inside the `gradle.properties` file 359 | // - Invoke gradle with `-newArchEnabled=true` 360 | // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true` 361 | return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" 362 | } 363 | -------------------------------------------------------------------------------- /ios/tabnewsapp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; }; 11 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 12 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 13 | 3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */; }; 14 | 96905EF65AED1B983A6B3ABC /* libPods-tabnewsapp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-tabnewsapp.a */; }; 15 | B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */; }; 16 | BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; }; 17 | 531D2CB429964DBBABEDFF78 /* noop-file.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70FD26C8CC2B4056834A8229 /* noop-file.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 22 | 13B07F961A680F5B00A75B9A /* tabnewsapp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = tabnewsapp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = tabnewsapp/AppDelegate.h; sourceTree = ""; }; 24 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = tabnewsapp/AppDelegate.mm; sourceTree = ""; }; 25 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = tabnewsapp/Images.xcassets; sourceTree = ""; }; 26 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = tabnewsapp/Info.plist; sourceTree = ""; }; 27 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = tabnewsapp/main.m; sourceTree = ""; }; 28 | 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-tabnewsapp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-tabnewsapp.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 6C2E3173556A471DD304B334 /* Pods-tabnewsapp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tabnewsapp.debug.xcconfig"; path = "Target Support Files/Pods-tabnewsapp/Pods-tabnewsapp.debug.xcconfig"; sourceTree = ""; }; 30 | 7A4D352CD337FB3A3BF06240 /* Pods-tabnewsapp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-tabnewsapp.release.xcconfig"; path = "Target Support Files/Pods-tabnewsapp/Pods-tabnewsapp.release.xcconfig"; sourceTree = ""; }; 31 | AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = tabnewsapp/SplashScreen.storyboard; sourceTree = ""; }; 32 | BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = ""; }; 33 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 34 | FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-tabnewsapp/ExpoModulesProvider.swift"; sourceTree = ""; }; 35 | 70FD26C8CC2B4056834A8229 /* noop-file.swift */ = {isa = PBXFileReference; name = "noop-file.swift"; path = "tabnewsapp/noop-file.swift"; sourceTree = ""; fileEncoding = 4; lastKnownFileType = sourcecode.swift; explicitFileType = undefined; includeInIndex = 0; }; 36 | /* End PBXFileReference section */ 37 | 38 | /* Begin PBXFrameworksBuildPhase section */ 39 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | 96905EF65AED1B983A6B3ABC /* libPods-tabnewsapp.a in Frameworks */, 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | 13B07FAE1A68108700A75B9A /* tabnewsapp */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | BB2F792B24A3F905000567C9 /* Supporting */, 54 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 55 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 56 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */, 57 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 58 | 13B07FB61A68108700A75B9A /* Info.plist */, 59 | 13B07FB71A68108700A75B9A /* main.m */, 60 | AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */, 61 | 70FD26C8CC2B4056834A8229 /* noop-file.swift */, 62 | ); 63 | name = tabnewsapp; 64 | sourceTree = ""; 65 | }; 66 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 70 | 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-tabnewsapp.a */, 71 | ); 72 | name = Frameworks; 73 | sourceTree = ""; 74 | }; 75 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | ); 79 | name = Libraries; 80 | sourceTree = ""; 81 | }; 82 | 83CBB9F61A601CBA00E9B192 = { 83 | isa = PBXGroup; 84 | children = ( 85 | 13B07FAE1A68108700A75B9A /* tabnewsapp */, 86 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 87 | 83CBBA001A601CBA00E9B192 /* Products */, 88 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 89 | D65327D7A22EEC0BE12398D9 /* Pods */, 90 | D7E4C46ADA2E9064B798F356 /* ExpoModulesProviders */, 91 | ); 92 | indentWidth = 2; 93 | sourceTree = ""; 94 | tabWidth = 2; 95 | usesTabs = 0; 96 | }; 97 | 83CBBA001A601CBA00E9B192 /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 13B07F961A680F5B00A75B9A /* tabnewsapp.app */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 92DBD88DE9BF7D494EA9DA96 /* tabnewsapp */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */, 109 | ); 110 | name = tabnewsapp; 111 | sourceTree = ""; 112 | }; 113 | BB2F792B24A3F905000567C9 /* Supporting */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | BB2F792C24A3F905000567C9 /* Expo.plist */, 117 | ); 118 | name = Supporting; 119 | path = tabnewsapp/Supporting; 120 | sourceTree = ""; 121 | }; 122 | D65327D7A22EEC0BE12398D9 /* Pods */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 6C2E3173556A471DD304B334 /* Pods-tabnewsapp.debug.xcconfig */, 126 | 7A4D352CD337FB3A3BF06240 /* Pods-tabnewsapp.release.xcconfig */, 127 | ); 128 | path = Pods; 129 | sourceTree = ""; 130 | }; 131 | D7E4C46ADA2E9064B798F356 /* ExpoModulesProviders */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 92DBD88DE9BF7D494EA9DA96 /* tabnewsapp */, 135 | ); 136 | name = ExpoModulesProviders; 137 | sourceTree = ""; 138 | }; 139 | /* End PBXGroup section */ 140 | 141 | /* Begin PBXNativeTarget section */ 142 | 13B07F861A680F5B00A75B9A /* tabnewsapp */ = { 143 | isa = PBXNativeTarget; 144 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "tabnewsapp" */; 145 | buildPhases = ( 146 | 08A4A3CD28434E44B6B9DE2E /* [CP] Check Pods Manifest.lock */, 147 | FD10A7F022414F080027D42C /* Start Packager */, 148 | 13B07F871A680F5B00A75B9A /* Sources */, 149 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 150 | 13B07F8E1A680F5B00A75B9A /* Resources */, 151 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 152 | 800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */, 153 | ); 154 | buildRules = ( 155 | ); 156 | dependencies = ( 157 | ); 158 | name = tabnewsapp; 159 | productName = tabnewsapp; 160 | productReference = 13B07F961A680F5B00A75B9A /* tabnewsapp.app */; 161 | productType = "com.apple.product-type.application"; 162 | }; 163 | /* End PBXNativeTarget section */ 164 | 165 | /* Begin PBXProject section */ 166 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 167 | isa = PBXProject; 168 | attributes = { 169 | LastUpgradeCheck = 1130; 170 | TargetAttributes = { 171 | 13B07F861A680F5B00A75B9A = { 172 | LastSwiftMigration = 1250; 173 | }; 174 | }; 175 | }; 176 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "tabnewsapp" */; 177 | compatibilityVersion = "Xcode 3.2"; 178 | developmentRegion = en; 179 | hasScannedForEncodings = 0; 180 | knownRegions = ( 181 | en, 182 | Base, 183 | ); 184 | mainGroup = 83CBB9F61A601CBA00E9B192; 185 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 186 | projectDirPath = ""; 187 | projectRoot = ""; 188 | targets = ( 189 | 13B07F861A680F5B00A75B9A /* tabnewsapp */, 190 | ); 191 | }; 192 | /* End PBXProject section */ 193 | 194 | /* Begin PBXResourcesBuildPhase section */ 195 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 196 | isa = PBXResourcesBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | BB2F792D24A3F905000567C9 /* Expo.plist in Resources */, 200 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 201 | 3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */, 202 | ); 203 | runOnlyForDeploymentPostprocessing = 0; 204 | }; 205 | /* End PBXResourcesBuildPhase section */ 206 | 207 | /* Begin PBXShellScriptBuildPhase section */ 208 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 209 | isa = PBXShellScriptBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | ); 213 | inputPaths = ( 214 | ); 215 | name = "Bundle React Native code and images"; 216 | outputPaths = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | shellPath = /bin/sh; 220 | shellScript = "if [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" $PROJECT_ROOT ios relative | tail -n 1)\"\nfi\n\n`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"`\n\n"; 221 | }; 222 | 08A4A3CD28434E44B6B9DE2E /* [CP] Check Pods Manifest.lock */ = { 223 | isa = PBXShellScriptBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | ); 227 | inputFileListPaths = ( 228 | ); 229 | inputPaths = ( 230 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 231 | "${PODS_ROOT}/Manifest.lock", 232 | ); 233 | name = "[CP] Check Pods Manifest.lock"; 234 | outputFileListPaths = ( 235 | ); 236 | outputPaths = ( 237 | "$(DERIVED_FILE_DIR)/Pods-tabnewsapp-checkManifestLockResult.txt", 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | shellPath = /bin/sh; 241 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 242 | showEnvVarsInLog = 0; 243 | }; 244 | 800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */ = { 245 | isa = PBXShellScriptBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | ); 249 | inputPaths = ( 250 | "${PODS_ROOT}/Target Support Files/Pods-tabnewsapp/Pods-tabnewsapp-resources.sh", 251 | "${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle", 252 | "${PODS_CONFIGURATION_BUILD_DIR}/EXUpdates/EXUpdates.bundle", 253 | "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", 254 | ); 255 | name = "[CP] Copy Pods Resources"; 256 | outputPaths = ( 257 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle", 258 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXUpdates.bundle", 259 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | shellPath = /bin/sh; 263 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-tabnewsapp/Pods-tabnewsapp-resources.sh\"\n"; 264 | showEnvVarsInLog = 0; 265 | }; 266 | FD10A7F022414F080027D42C /* Start Packager */ = { 267 | isa = PBXShellScriptBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | ); 271 | inputFileListPaths = ( 272 | ); 273 | inputPaths = ( 274 | ); 275 | name = "Start Packager"; 276 | outputFileListPaths = ( 277 | ); 278 | outputPaths = ( 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | shellPath = /bin/sh; 282 | shellScript = "if [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\nexport RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > `$NODE_BINARY --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/.packager.env'\"`\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open `$NODE_BINARY --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/launchPackager.command'\"` || echo \"Can't start packager automatically\"\n fi\nfi\n"; 283 | showEnvVarsInLog = 0; 284 | }; 285 | /* End PBXShellScriptBuildPhase section */ 286 | 287 | /* Begin PBXSourcesBuildPhase section */ 288 | 13B07F871A680F5B00A75B9A /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */, 293 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 294 | B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */, 295 | 531D2CB429964DBBABEDFF78 /* noop-file.swift in Sources */, 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | /* End PBXSourcesBuildPhase section */ 300 | 301 | /* Begin XCBuildConfiguration section */ 302 | 13B07F941A680F5B00A75B9A /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | baseConfigurationReference = 6C2E3173556A471DD304B334 /* Pods-tabnewsapp.debug.xcconfig */; 305 | buildSettings = { 306 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 307 | CLANG_ENABLE_MODULES = YES; 308 | CURRENT_PROJECT_VERSION = 1; 309 | ENABLE_BITCODE = NO; 310 | GCC_PREPROCESSOR_DEFINITIONS = ( 311 | "$(inherited)", 312 | "FB_SONARKIT_ENABLED=1", 313 | ); 314 | INFOPLIST_FILE = tabnewsapp/Info.plist; 315 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 316 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 317 | OTHER_LDFLAGS = ( 318 | "$(inherited)", 319 | "-ObjC", 320 | "-lc++", 321 | ); 322 | PRODUCT_BUNDLE_IDENTIFIER = "com.diegoramosgomes.tabnewsapp"; 323 | PRODUCT_NAME = "tabnewsapp"; 324 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 325 | SWIFT_VERSION = 5.0; 326 | VERSIONING_SYSTEM = "apple-generic"; 327 | TARGETED_DEVICE_FAMILY = "1,2"; 328 | CODE_SIGN_ENTITLEMENTS = tabnewsapp/tabnewsapp.entitlements; 329 | }; 330 | name = Debug; 331 | }; 332 | 13B07F951A680F5B00A75B9A /* Release */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 7A4D352CD337FB3A3BF06240 /* Pods-tabnewsapp.release.xcconfig */; 335 | buildSettings = { 336 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 337 | CLANG_ENABLE_MODULES = YES; 338 | CURRENT_PROJECT_VERSION = 1; 339 | INFOPLIST_FILE = tabnewsapp/Info.plist; 340 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 341 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 342 | OTHER_LDFLAGS = ( 343 | "$(inherited)", 344 | "-ObjC", 345 | "-lc++", 346 | ); 347 | PRODUCT_BUNDLE_IDENTIFIER = "com.diegoramosgomes.tabnewsapp"; 348 | PRODUCT_NAME = "tabnewsapp"; 349 | SWIFT_VERSION = 5.0; 350 | VERSIONING_SYSTEM = "apple-generic"; 351 | TARGETED_DEVICE_FAMILY = "1,2"; 352 | CODE_SIGN_ENTITLEMENTS = tabnewsapp/tabnewsapp.entitlements; 353 | }; 354 | name = Release; 355 | }; 356 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 357 | isa = XCBuildConfiguration; 358 | buildSettings = { 359 | ALWAYS_SEARCH_USER_PATHS = NO; 360 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 361 | CLANG_CXX_LANGUAGE_STANDARD = "c++17"; 362 | CLANG_CXX_LIBRARY = "libc++"; 363 | CLANG_ENABLE_MODULES = YES; 364 | CLANG_ENABLE_OBJC_ARC = YES; 365 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 366 | CLANG_WARN_BOOL_CONVERSION = YES; 367 | CLANG_WARN_COMMA = YES; 368 | CLANG_WARN_CONSTANT_CONVERSION = YES; 369 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 370 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 371 | CLANG_WARN_EMPTY_BODY = YES; 372 | CLANG_WARN_ENUM_CONVERSION = YES; 373 | CLANG_WARN_INFINITE_RECURSION = YES; 374 | CLANG_WARN_INT_CONVERSION = YES; 375 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 376 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 377 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 378 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 379 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 380 | CLANG_WARN_STRICT_PROTOTYPES = YES; 381 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 382 | CLANG_WARN_UNREACHABLE_CODE = YES; 383 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 384 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 385 | COPY_PHASE_STRIP = NO; 386 | ENABLE_STRICT_OBJC_MSGSEND = YES; 387 | ENABLE_TESTABILITY = YES; 388 | GCC_C_LANGUAGE_STANDARD = gnu99; 389 | GCC_DYNAMIC_NO_PIC = NO; 390 | GCC_NO_COMMON_BLOCKS = YES; 391 | GCC_OPTIMIZATION_LEVEL = 0; 392 | GCC_PREPROCESSOR_DEFINITIONS = ( 393 | "DEBUG=1", 394 | "$(inherited)", 395 | ); 396 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 404 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 405 | LIBRARY_SEARCH_PATHS = "\"$(inherited)\""; 406 | MTL_ENABLE_DEBUG_INFO = YES; 407 | ONLY_ACTIVE_ARCH = YES; 408 | SDKROOT = iphoneos; 409 | }; 410 | name = Debug; 411 | }; 412 | 83CBBA211A601CBA00E9B192 /* Release */ = { 413 | isa = XCBuildConfiguration; 414 | buildSettings = { 415 | ALWAYS_SEARCH_USER_PATHS = NO; 416 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 417 | CLANG_CXX_LANGUAGE_STANDARD = "c++17"; 418 | CLANG_CXX_LIBRARY = "libc++"; 419 | CLANG_ENABLE_MODULES = YES; 420 | CLANG_ENABLE_OBJC_ARC = YES; 421 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 422 | CLANG_WARN_BOOL_CONVERSION = YES; 423 | CLANG_WARN_COMMA = YES; 424 | CLANG_WARN_CONSTANT_CONVERSION = YES; 425 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 426 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 427 | CLANG_WARN_EMPTY_BODY = YES; 428 | CLANG_WARN_ENUM_CONVERSION = YES; 429 | CLANG_WARN_INFINITE_RECURSION = YES; 430 | CLANG_WARN_INT_CONVERSION = YES; 431 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 432 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 433 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 434 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 435 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 436 | CLANG_WARN_STRICT_PROTOTYPES = YES; 437 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 438 | CLANG_WARN_UNREACHABLE_CODE = YES; 439 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 440 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 441 | COPY_PHASE_STRIP = YES; 442 | ENABLE_NS_ASSERTIONS = NO; 443 | ENABLE_STRICT_OBJC_MSGSEND = YES; 444 | GCC_C_LANGUAGE_STANDARD = gnu99; 445 | GCC_NO_COMMON_BLOCKS = YES; 446 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 447 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 448 | GCC_WARN_UNDECLARED_SELECTOR = YES; 449 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 450 | GCC_WARN_UNUSED_FUNCTION = YES; 451 | GCC_WARN_UNUSED_VARIABLE = YES; 452 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 453 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 454 | LIBRARY_SEARCH_PATHS = "\"$(inherited)\""; 455 | MTL_ENABLE_DEBUG_INFO = NO; 456 | SDKROOT = iphoneos; 457 | VALIDATE_PRODUCT = YES; 458 | }; 459 | name = Release; 460 | }; 461 | /* End XCBuildConfiguration section */ 462 | 463 | /* Begin XCConfigurationList section */ 464 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "tabnewsapp" */ = { 465 | isa = XCConfigurationList; 466 | buildConfigurations = ( 467 | 13B07F941A680F5B00A75B9A /* Debug */, 468 | 13B07F951A680F5B00A75B9A /* Release */, 469 | ); 470 | defaultConfigurationIsVisible = 0; 471 | defaultConfigurationName = Release; 472 | }; 473 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "tabnewsapp" */ = { 474 | isa = XCConfigurationList; 475 | buildConfigurations = ( 476 | 83CBBA201A601CBA00E9B192 /* Debug */, 477 | 83CBBA211A601CBA00E9B192 /* Release */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | defaultConfigurationName = Release; 481 | }; 482 | /* End XCConfigurationList section */ 483 | }; 484 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 485 | } 486 | --------------------------------------------------------------------------------