mirror of https://github.com/oxen-io/session-ios
Merge branch 'charlesmchen/newConversationView'
commit
fb4ee8ffb8
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,19 @@
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SelectRecipientViewController.h"
|
||||
|
||||
@protocol NewNonContactConversationViewControllerDelegate <NSObject>
|
||||
|
||||
- (void)recipientIdWasSelected:(NSString *)recipientId;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@interface NewNonContactConversationViewController : SelectRecipientViewController
|
||||
|
||||
@property (nonatomic, weak) id<NewNonContactConversationViewControllerDelegate> nonContactConversationDelegate;
|
||||
|
||||
@end
|
@ -0,0 +1,141 @@
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NewNonContactConversationViewController.h"
|
||||
#import "BlockListUIUtils.h"
|
||||
#import "ContactsViewHelper.h"
|
||||
#import "OWSContactsManager.h"
|
||||
#import "SignalAccount.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NewNonContactConversationViewController () <SelectRecipientViewControllerDelegate>
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation NewNonContactConversationViewController
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
self.delegate = self;
|
||||
|
||||
[super loadView];
|
||||
|
||||
self.title = NSLocalizedString(
|
||||
@"NEW_NONCONTACT_CONVERSATION_VIEW_TITLE", @"Title for the 'new non-contact conversation' view.");
|
||||
}
|
||||
|
||||
- (NSString *)phoneNumberSectionTitle
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)phoneNumberButtonText
|
||||
{
|
||||
return NSLocalizedString(@"NEW_NONCONTACT_CONVERSATION_VIEW_BUTTON",
|
||||
@"A label for the 'add by phone number' button in the 'new non-contact conversation' view");
|
||||
}
|
||||
|
||||
- (NSString *)contactsSectionTitle
|
||||
{
|
||||
OWSAssert(0);
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)phoneNumberWasSelected:(NSString *)phoneNumber
|
||||
{
|
||||
OWSAssert(phoneNumber.length > 0);
|
||||
|
||||
__weak NewNonContactConversationViewController *weakSelf = self;
|
||||
ContactsViewHelper *helper = self.contactsViewHelper;
|
||||
if ([helper isRecipientIdBlocked:phoneNumber]) {
|
||||
[BlockListUIUtils showUnblockPhoneNumberActionSheet:phoneNumber
|
||||
fromViewController:self
|
||||
blockingManager:helper.blockingManager
|
||||
contactsManager:helper.contactsManager
|
||||
completionBlock:^(BOOL isBlocked) {
|
||||
if (isBlocked) {
|
||||
[weakSelf selectRecipient:phoneNumber];
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
[self selectRecipient:phoneNumber];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)signalAccountWasSelected:(SignalAccount *)signalAccount
|
||||
{
|
||||
OWSAssert(signalAccount);
|
||||
|
||||
__weak NewNonContactConversationViewController *weakSelf = self;
|
||||
ContactsViewHelper *helper = self.contactsViewHelper;
|
||||
if ([helper isRecipientIdBlocked:signalAccount.recipientId]) {
|
||||
[BlockListUIUtils showUnblockSignalAccountActionSheet:signalAccount
|
||||
fromViewController:self
|
||||
blockingManager:helper.blockingManager
|
||||
contactsManager:helper.contactsManager
|
||||
completionBlock:^(BOOL isBlocked) {
|
||||
if (isBlocked) {
|
||||
[weakSelf selectRecipient:signalAccount.recipientId];
|
||||
}
|
||||
}];
|
||||
} else {
|
||||
[self selectRecipient:signalAccount.recipientId];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)selectRecipient:(NSString *)recipientId
|
||||
{
|
||||
OWSAssert(recipientId.length > 0);
|
||||
|
||||
[self.nonContactConversationDelegate recipientIdWasSelected:recipientId];
|
||||
}
|
||||
|
||||
- (BOOL)shouldHideLocalNumber
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)shouldHideContacts
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)shouldValidatePhoneNumbers
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)canSignalAccountBeSelected:(SignalAccount *)signalAccount
|
||||
{
|
||||
OWSAssert(0);
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (nullable NSString *)accessoryMessageForSignalAccount:(SignalAccount *)signalAccount
|
||||
{
|
||||
OWSAssert(0);
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Logging
|
||||
|
||||
+ (NSString *)tag
|
||||
{
|
||||
return [NSString stringWithFormat:@"[%@]", self.class];
|
||||
}
|
||||
|
||||
- (NSString *)tag
|
||||
{
|
||||
return self.class.tag;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,60 +0,0 @@
|
||||
// Created by Michael Kirk on 11/30/16.
|
||||
// Copyright © 2016 Open Whisper Systems. All rights reserved.
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
@objc(OWSNoSignalContactsView)
|
||||
@IBDesignable class NoSignalContactsView: UIView {
|
||||
static let nibName = "NoSignalContactsView"
|
||||
|
||||
@IBOutlet var headingLabel: UILabel!
|
||||
@IBOutlet var subheadingLabel: UILabel!
|
||||
@IBOutlet var inviteButton: UIButton!
|
||||
|
||||
var view: UIView!
|
||||
|
||||
// Mark: - Initialize
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
commonInit()
|
||||
}
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
commonInit()
|
||||
}
|
||||
|
||||
func commonInit() {
|
||||
xibSetup()
|
||||
localizeStrings()
|
||||
}
|
||||
|
||||
func xibSetup() {
|
||||
view = loadViewFromNib()
|
||||
|
||||
// use bounds not frame or it'll be offset
|
||||
view.frame = bounds
|
||||
|
||||
// Make the view stretch with containing view
|
||||
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
// Adding custom subview on top of our view (over any custom drawing > see note below)
|
||||
addSubview(view)
|
||||
}
|
||||
|
||||
func localizeStrings() {
|
||||
headingLabel.text = NSLocalizedString("EMPTY_CONTACTS_LABEL_LINE1", comment:"Full width label displayed when attempting to compose message")
|
||||
subheadingLabel.text = NSLocalizedString("EMPTY_CONTACTS_LABEL_LINE2", comment:"Full width label displayed when attempting to compose message")
|
||||
let inviteText = NSLocalizedString("INVITE_FRIENDS_CONTACT_TABLE_BUTTON", comment:"Text for button at the top of the contact picker")
|
||||
inviteButton.setTitle(inviteText, for: .normal)
|
||||
}
|
||||
|
||||
func loadViewFromNib() -> UIView {
|
||||
let bundle = Bundle(for: type(of:self))
|
||||
let nib = UINib(nibName: NoSignalContactsView.nibName, bundle: bundle)
|
||||
let view = nib.instantiate(withOwner:self, options: nil)[0] as! UIView
|
||||
|
||||
return view
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="15G1108" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina3_5" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="OWSNoSignalContactsView">
|
||||
<connections>
|
||||
<outlet property="headingLabel" destination="ple-3h-S8P" id="usA-UI-6Cv"/>
|
||||
<outlet property="inviteButton" destination="Jfc-NG-all" id="uSx-BP-zWV"/>
|
||||
<outlet property="subheadingLabel" destination="cT2-0C-Dat" id="XEh-l0-Har"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="None of your contacts have Signal." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="ple-3h-S8P">
|
||||
<rect key="frame" x="8" y="196" width="304" height="18"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Why don't you invite someone?" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="cT2-0C-Dat">
|
||||
<rect key="frame" x="8" y="216" width="304" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.31764705882352939" green="0.31764705882352939" blue="0.31764705882352939" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Jfc-NG-all">
|
||||
<rect key="frame" x="8" y="357" width="304" height="33"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<state key="normal" title="Invite Your Friends">
|
||||
<color key="titleColor" red="0.09412795243864841" green="0.43645224658557435" blue="0.71380208333333339" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
</button>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" image="uiEmptyContact" translatesAutoresizingMaskIntoConstraints="NO" id="fKk-9P-Vfe">
|
||||
<rect key="frame" x="106" y="56" width="108" height="108"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="fKk-9P-Vfe" secondAttribute="height" multiplier="1:1" id="ZhY-sY-cRx"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="cT2-0C-Dat" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" constant="-16" id="1Zm-pA-q3f"/>
|
||||
<constraint firstItem="ple-3h-S8P" firstAttribute="top" secondItem="fKk-9P-Vfe" secondAttribute="bottom" constant="32" id="7Lb-ko-XsU"/>
|
||||
<constraint firstItem="cT2-0C-Dat" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leadingMargin" id="F7C-3A-Bfq"/>
|
||||
<constraint firstItem="ple-3h-S8P" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leadingMargin" id="HpA-Re-sfp"/>
|
||||
<constraint firstItem="Jfc-NG-all" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="I8m-CS-7Rn"/>
|
||||
<constraint firstItem="cT2-0C-Dat" firstAttribute="top" secondItem="ple-3h-S8P" secondAttribute="bottom" constant="2" id="NfJ-MK-gqj"/>
|
||||
<constraint firstItem="Jfc-NG-all" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leadingMargin" id="P1B-My-dq4"/>
|
||||
<constraint firstItem="fKk-9P-Vfe" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="Tan-qQ-d1V"/>
|
||||
<constraint firstItem="fKk-9P-Vfe" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" multiplier="1:3" constant="1" id="ZPp-oI-RGS"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="ple-3h-S8P" secondAttribute="trailing" id="eWz-EA-vVw"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="cT2-0C-Dat" secondAttribute="trailing" id="v9E-h7-SBE"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="Jfc-NG-all" secondAttribute="trailing" id="vN6-kC-OKO"/>
|
||||
<constraint firstItem="Jfc-NG-all" firstAttribute="top" secondItem="cT2-0C-Dat" secondAttribute="bottom" constant="124" id="zlH-k5-wED"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="34.5" y="100.5"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="uiEmptyContact" width="227" height="227"/>
|
||||
</resources>
|
||||
</document>
|
Loading…
Reference in New Issue