Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: news #1136

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added android/app/src/main/res/drawable-hdpi/export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable-hdpi/scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable-mdpi/export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/src/main/res/drawable-mdpi/scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions ios/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Foundation
import UIKit
import React
import FirebaseCore
import AVFoundation

func clearKeychainIfNecessary() {
// Checks whether or not this is the first time the app is run
Expand Down Expand Up @@ -47,8 +48,8 @@ class AppDelegate: RCTAppDelegate {
FirebaseApp.configure()
let app = super.application(application, didFinishLaunchingWithOptions: launchOptions);

RNSplashScreen.show()

RNSplashScreen.show();
configureAudioSession();
return app;
}

Expand Down Expand Up @@ -96,4 +97,15 @@ class AppDelegate: RCTAppDelegate {
return "haqq"
}
}

func configureAudioSession() {
// Retrieve the shared audio session.
let audioSession = AVAudioSession.sharedInstance()
do {
// Set the audio session category and mode.
try audioSession.setCategory(.playback, mode: .moviePlayback)
} catch {
print("Failed to set the audio session configuration")
}
}
}
4 changes: 2 additions & 2 deletions ios/haqq.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
CA97D1A6FCC0490AA0E660A8 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 8D52915C768145E4B5007D44 /* [email protected] */; };
CD8E3B4D34F041E8824FC13F /* InpageBridgeWeb3.js in Resources */ = {isa = PBXBuildFile; fileRef = EB5972ABD10C480FB1400A0F /* InpageBridgeWeb3.js */; };
CEBA4969BB874AF6B924DA37 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = F5FCD1005E8E4C08BB4782E3 /* [email protected] */; };
CF0D49E2FABD41D9A34AB04C /* BuildFile in Resources */ = {isa = PBXBuildFile; };
CF0D49E2FABD41D9A34AB04C /* (null) in Resources */ = {isa = PBXBuildFile; };
CF3BD3A1F0A24224948734D3 /* ElMessiri-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6B48442C371E4A5CB312ED9E /* ElMessiri-Medium.ttf */; };
CF6F3ED1E5A54155A2507F94 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 60F20D8762B94A298A8895E3 /* [email protected] */; };
D2EF8B9028754ED2AA9994E5 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 8D9E0B76C3074F8DB59AA2BB /* [email protected] */; };
Expand Down Expand Up @@ -750,7 +750,7 @@
BEFF23B4E9FE4A40BD7E5624 /* SF-ProText-Regular.ttf in Resources */,
F57AEFB435FF4249932EF918 /* SF-ProText-Semibold.ttf in Resources */,
2129B78329CACF69005C0CCA /* overview.storyboard in Resources */,
CF0D49E2FABD41D9A34AB04C /* BuildFile in Resources */,
CF0D49E2FABD41D9A34AB04C /* (null) in Resources */,
1A6D4E352A149298001B1549 /* staking_on_earn_page_dark.riv in Resources */,
7CE3C371577D43A6BAA1DF94 /* backup-notification-dark.png in Resources */,
8EF155B29CA4479AA8E82E4A /* [email protected] in Resources */,
Expand Down
12 changes: 12 additions & 0 deletions ios/haqq/Images.xcassets/export.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Export.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
3 changes: 3 additions & 0 deletions ios/haqq/Images.xcassets/export.imageset/Export.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions ios/haqq/Images.xcassets/scroll.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Scroll.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
3 changes: 3 additions & 0 deletions ios/haqq/Images.xcassets/scroll.imageset/Scroll.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 31 additions & 30 deletions ios/haqq/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>about</string>
<string>fb</string>
<string>tg</string>
<string>mailto</string>
<string>twitter</string>
<string>viber</string>
<string>whatsapp</string>
<string>wechat</string>
<string>line</string>
<string>instagram</string>
<string>kakaotalk</string>
<string>mqq</string>
<string>vk</string>
<string>comgooglemaps</string>
<string>googlephotos</string>
<string>ha</string>
<string>yammer</string>
<string>discord</string>
<string>cydia</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
Expand Down Expand Up @@ -54,7 +32,7 @@
</dict>
<dict>
<key>CFBundleIdentifier</key>
<string/>
<string></string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
Expand Down Expand Up @@ -83,6 +61,28 @@
<string>189</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>about</string>
<string>fb</string>
<string>tg</string>
<string>mailto</string>
<string>twitter</string>
<string>viber</string>
<string>whatsapp</string>
<string>wechat</string>
<string>line</string>
<string>instagram</string>
<string>kakaotalk</string>
<string>mqq</string>
<string>vk</string>
<string>comgooglemaps</string>
<string>googlephotos</string>
<string>ha</string>
<string>yammer</string>
<string>discord</string>
<string>cydia</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand All @@ -104,8 +104,6 @@
<string>Allow $(PRODUCT_NAME) to use camera for recognize QR code</string>
<key>NSFaceIDUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to use FaceID</string>
<key>NSUserTrackingUsageDescription</key>
<string>Your data will be used to track the source of the installation. We won't get access to any of your private information.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to use the photo library.</string>
<key>NSUbiquitousContainers</key>
Expand All @@ -120,6 +118,8 @@
<string>None</string>
</dict>
</dict>
<key>NSUserTrackingUsageDescription</key>
<string>Your data will be used to track the source of the installation. We won't get access to any of your private information.</string>
<key>UIAppFonts</key>
<array>
<string>ElMessiri-Bold.ttf</string>
Expand All @@ -136,8 +136,14 @@
<string>SF-ProText-Regular.ttf</string>
<string>SF-ProText-Semibold.ttf</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>fetch</string>
<string>remote-notification</string>
</array>
Expand All @@ -153,10 +159,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UISceneConfigurations</key>
<dict/>
</dict>
</dict>
</plist>
52 changes: 51 additions & 1 deletion ios/services/Version/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation
import AdSupport
import WebKit

