Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
playground-ios: Add account to playground app
Browse files Browse the repository at this point in the history
Note that this is ok, but we should not yet tell native that
account is available.
If they try to access it in production it could crash.
We need to publish new code-push-target-version before it is safe to use
in production
  • Loading branch information
tbergquist-godaddy committed Aug 19, 2019
1 parent c7fca54 commit f0173a0
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 29 deletions.
2 changes: 1 addition & 1 deletion app/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"dependencies": {
"@kiwicom/mobile-shared": "*",
"@kiwicom/account-native": "^0.0.1"
"@kiwicom/account-native": "^0.0.4"
},
"peerDependencies": {
"react": "*"
Expand Down
12 changes: 9 additions & 3 deletions app/account/src/appRegistry/AccountSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

import * as React from 'react';
import { WithNativeNavigation } from '@kiwicom/mobile-shared';
import { Accounts as AccountStack } from '@kiwicom/account-native';
import { Settings as AccountSettingsStack, NavigationProvider } from '@kiwicom/account-native';

type Props = {||};
type Props = {|
+onBackClicked: () => void,
|};

class AccountSettings extends React.Component<Props> {
render() {
return <AccountStack />;
return (
<NavigationProvider onBackPressed={this.props.onBackClicked}>
<AccountSettingsStack />
</NavigationProvider>
);
}
}

Expand Down
4 changes: 4 additions & 0 deletions app/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
NewHotelsStandAlonePackage,
} from '@kiwicom/react-native-app-hotels';
import { AncillaryFactory } from '@kiwicom/react-native-ancillary-factory';
import { AccountSettings } from '@kiwicom/mobile-account';

// Hotels
AppRegistry.registerComponent('NewKiwiHotels', () => NewHotelsStandAlonePackage);
Expand All @@ -15,6 +16,9 @@ AppRegistry.registerComponent('SingleHotel', () => SingleHotelStandalonePackage)
// AncillaryFactory
AppRegistry.registerComponent('AncillaryFactory', () => AncillaryFactory);

// Account
AppRegistry.registerComponent('AccountSettings', () => AccountSettings);

