Browse Source

Development

master
Dwayne Harris 6 years ago
parent
commit
5defdc5905
  1. 18
      elpha-ios.xcodeproj/project.pbxproj
  2. 12
      elpha-ios/Assets.xcassets/Globe.imageset/Contents.json
  3. BIN
      elpha-ios/Assets.xcassets/Globe.imageset/globe.pdf
  4. 148
      elpha-ios/Base.lproj/Main.storyboard
  5. 33
      elpha-ios/InstanceViewController.swift
  6. 4
      elpha-ios/InstancesNavigationController.swift
  7. 30
      elpha-ios/InstancesTableViewController.swift
  8. 4
      elpha-ios/MainTabBarController.swift
  9. 4
      elpha-ios/TimelinesNavigationController.swift
  10. 56
      elpha-ios/WebViewController.swift
  11. 22
      elpha-ios/WebViewHelper.swift

18
elpha-ios.xcodeproj/project.pbxproj

@ -8,6 +8,8 @@
/* Begin PBXBuildFile section */
157405A82150588A00EEAAEB /* InstanceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 157405A72150588A00EEAAEB /* InstanceViewController.swift */; };
157405AA2150804200EEAAEB /* WebViewHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 157405A92150804200EEAAEB /* WebViewHelper.swift */; };
157405AC215080D400EEAAEB /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 157405AB215080D400EEAAEB /* WebViewController.swift */; };
15830D93214F6F6F0037C342 /* ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15830D92214F6F6F0037C342 /* ImageCache.swift */; };
159048AF214F5015004F4014 /* InstancesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 159048AE214F5015004F4014 /* InstancesTableViewCell.swift */; };
15960E5B213145E100C38CE9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15960E5A213145E100C38CE9 /* AppDelegate.swift */; };
@ -31,6 +33,8 @@
/* Begin PBXFileReference section */
157405A72150588A00EEAAEB /* InstanceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstanceViewController.swift; sourceTree = "<group>"; };
157405A92150804200EEAAEB /* WebViewHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewHelper.swift; sourceTree = "<group>"; };
157405AB215080D400EEAAEB /* WebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = "<group>"; };
15830D92214F6F6F0037C342 /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = "<group>"; };
159048AE214F5015004F4014 /* InstancesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstancesTableViewCell.swift; sourceTree = "<group>"; };
15960E57213145E100C38CE9 /* elpha-ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "elpha-ios.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -89,6 +93,7 @@
15960E7B213272CD00C38CE9 /* AuthenticationManager.swift */,
15960E7621322C6F00C38CE9 /* Configuration.swift */,
15830D92214F6F6F0037C342 /* ImageCache.swift */,
157405A92150804200EEAAEB /* WebViewHelper.swift */,
15960E63213145E200C38CE9 /* Assets.xcassets */,
15960E6E21321FA500C38CE9 /* Elpha.xcdatamodeld */,
15960E7121322B9F00C38CE9 /* Keychain Helper */,
@ -111,16 +116,17 @@
15960E782132383600C38CE9 /* View Controllers */ = {
isa = PBXGroup;
children = (
15960E5E213145E100C38CE9 /* SecondViewController.swift */,
15960E792132387A00C38CE9 /* MainTabBarController.swift */,
15960E7D21329FED00C38CE9 /* AuthenticateViewController.swift */,
15960E7F21353DCF00C38CE9 /* TimelineViewController.swift */,
15960E812136668500C38CE9 /* TimelinesNavigationController.swift */,
15960E83213774FC00C38CE9 /* InstancesTableViewController.swift */,
15960E852137775D00C38CE9 /* InstancesNavigationController.swift */,
15960E87213902A400C38CE9 /* InstancesTableView.swift */,
159048AE214F5015004F4014 /* InstancesTableViewCell.swift */,
15960E83213774FC00C38CE9 /* InstancesTableViewController.swift */,
157405A72150588A00EEAAEB /* InstanceViewController.swift */,
15960E792132387A00C38CE9 /* MainTabBarController.swift */,
15960E5E213145E100C38CE9 /* SecondViewController.swift */,
15960E812136668500C38CE9 /* TimelinesNavigationController.swift */,
15960E7F21353DCF00C38CE9 /* TimelineViewController.swift */,
157405AB215080D400EEAAEB /* WebViewController.swift */,
);
name = "View Controllers";
sourceTree = "<group>";
@ -197,6 +203,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
157405AC215080D400EEAAEB /* WebViewController.swift in Sources */,
15960E88213902A400C38CE9 /* InstancesTableView.swift in Sources */,
159048AF214F5015004F4014 /* InstancesTableViewCell.swift in Sources */,
15830D93214F6F6F0037C342 /* ImageCache.swift in Sources */,
@ -204,6 +211,7 @@
15960E7021321FA500C38CE9 /* Elpha.xcdatamodeld in Sources */,
15960E5F213145E100C38CE9 /* SecondViewController.swift in Sources */,
15960E8021353DCF00C38CE9 /* TimelineViewController.swift in Sources */,
157405AA2150804200EEAAEB /* WebViewHelper.swift in Sources */,
15960E7A2132387A00C38CE9 /* MainTabBarController.swift in Sources */,
15960E7C213272CD00C38CE9 /* AuthenticationManager.swift in Sources */,
15960E7E21329FED00C38CE9 /* AuthenticateViewController.swift in Sources */,

12
elpha-ios/Assets.xcassets/Globe.imageset/Contents.json

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "globe.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
elpha-ios/Assets.xcassets/Globe.imageset/globe.pdf

148
elpha-ios/Base.lproj/Main.storyboard

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="49e-Tb-3d3">
<device id="retina4_7" orientation="portrait">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
@ -14,7 +14,7 @@
<objects>
<viewController id="9pv-A4-QxB" customClass="TimelineViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="tsR-hK-woN">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="PQr-Ze-W5v"/>
@ -30,17 +30,17 @@
<objects>
<viewController id="Bed-pj-wE9" customClass="AuthenticateViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="ITR-hY-wTb">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Enter a Mastodon Instance" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nru-sM-bKD">
<rect key="frame" x="10" y="302.5" width="355" height="21"/>
<rect key="frame" x="10" y="417" width="394" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.54117647058823526" green="0.4823529411764706" blue="0.68235294117647061" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="mastodon.social" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="02G-kI-p4F">
<rect key="frame" x="10" y="343.5" width="355" height="40"/>
<rect key="frame" x="10" y="458" width="394" height="40"/>
<color key="backgroundColor" red="0.54117647058823526" green="0.4823529411764706" blue="0.68235294117647061" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="rOZ-m9-lp9"/>
@ -50,7 +50,7 @@
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="awW-03-3TB">
<rect key="frame" x="80" y="403.5" width="215" height="40"/>
<rect key="frame" x="80" y="518" width="254" height="40"/>
<color key="backgroundColor" red="0.090196078431372548" green="0.047058823529411764" blue="0.28627450980392155" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="gl3-OE-jFa"/>
@ -60,10 +60,10 @@
</state>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TUU-fE-p3J">
<rect key="frame" x="0.0" y="577" width="375" height="90"/>
<rect key="frame" x="0.0" y="806" width="414" height="90"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ABr-tX-v5Y">
<rect key="frame" x="131.5" y="30" width="112" height="30"/>
<rect key="frame" x="151" y="30" width="112" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="TdG-vz-Mhq"/>
</constraints>
@ -83,13 +83,13 @@
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Logo" translatesAutoresizingMaskIntoConstraints="NO" id="sjL-eq-q6s">
<rect key="frame" x="0.0" y="77.5" width="375" height="175"/>
<rect key="frame" x="0.0" y="192" width="414" height="175"/>
<constraints>
<constraint firstAttribute="height" constant="175" id="O4x-xb-MbJ"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kt3-Mk-URm">
<rect key="frame" x="148" y="453.5" width="79" height="27"/>
<rect key="frame" x="167.5" y="568" width="79" height="27"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<state key="normal" title="Privacy Policy">
<color key="titleColor" red="0.54117647059999996" green="0.4823529412" blue="0.68235294120000001" alpha="1" colorSpace="calibratedRGB"/>
@ -100,6 +100,7 @@
<constraints>
<constraint firstItem="02G-kI-p4F" firstAttribute="leading" secondItem="x4b-tk-8EQ" secondAttribute="leading" constant="10" id="1bh-aZ-3Uh"/>
<constraint firstItem="kt3-Mk-URm" firstAttribute="top" secondItem="awW-03-3TB" secondAttribute="bottom" constant="10" id="2bp-25-NTS"/>
<constraint firstAttribute="bottom" secondItem="TUU-fE-p3J" secondAttribute="bottom" id="88j-Nl-cTM"/>
<constraint firstItem="x4b-tk-8EQ" firstAttribute="trailing" secondItem="awW-03-3TB" secondAttribute="trailing" constant="80" id="AS0-AS-ZgS"/>
<constraint firstItem="02G-kI-p4F" firstAttribute="top" secondItem="Nru-sM-bKD" secondAttribute="bottom" constant="20" id="B7M-5H-Zg0"/>
<constraint firstAttribute="trailing" secondItem="sjL-eq-q6s" secondAttribute="trailing" id="BAU-nb-aTg"/>
@ -107,7 +108,6 @@
<constraint firstItem="TUU-fE-p3J" firstAttribute="trailing" secondItem="x4b-tk-8EQ" secondAttribute="trailing" id="HZc-cz-fEl"/>
<constraint firstItem="x4b-tk-8EQ" firstAttribute="trailing" secondItem="02G-kI-p4F" secondAttribute="trailing" constant="10" id="NXw-TG-cic"/>
<constraint firstItem="x4b-tk-8EQ" firstAttribute="trailing" secondItem="Nru-sM-bKD" secondAttribute="trailing" constant="10" id="Sxb-jU-m0V"/>
<constraint firstItem="TUU-fE-p3J" firstAttribute="bottom" secondItem="x4b-tk-8EQ" secondAttribute="bottom" id="VH8-EU-1Ia"/>
<constraint firstItem="Nru-sM-bKD" firstAttribute="leading" secondItem="x4b-tk-8EQ" secondAttribute="leading" constant="10" id="WEA-WC-yja"/>
<constraint firstItem="Nru-sM-bKD" firstAttribute="top" secondItem="sjL-eq-q6s" secondAttribute="bottom" constant="50" id="gne-4p-g6Z"/>
<constraint firstItem="awW-03-3TB" firstAttribute="top" secondItem="02G-kI-p4F" secondAttribute="bottom" constant="20" id="j0m-WK-H0R"/>
@ -128,30 +128,71 @@
</objects>
<point key="canvasLocation" x="-615.20000000000005" y="770.46476761619192"/>
</scene>
<!--Web View Controller-->
<scene sceneID="MIo-vc-tec">
<objects>
<viewController storyboardIdentifier="WebViewController" id="ufm-NU-wEh" customClass="WebViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="oP6-QF-ODB">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="69Y-fp-1th">
<rect key="frame" x="0.0" y="46" width="414" height="850"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<wkWebViewConfiguration key="configuration">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
<progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="e2P-oa-L65">
<rect key="frame" x="0.0" y="44" width="414" height="2"/>
</progressView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Xhd-n0-wrI" firstAttribute="trailing" secondItem="69Y-fp-1th" secondAttribute="trailing" id="09z-LF-Bzf"/>
<constraint firstAttribute="bottom" secondItem="69Y-fp-1th" secondAttribute="bottom" id="DMr-RR-tQi"/>
<constraint firstItem="69Y-fp-1th" firstAttribute="top" secondItem="Xhd-n0-wrI" secondAttribute="top" constant="2" id="O50-pm-MnH"/>
<constraint firstItem="69Y-fp-1th" firstAttribute="leading" secondItem="Xhd-n0-wrI" secondAttribute="leading" id="RcD-DJ-C5a"/>
<constraint firstItem="e2P-oa-L65" firstAttribute="top" secondItem="Xhd-n0-wrI" secondAttribute="top" id="ZiT-m1-F3I"/>
<constraint firstItem="e2P-oa-L65" firstAttribute="leading" secondItem="Xhd-n0-wrI" secondAttribute="leading" id="h8f-GM-MWX"/>
<constraint firstItem="Xhd-n0-wrI" firstAttribute="trailing" secondItem="e2P-oa-L65" secondAttribute="trailing" id="tMb-ce-c9H"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Xhd-n0-wrI"/>
</view>
<connections>
<outlet property="mainProgressView" destination="e2P-oa-L65" id="lLE-Pv-wWV"/>
<outlet property="mainWebView" destination="69Y-fp-1th" id="Yi5-en-t7m"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="WjG-9G-tw9" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-616" y="1466"/>
</scene>
<!--Instances-->
<scene sceneID="24Q-ad-dey">
<objects>
<tableViewController id="bRx-56-pJs" customClass="InstancesTableViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="120" sectionHeaderHeight="28" sectionFooterHeight="28" id="MsU-Kh-W9V" customClass="InstancesTableView" customModule="elpha_ios" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="InstancesTableViewCell" rowHeight="120" id="t5I-4e-rPV" customClass="InstancesTableViewCell" customModule="elpha_ios" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="120"/>
<rect key="frame" x="0.0" y="28" width="414" height="120"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="t5I-4e-rPV" id="Awg-lg-91F">
<rect key="frame" x="0.0" y="0.0" width="341" height="119.5"/>
<rect key="frame" x="0.0" y="0.0" width="376" height="119.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Instance Placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="3lE-eD-RSI">
<rect key="frame" x="16" y="11" width="100" height="98"/>
<rect key="frame" x="20" y="11" width="100" height="98"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="Sf5-1G-8gX"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="scl-0p-jQO">
<rect key="frame" x="124" y="11" width="201" height="30"/>
<rect key="frame" x="128" y="11" width="232" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="v20-Wv-cjD"/>
</constraints>
@ -160,7 +201,7 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EuF-dW-Uua">
<rect key="frame" x="201.5" y="46" width="53" height="46"/>
<rect key="frame" x="205.5" y="46" width="53" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Statuses" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GvU-C8-JYy">
<rect key="frame" x="0.0" y="8" width="53" height="16"/>
@ -190,7 +231,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ir1-Wt-maG">
<rect key="frame" x="124" y="46" width="37.5" height="46"/>
<rect key="frame" x="128" y="46" width="37.5" height="46"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Users" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="x17-3V-ix0">
<rect key="frame" x="0.0" y="8" width="37.5" height="16"/>
@ -248,49 +289,79 @@
</connections>
</tableView>
<navigationItem key="navigationItem" title="Instances" largeTitleDisplayMode="always" id="mfC-MW-ufJ"/>
<refreshControl key="refreshControl" opaque="NO" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="agk-Mw-NTN">
<rect key="frame" x="0.0" y="0.0" width="1000" height="1000"/>
<autoresizingMask key="autoresizingMask"/>
<attributedString key="attributedTitle"/>
<color key="tintColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</refreshControl>
<connections>
<outlet property="mainNavigationItem" destination="mfC-MW-ufJ" id="YZK-rX-Gn3"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="pnx-Ji-ouu" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1064.8" y="1048.4257871064469"/>
<point key="canvasLocation" x="1973.913043478261" y="1047.9910714285713"/>
</scene>
<!--Instance View Controller-->
<scene sceneID="u4y-73-40c">
<objects>
<viewController storyboardIdentifier="InstanceViewController" id="mhy-lU-rss" customClass="InstanceViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="PuO-1l-eXq">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UZR-kd-UxJ">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<rect key="frame" x="0.0" y="140" width="414" height="722"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uMx-PR-Og0">
<rect key="frame" x="0.0" y="0.0" width="375" height="400"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="400"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="snd-Ts-rva">
<rect key="frame" x="0.0" y="0.0" width="375" height="200"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="200"/>
<constraints>
<constraint firstAttribute="height" constant="200" id="VeP-LC-gew"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tS4-1x-aPh">
<rect key="frame" x="8" y="208" width="359" height="26.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
<rect key="frame" x="8" y="208" width="358" height="31.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="26"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ztD-p8-9YN">
<rect key="frame" x="8" y="249.5" width="398" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.66422420739999999" green="0.66424006219999998" blue="0.66423153879999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Eld-tn-44S">
<rect key="frame" x="376" y="210" width="30" height="30"/>
<color key="backgroundColor" red="0.54117647059999996" green="0.4823529412" blue="0.68235294120000001" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="dh6-hk-ygd"/>
<constraint firstAttribute="width" constant="30" id="kh5-h8-uWv"/>
</constraints>
<inset key="imageEdgeInsets" minX="4" minY="4" maxX="4" maxY="4"/>
<state key="normal" title="Button" image="Globe"/>
<connections>
<action selector="webViewButtonPressed:" destination="mhy-lU-rss" eventType="touchUpInside" id="VYF-om-q5R"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="snd-Ts-rva" firstAttribute="leading" secondItem="uMx-PR-Og0" secondAttribute="leading" id="5PY-wc-Ih8"/>
<constraint firstItem="tS4-1x-aPh" firstAttribute="top" secondItem="snd-Ts-rva" secondAttribute="bottom" constant="8" id="5T8-Pf-0e3"/>
<constraint firstAttribute="trailing" secondItem="ztD-p8-9YN" secondAttribute="trailing" constant="8" id="6Sv-Ae-81L"/>
<constraint firstItem="Eld-tn-44S" firstAttribute="leading" secondItem="tS4-1x-aPh" secondAttribute="trailing" constant="10" id="6Xs-Ic-fjH"/>
<constraint firstAttribute="height" constant="400" id="AAM-kQ-MTD"/>
<constraint firstAttribute="trailing" secondItem="Eld-tn-44S" secondAttribute="trailing" constant="8" id="Erx-WB-FHY"/>
<constraint firstAttribute="trailing" secondItem="snd-Ts-rva" secondAttribute="trailing" id="G6a-Hu-AbR"/>
<constraint firstItem="tS4-1x-aPh" firstAttribute="leading" secondItem="uMx-PR-Og0" secondAttribute="leading" constant="8" id="JF4-Mq-Nx1"/>
<constraint firstAttribute="trailing" secondItem="tS4-1x-aPh" secondAttribute="trailing" constant="8" id="mhC-An-xdr"/>
<constraint firstItem="ztD-p8-9YN" firstAttribute="leading" secondItem="uMx-PR-Og0" secondAttribute="leading" constant="8" id="fJy-Ss-RM1"/>
<constraint firstItem="Eld-tn-44S" firstAttribute="top" secondItem="snd-Ts-rva" secondAttribute="bottom" constant="10" id="oog-lj-YRD"/>
<constraint firstItem="ztD-p8-9YN" firstAttribute="top" secondItem="tS4-1x-aPh" secondAttribute="bottom" constant="10" id="w2N-n3-Q3z"/>
<constraint firstItem="snd-Ts-rva" firstAttribute="top" secondItem="uMx-PR-Og0" secondAttribute="top" id="wiP-BX-cCT"/>
</constraints>
</view>
@ -314,31 +385,33 @@
<viewLayoutGuide key="safeArea" id="sJg-YO-5B3"/>
</view>
<connections>
<outlet property="instanceDescriptionLabel" destination="ztD-p8-9YN" id="pzv-iD-AIj"/>
<outlet property="instanceNameLabel" destination="tS4-1x-aPh" id="Bb8-r9-Tdi"/>
<outlet property="thumbnailImageView" destination="snd-Ts-rva" id="WM4-wU-Bn5"/>
<outlet property="webViewButton" destination="Eld-tn-44S" id="QRD-Z0-bZx"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2br-gN-kxb" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1792.8" y="1047.5262368815593"/>
<point key="canvasLocation" x="2702.898550724638" y="1047.3214285714284"/>
</scene>
<!--Second-->
<scene sceneID="wg7-f3-ORb">
<objects>
<viewController id="8rJ-Kc-sve" customClass="SecondViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="QS5-Rx-YEW">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Second View" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="zEq-FU-wV5">
<rect key="frame" x="87" y="312" width="201.5" height="43"/>
<rect key="frame" x="106.5" y="426.5" width="201.5" height="43"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Loaded by SecondViewController" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NDk-cv-Gan">
<rect key="frame" x="80" y="363" width="215" height="17"/>
<rect key="frame" x="99.5" y="477.5" width="215" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
@ -387,7 +460,7 @@
<tabBarItem key="tabBarItem" title="Timelines" image="Timelines" id="acW-dT-cKf"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="MdH-tW-gfk">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
@ -404,10 +477,14 @@
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="SqQ-GI-iCq" customClass="InstancesNavigationController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="QFN-sS-62X">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="QFN-sS-62X">
<rect key="frame" x="0.0" y="44" width="414" height="96"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="tintColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="barTintColor" red="0.29411764709999999" green="0.0" blue="0.50980392159999999" alpha="1" colorSpace="calibratedRGB"/>
<textAttributes key="titleTextAttributes">
<color key="textColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</textAttributes>
<textAttributes key="largeTitleTextAttributes">
<color key="textColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</textAttributes>
@ -419,10 +496,11 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="pTB-k2-GBg" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="125.59999999999999" y="1048.4257871064469"/>
<point key="canvasLocation" x="1034.7826086956522" y="1047.9910714285713"/>
</scene>
</scenes>
<resources>
<image name="Globe" width="496" height="496"/>
<image name="Instance Placeholder" width="60" height="60"/>
<image name="Logo" width="400" height="400"/>
<image name="Timelines" width="25" height="25"/>

33
elpha-ios/InstanceViewController.swift

@ -12,9 +12,31 @@ import UIKit
class InstanceViewController: UIViewController {
@IBOutlet var thumbnailImageView: UIImageView!
@IBOutlet var instanceNameLabel: UILabel!
@IBOutlet var instanceDescriptionLabel: UILabel!
@IBOutlet var webViewButton: UIButton!
var instance: Instance? = nil
@IBAction func webViewButtonPressed(_ sender: Any) {
guard let instance = instance, let name = instance.name else {
return
}
if let webViewController = WebViewHelper.getWebViewController(url: URL(string: "https://\(name)")!) {
navigationController?.pushViewController(webViewController, animated: true)
}
}
override func viewDidLoad() {
super.viewDidLoad()
webViewButton.layer.cornerRadius = 15
if let instance = instance, let name = instance.name {
navigationItem.title = name
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
@ -22,10 +44,13 @@ class InstanceViewController: UIViewController {
fatalError("No instance")
}
print(instanceNameLabel)
print(thumbnailImageView)
instanceNameLabel.text = instance.name
instanceNameLabel?.text = instance.name
if (instance.fullDescription ?? "").isEmpty {
instanceDescriptionLabel.text = "(No description)"
} else {
instanceDescriptionLabel.text = instance.fullDescription
}
if let thumbnailURL = instance.thumbnail {
ImageCache.shared.getImage(forURL: URL(string: thumbnailURL)!) { image, error in
@ -34,7 +59,7 @@ class InstanceViewController: UIViewController {
}
DispatchQueue.main.async {
self.thumbnailImageView?.image = image
self.thumbnailImageView.image = image
}
}
}

4
elpha-ios/InstancesNavigationController.swift

@ -9,7 +9,5 @@
import UIKit
class InstancesNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
}
}

30
elpha-ios/InstancesTableViewController.swift

@ -42,18 +42,31 @@ class InstancesTableViewController: UITableViewController, UIViewControllerPrevi
let instanceRequestCount = 20
var instances: [Instance] = []
var nextID: String? = nil
var loading: Bool = false
var finished: Bool = false
var loading: Bool = false {
didSet {
DispatchQueue.main.async {
if self.loading {
UIApplication.shared.isNetworkActivityIndicatorVisible = true
self.refreshControl?.beginRefreshing()
} else {
UIApplication.shared.isNetworkActivityIndicatorVisible = false
self.refreshControl?.endRefreshing()
}
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
UINavigationBar.appearance().barTintColor = UIColor.red
UINavigationBar.appearance().tintColor = UIColor.white
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
mainNavigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(done))
registerForPreviewing(with: self, sourceView: tableView)
refreshControl?.addTarget(self, action: #selector(self.reloadInstances), for: .valueChanged)
loadInstances()
}
@ -62,6 +75,13 @@ class InstancesTableViewController: UITableViewController, UIViewControllerPrevi
dismiss(animated: true, completion: nil)
}
@objc func reloadInstances() {
self.nextID = nil
self.finished = false
loadInstances()
}
func loadInstances() {
loading = true
@ -77,6 +97,10 @@ class InstancesTableViewController: UITableViewController, UIViewControllerPrevi
params.append("min_id=\(nextID)")
} else {
instances = []
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
let requestURL = "\(Config.instancesServiceUrl)\(Config.instancesServiceEndpoint)?\(params.joined(separator: "&"))"

4
elpha-ios/MainTabBarController.swift

@ -9,10 +9,6 @@
import UIKit
class MainTabBarController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

4
elpha-ios/TimelinesNavigationController.swift

@ -9,7 +9,5 @@
import UIKit
class TimelinesNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
}
}

56
elpha-ios/WebViewController.swift

@ -0,0 +1,56 @@
//
// WebViewController.swift
// elpha-ios
//
// Created by Dwayne Harris on 9/17/18.
// Copyright © 2018 Elpha. All rights reserved.
//
import Foundation
import UIKit
import WebKit
class WebViewController: UIViewController, WKNavigationDelegate {
@IBOutlet var mainWebView: WKWebView!
@IBOutlet var mainProgressView: UIProgressView!
var url: URL? = nil
override func viewDidLoad() {
super.viewDidLoad()
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
mainWebView.navigationDelegate = self
mainWebView.addObserver(self, forKeyPath: #keyPath(WKWebView.title), options: .new, context: nil)
mainWebView.addObserver(self, forKeyPath: #keyPath(WKWebView.estimatedProgress), options: .new, context: nil)
if let url = url {
mainWebView.load(URLRequest(url: url))
}
}
@objc func done() {
dismiss(animated: true, completion: nil)
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == #keyPath(WKWebView.title) {
if let title = mainWebView.title {
navigationItem.title = title
}
}
if keyPath == #keyPath(WKWebView.estimatedProgress) {
mainProgressView.progress = Float(mainWebView.estimatedProgress)
}
}
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
mainProgressView.alpha = 1.0
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
mainProgressView.alpha = 0.0
}
}

22
elpha-ios/WebViewHelper.swift

@ -0,0 +1,22 @@
//
// WebViewHelper.swift
// elpha-ios
//
// Created by Dwayne Harris on 9/17/18.
// Copyright © 2018 Elpha. All rights reserved.
//
import Foundation
import UIKit
class WebViewHelper {
static func getWebViewController(url: URL) -> WebViewController? {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let webViewController = storyboard.instantiateViewController(withIdentifier: "WebViewController") as? WebViewController {
webViewController.url = url
return webViewController
}
fatalError("Could not instantiate WebViewController")
}
}
Loading…
Cancel
Save