@objc(RNVersion)
class RNVersion: NSObject {
Expand Down Expand Up @@ -41,14 +42,63 @@ class RNVersion: NSObject {
@objc
static func requiresMainQueueSetup() -> Bool { return false }

func getDeviceModel() -> String {
let deviceModel = UIDevice.current.model
let deviceName = UIDevice.modelName
let osVersion = UIDevice.current.systemVersion

return "(\(deviceModel); CPU \(deviceModel) OS \(osVersion) like Mac OS X)"
}

func getOperatingSystem() -> String {
let osVersion = UIDevice.current.systemVersion
let osName = UIDevice.current.systemName

return "\(osName) \(osVersion)"
}

func getAppForUserAgent() -> String {
return "\(appName ?? "unknown")/\(appVersion ?? "unknown").\(buildNumber ?? "unknown")"
}

func getWebKitVersion(completion: @escaping (String) -> Void) {
DispatchQueue.main.async {
let webView = WKWebView(frame: .zero)
let configuration = webView.configuration
let applicationName = configuration.applicationNameForUserAgent ?? ""

completion(applicationName)
}
}

func buildUserAgentString() -> String {
var userAgentString = ""
let group = DispatchGroup()
group.enter()
getWebKitVersion { [self] webKitVersion in
let userAgentComponents = [
getAppForUserAgent(),
getDeviceModel(),
"AppleWebKit/\(webKitVersion)",
"(KHTML, like Gecko)",
getOperatingSystem()
]
userAgentString = userAgentComponents.joined(separator: " ")
group.leave()
}
group.wait()
return userAgentString
}


@objc
public func constantsToExport() -> [AnyHashable : Any]! {
return [
"appVersion": appVersion ?? "unknown",
"buildNumber": buildNumber ?? "unknown",
"adId": adId,
"isTrackingEnabled": isTrackingEnabled,
"userAgent": "\(appName ?? "unknown")/\(appVersion ?? "unknown").\(buildNumber ?? "unknown") CFNetwork/\(getCfnVersion ?? "unknown") Darwin \(UIDevice.modelName) \(UIDevice.current.systemName)/\(UIDevice.current.systemVersion)"
"userAgent": buildUserAgentString(),
]
}
}
31 changes: 28 additions & 3 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import {
NavigationContainer,
Theme,
} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {TransitionPresets, createStackNavigator} from '@react-navigation/stack';
import * as Sentry from '@sentry/react-native';
import {AppState, Linking, Platform, StyleSheet} from 'react-native';
import {AppState, Linking, Platform, StatusBar, StyleSheet} from 'react-native';
import {Adjust, AdjustConfig} from 'react-native-adjust';
import {AdjustOaid} from 'react-native-adjust-oaid';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
Expand Down Expand Up @@ -69,15 +69,18 @@ import {
} from '@app/types';
import {sleep} from '@app/utils';

import {Spacer} from './components/ui';
import {migrationWallets} from './models/migration-wallets';
import {BackupScreen} from './screens/backup';
import {CreateScreen} from './screens/create';
import {HomeScreen} from './screens/home';
import {HomeStakingScreen} from './screens/home-staking';
import {InAppBrowserScreen} from './screens/in-app-browser';
import {JsonRpcSignPopup} from './screens/json-rpc-sign-popup';
import {LedgerScreen} from './screens/ledger';
import {ModalsScreen} from './screens/modals-screen';
import {NftDetailsScreen} from './screens/nft-details';
import {OurNewsScreen} from './screens/our-news';
import {BackupNotificationScreen} from './screens/popup-backup-notification';
import {PopupNotificationScreen} from './screens/popup-notification';
import {PopupTrackActivityScreen} from './screens/popup-track-activity';
Expand Down Expand Up @@ -146,6 +149,16 @@ const actionsSheet: ActionSheetType = {
animationEnabled: false,
};

const fullScreenModalOptions: ScreenOptionType = {
keyboardHandlingEnabled: false,
headerBackHidden: true,
headerShown: true,
gestureEnabled: false,
header: () => <Spacer height={StatusBar.currentHeight} />,
headerBackground: () => <Spacer height={StatusBar.currentHeight} />,
...TransitionPresets.ModalSlideFromBottomIOS,
};

const basicScreenOptions = {
headerShown: false,
gestureEnabled: false,
Expand All @@ -169,7 +182,7 @@ export const App = () => {
);

useEffect(() => {
showModal('splash');
hideModal('splash');

sleep(150)
.then(() => SplashScreen.hide())
Expand Down Expand Up @@ -287,6 +300,11 @@ export const App = () => {
<Stack.Screen name="home" component={HomeScreen} />
<Stack.Screen name="welcome" component={WelcomeScreen} />
<Stack.Screen name="welcomeNews" component={WelcomeNewsScreen} />
<Stack.Screen
name="inAppBrowser"
component={InAppBrowserScreen}
options={fullScreenModalOptions}
/>
{/* Modals group */}
<Stack.Group screenOptions={stackScreenOptions}>
<Stack.Screen
Expand Down Expand Up @@ -405,6 +423,13 @@ export const App = () => {
title: 'Manage accounts',
}}
/>
<Stack.Screen
name="ourNews"
component={OurNewsScreen}
options={{
title: getText(I18N.ourNewsTitle),
}}
/>
<Stack.Screen
name="raffleDetails"
component={RaffleDetailsScreen}
Expand Down
Loading