// This file is only used for native integration and we use CodePush there
CodePush.sync({
installMode: CodePush.InstallMode.IMMEDIATE,
Expand Down
23 changes: 15 additions & 8 deletions ios/RNNativePlayground/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="9LU-Kd-CUw">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="9LU-Kd-CUw">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -20,7 +19,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="QHj-7e-Fcl">
<rect key="frame" x="88" y="318" width="198" height="30"/>
<rect key="frame" x="88.5" y="318.5" width="198" height="30"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="MyC-DG-EB7">
<rect key="frame" x="0.0" y="0.0" width="198" height="30"/>
Expand All @@ -37,30 +36,38 @@
</subviews>
</stackView>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Select start date" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="aMy-op-KJ7">
<rect key="frame" x="16" y="204" width="343" height="30"/>
<rect key="frame" x="16" y="204.5" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Select end date" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="oID-K6-8uc">
<rect key="frame" x="16" y="242" width="343" height="30"/>
<rect key="frame" x="16" y="242.5" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Select city" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="QBX-BO-IRW">
<rect key="frame" x="16" y="280" width="343" height="30"/>
<rect key="frame" x="16" y="280.5" width="343" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="fill" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mO0-5n-Vye">
<rect key="frame" x="136" y="356" width="103" height="30"/>
<rect key="frame" x="136" y="356.5" width="103" height="30"/>
<state key="normal" title="Present stay22"/>
<connections>
<action selector="present22stay:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Ujy-xz-cvG"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="72D-Ig-efP">
<rect key="frame" x="138" y="491" width="101" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Push accounts"/>
<connections>
<action selector="pushAccountsView:" destination="BYZ-38-t0r" eventType="touchUpInside" id="UKq-mA-4Cf"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<constraints>
Expand Down
10 changes: 10 additions & 0 deletions ios/RNNativePlayground/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ - (void)setActiveViewController:(RNKiwiViewController *)vc {
_activeVc = vc;
}

// Open accounts

- (IBAction)pushAccountsView:(id)sender {
RNKiwiViewController *controller = [[RNKiwiViewController alloc] initWithModule:@"AccountSettings" initialProperties:@{
@"lastNavigationMode": @"push"
}];
[self setActiveViewController:controller];
[[self navigationController] pushViewController:controller animated:YES];
}

// Offer search is based on city ID
- (IBAction)presentNewHotelsView:(id)sender {

Expand Down
21 changes: 16 additions & 5 deletions ios/reactNativeApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
27E931E420ADA0630053AE19 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 27E931E320ADA0630053AE19 /* main.m */; };
51A8F6BE673D4671A3545CD8 /* CircularPro-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 50EB547AC35C4D25B73F0376 /* CircularPro-Medium.otf */; };
60854A62F6F281394EE676B5 /* libPods-reactNativeApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0520FD3BC77D396F74CF8285 /* libPods-reactNativeApp.a */; };
63497BE72306A93D0006DC8B /* Roboto.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 63497BE62306A93D0006DC8B /* Roboto.ttf */; };
63497BE82306A93D0006DC8B /* Roboto.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 63497BE62306A93D0006DC8B /* Roboto.ttf */; };
63738759220D81E600665942 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63738758220D81E600665942 /* JavaScriptCore.framework */; };
6373875A220D81F200665942 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63738758220D81E600665942 /* JavaScriptCore.framework */; };
6373875B220D820200665942 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63738758220D81E600665942 /* JavaScriptCore.framework */; };
Expand Down Expand Up @@ -106,7 +108,7 @@
219FCC5921753450008F5428 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
21B8D73121834B830079431F /* City.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = City.m; sourceTree = "<group>"; };
21B8D73321834BA10079431F /* City.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = City.h; sourceTree = "<group>"; };
21C03BEA6DA8479DBFFA62F0 /* Roboto-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Roboto-Regular.ttf"; path = "../assets/fonts/Roboto-Regular.ttf"; sourceTree = "<group>"; };
21C03BEA6DA8479DBFFA62F0 /* Roboto.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = file; name = Roboto.ttf; path = ../assets/fonts/Roboto.ttf; sourceTree = "<group>"; };
21C5EFC12189F86100F3C098 /* package.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = package.json; path = ../package.json; sourceTree = "<group>"; };
2711986D20B2A0C100C6292B /* RNKiwiSharedBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNKiwiSharedBridge.h; sourceTree = "<group>"; };
2711986E20B2A0C100C6292B /* RNKiwiSharedBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNKiwiSharedBridge.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -134,6 +136,7 @@
34003FC5EE453F3F2C072F56 /* libPods-RNNativePlayground.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNNativePlayground.a"; sourceTree = BUILT_PRODUCTS_DIR; };
50EB547AC35C4D25B73F0376 /* CircularPro-Medium.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "CircularPro-Medium.otf"; path = "../assets/fonts/ios/CircularPro-Medium.otf"; sourceTree = "<group>"; };
5EF541A9996B4D6AB8AEDA5B /* Roboto-Bold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Roboto-Bold.ttf"; path = "../assets/fonts/android/Roboto-Bold.ttf"; sourceTree = "<group>"; };
63497BE62306A93D0006DC8B /* Roboto.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = Roboto.ttf; path = "../node_modules/@kiwicom/account-native/apps/account-native/assets/fonts/Roboto/Roboto.ttf"; sourceTree = "<group>"; };
63738758220D81E600665942 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
63A8419C20C853840093183F /* Social.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; };
63A8419E20C8538A0093183F /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -288,8 +291,9 @@
A142755D6A354DA78D29BEB8 /* Resources */ = {
isa = PBXGroup;
children = (
63497BE62306A93D0006DC8B /* Roboto.ttf */,
21C5EFC12189F86100F3C098 /* package.json */,
21C03BEA6DA8479DBFFA62F0 /* Roboto-Regular.ttf */,
21C03BEA6DA8479DBFFA62F0 /* Roboto.ttf */,
DF5410E6DB94477AB0C446B4 /* CircularPro-Book.otf */,
D1641E3E0F4C42F0A3CB58F1 /* CircularPro-Bold.otf */,
2C62C7C2DC5B49F98F047AD3 /* CircularPro-Medium.otf */,
Expand Down Expand Up @@ -468,6 +472,7 @@
898C440300784E69B91D0ED6 /* Roboto-Medium.ttf in Resources */,
21C5EFC22189F86200F3C098 /* package.json in Resources */,
FA705002A8FD4F5BBDB4B4F4 /* Roboto-Regular.ttf in Resources */,
63497BE72306A93D0006DC8B /* Roboto.ttf in Resources */,
6AC23FDF8E5142199F66BC24 /* CircularPro-Bold.otf in Resources */,
DD9F4DDDD70840CBBECA0434 /* CircularPro-Book.otf in Resources */,
51A8F6BE673D4671A3545CD8 /* CircularPro-Medium.otf in Resources */,
Expand All @@ -481,6 +486,7 @@
files = (
21C5EFC32189FA0200F3C098 /* package.json in Resources */,
21C5EFBA2189DCFA00F3C098 /* orbit-icons.ttf in Resources */,
63497BE82306A93D0006DC8B /* Roboto.ttf in Resources */,
21EFD4CD21768D8C00B5F21B /* Images.xcassets in Resources */,
68E80E25215E66CD00EB4717 /* CircularPro-Book.otf in Resources */,
27E931E120ADA0630053AE19 /* LaunchScreen.storyboard in Resources */,
Expand Down Expand Up @@ -856,10 +862,11 @@
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = G44VYF3687;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand All @@ -869,6 +876,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.kiwi.mobile.rniosplayground;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Staging;
Expand Down Expand Up @@ -982,9 +990,10 @@
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = G44VYF3687;
DEVELOPMENT_TEAM = "";
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand Down Expand Up @@ -1021,10 +1030,11 @@
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = G44VYF3687;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
Expand All @@ -1034,6 +1044,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.kiwi.mobile.rniosplayground;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@kiwicom/react-native-ancillary-factory": "^0",
"@kiwicom/react-native-app-hotels": "^0",
"@kiwicom/react-native-fast-track": "^0",
"@kiwicom/mobile-account": "*",
"chalk": "^2.4.2",
"commander": "^2.20.0",
"detox": "^13.3.3",
Expand Down
2 changes: 1 addition & 1 deletion react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getAutolinkConfig() {
}

module.exports = {
assets: ['./assets/fonts'],
assets: ['./assets/fonts', '@kiwicom/account-native/apps/account-native/assets/fonts'],
dependencies: {
...getAutolinkConfig(),
},
Expand Down
Loading

0 comments on commit f0173a0

Please sign in to comment.